Project

General

Profile

Repo Command » History » Version 1

Alex Afanasyev, 07/23/2014 04:35 PM

1 1 Alex Afanasyev
Repo Command
2
============
3
4
For insertion, deletion and other operations of repo, these commands are encoded in the form of [[ndn-cxx:SignedInterest|Signed Interests]]:
5
6
    /<repo-prefix>/<command-verb>/................./.........................................
7
                                  \______  _______/ \__________________  ___________________/
8
                                         \/                            \/
9
                                 RepoCommandParameter   Signed Interest additional components
10
11
The semantics of repo command interest is as follows:
12
13
The name semantics is defined to have following components:
14
15
* ``<repo prefix>`` refers to specific prefix repo is listening
16
* ``<command verb>`` refers to the name of command
17
* ``<RepoCommandParameter>`` refers to parameters of repo command
18
19
The following components are components of singed interest for access control:
20
21
* ``<timestamp>``
22
* ``<random-value>``
23
* ``<SignatureInfo>``
24
* ``<SignatureValue>``
25
26
For prefix of repo /ucla/cs/repo/, the command will be defined as this:
27
28
    /ucla/cs/repo/<command verb>/<RepoCommandParameter>/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue>
29
30
### RepoCommandParameter
31
32
    RepoCommandParameter ::= REPOCOMMANDPARAMETER-TYPE TLV-LENGTH
33
                               Name?
34
                               Selectors?
35
                               StartBlockId?
36
                               EndBlockId?
37
                               ProcessId?
38
39
    Name                  ::= NAME-TYPE TLV-LENGTH NameComponent*
40
    NameComponent         ::= NAME-COMPONENT-TYPE TLV-LENGTH BYTE+
41
42
    Selectors             ::= SELECTORS-TYPE TLV-LENGTH
43
                               MinSuffixComponents?
44
                               MaxSuffixComponents?
45
                               PublisherPublicKeyLocator?
46
                               Exclude?
47
                               ChildSelector?
48
49
    MinSuffixComponents   ::= MIN-SUFFIX-COMPONENTS-TYPE TLV-LENGTH
50
                               nonNegativeInteger
51
52
    MaxSuffixComponents   ::= MAX-SUFFIX-COMPONENTS-TYPE TLV-LENGTH
53
                               nonNegativeInteger
54
55
    PublisherPublicKeyLocator ::= KeyLocator
56
57
    Exclude               ::= EXCLUDE-TYPE TLV-LENGTH Any? (NameComponent (Any)?)+
58
    Any                   ::= ANY-TYPE TLV-LENGTH(=0)
59
60
    ChildSelector         ::= CHILD-SELECTOR-TYPE TLV-LENGTH
61
                               nonNegativeInteger
62
    
63
    StartBlockId          ::= STARTBLOCKID-TYPE TLV-LENGTH
64
                               nonNegativeInteger
65
    
66
    EndBlockId            ::= ENDBLOCKID-TYPE TLV-LENGTH
67
                               nonNegativeInteger
68
69
    ProcessId            ::= PROCESSID-TYPE TLV-LENGTH
70
                               nonNegativeInteger
71
72
#### Repo Command Selectors
73
74
Repo command supports parts of interest selectors of interest to indicate which contents to process. The definition of standard NDN selectors is described in [NDN Selectors Doc](http://named-data.net/doc/ndn-tlv/interest.html#selectors). The concrete definitions of both standard NDN selectors and repo command selectors are the same.
75
76
The difference between standard NDN interest and Repo Deletion Command interest that, the standard NDN selectors just matches **one** data packet that conforms to the selector conditions, but repo command selectors would matches **any** data packets. For example, if Interest is expressed for /ndn/edu and Exclude specifies one name component ucla, in standard NDN interest, the data producers will first exclude all the data packets with prefix /ndn/edu but not /ndn/edu/ucla, and then just selects one data packet. In repo deletion command interest, it will select all the data packets with prefix /ndn/edu but not /ndn/edu/ucla. However, in repo insert command, the repo will fetch one data just like standard interest selectors.
77
78
Repo command supports parts of standard NDN interests including MinSuffixComponents, MaxSuffixComponents, PublisherPublicKeyLocator, and Exclude. ChildSelector is supported in insertion command but not deletion command. If command contains other selectors, repo will ignore these not supported selectors. In addition, selectors are just supported in delete command. If other commands contains selectors, repo will ignore selectors when processing these commands.
79
80
The form of selectors is as follows:
81
82
    Selectors             ::= SELECTORS-TYPE TLV-LENGTH
83
                               MinSuffixComponents?
84
                               MaxSuffixComponents?
85
                               PublisherPublicKeyLocator?
86
                               Exclude?
87
                               ChildSelector?
88
    
89
    MinSuffixComponents   ::= MIN-SUFFIX-COMPONENTS-TYPE TLV-LENGTH
90
                               nonNegativeInteger
91
92
    MaxSuffixComponents   ::= MAX-SUFFIX-COMPONENTS-TYPE TLV-LENGTH
93
                               nonNegativeInteger
94
95
    PublisherPublicKeyLocator ::= KeyLocator
96
    
97
    Exclude               ::= EXCLUDE-TYPE TLV-LENGTH Any? (NameComponent (Any)?)+
98
    Any                   ::= ANY-TYPE TLV-LENGTH(=0)
99
100
    ChildSelector         ::= CHILD-SELECTOR-TYPE TLV-LENGTH
101
                               nonNegativeInteger
102
103
#### StartBlockId, EndBlockId
104
105
StartBlockId and EndBlockId are used to process segmented data. StartBlockId indicate the first segment number and EndBlockId indicate the last segment number. Repo will process segment data whose segment id between StartBlockId and EndBlockId. If StartBlockId is missing, the first segment id the repo process is 0; If EndBlockId is missing, this scenario is described in specific process in Repo Insertion Command section and Repo Deletion Command section.
106
107
#### Conflict of Selectors and StartBlockId, EndBlockId
108
109
Repo cannot process command with both selectors and StartBlockId, EndBlockId in RepoCommandParameter. If the RepoCommandParameter carries both, repo will ignore this command interest and return with error code of 405.
110
111
#### ProcessId
112
113
ProcessId is used by insertion and deletion check command to indicate specific insertion and deletion process. The ProcessId is fetched by repo command response of insertion and deletion command.
114
115
## Repo Command Response
116
117
Repo command response is the response data packet of repo command interest. The response contains statuscode to indicate the status of command process and other information. A TLV-encoded block called ``RepoCommandResponse`` is encoded in content of the data packet.
118
119
    RepoCommandResponse   ::= INSERTSTATUS-TYPE TLV-LENGTH
120
                               ProcessId?
121
                               StatusCode
122
                               StartBlockId?
123
                               EndBlockId?
124
                               InsertNum?
125
                               DeleteNum?
126
127
    ProcessId            ::= PROCESSID-TYPE TLV-LENGTH
128
                                nonNegativeInteger 
129
    
130
    StatusCode            ::= STATUSCODE-TYPE TLV-LENGTH
131
                                nonNegativeInteger    
132
133
    StartBlockId          ::= STARTBLOCKID-TYPE TLV-LENGTH
134
                                nonNegativeInteger
135
    
136
    EndBlockId            ::= ENDBLOCKID-TYPE TLV-LENGTH
137
                                nonNegativeInteger
138
139
    InsertNum             ::= INSERTNUM-TYPE TLV-LENGTH
140
                                nonNegativeInteger
141
142
    DeleteNum             ::= DELETENUM-TYPE TLV-LENGTH
143
                                nonNegativeInteger
144
145
### Name
146
Name indicates the Name in repocommandparameter of repo command
147
148
149
### ProcessId
150
ProcessId is a random number generated by repo to indicate the number of the command process. Client could use this ProcessId to check the status of specific command.
151
152
### StatusCode
153
154
StatusCode indicates the status of repo command process. The statuscodes of insert and deletion command are described in following insertion and deletion specification.
155
156
### StartBlockId, EndBlockId
157
158
StartBlockId and EndBlockId are the same as those of RepoCommandParameter. If either of those in RepoCommandParameter is missing, repo will set them as the Id known for now. For example, if StartBlockId is missing in RepoCommandParameter, StartBlockId in response will be set 0. If EndBlockId is missing in RepoCommandParameter, EndBlockId will be set null untill Repo get FinalBlockId in data packet. If FinalBlockId in returned data packet is less than EndBlockId, the EndBlockId will be set FinalBlockId.
159
160
### InsertNum, DeleteNum
161
InsertNum is used in reponse of insertion status check to indicate how many data packets have been successfully inserted into the repo. DeleteNum is used in response of deletion command and deletion check command. DeleteNum indicates how many data packets have been successfully inserted from repo.
162
163
## Repo TLV Type Encoding Number
164
165
Type                  | Number
166
----------------------| -------
167
RepoCommandParameter  | 201
168
StartBlockId          | 204
169
EndBlockId            | 205
170
ProcessId             | 206
171
RepoCommandResponse   | 207
172
StatusCode            | 208
173
InsertNum             | 209
174
DeleteNum             | 210
175
176
## Repo Trust Model
177
178
The trust model of repo depends on people who deploy the repo service, such as PKI. Repo can specify their own verification policies, and data consumers can specify their own trust anchors. The NDN [FAQ](http://named-data.net/project/faq/#How_does_NDN8217s_8220trust_management8221_work) shows how NDN trust managment works.
179
180
## Repo Insertion Specification
181
182
Repo insertion command requests that the repo retrieve and store content. 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 reponsd with a data object containing OK status and start to send the interest to fetch the data to insert.
183
184
Segmented data insertion is also supported in the insertion protocol. Segmentation info is defined in RepoCommandParameter. If the content is segmented, the final segment id will be encoded in this block.