Basic Repo Insertion Protocol » History » Revision 4
« Previous |
Revision 4/13
(diff)
| Next »
Alex Afanasyev, 07/23/2014 04:39 PM
Basic Repo Insertion Protocol¶
Basic repo insertion protocol uses Repo Command.
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.
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.
Basic operations¶
Insert data¶
Command verb: insert
The name semantics follows the format of the repo command. The is defined as insert
.
For example, for <repo prefix>
as /ucla/cs/repo
, the following is an example:
/ucla/cs/repo/insert/<RepoCommandParameter>/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue>
Insertion status check¶
Command verb: insert check
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:
equals to insert check
. For example:
/ucla/cs/repo/insert check/<RepoCommandParameter>/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue>
Formats¶
RepoCommandParameter¶
RepoCommandParameter of insertion and insertion check command follows that in Repo Command section. Name, Selectors, StartBlockId, EndBlockId are used in insertion. Name and ProcessId are used in insertion check command.
In insertion command, Name represents the name or prefix of data for repo to fetch. If selectors are set, repo will use these selectors to fetch the data. If StartBlockId or EndBlockId is set, the repo will retrieve segmented data with segment number between StartBlockId and EndBlockId. If Repo Insert Command carries both Selectors and StartBlockId, EndBlockId, repo would ignore it and response with statuscode of 405.
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.
Insertatation status response¶
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.
StatusCode indicates the status of insertion. InsertNum represents how many data has been intersted 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 gernerated by repo.
For insert cammand, 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.
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.
StatusCode Definition:
StatusCode |
Description |
---|---|
100 |
The command is OK. can start to fetch the data |
200 |
All the data has been inserted |
300 |
This insertion is in progress |
401 |
This insertion command or insertion check command is invalidated |
402 |
Selectors and BlockId both present |
403 |
Malformed Command |
404 |
No such this insertion is in progress |
405 |
EndBlockId Missing Timeout |
EndBlockId Missing Timeout¶
If StartBlockId presents but EndBlockId is missing, and returned data packets do not contain FinalBlockId, the repo will continuosly fetch the data. An EndBlockId missing timeout is set to prevent this ocassion. 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.
Protocol Process¶
start to authorize the command; if authorization does not fail immediately, go to step 3
send a negative response indicating authorization failure, and abort these steps, insert process ends (StatusCode: 401)
if both StartBlockId and EndBlockId are missing, go to step 7
if either StartBlockId or EndBlockId is present, and one of supported selectors is present. send negative reponse back and abort steps, insert process ends (StatusCode: 402)
if both StartBlockId and EndBlockId are present, and StartBlockId is less than or equal to EndBlockId, go to step 7
send a negative response indicating malformed command, and abort these steps, insert process ends (StatusCode: 403)
wait for authorization completion
if authorization fails, go to step 2 (StatusCode: 401)
send a positive response indicating insert is in progress (StatusCode: 200)
if either StartBlockId or EndBlockId is present, go to step 16
start to retrieve Name with selectors in insert command
wait for retrieval completion
if retrieval fails, go to step 27
store retrieved Data packet
abort these steps, insert process ends
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.
append StartBlockId to Name
start to retrieve Name
wait for retrieval completion
if retrieval fails, go to step 26
store retrieved Data packet
if retrieved Data packet contains FinalBlockId, and FinalBlockId is less than EndBlockId or EndBlockId is missing, let EndBlockId be FinalBlockId
if the last component of Name is greater than or equal to EndBlockId, abort these steps, insert process ends
increment the last component of Name
go to step 17
retrieve data with this data another 2 times. If these 2 retrieval both failes, abort these steps. if success, go to step 21
retrieve data with this data another 2 times. If these 2 retrieval both failes, abort these steps. if success, go to step 14
If EndBlockId Missing Timeout timer starts, repo will monitor this timer during step 17~26. If this timeout occurs, abort insert command process immediately.
Implementation MAY pipeline the Interests.
Repo insert check command progress¶
Implementation MAY publish a notification of status regarding insert progress. The process of status check is as follows:
start to authorize the insert status command, if fails go to 2, if success, go to 3
send a negative response indicating authorization failure, and abort these steps (StatusCode: 401)
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.
reponse status with status code, abort check process. (StatusCode: 404)
ckeck the status of insertion. return the status of insertion progress. If a EndBlockId Missing Timeour timer is running, set this timer to 0. About check process. (StatusCode: 300)
Protocol diagram:¶
Requester Repo Data producer
| | |
| | |
+---+ Insert command +---+ |
| | --------------------> | | |
+---+ | | |
| | | |
+---+ Confirm start | | |
| | <==================== | | |
+---+ Reject command +---+ |
| (with status code) | |
| +---+ Interest for Data +---+
| | | --------------------------> | |
| +---+ | |
| | | |
| +---+ Data segment | |
| | | <========================== | |
| +---+ +---+
| | |
| ~ ~
| ~ ~
| | |
| +---+ Interest for Data +---+
| | | --------------------------> | |
| +---+ | |
| | | |
| +---+ Data segment | |
| | | <========================== | |
| +---+ +---+
| | |
| | |
| ~ ~
| ~ ~
| | |
| | |
| | |
+---+ Status interest +---+ |
| | --------------------> | | |
+---+ | | |
| | | |
+---+ Status response | | |
| | <==================== | | |
+---+ +---+ |
| | |
| | |
Updated by Alex Afanasyev over 10 years ago · 13 revisions