Full sync logic to synchronize with other nodes where all nodes wants to get all names prefixes synced. More...
#include <full-producer.hpp>
Public Member Functions | |
FullProducer (size_t expectedNumEntries, ndn::Face &face, const ndn::Name &syncPrefix, const ndn::Name &userPrefix, const UpdateCallback &onUpdateCallBack, ndn::time::milliseconds syncInterestLifetime=SYNC_INTEREST_LIFTIME, ndn::time::milliseconds syncReplyFreshness=SYNC_REPLY_FRESHNESS, CompressionScheme ibltCompression=CompressionScheme::DEFAULT, CompressionScheme contentCompression=CompressionScheme::DEFAULT) | |
constructor More... | |
~FullProducer () | |
bool | addUserNode (const ndn::Name &prefix) |
Adds a user node for synchronization. More... | |
ndn::optional< uint64_t > | getSeqNo (const ndn::Name &prefix) const |
Returns the current sequence number of the given prefix. More... | |
void | publishName (const ndn::Name &prefix, ndn::optional< uint64_t > seq=ndn::nullopt) |
Publish name to let others know. More... | |
void | removeUserNode (const ndn::Name &prefix) |
Remove the user node from synchronization. More... | |
Protected Types | |
using | HashNameBiMap = bm::bimap< bm::unordered_set_of< uint32_t >, bm::unordered_set_of< ndn::Name, std::hash< ndn::Name > >> |
Protected Member Functions | |
bool | isUserNode (const ndn::Name &prefix) const |
void | onRegisterFailed (const ndn::Name &prefix, const std::string &msg) const |
Logs a message if setting an interest filter fails. More... | |
void | sendApplicationNack (const ndn::Name &name) |
Sends a data packet with content type nack. More... | |
void | updateSeqNo (const ndn::Name &prefix, uint64_t seq) |
Update m_prefixes and IBF with the given prefix and seq. More... | |
Protected Attributes | |
HashNameBiMap | m_biMap |
CompressionScheme | m_contentCompression |
uint32_t | m_expectedNumEntries |
ndn::Face & | m_face |
detail::IBLT | m_iblt |
CompressionScheme | m_ibltCompression |
ndn::KeyChain | m_keyChain |
std::map< ndn::Name, uint64_t > | m_prefixes |
ndn::random::RandomNumberEngine & | m_rng |
ndn::Scheduler | m_scheduler |
SegmentPublisher | m_segmentPublisher |
ndn::Name | m_syncPrefix |
ndn::time::milliseconds | m_syncReplyFreshness |
uint32_t | m_threshold |
ndn::Name | m_userPrefix |
Full sync logic to synchronize with other nodes where all nodes wants to get all names prefixes synced.
Application should call publishName whenever it wants to let consumers know that new data is available for the userPrefix. Multiple userPrefixes can be added by using addUserNode. Currently, fetching and publishing of data needs to be handled by the application.
Definition at line 43 of file full-producer.hpp.
|
protectedinherited |
Definition at line 169 of file producer-base.hpp.
psync::FullProducer::FullProducer | ( | size_t | expectedNumEntries, |
ndn::Face & | face, | ||
const ndn::Name & | syncPrefix, | ||
const ndn::Name & | userPrefix, | ||
const UpdateCallback & | onUpdateCallBack, | ||
ndn::time::milliseconds | syncInterestLifetime = SYNC_INTEREST_LIFTIME , |
||
ndn::time::milliseconds | syncReplyFreshness = SYNC_REPLY_FRESHNESS , |
||
CompressionScheme | ibltCompression = CompressionScheme::DEFAULT , |
||
CompressionScheme | contentCompression = CompressionScheme::DEFAULT |
||
) |
constructor
Registers syncPrefix in NFD and sends a sync interest
expectedNumEntries | expected entries in IBF |
face | application's face |
syncPrefix | The prefix of the sync group |
userPrefix | The prefix of the first user in the group |
onUpdateCallBack | The call back to be called when there is new data |
syncInterestLifetime | lifetime of the sync interest |
syncReplyFreshness | freshness of sync data |
ibltCompression | Compression scheme to use for IBF |
contentCompression | Compression scheme to use for Data content |
Definition at line 34 of file full-producer.cpp.
psync::FullProducer::~FullProducer | ( | ) |
Definition at line 59 of file full-producer.cpp.
|
inherited |
Adds a user node for synchronization.
Initializes m_prefixes[prefix] to zero Does not add zero-th sequence number to IBF because if a large number of user nodes are added then decoding of the difference between own IBF and other IBF will not be possible
prefix | the user node to be added |
Definition at line 57 of file producer-base.cpp.
|
inlineinherited |
Returns the current sequence number of the given prefix.
prefix | prefix to get the sequence number of |
Definition at line 87 of file producer-base.hpp.
|
inlineprotectedinherited |
Definition at line 136 of file producer-base.hpp.
|
protectedinherited |
Logs a message if setting an interest filter fails.
Definition at line 141 of file producer-base.cpp.
void psync::FullProducer::publishName | ( | const ndn::Name & | prefix, |
ndn::optional< uint64_t > | seq = ndn::nullopt |
||
) |
Publish name to let others know.
addUserNode needs to be called before this to add the prefix if not already added via the constructor. If seq is null then the seq of prefix is incremented by 1 else the supplied sequence is set in the IBF.
prefix | the prefix to be updated |
seq | the sequence number of the prefix |
Definition at line 67 of file full-producer.cpp.
|
inherited |
Remove the user node from synchronization.
Erases prefix from IBF and other maps
prefix | the user node to be removed |
Definition at line 69 of file producer-base.cpp.
|
protectedinherited |
Sends a data packet with content type nack.
Producer sends a nack to consumer if consumer has very old IBF whose differences with latest IBF can't be decoded successfully
name | send application nack with this name |
Definition at line 125 of file producer-base.cpp.
|
protectedinherited |
Update m_prefixes and IBF with the given prefix and seq.
Whoever calls this needs to make sure that prefix is in m_prefixes We remove already existing prefix/seq from IBF (unless seq is zero because we don't insert zero seq into IBF) Then we update m_prefixes, m_biMap, and IBF
prefix | prefix of the update |
seq | sequence number of the update |
Definition at line 86 of file producer-base.cpp.
|
protectedinherited |
Definition at line 170 of file producer-base.hpp.
|
protectedinherited |
Definition at line 185 of file producer-base.hpp.
|
protectedinherited |
Definition at line 160 of file producer-base.hpp.
|
protectedinherited |
Definition at line 172 of file producer-base.hpp.
|
protectedinherited |
Definition at line 159 of file producer-base.hpp.
|
protectedinherited |
Definition at line 184 of file producer-base.hpp.
|
protectedinherited |
Definition at line 173 of file producer-base.hpp.
|
protectedinherited |
Definition at line 166 of file producer-base.hpp.
|
protectedinherited |
Definition at line 183 of file producer-base.hpp.
|
protectedinherited |
Definition at line 174 of file producer-base.hpp.
|
protectedinherited |
Definition at line 181 of file producer-base.hpp.
|
protectedinherited |
Definition at line 176 of file producer-base.hpp.
|
protectedinherited |
Definition at line 179 of file producer-base.hpp.
|
protectedinherited |
Definition at line 163 of file producer-base.hpp.
|
protectedinherited |
Definition at line 177 of file producer-base.hpp.