This module defines the ChronoSync2013 class which implements the NDN ChronoSync protocol as described in the 2013 paper “Let’s ChronoSync: Decentralized Dataset State Synchronization in Named Data Networking”. http://named-data.net/publications/chronosync . Note: The support for ChronoSync is experimental and the API is not finalized. See the API docs for more detail at http://named-data.net/doc/ndn-ccl-api/chrono-sync2013.html .
Bases: object
Create a new ChronoSync2013 to communicate using the given face. Initialize the digest log with a digest of “00” and and empty content. Register the applicationBroadcastPrefix to receive interests for sync state messages and express an interest for the initial root digest “00”. Note: Your application must call processEvents. Since processEvents modifies the internal ChronoSync data structures, your application should make sure that it calls processEvents in the same thread as this constructor (which also modifies the data structures).
Parameters: |
|
---|
Bases: object
A SyncState holds the values of a sync state message which is passed to the onReceivedSyncState callback which was given to the ChronoSyn2013 constructor. Note: this has the same info as the Protobuf class sync_state_pb2.SyncState, but we make a separate class so that we don’t need the Protobuf definition in the ChronoSync API.
Get the application data prefix for this sync state message.
Returns: | The application data prefix as a Name URI string. |
---|---|
Return type: | str |
Get the current sequence number in the digest tree for the given producer dataPrefix and sessionNo.
Parameters: |
|
---|---|
Returns: | The current producer sequence number, or -1 if the producer namePrefix and sessionNo are not in the digest tree. |
Return type: | int |
Get the sequence number of the latest data published by this application instance.
Returns: | The sequence number. |
---|---|
Return type: | int |
Increment the sequence number, create a sync message with the new sequence number and publish a data packet where the name is the applicationBroadcastPrefix + the root digest of the current digest tree. Then add the sync message to the digest tree and digest log which creates a new root digest. Finally, express an interest for the next sync update with the name applicationBroadcastPrefix + the new root digest. After this, your application should publish the content for the new sequence number. You can get the new sequence number with getSequenceNo(). Note: Your application must call processEvents. Since processEvents modifies the internal ChronoSync data structures, your application should make sure that it calls processEvents in the same thread as publishNextSequenceNo() (which also modifies the data structures).
Unregister callbacks so that this does not respond to interests anymore. If you will discard this ChronoSync2013 object while your application is still running, you should call shutdown() first. After calling this, you should not call publishNextSequenceNo() again since the behavior will be undefined. Note: Because this modifies internal ChronoSync data structures, your application should make sure that it calls processEvents in the same thread as shutdown() (which also modifies the data structures).
This module defines the DigestTree class which maintains a digest tree for ChronoSync.
Bases: object
Bases: object
Create a new DigestTree.Node with the given fields and compute the digest.
Parameters: |
|
---|
Get the root digest.
Returns: | The root digest as a hex string. |
---|---|
Return type: | str |
Update the digest tree and recompute the root digest. If the combination of dataPrefix and sessionNo already exists in the tree then update its sequenceNo (only if the given sequenceNo is newer), otherwise add a new node.
Parameters: |
|
---|---|
Returns: | True if the digest tree is updated, False if not (because the given sequenceNo is not newer than the existing sequence number). |
Return type: | bool |
Bases: google.protobuf.message.Message
Finds required fields which are not initialized.
Checks if all required fields of a message are set.
Bases: google.protobuf.message.Message
Finds required fields which are not initialized.
Checks if all required fields of a message are set.
Sets the _cached_byte_size_dirty bit to true, and propagates this to our listener iff this was a state change.
Returns the name of the currently set field inside a oneof, or None.
Magic attribute generated for “seq” proto field.
Magic attribute generated for “session” proto field.
Sets the _cached_byte_size_dirty bit to true, and propagates this to our listener iff this was a state change.
Returns the name of the currently set field inside a oneof, or None.
Magic attribute generated for “name” proto field.
Magic attribute generated for “seqno” proto field.
Magic attribute generated for “type” proto field.
Bases: google.protobuf.message.Message
Finds required fields which are not initialized.
Checks if all required fields of a message are set.
Sets the _cached_byte_size_dirty bit to true, and propagates this to our listener iff this was a state change.
Returns the name of the currently set field inside a oneof, or None.
Magic attribute generated for “ss” proto field.