Base class for PartialProducer and FullProducer.
More...
#include <PSync/producer-base.hpp>
|
| bool | addUserNode (const ndn::Name &prefix) |
| | Adds a user node for synchronization. More...
|
| |
| std::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...
|
| |
|
| using | HashNameBiMap = bm::bimap< bm::unordered_set_of< uint32_t >, bm::unordered_set_of< ndn::Name, std::hash< ndn::Name > >> |
| |
|
| static void | onRegisterFailed (const ndn::Name &prefix, const std::string &msg) |
| | Logs a message and throws if setting an interest filter fails. More...
|
| |
Base class for PartialProducer and FullProducer.
Contains code common to both.
Definition at line 47 of file producer-base.hpp.
◆ HashNameBiMap
◆ ProducerBase()
Constructor.
- Parameters
-
| face | Application's face |
| keyChain | KeyChain instance to use for signing |
| expectedNumEntries | Expected number of entries in IBF |
| syncPrefix | The prefix of the sync group |
| syncReplyFreshness | FreshnessPeriod of sync data |
| ibltCompression | Compression scheme to use for IBF |
| contentCompression | Compression scheme to use for Data content |
Definition at line 30 of file producer-base.cpp.
◆ 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
-
| prefix | the user node to be added |
Definition at line 53 of file producer-base.cpp.
◆ getSeqNo()
| std::optional<uint64_t> psync::ProducerBase::getSeqNo |
( |
const ndn::Name & |
prefix | ) |
const |
|
inline |
Returns the current sequence number of the given prefix.
- Parameters
-
| prefix | prefix to get the sequence number of |
Definition at line 83 of file producer-base.hpp.
◆ isUserNode()
| bool psync::ProducerBase::isUserNode |
( |
const ndn::Name & |
prefix | ) |
const |
|
inlineprotected |
◆ onRegisterFailed()
| void psync::ProducerBase::onRegisterFailed |
( |
const ndn::Name & |
prefix, |
|
|
const std::string & |
msg |
|
) |
| |
|
staticprotected |
Logs a message and throws if setting an interest filter fails.
Definition at line 140 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
-
| prefix | the user node to be removed |
Definition at line 65 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
-
| name | send application nack with this name |
Definition at line 123 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
-
| prefix | prefix of the update |
| seq | sequence number of the update |
Definition at line 82 of file producer-base.cpp.
◆ m_biMap
◆ m_contentCompression
◆ m_expectedNumEntries
| const size_t psync::ProducerBase::m_expectedNumEntries |
|
protected |
◆ m_face
| ndn::Face& psync::ProducerBase::m_face |
|
protected |
◆ m_iblt
◆ m_ibltCompression
◆ m_keyChain
| ndn::KeyChain& psync::ProducerBase::m_keyChain |
|
protected |
◆ m_numOwnElements
| uint64_t psync::ProducerBase::m_numOwnElements = 0 |
|
protected |
◆ m_prefixes
| std::map<ndn::Name, uint64_t> psync::ProducerBase::m_prefixes |
|
protected |
◆ m_rng
| ndn::random::RandomNumberEngine& psync::ProducerBase::m_rng |
|
protected |
◆ m_scheduler
| ndn::Scheduler psync::ProducerBase::m_scheduler |
|
protected |
◆ m_segmentPublisher
◆ m_syncPrefix
| const ndn::Name psync::ProducerBase::m_syncPrefix |
|
protected |
◆ m_syncReplyFreshness
| const ndn::time::milliseconds psync::ProducerBase::m_syncReplyFreshness |
|
protected |
◆ m_threshold
| const size_t psync::ProducerBase::m_threshold |
|
protected |