From 6e362c184c2dc1a832f4624a0b96ed55600eaae6 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Tue, 12 Feb 2019 19:23:30 -0500 Subject: [PATCH] docs: refactor architecture into its own doc --- README.md | 13 ------------- docs/architecture.md | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 docs/architecture.md diff --git a/README.md b/README.md index 182ca8b..982e80f 100644 --- a/README.md +++ b/README.md @@ -121,19 +121,6 @@ Removing `-bench` will just run unit tests. $ go test -bench $(go list ./...) ``` -### Architecture - -![](https://user-images.githubusercontent.com/343539/52676700-05c45c80-2ef9-11e9-9887-8366008b4e7e.png) - -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. -Because they are unnecessary to for generating a response, updates to the Storage for a particular request are done asynchronously in a PostHook. - ## Related projects - [BitTorrent.org](https://github.com/bittorrent/bittorrent.org): a static website containing the BitTorrent spec and all BEPs diff --git a/docs/architecture.md b/docs/architecture.md new file mode 100644 index 0000000..dad5b8e --- /dev/null +++ b/docs/architecture.md @@ -0,0 +1,16 @@ +# Architecture + +### Overview + +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 is used to generate responses for 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. +Because they are unnecessary to for generating a response, updates to the Storage for a particular request are done asynchronously in a PostHook. + +### Diagram + +![](https://user-images.githubusercontent.com/343539/52676700-05c45c80-2ef9-11e9-9887-8366008b4e7e.png)