The problem of ndnputfile and ndngetfile
There are some problems both in the design and implementation of these tools.
- repo cannot use ndngetfile to get the data which is inserted by ndnputfile with -s.
When we use ndnputfile -s, the tool will automatically and randomly append a version number after the prefix.
When we want to use ndngetfile, we can decide to use only the prefix or use the prefix with version number to request data (for parameter, with -u means the name contain the version number, without -u means the name we use is only a prefix). Both these two mode cannot be used to get the data back.
1) if without -u, the tool assumes that the data received should include version number as the second to last component and sequence number as last component. But as mentioned above, if we use ndnputfile -s to insert the data, no sequence number will be appended. In this case, repo will throw an error due to the name size does not match, even if the correct data has been pushed back.
2) if with -u, the ndngetfile tool will append a sequence number for interest name (prefix + version + sequence), which cannot be recognized by the repo who have the data. In current repo storage, data names are in the format: prefix + (version) + (sequence) + digest. Since the data inserted by ndnputfile -s, there is no sequence in data name, therefore repo cannot use Name::isPrefixOf to match the correct data.
- We cannot use ndnputfile without -s to insert small data, which could be stored in only one data packet.
In most cases, we should specify -s when we want to insert small data and the data will be stored in one data packet. But in some cases, if we forget to specify -s, repo should also work well by using segment insertion, even if only one segment carries data. However, current ndnputfile cannot make it. Since by using segment insertion, the finalblockId will be specified as %00. WriteHandle needs to use Component::toSegment to decode it from a name component. But this function will throw an error: "Invalid length for nonNegativeInteger (only 1, 2, 4, and 8 are allowed)" and stop the process. Therefore either the toSegment function or the finalBlockId needs to be improved.
Updated by Weiqi Shi about 7 years ago
For ndnputfile and updated version number %FD%00%00%01G%F0%C8%AD-
If -u is specified, the ndn-name must be in format /example/data/1/%FD%00%00%01G%F0%C8%AD- and the data name is the same.
If -u is not specified, the ndn-name is /example/data/1, then the data name is /example/data/1/%FD%00%00%01G%F0%C8%AD- (append the version number automatically)
If -s is specified, no segment number will be appended. If the ndn-name is /example/data/1, then the data name should be /example/data/1/%FD%00%00%01G%F0%C8%AD-(append a version number since -u is not specified)
If -s is not specified, the data name should start from /example/data/1/%FD%00%00%01G%F0%C8%AD-/%00%00(append a version number since -u is not specified).
If -u is specified, the input data name that we want to get must be in format /example/data/1/%FD%00%00%01G%F0%C8%AD. We can choose which version number we want by this command.
If -u is not specified, the data name could be /example/data/1, and the data with same prefix and updated version number will be returned.
if -s is specified, the input data name could be /example/data/1 (without version number) and the fetched data is /example/data/1/%FD%00%00%01G%F0%C8%AD (the updated version number). The fetched data could not be the segmented data in format /example/data/1/%FD%00%00%01G%F0%C8%AD/%00%00.
If -s is not specified and the input data name could be /example/data/1, then all the segment data starting from /example/data/1/%FD%00%00%01G%F0%C8%AD/%00%00 will be fetched.
Updated by Weiqi Shi about 7 years ago
More detail could be found here http://redmine.named-data.net/projects/repo-ng/wiki/Tools