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 <nitish.malhotra@gmail.com>
nmalhotra committed
Jan 15, 2019 at 21:03 UTC
269550bcbaf7779a4fdfe2b0eca075becce040e9
2 files changed
+9
-9
README.md
+1
@@ -403,6 +403,7 @@ Some places to get you started on the codebase:
403
- libp2p: https://github.com/libp2p/go-libp2p
404
- DHT: https://github.com/libp2p/go-libp2p-kad-dht
405
- 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)
407
408
### CLI, HTTP-API, Architecture Diagram
409
docs/add-code-flow.md
+8
-9
@@ -2,6 +2,11 @@
2
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.
4
5
+## Concepts
6
+- [Files](https://github.com/ipfs/docs/issues/133)
7
+
8
+---
9
+
10
**Try this yourself**
11
>
12
> ```
@@ -28,9 +33,7 @@ The goal of this document is to capture the code flow for adding a file (see the
33
> # Hello World
34
> ```
35
31
----
32
-
33
-# Code Flow
36
+## Code Flow
37
38
**[`UnixfsAPI.Add()`](https://github.com/ipfs/go-ipfs/blob/v0.4.18/core/coreapi/unixfs.go#L31)** - *Entrypoint into the `Unixfs` package*
39
@@ -82,7 +85,7 @@ Within the function, a new `Adder` is created with the configured `Blockstore` a
85
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`*
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.
89
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)`.
91
@@ -96,8 +99,4 @@ Within the function, a new `Adder` is created with the configured `Blockstore` a
99
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***
101
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)
\ No newline at end of file
102
+ The whole process ends with `PinRoot` recursively pinning all the files under the `MFS` **root**
\ No newline at end of file