Tools » History » Revision 4
Revision 3 (Weiqi Shi, 08/20/2014 11:24 AM) → Revision 4/7 (Weiqi Shi, 08/20/2014 11:56 AM)
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