Project

General

Profile

Watched Prefix Insertion Protocol » History » Version 12

Alex Afanasyev, 07/28/2014 07:14 PM

1 1 Weiqi Shi
Watched Prefix Insertion Protocol
2
=================================
3
Watched Prefix is a new protocol for repo insertion. By using this protocol, repo keep sending interests to request the data with same prefix. When a data packet is received, repo will update selectors (exclude selector in most cases) to exclude the received data and request new one. Repo will stop watching the prefix until a command interest in tell it to stop, the total amount of sent interests reaches a specific number or time out.
4
5
## Basic operations
6
7
### Keep requesting and inserting data with same prefix
8
9 9 Weiqi Shi
Command verb: **watch start**
10 1 Weiqi Shi
11 12 Alex Afanasyev
The name semantics follows the format of the [[Repo Command]]. The <command verb> is defined as ``watch``.
12 1 Weiqi Shi
For example, for ``<repo prefix>`` as ``/ucla/cs/repo``, the following is an example:
13
14 9 Weiqi Shi
    /ucla/cs/repo/watch/start/<RepoCommandParameter>/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue>
15 1 Weiqi Shi
16 12 Alex Afanasyev
The command is using the following parameters:
17 1 Weiqi Shi
18 12 Alex Afanasyev
* ``Name`` (required)
19
* ``InterestLifetime`` (optional)
20
* ``MaxInterestNum`` (optional)
21
* ``WatchTimeout`` (optional)
22
* ``WatchStatus`` (required)
23
* ``Selectors`` (optional)
24 1 Weiqi Shi
25 12 Alex Afanasyev
Detailed description of the parameters:
26 1 Weiqi Shi
27 12 Alex Afanasyev
* **`Name`** is the prefix that will be watched.
28 1 Weiqi Shi
29 12 Alex Afanasyev
* **`InterestLifetime`** is the maximum latency between interest sent and data received. If the time duration is larger than interest timeout, the same interest will be resent. If data is received within the Interest timeout, the selectors of the interest will be updated and sent to request new data. If it is not specified, a default value(4000 millisecond) will be set. 
30 1 Weiqi Shi
31 12 Alex Afanasyev
* **`MaxInterestNum`** is the maximum of total interests that can be sent. The process will stop if the total number of interests reaches this limit. If it is not specified, MaxInterestNum will be set as -1, means infinity.
32 1 Weiqi Shi
33 12 Alex Afanasyev
* **`WatchTimeout`** is the time duration of this process. Repo will keep watching the prefix until it times out. If it is not specified, WatchTimeout will be set as 0, means this process will run forever.
34 1 Weiqi Shi
35 12 Alex Afanasyev
* **`WatchStatus`** is used to show whether repo is watching a prefix or not. 
36 1 Weiqi Shi
37 12 Alex Afanasyev
* **`Selectors`** are used to exclude the received data and request new data.
38 1 Weiqi Shi
39 12 Alex Afanasyev
### Watch status check
40 1 Weiqi Shi
41 12 Alex Afanasyev
Command verb: **watch check**
42 1 Weiqi Shi
43 12 Alex Afanasyev
During the watched prefix progress, requester could send watch status check command to check the status of the progress. This status check command is also [[Repo Command]]. The semantics of watch status check command is shown as follows:
44 1 Weiqi Shi
45 12 Alex Afanasyev
    /ucla/cs/repo/watch/check/<RepoCommandParameter>/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue>
46 1 Weiqi Shi
47 12 Alex Afanasyev
The command is using the following parameters:
48 1 Weiqi Shi
49 12 Alex Afanasyev
* ``ProcessId`` (required)
50 1 Weiqi Shi
51 12 Alex Afanasyev
Detailed description of the parameters:
52 1 Weiqi Shi
53 12 Alex Afanasyev
* **`ProcessId`**  is the ID returned by repo for watch start command.
54 9 Weiqi Shi
55
56 12 Alex Afanasyev
### Stop watched prefix insertion
57 9 Weiqi Shi
58 12 Alex Afanasyev
Command verb: **watch stop**
59 9 Weiqi Shi
60 12 Alex Afanasyev
During the watched prefix progress, requester could send watch stop [[Repo Command]] to stop the watched prefix insertion
61 9 Weiqi Shi
62 12 Alex Afanasyev
    /ucla/cs/repo/watch/stop/<RepoCommandParameter>/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue>
63 9 Weiqi Shi
64 12 Alex Afanasyev
The command is using the following parameters:
65 9 Weiqi Shi
66
* ``WatchStatus`` (required)
67
68
For watch stop command interest, only WatchStatus is needed.
69 1 Weiqi Shi
70
### RepoCommandResponse
71
72
This watch status data object could be the response data object of both watch command and watchCheck command. It will follow the format of repo command response.
73
74
Response has three part: ProcessId, indicates an ID of process;  InsertNumber, indicates how many data packets under the watched prefix has been inserted into repo; 
75 2 Weiqi Shi
StatusCode, indicates the status of the process.
76
77
StatusCode Definition:
78
79
``StatusCode`` | Description
80
-------------- | ----------------------------------------------
81
``100``        | The command is OK. Start to watch the prefix
82
``101``        | Watched Prefix Insertion is stop.
83
``300``        | This watched prefix Insertion is in progress
84
``401``        | This watch command or watchCheck command is invalidated
85
``402``        | BlockId present. BlockId is not supported in this protocol
86
``403``        | Malformed Command
87
``404``        | No such this process is in progress
88 3 Weiqi Shi
89
## Protocol Process
90
91 11 Weiqi Shi
### Repo watch start command process:
92 10 Weiqi Shi
93 3 Weiqi Shi
1. Start to validate the command. If it is validated, go to Step 3, otherwise go to Step 2.
94
95
2. Send a negative response indicating validation failure, and abort these steps, process ends (StatusCode: 401).
96
97
3. Check parameters. If it cannot be extracted from interest, send a negative response(StatusCode: 403) and stop process.
98
99
4. If it has BlockId, send a negative response(StatusCode: 402) and stop process.
100
101
5. Use parameter of the command interest to construct interest. Set the Rightmost Child Selector.
102
103
6. Send the interest and start timer. The number of sent interest plus 1(the initial value is 0).
104
105
7. If received a data, go to Step 8, if times out, go to Step 17.
106
107
8. If data is validated, go to Step 9, otherwise, go to Step 15.
108
109
9. Check whether the watched prefix insertion is still running. If it does not, process ends.
110
111
10. If the process times out(exceed watch timeout) or if total number of sent interest reaches limit, go to Step 11, otherwise go to Step 12.
112
113
11. Clear all the variables(the number of sent interest, watch timeout, interest lifetime), abort these steps, process ends.
114
115
12. Store the data into repo.
116
117
13. Update selectors, exclude from min to the received one and use the updated selectors construct new interest. 
118
119
14. Send new interest and the number of sent interest plus 1, and then go to Step 7.
120
121
15. Repeat Step 9 to 11 and skip Step 12.
122
123
16. Update selectors, only exclude the received data(since other data whose name is smaller may be satisfied), then go to Step 14.
124
125
17. Repeat Step 9 to 11 and skip Step 12.
126
127 4 Weiqi Shi
18. Send the interest again and the number of sent interest plus 1, and then go to Step 7.
128 1 Weiqi Shi
129 11 Weiqi Shi
### Repo watch check command process:
130 4 Weiqi Shi
131
1. Start to validate the check command. If it is validated, go to Step 3, otherwise, go to Step 2.
132
133
2. Send a negative response indicating validation failure, and abort these steps, process ends (StatusCode: 401).
134
135
3. Check parameter. If it cannot extracted from interest or if it does not have processId, send a negative reply(StatusCode: 403).
136
137
4. Check whether the processId is existed. If it does, go to Step 5, otherwise, send a negative reply(StatusCode: 404).
138
139 1 Weiqi Shi
5. Use the processId to find the response and send the response back.
140 10 Weiqi Shi
141 11 Weiqi Shi
### Repo watch stop command process:
142 10 Weiqi Shi
143
1. Start to validate the stop command. If it is validated, go to Step 3, otherwise, go to Step 2.
144
145
2. Send a negative response indicating validation failure, and abort these steps, process ends (StatusCode: 401).
146
147
3. Check parameter. If it cannot extracted from interest or if it does not have processId, send a negative reply(StatusCode: 403).
148
149
4. Check whether the WatchStatus is existed. If it does, go to Step 5, otherwise, send a negative reply(StatusCode: 403).
150
151
5. Stop the process and send a negative reply (StatusCode: 101).