diff --git a/README.md b/README.md index ccdc231082..5e529e2196 100644 --- a/README.md +++ b/README.md @@ -991,9 +991,11 @@ the metrics (in prometheus format) by making a GET request to the following endp http://localhost:5002/debug/metrics/prometheus ``` -### IPFS Core Architecture +### IPFS Architecture -![](/img/core.png) +![](/img/architecture.png) + +[Annotated version](https://user-images.githubusercontent.com/1211152/47606420-b6265780-da13-11e8-923b-b365a8534e0e.png)j What does this image explain? @@ -1001,16 +1003,16 @@ What does this image explain? - The exchange protocol, `bitswap`, uses the Block Service which in turn uses the Repo, offering a get and put of blocks to the IPFS implementation. - The DAG API (previously Object) comes from the IPLD Resolver, it can support several IPLD Formats (i.e: dag-pb, dag-cbor, etc). - The Files API uses `ipfs-unixfs-engine` to import and export files to and from IPFS. -- Swarm, the component that offers a network API, uses libp2p to dial and listen for connections, to use the DHT, for discovery mechanisms, and more. libp2p-ipfs-nodejs is used when running in Node.js and libp2p-ipfs-browser is used when running in the browser. +- libp2p, the network stack of IPFS, uses libp2p to dial and listen for connections, to use the DHT, for discovery mechanisms, and more. ## Contribute IPFS implementation in JavaScript is a work in progress. As such, there's a few things you can do right now to help out: - * Go through the modules below and **check out existing issues**. This would be especially useful for modules in active development. Some knowledge of IPFS may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically. - * **Perform code reviews**. More eyes will help (a) speed the project along, (b) ensure quality, and (c) reduce possible future bugs. - * Take a look at go-ipfs and some of the planning repositories or issues: for instance, the [libp2p spec](https://github.com/ipfs/specs/pull/19). Contributions here that would be most helpful are **top-level comments** about how it should look based on our understanding. Again, the more eyes the better. - * **Add tests**. There can never be enough tests. +- Go through the modules below and **check out existing issues**. This would be especially useful for modules in active development. Some knowledge of IPFS may be required, as well as the infrastructure behind it - for instance, you may need to read up on p2p and more complex operations like muxing to be able to help technically. +- **Perform code reviews**. More eyes will help (a) speed the project along, (b) ensure quality, and (c) reduce possible future bugs. +- Take a look at go-ipfs and some of the planning repositories or issues: for instance, the [libp2p spec](https://github.com/ipfs/specs/pull/19). Contributions here that would be most helpful are **top-level comments** about how it should look based on our understanding. Again, the more eyes the better. +- **Add tests**. There can never be enough tests. ### Want to hack on IPFS? diff --git a/examples/README.md b/examples/README.md index b7b587eeb5..279dc117d4 100644 --- a/examples/README.md +++ b/examples/README.md @@ -31,7 +31,9 @@ Let us know if you find any issue or if you want to contribute and add a new tut In this section, you will find explanations to different pieces of IPFS Architecture and how `js-ipfs` implements them. -![](../img/core.png) +![](../img/architecture.png) + +[Annotated version](https://user-images.githubusercontent.com/1211152/47606420-b6265780-da13-11e8-923b-b365a8534e0e.png) > These explanations are still a work in progress diff --git a/img/architecture.monopic b/img/architecture.monopic new file mode 100644 index 0000000000..340177d0ed Binary files /dev/null and b/img/architecture.monopic differ diff --git a/img/architecture.png b/img/architecture.png new file mode 100644 index 0000000000..7a271cf968 Binary files /dev/null and b/img/architecture.png differ diff --git a/img/architecture.txt b/img/architecture.txt new file mode 100644 index 0000000000..a865ac593e --- /dev/null +++ b/img/architecture.txt @@ -0,0 +1,64 @@ + ┌─────────────────────────────────────────────────────────────────────────────┐ + │ The IPFS Architecture │ + └─────────────────────────────────────────────────────────────────────────────┘ + ┏━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ + ======================= IPFS Daemon ======================= ┃ + ┃ ┃ + ┃┌────┐ ┏ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ + │ │ ++++++++++++++++++ IPFS Core ++++++++++++++++++ ┃ + │ │ ┃ ┌──────────────────────────────────────────────────┐ + │HTTP│ ┌─│ API (Core API) │ ┃┃ + ┃│Gate│ │ ├──────┬──────┬──────┬──────┬──────┬───────┬───────┤ ┃ + ┃│way │◀┤ │ Repo │Block │ DAG │ Pin │Files │ │Network│ ┃ + │ │ │ └──────┴──────┴──────┴──────┴──────┘ └───────┘ + │ │ │ │ │ │ │ │ │ ┃ + │ │ │ │ │ ┌────┘ │ ┌────┘ ┌────┘ ┃ + ┃└────┘ │ ┌──┘ │ │ ┌──────┘ │ ▼ ┃┃ + ┃ │ │┌────────┘ │ ▼ ▼ ┌────────────────────┐ + ┌────┐ │ ││ │┌───────┐┌──────┐│ libp2p │┃ + │ │ │ ││ ││Pinning││Unixfs││ (Network, PubSub, │ + │ │ │ ││ ││Service││Engine││ Swarm, Crypto) │┃┃ + ┃│ │ │ ││ │└───────┘└──────┘│┌──────────────────┐│ ┃ + ┃│HTTP│ │ ││ │ │ │ ││Connection Manager││┃ + │RPC │ │ ││ ├────┴────────┘ │└──────────────────┘│ +┌───┐┌────────┐ │API │◀┘ ││ │ │┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ │┃ +│CLI││ipfs-api│ │ │ ┃ ││ │ │ Peer Reputation ││ ┃ +└───┘└────────┘┃│ │ ││ │ │└ ─ ─ ─ ─ ─ ─ ─ ─ ─ │┃┃ + ┃│ │ ┃ ││ ┌──┘ └────────────────────┘ + │ │ ││ │ ┌ ─ ─ ─ ─ ┐┌ ─ ─ ─ ─ ─ ┃ + └────┘ ┃ ││ │ Providers GC │ + ││ ▼ │ Service ││ ┃┃ + ┃ ┃ ││┌─────────────┐ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ ┃ + ┃ │││Graph Service│─────┬───────────┬───────────┐ ┃ + ┃ ││└─────────────┘ ▼ ▼ ▼ + ││ │ ┌ ─ ─ ─ ─ ─ ┌ ─ ─ ─ ─ ─ ┌ ─ ─ ─ ─ ─ ┃ + ┃ │└───────┤ GraphSync │ GraphSyncB│ GraphSyncC│ ┃ + ┃ │ ▼ └ ─ ─ ─ ─ ─ └ ─ ─ ─ ─ ─ └ ─ ─ ─ ─ ─ ┃┃ + ┃ ┃ │ ┌─────────────┐ + │ │Block Service│─────┬───────────┬───────────┐ ┃ + ┃ │ └─────────────┘ ▼ ▼ ▼ + │ │ ┌──────────┐┌ ─ ─ ─ ─ ─ ┌ ─ ─ ─ ─ ─ ┃┃ + ┃ ┃ └─────┬──┴──────│ Bitswap │ BitswapB │ BitswapB │ ┃ + ┃ ▼ └──────────┘└ ─ ─ ─ ─ ─ └ ─ ─ ─ ─ ─ ┃ + ┃ ┌─────────┐ + │ Repo │ ┃ + ┃ └─────────┘ ┃ + ┃ │ ┃┃ + ┃ ┃ ┌─┴──────┬──────────┬───────┐ + ▼ ▼ ▼ ▼ ┃ + ┃ ┌────┐┌──────────┐┌────────┐┌────┐ + │ fs ││indexedDB ││LevelDB ││ S3 │ ┃┃ + ┃ ┃ └────┘└──────────┘└────────┘└────┘ ┃ + ┃ ┃ + ┗ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ ━ + ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ + + ┌───────────────────────────────────────────────────────────────────────────┐ + │ Legend │ + │ ┌ ─ ─ ┐ │ + │ Planned, not yet implemented │ + │ └ ─ ─ ┘ │ + │ ┌─────┐ │ + │ │ │ Exist and shipped with IPFS │ + │ └─────┘ │ + └───────────────────────────────────────────────────────────────────────────┘ \ No newline at end of file