Skip to content

Commit 269550b

Browse files
author
nmalhotra
committed
Added link to doc in README.md
- Fixed typo. - Moved concept document link to top of page. - Added link to this doc to README.md License: MIT Signed-off-by: Nitish Malhotra <[email protected]>
1 parent 7dbdb0e commit 269550b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ Some places to get you started on the codebase:
403403
- libp2p: https://github.com/libp2p/go-libp2p
404404
- DHT: https://github.com/libp2p/go-libp2p-kad-dht
405405
- PubSub: https://github.com/libp2p/go-libp2p-pubsub
406+
- [IPFS : The `Add` command demystified](https://github.com/ipfs/go-ipfs/tree/master/docs/add-code-flow.md)
406407

407408
### CLI, HTTP-API, Architecture Diagram
408409

docs/add-code-flow.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
The goal of this document is to capture the code flow for adding a file (see the `coreapi` package) using the IPFS CLI, in the process exploring some datastructures and packages like `ipld.Node` (aka `dagnode`), `FSNode`, `MFS`, etc.
44

5+
## Concepts
6+
- [Files](https://github.com/ipfs/docs/issues/133)
7+
8+
---
9+
510
**Try this yourself**
611
>
712
> ```
@@ -28,9 +33,7 @@ The goal of this document is to capture the code flow for adding a file (see the
2833
> # Hello World
2934
> ```
3035
31-
---
32-
33-
# Code Flow
36+
## Code Flow
3437
3538
**[`UnixfsAPI.Add()`](https://github.com/ipfs/go-ipfs/blob/v0.4.18/core/coreapi/unixfs.go#L31)** - *Entrypoint into the `Unixfs` package*
3639
@@ -82,7 +85,7 @@ Within the function, a new `Adder` is created with the configured `Blockstore` a
8285
8386
- **[UnixFS] [`(BasicDirectory).AddChild(ctx, name, ipld.Node)`](https://github.com/ipfs/go-unixfs/blob/v1.1.16/io/directory.go#L137)** - *Add child to `BasicDirectory`*
8487
85-
> IMPORTANT: It should be noted that the `BasicDirectory` object uses the `ProtoNode` type object which is an implementation of the `ipld.Node` interface, seen and used throughout this document. Ideally the `ipld.Node` should always be used, unless we need access tp specific functions from `ProtoNode` (like `Copy()`) that are not available in the interface.
88+
> IMPORTANT: It should be noted that the `BasicDirectory` object uses the `ProtoNode` type object which is an implementation of the `ipld.Node` interface, seen and used throughout this document. Ideally the `ipld.Node` should always be used, unless we need access to specific functions from `ProtoNode` (like `Copy()`) that are not available in the interface.
8689
8790
This method first attempts to remove any old links (`ProtoNode.RemoveNodeLink(name)`) to the `ProtoNode` prior to adding a link to the newly added `ipld.Node`, using `ProtoNode.AddNodeLink(name, ipld.Node)`.
8891
@@ -96,8 +99,4 @@ Within the function, a new `Adder` is created with the configured `Blockstore` a
9699
97100
- **[`adder.PinRoot()`](https://github.com/ipfs/go-ipfs/blob/v0.4.18/core/coreunix/add.go#L171)** - *Pin all files under the `MFS` **root***
98101
99-
The whole process ends with `PinRoot` recursively pinning all the files under the `MFS` **root**
100-
101-
# Also see
102-
1. https://github.com/ipfs/go-ipfs/#development
103-
2. [Concept document about files](https://github.com/ipfs/docs/issues/133)
102+
The whole process ends with `PinRoot` recursively pinning all the files under the `MFS` **root**

0 commit comments

Comments
 (0)