Insert
Repo insertion process makes use of the PubSub package.
The repo subscribes to the topic
/<repo_name>/insert.The client publishes a message to the topic
/<repo_name>/insert. The message payload isRepoCommandParamcontaining one or moreObjectParamwith the following fields:name: either a Data packet name, or a name prefix of segmented Data packets.start_block_id(Optional): inclusive start segment number.end_block_id(Optional): inclusive end segment number.forwarding_hint(Optional): forwarding hint for Data fetching.
This is useful in two scenarios:
The producer choose not to announce its name prefix, but only allow the repo to reach it via forwarding hint.
The name prefix is already announced by repo node(s), but the producer in another node wants to insert to the repo.
register_prefix(Optional): if repo doesn’t register the root prefix (Configurationregister_rootis disabled), client can tell repo to register this prefix.
The repo fetches and inserts single or segmented Data packets according to given parameters.
If neither
start_block_idnorend_block_idare given, the repo fetches a single packet identified innameparameter. The insertion process succeeds when this packet is received.If only
end_block_idis given,start_block_idis considered 0.If only
start_block_idis given,end_block_idis auto detected, i.e. infinity.If both block ids are given, the command is considered as correct only if
end_block_id >= start_block_id.Whenever the repo cannot fetch a segment, it will stop, no matter what
end_block_idis.Segment numbers are encoded in accordance with NDN naming conventions rev2.
Insert status check
The client can use the Check protocol to check the progress of an insertion process.
The insertion check response message payload is RepoCommandRes containing zero or more
ObjectResult with the following fields:
status_code: status code, as defined on Check. Both the command itself and objects has a status code.name: the name of object to insert.insert_num: number of Data packets received by the repo so far.The number of
ObjectResultin the result should be either: * =0, which means the command is malformed or not allowed. * equals to the number ofObjectParamin the insertion command.