Project

General

Profile

Repo Protocol Specification » History » Version 25

Shuo Chen, 02/20/2014 01:56 PM

1 1 Shuo Chen
Repo Protocol Specification
2
===========================
3
4 2 Shuo Chen
Repo is persistent storage of data objects model in NDN. The NDN repo protocol is a specification of repo operations including reading, insertion and deletion of data objects in repo.
5
6
Repo semantics is based on [Command Interests](http://redmine.named-data.net/projects/nfd/wiki/Command_Interests) with signed commponents an the end of the name and basic common semantics of NDN. 
7
8 11 Shuo Chen
When some operation of repo including insertion and deletion of data objects is requested, a command interest is sent. The command interest is the interest as command of insertion and deletion and signed as form of command interest for access control. The repo will response the command with the data object.
9 4 Shuo Chen
10
The repo protocol can be categorized in three sections of reading, insertion and deletion of data objects.
11
12
## Repo Reading Specification
13
14 11 Shuo Chen
The repo could be viewed as the data container of the data objects. It will register some specific prefixes of data objects it holds into NFD (NDN Forwarding Deamon) and the repo will respond the data with such prefixes.
15 6 Shuo Chen
16 11 Shuo Chen
A standard interest is used to fetch content from the repo. The repo will respond when the name of the interest matches the prefix it registered in NFD. If the content in repo matches the interests, it will respond with the data object. When the interest is not matched, it will not respond.
17 6 Shuo Chen
18
The protocol is listed as bellow
19
20
If there is a matching data object:
21
22 7 Shuo Chen
    Requester                     Repo
23
        |                           |
24
        |                           |
25
        |         Interest          |
26
     t1 |-------------------------->|
27
        |                           |
28
        |        Data Object        |
29
     t2 |<==========================|
30 1 Shuo Chen
        |                           |
31 7 Shuo Chen
        |                           |
32 1 Shuo Chen
        |                           |
33 7 Shuo Chen
34
If there is no matching data object:
35 6 Shuo Chen
36
    Requester                     Repo
37
        |                           |
38 1 Shuo Chen
        |                           |
39 7 Shuo Chen
        |         Interest          |
40
     t1 |-------------------------->|
41
        |                           |
42
        |                           |
43
        |                           |
44
45 8 Shuo Chen
## Repo Insertion Specification
46
47 11 Shuo Chen
Insertion specification is for some client and application to insert data objects into certain NDN repo. A command interest as insertion command will be sent to the repo. This command interest is a signed interest and will be validated with access control policy defined by the repo. When the interested is validated and name of the data is not existed in the repo. The repository will reponse with a data object containing OK status and start to send the interest to fetch the data to insert.
48 8 Shuo Chen
49 19 Shuo Chen
Segmented data insertion is also supported in the insertion protocol. Segmantation info is defined as a TLV-encoded SegmantationInfo block. If the content is segmented, the final segment id will be encoded in this block.
50 14 Shuo Chen
51 8 Shuo Chen
### Insertion command interest semantics
52 1 Shuo Chen
53
The name semantics is defined to have following components:
54
55 17 Shuo Chen
* ``<name of repo>`` refers to specific name of repo
56 11 Shuo Chen
* ``insert`` refers to insert data objects
57 1 Shuo Chen
* ``<data name>`` refers to specific name of data that will be inserted
58
59 8 Shuo Chen
The folloing components are components of singed interest for access control:
60
61
* ``<timestamp>``
62
* ``<random-value>``
63
* ``<SignatureInfo>``
64
* ``<SignatureValue>``
65
66 17 Shuo Chen
<name of repo> and <data name> can be divided by serveral continious ``/`` according to specific defination.
67
For example, for ``<name of repo>`` as ``/ucla/cs/repo`` and ``<data name>`` as ``/vedio/Forrest Gump``, the data object is defined as following:
68 8 Shuo Chen
69 11 Shuo Chen
    /ucla/cs/repo/insert/vedio/Forrest Gump/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue>
70 14 Shuo Chen
71
### SegmantationInfo
72
73
    SegmantationInfo      ::= SEGMENTATIONINFO-TYPE TLV-LENGTH
74
                               StartBlockId?
75 23 Shuo Chen
                               EndBlockId?
76 14 Shuo Chen
    
77
    StartBlockId          ::= STARTBLOCKID-TYPE TLV-LENGTH
78
                                nonNegativeInteger
79 1 Shuo Chen
    
80 24 Shuo Chen
    EndBlockId            ::= ENDBLOCKID-TYPE TLV-LENGTH
81 1 Shuo Chen
                                nonNegativeInteger
82
83 17 Shuo Chen
### Insertion status check
84 1 Shuo Chen
85 19 Shuo Chen
During the insertion progress, the requester could send insertion status check command to check the status of the insertion progress. This status check command is also signed interest. The semantics of insertion status check command is shown as follows:
86 17 Shuo Chen
87
The name semantics is defined to have following components:
88
89
* ``<name of repo>`` refers to specific name of repo
90
* ``insert check`` refers to insert data objects
91
* ``<data name>`` refers to specific name of data that will be inserted
92
93
The folloing components are components of singed interest for access control:
94
95
* ``<timestamp>``
96
* ``<random-value>``
97
* ``<SignatureInfo>``
98 1 Shuo Chen
* ``<SignatureValue>``
99
100 19 Shuo Chen
### Insertatation status response
101
102
This insert status data object could be the response data object of both insert command and insert check command. The name of data packet is the same as that of command. The insertion status is enocoded as a TLV echoded block in content block in data packet. The TLV block format is as follows:
103
104 17 Shuo Chen
    InsertStatus          ::= INSERTSTATUS-TYPE TLV-LENGTH
105
                               StatusCode?
106 1 Shuo Chen
                               StartBlockId?
107 25 Shuo Chen
                               EndBlockId?
108 17 Shuo Chen
                               InsertNum?
109
110
    StatusCode            ::= STATUSCODE-TYPE TLV-LENGTH
111
                                nonNegativeInteger    
112
113
    StartBlockId          ::= STARTBLOCKID-TYPE TLV-LENGTH
114 1 Shuo Chen
                                nonNegativeInteger
115 17 Shuo Chen
    
116 25 Shuo Chen
    EndBlockId            ::= ENDBLOCKID-TYPE TLV-LENGTH
117 17 Shuo Chen
                                nonNegativeInteger
118 1 Shuo Chen
119 17 Shuo Chen
    InsertNum             ::= INSERTNUM-TYPE TLV-LENGTH
120
                                nonNegativeInteger
121
122 19 Shuo Chen
StatusCode indicates the status of insertion. InsertNum represents how many data has been intersted into the repo.
123 1 Shuo Chen
124 17 Shuo Chen
StatusCode Definition:
125
126
``StatusCode`` | Description
127 19 Shuo Chen
-------------- | ----------------------------------------------
128
``100``        | The command is OK. can start to fetch the data
129 17 Shuo Chen
``200``        | All the data has been inserted
130
``300``        | This insertion is in progress
131
``401``        | This insertion check is invalidated
132
``404``        | No such this insertion is in progress
133
134 22 Alex Afanasyev
### Protocol Process
135
136 20 Alex Afanasyev
1. start to authorize the command; if authorization does not fail immediately, go to step 3
137 17 Shuo Chen
138 20 Alex Afanasyev
2. send a negative response indicating authorization failure, and abort these steps
139 14 Shuo Chen
140 20 Alex Afanasyev
3. if both StartBlockId and EndBlockId are missing, go to step 6
141 14 Shuo Chen
142 20 Alex Afanasyev
4. if both StartBlockId and EndBlockId are present, and StartBlockId is less than or equal to EndBlockId, go to step 6
143 14 Shuo Chen
144 20 Alex Afanasyev
5. send a negative response indicating malformed command, and abort these steps
145 14 Shuo Chen
146 20 Alex Afanasyev
6. wait for authorization completion
147 14 Shuo Chen
148 20 Alex Afanasyev
7. if authorization fails, go to step 2
149 14 Shuo Chen
150 20 Alex Afanasyev
8. send a positive response indicating insert is in progress
151 14 Shuo Chen
152 20 Alex Afanasyev
9. if both StartBlockId and EndBlockId are present, go to step 15
153 14 Shuo Chen
154 20 Alex Afanasyev
10. start to retrieve Name
155 14 Shuo Chen
156 20 Alex Afanasyev
11. wait for retrieval completion
157 14 Shuo Chen
158 20 Alex Afanasyev
12. if retrieval fails, abort these steps
159 14 Shuo Chen
160 20 Alex Afanasyev
13. store retrieved Data packet
161 14 Shuo Chen
162 20 Alex Afanasyev
14. abort these steps
163 14 Shuo Chen
164 20 Alex Afanasyev
15. append StartBlockId to Name
165 1 Shuo Chen
166 20 Alex Afanasyev
16. start to retrieve Name
167 14 Shuo Chen
168 20 Alex Afanasyev
17. wait for retrieval completion
169 14 Shuo Chen
170 20 Alex Afanasyev
18. if retrieval fails, abort these steps
171 14 Shuo Chen
172 20 Alex Afanasyev
19. store retrieved Data packet
173 15 Shuo Chen
174 20 Alex Afanasyev
20. if retrieved Data packet contains FinalBlockId, and FinalBlockId is less than EndBlockId, let EndBlockId be FinalBlockId
175 15 Shuo Chen
176 20 Alex Afanasyev
21. if the last component of Name is greater than or equal to EndBlockId, abort these steps
177 15 Shuo Chen
178 20 Alex Afanasyev
22. increment the last component of Name
179 15 Shuo Chen
180 20 Alex Afanasyev
23. go to step 16
181 15 Shuo Chen
182 20 Alex Afanasyev
Implementation MAY pipeline the Interests.
183 1 Shuo Chen
184 20 Alex Afanasyev
### Repo command progress report
185 16 Shuo Chen
186 20 Alex Afanasyev
Implementation MAY publish a notification of status regarding insert progress. The process of status check is as follows:
187 18 Shuo Chen
188 20 Alex Afanasyev
1. start to authorize the insert status command
189 1 Shuo Chen
190 20 Alex Afanasyev
2. send a negative response indicating authorization failure, and abort these steps
191 18 Shuo Chen
192 20 Alex Afanasyev
3. start to check the progress of the insert with the data name in the command. If no such progress is found, go to 4. or go to 5.
193 18 Shuo Chen
194 20 Alex Afanasyev
4. reponse status with status code of 404
195 18 Shuo Chen
196 20 Alex Afanasyev
5. ckeck te status of insertion. return the status data content
197
198 17 Shuo Chen
### Protocol diagram:
199 10 Alex Afanasyev
200
    Requester                     Repo                          Data producer
201
        |                           |                                 |
202
        |                           |                                 |
203
      +---+  Insert command       +---+                               |
204
      |   | --------------------> |   |                               |
205
      +---+                       |   |                               |
206
        |                         |   |                               |
207
      +---+   Confirm start       |   |                               |
208
      |   | <==================== |   |                               |
209
      +---+   Reject command      +---+                               |
210
        |     (with status code)    |                                 |
211
        |                         +---+     Interest for Data       +---+
212
        |                         |   | --------------------------> |   |
213
        |                         +---+                             |   |
214
        |                           |                               |   |
215
        |                         +---+       Data segment          |   |
216
        |                         |   | <========================== |   |
217
        |                         +---+                             +---+
218
        |                           |                                 |
219
        |                           ~                                 ~
220
        |                           ~                                 ~
221
        |                           |                                 |
222
        |                         +---+     Interest for Data       +---+
223
        |                         |   | --------------------------> |   |
224
        |                         +---+                             |   |
225
        |                           |                               |   |
226
        |                         +---+       Data segment          |   |
227
        |                         |   | <========================== |   |
228
        |                         +---+                             +---+
229
        |                           |                                 |
230
        |                           |                                 |
231
        |                           ~                                 ~
232
        |                           ~                                 ~
233
        |                           |                                 |
234
        |                           |                                 |
235
        |                           |                                 |
236
      +---+   Status interest     +---+                               |
237
      |   | --------------------> |   |                               |
238
      +---+                       |   |                               |
239 1 Shuo Chen
        |                         |   |                               |
240
      +---+    Status response    |   |                               |
241
      |   | <==================== |   |                               |
242
      +---+                       +---+                               |
243
        |                           |                                 |
244
        |                           |                                 |
245
246
## Repo Deletion Specification
247
248
Deletion of one content object or content objects under certain prefix are both supported in repo specification. Selectors are used to select multiple content objects. These selectors are different from conventional [selectors](http://named-data.net/doc/ndn-tlv/interest.html#selectors) of interest packet. The conventional selecors of interest would select one data packet of repo. Selecors of delete command will return any data packets which applies for these selectors.
249
250 19 Shuo Chen
### Deletion command interest semantics
251
252
The name semantics is defined to have following components:
253
254
* ``<name of repo>`` refers to specific name of repo
255
* ``delete`` refers to insert data objects
256
* ``<data name>`` refers to specific name of data that will be inserted
257
258
The folloing components are components of singed interest for access control:
259
260
* ``<timestamp>``
261
* ``<random-value>``
262
* ``<SignatureInfo>``
263
* ``<SignatureValue>``
264
265
<name of repo> and <data name> can be divided by serveral continious ``/`` according to specific defination.
266
For example, for ``<name of repo>`` as ``/ucla/cs/repo`` and ``<data name>`` as ``/vedio/Forrest Gump``, the data object is defined as following:
267
268
    /ucla/cs/repo/delete/vedio/Forrest Gump/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue>
269
270 17 Shuo Chen
### Deletion Command Selectors
271
272
    Selectors             ::= SELECTORS-TYPE TLV-LENGTH
273
                               MinSuffixComponents?
274
                               MaxSuffixComponents?
275
                               PublisherPublicKeyLocator?
276
                               Exclude?
277
    
278
    MinSuffixComponents   ::= MIN-SUFFIX-COMPONENTS-TYPE TLV-LENGTH
279
                               nonNegativeInteger
280
281
    MaxSuffixComponents   ::= MAX-SUFFIX-COMPONENTS-TYPE TLV-LENGTH
282
                               nonNegativeInteger
283
284
    PublisherPublicKeyLocator ::= KeyLocator
285
    
286 1 Shuo Chen
    Exclude               ::= EXCLUDE-TYPE TLV-LENGTH Any? (NameComponent (Any)?)+
287
    Any                   ::= ANY-TYPE TLV-LENGTH(=0)
288
289
The definitions of delete command selectors is the same as the selectors of conventional [selectors](http://named-data.net/doc/ndn-tlv/interest.html#selectors). The difference is that this delete command selectors will return any data packets that comforms to the selectors. If selectors are not presented, the repo will just delete the data of exact name. So, for example, if somebody wants to delete all the data under certain prefix, at least, MinSuffixComponents should be set to 0.
290
291 19 Shuo Chen
### Deletion status check
292
293
During the deletion progress, the requester could send deletion status check command to check the status of the deletion progress. This status check command is also signed interest. The semantics of deletion status check command is shown as follows:
294
295
The name semantics is defined to have following components:
296
297
* ``<name of repo>`` refers to specific name of repo
298
* ``delete check`` refers to insert data objects
299
* ``<data name>`` refers to specific name of data that will be inserted
300
301
The folloing components are components of singed interest for access control:
302
303
* ``<timestamp>``
304
* ``<random-value>``
305
* ``<SignatureInfo>``
306
* ``<SignatureValue>``
307
308
### Deletion status response
309
310
This delete status data object could be the response data packet of both delete command and delete check command. The name of data packet is the same as that of command.The deletion status is enocoded as a TLV echoded block in content block in data packet. The TLV block format is as follows:
311
312
    DeleteStatus          ::= DELETESTATUS-TYPE TLV-LENGTH
313
                               StatusCode?
314
                               DeleteSum?
315
                               DeleteNum?
316
317
    StatusCode            ::= STATUSCODE-TYPE TLV-LENGTH
318
                                nonNegativeInteger    
319
320
    DeleteSum             ::= INSERTNUM-TYPE TLV-LENGTH
321
                                nonNegativeInteger
322
323
    DeleteNum             ::= INSERTNUM-TYPE TLV-LENGTH
324
                                nonNegativeInteger
325
326
StatusCode indicates the status of deletion. DeleteSum is the sum of the deletion. DeleteNum represents how many data has been deleted.
327
328
StatusCode Definition:
329
330
``StatusCode`` | Description
331
-------------- | --------------------------------------
332
``200``        | All the data has been deleted
333
``300``        | This deletion is in progress
334
``401``        | This deletion check is invalidated
335
``404``        | No such this deletion is in progress
336
337 17 Shuo Chen
### Protocol process
338 1 Shuo Chen
339 21 Alex Afanasyev
1. start to authorize the command; if authorization does not fail immediately, go to step 3
340 1 Shuo Chen
341 21 Alex Afanasyev
2. send a negative response indicating authorization failure, and abort these steps
342 1 Shuo Chen
343 21 Alex Afanasyev
3. check whether selectors are presented. If selectors are presented, go to step 4, or select the data packet of the exact name of command. If some data is selected, go to step 6. If no data selected, go to step 5
344 1 Shuo Chen
345 21 Alex Afanasyev
4. select all the data packets that comforms to data name of the command and the selectors. If some data packets are selected, go to step 6. Or no data selected, go to step 5.
346 1 Shuo Chen
347 21 Alex Afanasyev
5. send a negative response and abort the delete transaction.
348 1 Shuo Chen
349 21 Alex Afanasyev
6. wait for authorization completion
350 1 Shuo Chen
351 21 Alex Afanasyev
7. if authorization fails, go to step 2
352 1 Shuo Chen
353 21 Alex Afanasyev
8. start to delete the selected data. If deletion success, return positive reponse, or return negative response and abort the deletion.
354 19 Shuo Chen
355 21 Alex Afanasyev
Implementation MAY publish a notification of status regarding delete progress. The process of status check is as follows:
356 19 Shuo Chen
357 21 Alex Afanasyev
1. start to authorize the delete status command
358 19 Shuo Chen
359 21 Alex Afanasyev
2. send a negative response indicating authorization failure, and abort these steps
360 19 Shuo Chen
361 21 Alex Afanasyev
3. start to check the progress of the delete with the data name in the command. If no such progress is found, go to 4. or go to 5.
362 19 Shuo Chen
363 21 Alex Afanasyev
4. reponse status with status code of 404
364
365
5. ckeck te status of delete. return the status data content
366 19 Shuo Chen
367
### Protocol diagram:
368
369
    Requester                     Repo 
370
        |                           |                                 
371
        |                           |                                 
372
      +---+  Delete command       +---+                               
373
      |   | --------------------> |   |                               
374
      +---+                       +---+                               
375
        |                           |                                 
376
        |                           |                                 
377
        |                           |                                 
378
      +---+   Status interest     +---+                               
379
      |   | --------------------> |   |                               
380
      +---+                       |   |                               
381
        |                         |   |                               
382
      +---+    Status response    |   |                               
383
      |   | <==================== |   |                               
384
      +---+                       +---+                               
385
        |                           |                                 
386
        |                           |                                 
387
        |                           |                                 
388
      +---+   Confirm Deletion    +---+                               
389
      |   | <==================== |   |                               
390
      +---+   Reject command      +---+                               
391
        |     (with status code)    |    
392 20 Alex Afanasyev
        |                           |