##// END OF EJS Templates
Moved the samples to the protocol document. Title the protocol "DIP" and...
neko259 -
r1189:762bb507 decentral
parent child Browse files
Show More
@@ -1,10 +1,16 b''
1 # 0 Title #
2
3 DIP-1 Common protocol description
4
1 # 1 Intro #
5 # 1 Intro #
2
6
3 This document describes the server sync protocol.
7 This document describes the Data Interchange Protocol (DIP), designed to
8 exchange filtered data that can be stored as a graph structure between
9 network nodes.
4
10
5 # 2 Purpose #
11 # 2 Purpose #
6
12
7 This protocol will be used to share the models (currently imageboard posts)
13 This protocol will be used to share the models (originally imageboard posts)
8 across multiple servers. The main differnce of this protocol is that the node
14 across multiple servers. The main differnce of this protocol is that the node
9 can specify what models it wants to get and from whom. The nodes can get
15 can specify what models it wants to get and from whom. The nodes can get
10 models from a specific server, or from all except some specific servers. Also
16 models from a specific server, or from all except some specific servers. Also
@@ -14,7 +20,7 b' the models can be filtered by timestamps'
14
20
15 The node requests other node's changes list since some time (since epoch if
21 The node requests other node's changes list since some time (since epoch if
16 this is the start). The other node sends a list of post ids or posts in the
22 this is the start). The other node sends a list of post ids or posts in the
17 XML or JSON format.
23 XML format.
18
24
19 Protocol version is the version of the sync api. Model version is the version
25 Protocol version is the version of the sync api. Model version is the version
20 of data models. If at least one of them is different, the sync cannot be
26 of data models. If at least one of them is different, the sync cannot be
@@ -60,9 +66,119 b' The server is required to return the sta'
60 "pull" request gets the desired model id list by the given filter (e.g. thread, tags,
66 "pull" request gets the desired model id list by the given filter (e.g. thread, tags,
61 author)
67 author)
62
68
69 Sample request is as follows:
70
71 <?xml version="1.1" encoding="UTF-8" ?>
72 <request version="1.0" type="pull">
73 <model version="1.0" name="post">
74 <timestamp_from>0</timestamp_from>
75 <timestamp_to>0</timestamp_to>
76 <tags>
77 <tag>tag1</tag>
78 </tags>
79 <sender>
80 <allow>
81 <key>abcehy3h9t</key>
82 <key>ehoehyoe</key>
83 </allow>
84 <!-- There can be only allow block (all other are denied) or deny block (all other are allowed) -->
85 </sender>
86 </model>
87 </request>
88
89 Under the <model> tag there are filters. Filters for the "post" model can
90 be found in DIP-2.
91
92 Sample response:
93
94 <?xml version="1.1" encoding="UTF-8" ?>
95 <response>
96 <status>success</status>
97 <models>
98 <id key="id1" type="ecdsa" local-id="1" />
99 <id key="id1" type="ecdsa" local-id="2" />
100 <id key="id2" type="ecdsa" local-id="1" />
101 <id key="id2" type="ecdsa" local-id="5" />
102 </models>
103 </response>
104
63 ### 3.1.2 get ###
105 ### 3.1.2 get ###
64
106
65 "get" gets models by id list
107 "get" gets models by id list.
108
109 Sample request:
110
111 <?xml version="1.1" encoding="UTF-8" ?>
112 <request version="1.0" type="get">
113 <model version="1.0" name="post">
114 <id key="id1" type="ecdsa" local-id="1" />
115 <id key="id1" type="ecdsa" local-id="2" />
116 </model>
117 </request>
118
119 Id consists of a key, key type and local id. This key is used for signing and
120 validating of data in the model content.
121
122 Sample response:
123
124 <?xml version="1.1" encoding="UTF-8" ?>
125 <response>
126 <!--
127 Valid statuses are 'success' and 'error'.
128 -->
129 <status>success</status>
130 <models>
131 <model name="post">
132 <!--
133 Content tag is the data that is signed by signatures and must
134 not be changed for the post from other node.
135 -->
136 <content>
137 <id key="id1" type="ecdsa" local-id="1" />
138 <title>13</title>
139 <text>Thirteen</text>
140 <thread><id key="id1" type="ecdsa" local-id="2" /></thread>
141 <pub-time>12</pub-time>
142 <!--
143 Images are saved as attachments and included in the
144 signature.
145 -->
146 <attachments>
147 <attachment mimetype="image/png" name="12345.png">
148 TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0
149 aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1
150 c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0
151 aGUgY29udGludWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdl
152 LCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=
153 </attachment>
154 </attachments>
155 </content>
156 <!--
157 There can be several signatures for one model. At least one
158 signature must be made with the key used in global ID.
159 -->
160 <signatures>
161 <signature key="id1" type="ecdsa" value="dhefhtreh" />
162 <signature key="id45" type="ecdsa" value="dsgfgdhefhtreh" />
163 </signatures>
164 </model>
165 <model name="post">
166 <content>
167 <id key="id1" type="ecdsa" local-id="id2" />
168 <title>13</title>
169 <text>Thirteen</text>
170 <pub-time>12</pub-time>
171 <edit-time>13</edit-time>
172 <tags>
173 <tag>tag1</tag>
174 </tags>
175 </content>
176 <signatures>
177 <signature key="id2" type="ecdsa" value="dehdfh" />
178 </signatures>
179 </model>
180 </models>
181 </response>
66
182
67 ### 3.1.3 put ###
183 ### 3.1.3 put ###
68
184
@@ -78,7 +194,7 b' across the pool.'
78 If the request if completely not supported, a "not supported" status will be
194 If the request if completely not supported, a "not supported" status will be
79 returned.
195 returned.
80
196
81 ### 3.2.2 "success"" ###
197 ### 3.2.2 "success" ###
82
198
83 "success" status means the request was processed and the result is returned.
199 "success" status means the request was processed and the result is returned.
84
200
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now