readme: add why & move architecture sections
This commit is contained in:
parent
1304ceb65b
commit
191304890c
1 changed files with 44 additions and 40 deletions
84
README.md
84
README.md
|
@ -26,49 +26,17 @@ Differentiating features include:
|
||||||
[YAML]: http://yaml.org
|
[YAML]: http://yaml.org
|
||||||
[Prometheus]: http://prometheus.io
|
[Prometheus]: http://prometheus.io
|
||||||
|
|
||||||
## Architecture
|
## Why Chihaya?
|
||||||
|
|
||||||
### Diagram
|
Chihaya is built for developers looking to integrate BitTorrent into a preexisting production environment.
|
||||||
|
Chihaya's pluggable architecture and middleware framework offers a simple and flexible integration point that abstracts the BitTorrent tracker protocols.
|
||||||
|
The most common use case for Chihaya is integration with the deployment of cloud software.
|
||||||
|
|
||||||
```
|
[OpenBittorrent]: https://openbittorrent.com
|
||||||
+----------------------+
|
|
||||||
| BitTorrent Client |<--------------+
|
|
||||||
+----------------------+ |
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
| |
|
|
||||||
-------------v--------------------------+-------------------+-------------------------+
|
|
||||||
|+----------------------+ +----------------------+frontend| chihaya|
|
|
||||||
|| Parser | | Writer | | |
|
|
||||||
|+----------------------+ +----------------------+ | |
|
|
||||||
| | ^ | |
|
|
||||||
-------------+--------------------------+-------------------+ |
|
|
||||||
+------------v--------------------------+-------------------+ |
|
|
||||||
|+----------------------+ +----------------------+ logic| |
|
|
||||||
|| PreHook Middleware |-->| Response Generator |<-------|-------------+ |
|
|
||||||
|+----------------------+ +----------------------+ | | |
|
|
||||||
| | | |
|
|
||||||
|+----------------------+ | +----------------------+|
|
|
||||||
|| PostHook Middleware |-----------------------------------|>| Storage ||
|
|
||||||
|+----------------------+ | +----------------------+|
|
|
||||||
| | |
|
|
||||||
+-----------------------------------------------------------+-------------------------+
|
|
||||||
```
|
|
||||||
|
|
||||||
### Description
|
### Production Use
|
||||||
|
|
||||||
BitTorrent clients send Announce and Scrape requests to a _Frontend_.
|
#### Facebook
|
||||||
Frontends parse requests and write responses for the particular protocol they implement.
|
|
||||||
The _TrackerLogic_ interface to is used to generate responses for their requests and optionally perform a task after responding to a client.
|
|
||||||
A configurable chain of _PreHook_ and _PostHook_ middleware is used to construct an instance of TrackerLogic.
|
|
||||||
PreHooks are middleware that are executed before the response has been written.
|
|
||||||
After all PreHooks have executed, any missing response fields that are required are filled by reading out of the configured implementation of the _Storage_ interface.
|
|
||||||
PostHooks are asynchronous tasks that occur after a response has been delivered to the client.
|
|
||||||
Request data is written to the storage asynchronously in one of these PostHooks.
|
|
||||||
|
|
||||||
## Production Use
|
|
||||||
|
|
||||||
### Facebook
|
|
||||||
|
|
||||||
[Facebook] uses BitTorrent to deploy new versions of their software.
|
[Facebook] uses BitTorrent to deploy new versions of their software.
|
||||||
In order to optimize the flow of traffic within their datacenters, Chihaya is configured to prefer peers within the same subnet.
|
In order to optimize the flow of traffic within their datacenters, Chihaya is configured to prefer peers within the same subnet.
|
||||||
|
@ -76,7 +44,7 @@ Because Facebook organizes their network such that server racks are allocated IP
|
||||||
|
|
||||||
[Facebook]: https://facebook.com
|
[Facebook]: https://facebook.com
|
||||||
|
|
||||||
### CoreOS
|
#### CoreOS
|
||||||
|
|
||||||
[Quay] is a container registry that offers the ability to download containers via BitTorrent in order to speed up large or geographically distant deployments.
|
[Quay] is a container registry that offers the ability to download containers via BitTorrent in order to speed up large or geographically distant deployments.
|
||||||
Announce URLs from Quay's torrent files contain a [JWT] in order to allow Chihaya to verify that an infohash was approved by the registry.
|
Announce URLs from Quay's torrent files contain a [JWT] in order to allow Chihaya to verify that an infohash was approved by the registry.
|
||||||
|
@ -112,6 +80,42 @@ For more information read [CONTRIBUTING.md].
|
||||||
[freenode IRC]: http://webchat.freenode.net/?channels=chihaya
|
[freenode IRC]: http://webchat.freenode.net/?channels=chihaya
|
||||||
[CONTRIBUTING.md]: https://github.com/chihaya/chihaya/blob/master/CONTRIBUTING.md
|
[CONTRIBUTING.md]: https://github.com/chihaya/chihaya/blob/master/CONTRIBUTING.md
|
||||||
|
|
||||||
|
### Architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
+----------------------+
|
||||||
|
| BitTorrent Client |<--------------+
|
||||||
|
+----------------------+ |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
| |
|
||||||
|
+------------v--------------------------+-------------------+-------------------------+
|
||||||
|
|+----------------------+ +----------------------+frontend| chihaya|
|
||||||
|
|| Parser | | Writer | | |
|
||||||
|
|+----------------------+ +----------------------+ | |
|
||||||
|
| | ^ | |
|
||||||
|
+------------+--------------------------+-------------------+ |
|
||||||
|
+------------v--------------------------+-------------------+ |
|
||||||
|
|+----------------------+ +----------------------+ logic| |
|
||||||
|
|| PreHook Middleware |-->| Response Generator |<-------|-------------+ |
|
||||||
|
|+----------------------+ +----------------------+ | | |
|
||||||
|
| | | |
|
||||||
|
|+----------------------+ | +----------------------+|
|
||||||
|
|| PostHook Middleware |-----------------------------------|>| Storage ||
|
||||||
|
|+----------------------+ | +----------------------+|
|
||||||
|
| | |
|
||||||
|
+-----------------------------------------------------------+-------------------------+
|
||||||
|
```
|
||||||
|
|
||||||
|
BitTorrent clients send Announce and Scrape requests to a _Frontend_.
|
||||||
|
Frontends parse requests and write responses for the particular protocol they implement.
|
||||||
|
The _TrackerLogic_ interface to is used to generate responses for their requests and optionally perform a task after responding to a client.
|
||||||
|
A configurable chain of _PreHook_ and _PostHook_ middleware is used to construct an instance of TrackerLogic.
|
||||||
|
PreHooks are middleware that are executed before the response has been written.
|
||||||
|
After all PreHooks have executed, any missing response fields that are required are filled by reading out of the configured implementation of the _Storage_ interface.
|
||||||
|
PostHooks are asynchronous tasks that occur after a response has been delivered to the client.
|
||||||
|
Request data is written to the storage asynchronously in one of these PostHooks.
|
||||||
|
|
||||||
## Related projects
|
## Related projects
|
||||||
|
|
||||||
- [BitTorrent.org](https://github.com/bittorrent/bittorrent.org): a static website containing the BitTorrent spec and all BEPs
|
- [BitTorrent.org](https://github.com/bittorrent/bittorrent.org): a static website containing the BitTorrent spec and all BEPs
|
||||||
|
|
Loading…
Reference in a new issue