Skip to content

Commit

Permalink
Added link to doc in README.md
Browse files Browse the repository at this point in the history
- 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]
  • Loading branch information
nmalhotra committed Jan 16, 2019
1 parent 7dbdb0e commit ab44a46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ Some places to get you started on the codebase:
- libp2p: https://github.com/libp2p/go-libp2p
- DHT: https://github.com/libp2p/go-libp2p-kad-dht
- PubSub: https://github.com/libp2p/go-libp2p-pubsub
- [IPFS : The `Add` command demystified](https://github.com/ipfs/go-ipfs/tree/master/docs/add-code-flow.md)

### CLI, HTTP-API, Architecture Diagram

Expand Down
17 changes: 8 additions & 9 deletions docs/add-code-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

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.

## Concepts
- [Files](https://github.com/ipfs/docs/issues/133)

---

**Try this yourself**
>
> ```
Expand All @@ -28,9 +33,7 @@ The goal of this document is to capture the code flow for adding a file (see the
> # Hello World
> ```
---

# Code Flow
## Code Flow

**[`UnixfsAPI.Add()`](https://github.com/ipfs/go-ipfs/blob/v0.4.18/core/coreapi/unixfs.go#L31)** - *Entrypoint into the `Unixfs` package*

Expand Down Expand Up @@ -82,7 +85,7 @@ Within the function, a new `Adder` is created with the configured `Blockstore` a
- **[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`*

> 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.
> 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.
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)`.

Expand All @@ -96,8 +99,4 @@ Within the function, a new `Adder` is created with the configured `Blockstore` a

- **[`adder.PinRoot()`](https://github.com/ipfs/go-ipfs/blob/v0.4.18/core/coreunix/add.go#L171)** - *Pin all files under the `MFS` **root***

The whole process ends with `PinRoot` recursively pinning all the files under the `MFS` **root**

# Also see
1. https://github.com/ipfs/go-ipfs/#development
2. [Concept document about files](https://github.com/ipfs/docs/issues/133)
The whole process ends with `PinRoot` recursively pinning all the files under the `MFS` **root**

1 comment on commit ab44a46

@GitCop
Copy link

@GitCop GitCop commented on ab44a46 Jan 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were the following issues with your Pull Request

We ask for a few features in the commit message for Open Source licensing hygiene and commit message clarity.
git commit --amend can often help you quickly improve the commit message.
Guidelines and a script are available to help in the long run.
Your feedback on GitCop is welcome on this issue.


This message was auto-generated by https://gitcop.com

Please sign in to comment.