Project

General

Profile

Tools » History » Version 5

Weiqi Shi, 08/20/2014 12:14 PM

1 1 Weiqi Shi
Tools
2
=====
3
repo tools use the command line to instruct different behavior of repo.
4
5
## ndnputfile
6
7
This tool is used to insert data into repo.
8
9
    $ndnputfile <command> repo-prefix  ndn-name  filename
10
11
Here is a list of commands supported so far:
12
13
     $ndnputfile -h
14
          -u: unversioned: do not add a version component
15
          -s: single: do not add version or segment component, implies -u
16
          -D: use DigestSha256 signing method instead of SignatureSha256WithRsa
17
          -i: specify identity used for signing Data
18
          -I: specify identity used for signing commands
19
          -x: FreshnessPeriod in milliseconds
20
          -l: InterestLifetime in milliseconds for each command
21
          -w: timeout in milliseconds for whole process (default unlimited)
22
          -v: be verbose
23 2 Weiqi Shi
24
Next, we will introduce these commands one-by-one:
25
26
#### List
27
28
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
29
30
    $ndnputfile -u /exmaple/repo/1  /example/data/1/%FD%00%00%01G%F0%C8%AD-  test.txt
31
    $ndnputfile /exmaple/repo/1  /example/data/1/ test.txt
32
33
In both cases, the real nun-name is /example/data/1/%FD%00%00%01G%F0%C8%AD-.
34
35
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 
36
37
    $ndnputfile -s /exmaple/repo/1  /example/data/1/  test.txt
38
39
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-.
40
41
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.
42
43
    $ndnputfile /exmaple/repo/1 /example/data/1/ test.jpg
44
45
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.
46
47
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.
48
49
You can specify -D to choose the DigestSha256 as the signing method to sign data packet and command interest
50
51
    $ndnputfile -D /exmaple/repo/1  /example/data/1/  test.txt
52
53
You can also specify the identity to sign command interest or data by using -I and -i respectively.
54
55 3 Weiqi Shi
    $ndnputfile -I /ndn/test/alice /exmaple/repo/1  /example/data/1  test.txt
56
    $ndnputfile -i /ndn/test/bob /exmaple/repo/1  /example/data/1  test.txt
57
58
You can set the data freshness time by using -x. The time is measured in milliseconds. For example:
59
60
    $ndnputfile -x 4000 /ndn/test/alice /exmaple/repo/1  /example/data/1  test.txt
61
62
If you want to specify the interest life time, you can use -l to set the interest time out value. For example.
63
64
    $ndnputfile -l 1000 /ndn/test/alice /exmaple/repo/1  /example/data/1  test.txt
65
66
You can use -w to set the timeout for the whole insert process. The process will stop if time expire.
67
68
You can print the log information by specifying -v.
69 4 Weiqi Shi
70
## ndngetfile
71
72
This tool is used to get data from repo.
73
74
    $ndngetfile <command> ndn-name
75
76
Here is a list of commands supported so far:
77
78
    $ndngetfile -h
79
         -v: be verbose
80
         -s: only get single data packet
81
         -u: versioned: ndn-name contains version component.if -u is not specified, this command will return the rightmost child for the prefix
82
         -l: InterestLifetime in milliseconds
83
         -w: timeout in milliseconds for whole process (default unlimited)
84
         -o: write to local file name instead of stdout
85 5 Weiqi Shi
86
Next, we will introduce these commands one-by-one:
87
88
#### List
89
90
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.
91
Only single data without segment number will be fetched by this command. For example.
92
93
    $ndngetfile -s /example/data/1
94
95
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.
96
If -s is not specified, ndngetfile will try to fetch all the segmented data with the same prefix.
97
98
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:
99
100
    $ndngetfile -u /example/data/1/%FD%00%00%01G%F0%C8%AD-
101
102
If -u is not specified, the data with newest version number(the rightmost child) will be fetched.
103
104
You can choose to write to the local file by specifying -o. Otherwise, ndngetfile will use stdout. For example:
105
106
    $ndngetfile -o result.txt /example/data/1
107
108
The content will be write to result.txt
109
110
The command -w, -l, -v is similar to ndnputfile.