Skip to content

Commit

Permalink
docs: add architecture graph
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Dec 10, 2016
1 parent e7835cb commit de99976
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 19 deletions.
42 changes: 23 additions & 19 deletions README.md
Expand Up @@ -142,31 +142,35 @@ Get stats about about the current state of the bitswap instance.

## Development

### Code Structure
### Structure

![](/img/architecture.png)

```sh
» tree src
src
├── components
│   ├── decision
│   │   ├── engine.js
│   │   ├── index.js
│   │   ├── ledger.js
│   │   ├── peer-request-queue.js
│   │   └── pq.js
│   ├── network # Handles peerSet and open new conns
│   │   └── index.js
│   └── want-manager # Keeps track of all blocks the peer wants (not the others which it is connected)
│   ├── index.js
│   └── msg-queue.js # Messages to send queue, one per peer
├── constants.js
├── decision #
│   ├── engine.js
│   ├── index.js
│   ├── ledger.js
│   ├── peer-request-queue.js
│   └── pq.js
├── index.js
├── message # (Type) message that is put in the wire
│   ├── entry.js
│   ├── index.js
│   └── message.proto.js
├── network # Handles peerSet and open new conns
│   └── index.js
├── wantlist # (Type) track wanted blocks
│   ├── entry.js
│   └── index.js
└── wantmanager # Keeps track of all blocks the peer wants (not the others which it is connected)
├── index.js
└── msg-queue.js
└── types
├── message # (Type) message that is put in the wire
│   ├── entry.js
│   ├── index.js
│   └── message.proto.js
└── wantlist # (Type) track wanted blocks
├── entry.js
└── index.js
```

## Contribute
Expand Down
Binary file added img/architecture.monopic
Binary file not shown.
Binary file added img/architecture.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions img/architecture.txt
@@ -0,0 +1,51 @@

┌────────────────────────────────────────────────────────────────────────────┐
│ Bitswap API │
└────────────────────────────────────────────────────────────────────────────┘
│ ▲
│register wants │yields the
│and unwants │received
│ │blocks
│ │
│ send block to other nodes┌───────────────────────────┐
│ by adding them to their │ Decision Engine │
│ buckets │ │
│ ┌─────────◀├ ─ ─ ─ │
│ │ │Ledger│ │
│ │ └───────────────────────────┘
│ │ ▲
▼ │ │
┌────────────────────┐ │ │
│ │ │ │
│ Want Manager │ │ │
│ │ │ │
├───────────┬──┬─────┘ │ │
│my wantlist│ │ │ │
└───────────┘ │update wantlist │ │
│messages │ receive a block │
└─────┬───────┬───────┤ │
│ │ │ │
▼ ▼ ▼ │
┌───────┬───────┬───────┐ │
│Message│Message│... │ │
│Queue/ │Queue/ │ │ │
│peer │peer │ │ │
└───────┴───────┴───────┘ │
│ │ │ │
│ │ │ │
│ │ │ │
└───────┴───────┴─┐ │
│ │
│ │
▼ │
┌────────────────────────────────────────┐
│ Network │
└────────────────────────────────────────┘
│ ▲ │ ▲
▼ │ │ │
┌─────────┐ ▼ │
│Transform│ /ipfs/bitswap/1.1.0
└─────────┘
│ ▲
▼ │
/ipfs/bitswap/1.0.0

0 comments on commit de99976

Please sign in to comment.