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