Show More
@@ -1,57 +1,59 b'' | |||
|
1 | 1 | # INTRO # |
|
2 | 2 | This document discribes the server sync protocol. |
|
3 | 3 | |
|
4 | 4 | # PURPOSE # |
|
5 | 5 | This protocol will be used to share the models (currently imageboard posts) |
|
6 | 6 | across multiple servers. The main differnce of this protocol is that the node |
|
7 | 7 | can specify what models it wants to get and from whom. The nodes can get |
|
8 | 8 | models from a specific server, or from all except some specific servers. Also |
|
9 | 9 | the models can be filtered by timestamps or tags. |
|
10 | 10 | |
|
11 | 11 | # DRAFT PROTOCOL DESCRIPTION # |
|
12 | 12 | The node requests other node's changes list since some time (since epoch if |
|
13 | 13 | this is the start). The other node sends a list of post ids or posts in the |
|
14 | 14 | XML or JSON format. |
|
15 | 15 | |
|
16 | 16 | Protocol version is the version of the sync api. Model version is the version |
|
17 | 17 | of data models. If at least one of them is different, the sync cannot be |
|
18 | 18 | performed. |
|
19 | 19 | |
|
20 | The node signs the data with its key. The receiving node saves the key at the | |
|
20 | The node signs the data with its keys. The receiving node saves the key at the | |
|
21 | 21 | first sync and checks it every time. If the key has changed, the info won't be |
|
22 | saved from the node (or the node id must be changed). | |
|
22 | saved from the node (or the node id must be changed). A model can be signed | |
|
23 | with several keys but at least one of them must be the same as in the global | |
|
24 | ID to verify the sender. | |
|
23 | 25 | |
|
24 | 26 | Each node can have several keys. Nodes can have shared keys to serve as a pool |
|
25 | 27 | (several nodes with the same key). |
|
26 | 28 | |
|
27 |
Each post has an ID in the unique format: |
|
|
29 | Each post has an ID in the unique format: [key-type][key][local-id] | |
|
28 | 30 | |
|
29 | All requests pass a request type, protocol and model versions and a list of | |
|
31 | All requests pass a request type, protocol and model versions, and a list of | |
|
30 | 32 | optional arguments used for filtering. |
|
31 | 33 | |
|
32 |
Each |
|
|
34 | Each request has its own version. Version consists of 2 numbers: first is | |
|
33 | 35 | incompatible version (1.3 and 2.0 are not compatible and must not be in sync) |
|
34 | 36 | and the second one is minor and compatible (for example, new optional field |
|
35 | 37 | is added which will be igroned by those who don't support it yet). |
|
36 | 38 | |
|
37 | 39 | Post edits and reflinks are not saved to the sync model. The replied post ID |
|
38 | 40 | can be got from the post text, and reflinks can be computed when loading |
|
39 | 41 | posts. The edit time is not saved because a foreign post can be 'edited' (new |
|
40 | 42 | replies are added) but the signature must not change (so we can't update the |
|
41 | 43 | content). The inner posts can be edited, and the signature will change then |
|
42 | 44 | but the local-id won't, so the other node can detect that and replace the post |
|
43 | 45 | instead of adding a new one. |
|
44 | 46 | |
|
45 | 47 | # REQUESTS # |
|
46 | 48 | Request types: |
|
47 | 49 | * pull - pull the desired model ids |
|
48 | 50 | * get - get models by ids |
|
49 | 51 | * put - give a model to the given node (you have no guarantee the node takes |
|
50 | 52 | it, consider you are just advising the node to take your post. This request |
|
51 | 53 | type is useful in pool where all the nodes try to duplicate all of their data |
|
52 | 54 | across the pool. |
|
53 | 55 | |
|
54 | 56 | # RESPONSES # |
|
55 | 57 | * not supported - request is not supported |
|
56 | 58 | * success - request was successfull |
|
57 | 59 | * error - unexpected error |
General Comments 0
You need to be logged in to leave comments.
Login now