You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- 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]>
Copy file name to clipboardExpand all lines: docs/add-code-flow.md
+8-9Lines changed: 8 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,11 @@
2
2
3
3
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.
@@ -28,9 +33,7 @@ The goal of this document is to capture the code flow for adding a file (see the
28
33
> # Hello World
29
34
> ```
30
35
31
-
---
32
-
33
-
# Code Flow
36
+
## Code Flow
34
37
35
38
**[`UnixfsAPI.Add()`](https://github.com/ipfs/go-ipfs/blob/v0.4.18/core/coreapi/unixfs.go#L31)** - *Entrypoint into the `Unixfs` package*
36
39
@@ -82,7 +85,7 @@ Within the function, a new `Adder` is created with the configured `Blockstore` a
82
85
83
86
- **[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`*
84
87
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.
86
89
87
90
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)`.
88
91
@@ -96,8 +99,4 @@ Within the function, a new `Adder` is created with the configured `Blockstore` a
96
99
97
100
- **[`adder.PinRoot()`](https://github.com/ipfs/go-ipfs/blob/v0.4.18/core/coreunix/add.go#L171)** - *Pin all files under the `MFS` **root***
98
101
99
-
The whole process ends with `PinRoot` recursively pinning all the files under the `MFS` **root**
0 commit comments