Tools » History » Revision 5
« Previous |
Revision 5/7
(diff)
| Next »
Weiqi Shi, 08/20/2014 12:14 PM
Tools¶
repo tools use the command line to instruct different behavior of repo.
ndnputfile¶
This tool is used to insert data into repo.
$ndnputfile <command> repo-prefix ndn-name filename
Here is a list of commands supported so far:
$ndnputfile -h
-u: unversioned: do not add a version component
-s: single: do not add version or segment component, implies -u
-D: use DigestSha256 signing method instead of SignatureSha256WithRsa
-i: specify identity used for signing Data
-I: specify identity used for signing commands
-x: FreshnessPeriod in milliseconds
-l: InterestLifetime in milliseconds for each command
-w: timeout in milliseconds for whole process (default unlimited)
-v: be verbose
Next, we will introduce these commands one-by-one:
List¶
If you want to add a version number manually after the ndn-name, you can specify -u. Otherwise, ndnputfile will automatically append a version number according to current time. For example
$ndnputfile -u /exmaple/repo/1 /example/data/1/%FD%00%00%01G%F0%C8%AD- test.txt
$ndnputfile /exmaple/repo/1 /example/data/1/ test.txt
In both cases, the real nun-name is /example/data/1/%FD%00%00%01G%F0%C8%AD-.
If you want to use exact one data to storage your file, you can specify -s. Otherwise, your file content will be separated into multiple segmented data
$ndnputfile -s /exmaple/repo/1 /example/data/1/ test.txt
In this way, all you content will be stored in one data packet and no segment number will be appended. The real ndn-name for example will be /example/data/1/%FD%00%00%01G%F0%C8%AD-.
If the file is large enough and cannot be stored into one data packet, you should not specify -s. In this way, ndnputfile will automatically separate the data content and use the segment number to identify different segments.
$ndnputfile /exmaple/repo/1 /example/data/1/ test.jpg
In this case, data will be segmented and the segment number starts from 0. The real ndn-name could be /example/data/1/%FD%00%00%01G%F0%C8%AD-/%00%00.
Notice: If the data is not large enough to use segmented data to insert, not specify -s will only generate one segment, whose real ndn-name contain a segment number /%00%00.
You can specify -D to choose the DigestSha256 as the signing method to sign data packet and command interest
$ndnputfile -D /exmaple/repo/1 /example/data/1/ test.txt
You can also specify the identity to sign command interest or data by using -I and -i respectively.
$ndnputfile -I /ndn/test/alice /exmaple/repo/1 /example/data/1 test.txt
$ndnputfile -i /ndn/test/bob /exmaple/repo/1 /example/data/1 test.txt
You can set the data freshness time by using -x. The time is measured in milliseconds. For example:
$ndnputfile -x 4000 /ndn/test/alice /exmaple/repo/1 /example/data/1 test.txt
If you want to specify the interest life time, you can use -l to set the interest time out value. For example.
$ndnputfile -l 1000 /ndn/test/alice /exmaple/repo/1 /example/data/1 test.txt
You can use -w to set the timeout for the whole insert process. The process will stop if time expire.
You can print the log information by specifying -v.
ndngetfile¶
This tool is used to get data from repo.
$ndngetfile <command> ndn-name
Here is a list of commands supported so far:
$ndngetfile -h
-v: be verbose
-s: only get single data packet
-u: versioned: ndn-name contains version component.if -u is not specified, this command will return the rightmost child for the prefix
-l: InterestLifetime in milliseconds
-w: timeout in milliseconds for whole process (default unlimited)
-o: write to local file name instead of stdout
Next, we will introduce these commands one-by-one:
List¶
If the -s is specified, you will only get one data. This command should only be used when the data is inserted by ndnputfile -s. Otherwise, it may throw an Error.
Only single data without segment number will be fetched by this command. For example.
$ndngetfile -s /example/data/1
The data returned can only be /example/data/1/%FD%00%00%01G%F0%C8%AD-, for example. Data with name /example/data/1/%FD%00%00%01G%F0%C8%AD-/%00%00 can never be fetched.
If -s is not specified, ndngetfile will try to fetch all the segmented data with the same prefix.
If you want to manually append the version number after ndn-name, you can specify -u to choose the data with specific version. For example:
$ndngetfile -u /example/data/1/%FD%00%00%01G%F0%C8%AD-
If -u is not specified, the data with newest version number(the rightmost child) will be fetched.
You can choose to write to the local file by specifying -o. Otherwise, ndngetfile will use stdout. For example:
$ndngetfile -o result.txt /example/data/1
The content will be write to result.txt
The command -w, -l, -v is similar to ndnputfile.
Updated by Weiqi Shi about 10 years ago · 7 revisions