-
Notifications
You must be signed in to change notification settings - Fork 13
NDN Repo Clients
The Client is a logical entity that can communicate commands to the repo for ordinary use, as well as a few other features.
In particular, the Client can use command interests for the following commands:
-
a: insert: The client can send a command interest to the repo, which will then fetch a particular file (which can, of course, be larger than a data packet) and store it in the repo. Notably, this requires the name of the repo, the path to the input file, and the name used to store the file at the repo. Optionally, one can include a start_block_id, which will otherwise default to 0 and stretch to the number of packets that the file was transmitted in. This command will return the a process id and a status.
- e.g.
/<repo_prefix>/insert/<RepoCommandParameter>/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue>
- e.g.
-
b: insert_check: The client can send a command interest to the repo querying the status of a particular process, which will respond with an appropriate status code.
- e.g.
/<repo_prefix>/insert check/<RepoCommandParameter>/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue>
- e.g.
-
c: delete: The client can send a delete command interest that instructs the repo to delete all data within a certain range of blocks (for a certain data prefix). This also returns a status code and a randomly generated process_id which identifies this delete process. This process_id is then used in the delete check command, which returns a status code.
- e.g.
/<repo_prefix>/delete/<RepoCommandParameter>/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue>
- e.g.
-
d: delete check: The client can send a delete command interest querying the status of a particular process. The repo will return the appropriate status code.
- e.g.
/<repo_prefix>/delete check/<RepoCommandParameter>/<timestamp>/<random-value>/<SignatureInfo>/<SignatureValue>
- e.g.
-
e: TCP Bulk Insertion Protocol — Additionally, the client can use the TCP Bulk Insertion Protocol. NDN-Repo listens on port 6367. Clients can establish a TCP connection, and transfer multiple Data packets over this connection.
All of these are detailed in greater detail (e.g. with all parameters) in [the home page] (https://github.com/JonnyKong/NDN-Repo/wiki)
Getting packets: The client can fetch Data packets stored in the repo using ordinary interests.
The status codes are listed on the wiki page, and reproduced here for completeness.
- 100: The command is OK
- 200: All the data have been inserted/deleted
- 300: The insertion/deletion command is in progress
- 401: The insertion/deletion command is invalidated
- 403: Malformed Command
- 404: No such insertion/deletion is in progress
Commands, files
+----------+ <--------------------- +--------+
| Repo | | Client |
+----------+ ---------------------> +--------+
Data packets, status
Users can create an instance of this class as a client, which provides (given a fully set-up NFD/keychain) the following functionality:
-
a: delete.py: when run with repo name, data prefix, start block ID, and end block ID arguments, sends a signed command interest to delete a particular set of blocks within a name prefix. Additionally, logs the status returned by the repo.
-
b: getfile.py: when run with the repo name and name of the file as arguments, retrieves a file from the repo. Notably, as the client doesn’t know how the file is sharded, keeps trying new block ids until no data is returned. Finally, saves the file to the current working directory.
-
c: insert_check.py: when run with the repo name and a process id as arguments, retrieves a status for the given process from the repo, as detailed in part C.
-
d: putfile.py: when run with the repo name, the path to the input file, and the Name used to store a file at the repo, will command the repo to fetch the local file and save it with the given name. Importantly, will log the process_id, such that an application or user can later delete it or check the insertion process.
This is just one example of an example client. Users can also utilize the repo with command line tools, or some other custom solution.