mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 18:37:45 +08:00
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>
This commit is contained in:
parent
7dbdb0e813
commit
269550bcba
@ -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
|
||||
|
||||
|
||||
@ -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**
|
||||
>
|
||||
> ```
|
||||
@ -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*
|
||||
|
||||
@ -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)`.
|
||||
|
||||
@ -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**
|
||||
Loading…
Reference in New Issue
Block a user