diff --git a/docs/sync.markdown b/docs/sync.markdown --- a/docs/sync.markdown +++ b/docs/sync.markdown @@ -1,14 +1,17 @@ -# INTRO # -This document discribes the server sync protocol. +# 1 Intro # -# PURPOSE # +This document describes the server sync protocol. + +# 2 Purpose # + This protocol will be used to share the models (currently imageboard posts) across multiple servers. The main differnce of this protocol is that the node can specify what models it wants to get and from whom. The nodes can get models from a specific server, or from all except some specific servers. Also the models can be filtered by timestamps or tags. -# DRAFT PROTOCOL DESCRIPTION # +# 3 Protocol description # + The node requests other node's changes list since some time (since epoch if this is the start). The other node sends a list of post ids or posts in the XML or JSON format. @@ -26,7 +29,7 @@ ID to verify the sender. Each node can have several keys. Nodes can have shared keys to serve as a pool (several nodes with the same key). -Each post has an ID in the unique format: [key-type][key][local-id] +Each post has an ID in the unique format: key-type::key::local-id All requests pass a request type, protocol and model versions, and a list of optional arguments used for filtering. @@ -44,16 +47,43 @@ content). The inner posts can be edited, but the local-id won't, so the other node can detect that and replace the post instead of adding a new one. -# REQUESTS # -Request types: -* pull - pull the desired model ids -* get - get models by ids -* put - give a model to the given node (you have no guarantee the node takes -it, consider you are just advising the node to take your post. This request +## 3.1 Requests ## + +There is no constraint on how the server should calculate the request. The +server can return any information by any filter and the requesting node is +responsible for validating it. + +The server is required to return the status of request. See 3.2 for details. + +### 3.1.1 pull ### + +"pull" request gets the desired model id list by the given filter (e.g. thread, tags, +author) + +### 3.1.2 get ### + +"get" gets models by id list + +### 3.1.3 put ### + +"put" gives a model to the given node (you have no guarantee the node takes +it, consider you are just advising the node to take your post). This request type is useful in pool where all the nodes try to duplicate all of their data across the pool. -# RESPONSES # -* not supported - request is not supported -* success - request was successfull -* error - unexpected error +## 3.2 Responses ## + +### 3.2.1 "not supported" ### + +If the request if completely not supported, a "not supported" status will be +returned. + +### 3.2.2 "success"" ### + +"success" status means the request was processed and the result is returned. + +### 3.2.3 "error" ### + +If the server knows for sure that the operation cannot be processed, it sends +the "error" status. Additional tags describing the error may be +and .