Basic Repo Insertion Protocol » History » Version 12
weijia yuan, 10/19/2018 10:19 PM
1 | 1 | Alex Afanasyev | Basic Repo Insertion Protocol |
---|---|---|---|
2 | ============================= |
||
3 | |||
4 | 2 | Alex Afanasyev | Basic repo insertion protocol uses **[[Repo Command]]**. |
5 | 1 | Alex Afanasyev | |
6 | 6 | Muktadir Chowdhury | 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 Interest is validated and name of the data is not existed in the repo. The repository will respond with a data object containing OK status and start to send the interest to fetch the data to insert. |
7 | 4 | Alex Afanasyev | |
8 | 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. |
||
9 | |||
10 | 9 | weijia yuan | Forwarding hint is a scheme for mobility support in a large NDN network. Repo will support forwarding hint method in the insertion protocol. If regular interest is unroutable, consumer will send the interest with a link object, which contain information about destination region. When interest reached consumer region edge, the router will make a selection among delegation information. Intermediate router will forward the interest through this delegation. When interest reaches producer region edge, the router will forward the interest through the original name. |
11 | |||
12 | 4 | Alex Afanasyev | |
13 | 3 | Alex Afanasyev | ## Basic operations |
14 | |||
15 | ### Insert data |
||
16 | |||
17 | Command verb: **insert** |
||
18 | |||
19 | 1 | Alex Afanasyev | The name semantics follows the format of the repo command. The <command verb> is defined as ``insert``. |
20 | For example, for ``<repo prefix>`` as ``/ucla/cs/repo``, the following is an example: |
||
21 | |||
22 | /ucla/cs/repo/insert/<RepoCommandParameter>/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue> |
||
23 | |||
24 | ### Insertion status check |
||
25 | |||
26 | 3 | Alex Afanasyev | Command verb: **insert check** |
27 | |||
28 | 1 | Alex Afanasyev | 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: |
29 | |||
30 | <command verb> equals to ``insert check``. For example: |
||
31 | |||
32 | /ucla/cs/repo/insert check/<RepoCommandParameter>/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue> |
||
33 | |||
34 | 3 | Alex Afanasyev | ## Formats |
35 | |||
36 | 1 | Alex Afanasyev | ### RepoCommandParameter |
37 | |||
38 | 10 | weijia yuan | RepoCommandParameter of insertion and insertion check command follows that in Repo Command section. Name, StartBlockId, EndBlockId are used in insertion. Name and ProcessId are used in insertion check command. |
39 | 1 | Alex Afanasyev | |
40 | 10 | weijia yuan | In insertion command, Name represents the name or prefix of data for repo to fetch. If StartBlockId or EndBlockId is set, the repo will retrieve segmented data with segment number between StartBlockId and EndBlockId. |
41 | 1 | Alex Afanasyev | |
42 | In insertion check command, Name represents name or prefix of data for repo to fetch. ProcessId is set by the RepoCommandResponse to indicate specified process. |
||
43 | |||
44 | 5 | Alex Afanasyev | ### Insertion status response |
45 | 1 | Alex Afanasyev | |
46 | This insert status data object could be the response data object of both insert command and insert check command. It will follow the format of repo command response. |
||
47 | |||
48 | 5 | Alex Afanasyev | StatusCode indicates the status of insertion. InsertNum represents how many data has been interested into the repo. StartBlockId and EndBlockId is the start and end segment id of data inserted. InsertNum is the how many data segments have been inserted. ProcessId indicates an ID of process, a random number generated by repo. |
49 | 1 | Alex Afanasyev | |
50 | 5 | Alex Afanasyev | For insert command, status code will be set according to definition below, StartBlockId and EndBlockId will be set according to the insert command. If StartBlockId in RepoCommandParameter is missing, it will be set 0 in response. If EndBlockId is missing, it will not be set. |
51 | 1 | Alex Afanasyev | |
52 | For insert check command, status code will be set according to definition below, StartBlockId and EndBlockId will be set according to the StartBlockId and EndBlockId that repo is using, insertnum will be set according to insertion progress. ProcessId is set according to the ID of process checked. If EndBlockId has not been decided, this EndBlockId will not be set in response. |
||
53 | |||
54 | StatusCode Definition: |
||
55 | |||
56 | ``StatusCode`` | Description |
||
57 | -------------- | ---------------------------------------------- |
||
58 | ``100`` | The command is OK. can start to fetch the data |
||
59 | ``200`` | All the data has been inserted |
||
60 | ``300`` | This insertion is in progress |
||
61 | ``401`` | This insertion command or insertion check command is invalidated |
||
62 | ``403`` | Malformed Command |
||
63 | ``404`` | No such this insertion is in progress |
||
64 | ``405`` | EndBlockId Missing Timeout |
||
65 | |||
66 | ### EndBlockId Missing Timeout |
||
67 | |||
68 | 5 | Alex Afanasyev | If StartBlockId presents but EndBlockId is missing, and returned data packets do not contain FinalBlockId, the repo will continuously fetch the data. An EndBlockId missing timeout is set to prevent this occasion. The repo will start a timer when StartBlockId presents but EndBlockId is missing. When timeout happens, repo will stop fetching data to store and end insert process. If an insert check command arrives during this insert process, the time of timer is set to 0. If data packet containing FinalBlockId arrives, this timeout timer will be dismissed. |
69 | 1 | Alex Afanasyev | |
70 | 3 | Alex Afanasyev | ## Protocol Process |
71 | 1 | Alex Afanasyev | |
72 | 1. start to authorize the command; if authorization does not fail immediately, go to step 3 |
||
73 | |||
74 | 2. send a negative response indicating authorization failure, and abort these steps, insert process ends (StatusCode: 401) |
||
75 | |||
76 | 3. if both StartBlockId and EndBlockId are missing, go to step 7 |
||
77 | |||
78 | 12 | weijia yuan | 4. if both StartBlockId and EndBlockId are present, and StartBlockId is less than or equal to EndBlockId, go to step 7 |
79 | 1 | Alex Afanasyev | |
80 | 12 | weijia yuan | 5. send a negative response indicating malformed command, and abort these steps, insert process ends (StatusCode: 403) |
81 | 1 | Alex Afanasyev | |
82 | 12 | weijia yuan | 6. wait for authorization completion |
83 | 1 | Alex Afanasyev | |
84 | 12 | weijia yuan | 7. if authorization fails, go to step 2 (StatusCode: 401) |
85 | 1 | Alex Afanasyev | |
86 | 12 | weijia yuan | 8. send a positive response indicating insert is in progress (StatusCode: 200) |
87 | 1 | Alex Afanasyev | |
88 | 12 | weijia yuan | 9. if either StartBlockId or EndBlockId is present, go to step 16 |
89 | 1 | Alex Afanasyev | |
90 | 12 | weijia yuan | 10. start to retrieve Name with selectors in insert command |
91 | 1 | Alex Afanasyev | |
92 | 12 | weijia yuan | 11. wait for retrieval completion |
93 | 1 | Alex Afanasyev | |
94 | 12 | weijia yuan | 12. if retrieval fails, go to step 27 |
95 | 1 | Alex Afanasyev | |
96 | 12 | weijia yuan | 13. store retrieved Data packet |
97 | 1 | Alex Afanasyev | |
98 | 12 | weijia yuan | 14. abort these steps, insert process ends |
99 | 1 | Alex Afanasyev | |
100 | 12 | weijia yuan | 15. if StartBlockId is missing, set StartBlockId 0. If EndBlockId is missing, EndBlockId will be missing unless get FinalBlockId in comming data packets, start EndBlockId Misiing Timeout timer. |
101 | 1 | Alex Afanasyev | |
102 | 12 | weijia yuan | 16. append StartBlockId to Name |
103 | 1 | Alex Afanasyev | |
104 | 12 | weijia yuan | 17. start to retrieve Name |
105 | 1 | Alex Afanasyev | |
106 | 12 | weijia yuan | 18. wait for retrieval completion |
107 | 1 | Alex Afanasyev | |
108 | 12 | weijia yuan | 19. if retrieval fails, go to step 26 |
109 | 1 | Alex Afanasyev | |
110 | 12 | weijia yuan | 20. store retrieved Data packet |
111 | 1 | Alex Afanasyev | |
112 | 12 | weijia yuan | 21. if retrieved Data packet contains FinalBlockId, and FinalBlockId is less than EndBlockId or EndBlockId is missing, let EndBlockId be FinalBlockId |
113 | 1 | Alex Afanasyev | |
114 | 12 | weijia yuan | 22. if the last component of Name is greater than or equal to EndBlockId, abort these steps, insert process ends |
115 | 1 | Alex Afanasyev | |
116 | 12 | weijia yuan | 23. increment the last component of Name |
117 | 1 | Alex Afanasyev | |
118 | 12 | weijia yuan | 24. go to step 17 |
119 | 1 | Alex Afanasyev | |
120 | 12 | weijia yuan | 25. retrieve data with this data another 2 times. If these 2 retrieval both failes, abort these steps. if success, go to step 21 |
121 | 1 | Alex Afanasyev | |
122 | 12 | weijia yuan | 26. retrieve data with this data another 2 times. If these 2 retrieval both failes, abort these steps. if success, go to step 14 |
123 | 1 | Alex Afanasyev | |
124 | If EndBlockId Missing Timeout timer starts, repo will monitor this timer during step 17~26. If this timeout occurs, abort insert command process immediately. |
||
125 | |||
126 | Implementation MAY pipeline the Interests. |
||
127 | |||
128 | ### Repo insert check command progress |
||
129 | |||
130 | Implementation MAY publish a notification of status regarding insert progress. The process of status check is as follows: |
||
131 | |||
132 | 1. start to authorize the insert status command, if fails go to 2, if success, go to 3 |
||
133 | |||
134 | 2. send a negative response indicating authorization failure, and abort these steps (StatusCode: 401) |
||
135 | |||
136 | 8 | weijia yuan | 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. |
137 | 1 | Alex Afanasyev | |
138 | 5 | Alex Afanasyev | 4. response status with status code, abort check process. (StatusCode: 404) |
139 | 1 | Alex Afanasyev | |
140 | 7 | weijia yuan | 5. check the status of insertion. return the status of insertion progress. If a EndBlockId Missing Timeout timer is running, set this timer to 0. Abort check process. (StatusCode: 300) |
141 | 1 | Alex Afanasyev | |
142 | ### Protocol diagram: |
||
143 | |||
144 | Requester Repo Data producer |
||
145 | | | | |
||
146 | | | | |
||
147 | +---+ Insert command +---+ | |
||
148 | | | --------------------> | | | |
||
149 | +---+ | | | |
||
150 | | | | | |
||
151 | +---+ Confirm start | | | |
||
152 | | | <==================== | | | |
||
153 | +---+ Reject command +---+ | |
||
154 | | (with status code) | | |
||
155 | | +---+ Interest for Data +---+ |
||
156 | | | | --------------------------> | | |
||
157 | | +---+ | | |
||
158 | | | | | |
||
159 | | +---+ Data segment | | |
||
160 | | | | <========================== | | |
||
161 | | +---+ +---+ |
||
162 | | | | |
||
163 | | ~ ~ |
||
164 | | ~ ~ |
||
165 | | | | |
||
166 | | +---+ Interest for Data +---+ |
||
167 | | | | --------------------------> | | |
||
168 | | +---+ | | |
||
169 | | | | | |
||
170 | | +---+ Data segment | | |
||
171 | | | | <========================== | | |
||
172 | | +---+ +---+ |
||
173 | | | | |
||
174 | | | | |
||
175 | | ~ ~ |
||
176 | | ~ ~ |
||
177 | | | | |
||
178 | | | | |
||
179 | | | | |
||
180 | +---+ Status interest +---+ | |
||
181 | | | --------------------> | | | |
||
182 | +---+ | | | |
||
183 | | | | | |
||
184 | +---+ Status response | | | |
||
185 | | | <==================== | | | |
||
186 | +---+ +---+ | |
||
187 | | | | |
||
188 | | | | |