]> git.aero2k.de Git - sirius.git/commitdiff
Update documentation.
authorTom Hunger <tehunger@gmail.com>
Sun, 25 Jan 2015 20:17:28 +0000 (20:17 +0000)
committerTom Hunger <tehunger@gmail.com>
Sun, 25 Jan 2015 20:17:28 +0000 (20:17 +0000)
README.md

index 7e6a3cd6551d3555f586e4e6233291f60cd5c252..1f0ace3f81e9680fbe635efb2363db57a6b40bc4 100644 (file)
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ $ bin/gunicorn -k flask_sockets.worker sirius.server:app -b 0.0.0.0:5002 -w 1
 Navigate browser to http://127.0.0.1:5002/
 
 
-## Creating fake printers
+## Creating fake printers and friends
 
 Resetting the actual hardware all the time gets a bit tiresome so
 there's a fake command that creates unclaimed fake little printers:
@@ -29,10 +29,20 @@ Created printer
 Functionally there is no difference between resetting and creating a
 new printer so we don't distinguish between the two.
 
+To create a fake friend from twitter who signed up do this:
+
+```console
+$ ./manage.py fake user stephenfry
+```
+
 # Sirius Architecture
 
 ## Layers
 
+The design is somewhat stratified: each layer only talks to the one
+below and above. The ugliest bits are how database and protocol loop
+interact.
+
 ```
 UI / database
 ----------------------------
@@ -54,39 +64,18 @@ the websocket/bridge_address mapping in a global dictionary; it then
 loops forever, decoding messages as they come in.
 
 
-## Information flow (user-facing)
-
-So far we aren't sending any messages to the devices or bridges other
-than encryption keys derived from claim codes (see below).
-
-In order to inject messages into the flow we need to look up a device
-in the `connected_devices` member of
-`sirius.protocol.protocol_loop.BridgeState`. If we found a matching
-`BridgeState` we can use its websocket to send the message.
-
-As gunicorn spawns several processes we'll need to publish updates
-over the process boundary which will probably necessitate a message
-broker like redis.
-
-
 ## Claim codes
 
 Devices are associated with an account when a user enters a "claim
 code". This claim code contains a "hardware-xor" which is derived via
-a lossy 3-byte hash from the device address. These codes are meant to
-be used "timely", i.e. within a short window of the printer
-reset. Hence collisions shouldn't be an issue.
+a lossy 3-byte hash from the device address. The XOR-code for a device
+is always the same even though the address changes!
+
+The claim codes are meant to be used "timely", i.e. within a short
+window of the printer reset. If there are multiple, conflicting claim
+codes we always pick the most recently created code.
 
 We are also deriving this hardware xor when a device calls home with
 an "encryption_key_required". In that case we connect the device to
 the claim code via the hardware-xor and send back the correct
 encryption key.
-
-
-## TODO
-
-* Can't read images from the net because we're rendering a local file
-  with phantomjs. The way to fix is probably to run an in-process
-  web-server for the duration of rendering (urg).
-* What to do with twitter users that have > 5000 followers? More
-  generally the UI becomes unusable.