psync::ProducerBase Class Reference

Base class for PartialProducer and FullProducer. More...

#include <producer-base.hpp>

+ Inheritance diagram for psync::ProducerBase:
+ Collaboration diagram for psync::ProducerBase:

Classes

class  Error
 

Public Member Functions

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 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

 ProducerBase (size_t expectedNumEntries, ndn::Face &face, const ndn::Name &syncPrefix, const ndn::Name &userPrefix, ndn::time::milliseconds syncReplyFreshness=SYNC_REPLY_FRESHNESS, CompressionScheme ibltCompression=CompressionScheme::NONE, CompressionScheme contentCompression=CompressionScheme::NONE)
 constructor More...
 
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
 

Detailed Description

Base class for PartialProducer and FullProducer.

Contains code common to both

Definition at line 52 of file producer-base.hpp.

Member Typedef Documentation

◆ HashNameBiMap

using psync::ProducerBase::HashNameBiMap = bm::bimap<bm::unordered_set_of<uint32_t>, bm::unordered_set_of<ndn::Name, std::hash<ndn::Name> >>
protected

Definition at line 169 of file producer-base.hpp.

Constructor & Destructor Documentation

◆ ProducerBase()

psync::ProducerBase::ProducerBase ( size_t  expectedNumEntries,
ndn::Face &  face,
const ndn::Name &  syncPrefix,
const ndn::Name &  userPrefix,
ndn::time::milliseconds  syncReplyFreshness = SYNC_REPLY_FRESHNESS,
CompressionScheme  ibltCompression = CompressionScheme::NONE,
CompressionScheme  contentCompression = CompressionScheme::NONE 
)
protected

constructor

Parameters
expectedNumEntriesexpected number entries in IBF
faceapplication's face
syncPrefixThe prefix of the sync group
userPrefixThe prefix of the first user in the group
syncReplyFreshnessfreshness of sync data
ibltCompressionCompression scheme to use for IBF
contentCompressionCompression scheme to use for Data content

Definition at line 33 of file producer-base.cpp.

Member Function Documentation

◆ addUserNode()

bool psync::ProducerBase::addUserNode ( const ndn::Name &  prefix)

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

Parameters
prefixthe user node to be added

Definition at line 57 of file producer-base.cpp.

◆ getSeqNo()

ndn::optional<uint64_t> psync::ProducerBase::getSeqNo ( const ndn::Name &  prefix) const
inline

Returns the current sequence number of the given prefix.

Parameters
prefixprefix to get the sequence number of

Definition at line 87 of file producer-base.hpp.

◆ isUserNode()

bool psync::ProducerBase::isUserNode ( const ndn::Name &  prefix) const
inlineprotected

Definition at line 136 of file producer-base.hpp.

◆ onRegisterFailed()

void psync::ProducerBase::onRegisterFailed ( const ndn::Name &  prefix,
const std::string &  msg 
) const
protected

Logs a message if setting an interest filter fails.

Definition at line 141 of file producer-base.cpp.

◆ removeUserNode()

void psync::ProducerBase::removeUserNode ( const ndn::Name &  prefix)

Remove the user node from synchronization.

Erases prefix from IBF and other maps

Parameters
prefixthe user node to be removed

Definition at line 69 of file producer-base.cpp.

◆ sendApplicationNack()

void psync::ProducerBase::sendApplicationNack ( const ndn::Name &  name)
protected

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

Parameters
namesend application nack with this name

Definition at line 125 of file producer-base.cpp.

◆ updateSeqNo()

void psync::ProducerBase::updateSeqNo ( const ndn::Name &  prefix,
uint64_t  seq 
)
protected

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

Parameters
prefixprefix of the update
seqsequence number of the update

Definition at line 86 of file producer-base.cpp.

Member Data Documentation

◆ m_biMap

HashNameBiMap psync::ProducerBase::m_biMap
protected

Definition at line 170 of file producer-base.hpp.

◆ m_contentCompression

CompressionScheme psync::ProducerBase::m_contentCompression
protected

Definition at line 185 of file producer-base.hpp.

◆ m_expectedNumEntries

uint32_t psync::ProducerBase::m_expectedNumEntries
protected

Definition at line 160 of file producer-base.hpp.

◆ m_face

ndn::Face& psync::ProducerBase::m_face
protected

Definition at line 172 of file producer-base.hpp.

◆ m_iblt

detail::IBLT psync::ProducerBase::m_iblt
protected

Definition at line 159 of file producer-base.hpp.

◆ m_ibltCompression

CompressionScheme psync::ProducerBase::m_ibltCompression
protected

Definition at line 184 of file producer-base.hpp.

◆ m_keyChain

ndn::KeyChain psync::ProducerBase::m_keyChain
protected

Definition at line 173 of file producer-base.hpp.

◆ m_prefixes

std::map<ndn::Name, uint64_t> psync::ProducerBase::m_prefixes
protected

Definition at line 166 of file producer-base.hpp.

◆ m_rng

ndn::random::RandomNumberEngine& psync::ProducerBase::m_rng
protected

Definition at line 183 of file producer-base.hpp.

◆ m_scheduler

ndn::Scheduler psync::ProducerBase::m_scheduler
protected

Definition at line 174 of file producer-base.hpp.

◆ m_segmentPublisher

SegmentPublisher psync::ProducerBase::m_segmentPublisher
protected

Definition at line 181 of file producer-base.hpp.

◆ m_syncPrefix

ndn::Name psync::ProducerBase::m_syncPrefix
protected

Definition at line 176 of file producer-base.hpp.

◆ m_syncReplyFreshness

ndn::time::milliseconds psync::ProducerBase::m_syncReplyFreshness
protected

Definition at line 179 of file producer-base.hpp.

◆ m_threshold

uint32_t psync::ProducerBase::m_threshold
protected

Definition at line 163 of file producer-base.hpp.

◆ m_userPrefix

ndn::Name psync::ProducerBase::m_userPrefix
protected

Definition at line 177 of file producer-base.hpp.