Zero Module Framework  1.0
A framework for running distributed modules using a ZMQ message bus
 All Classes Namespaces Files Functions Variables Friends Macros
zmf::discovery::PeerRegistryInternal Class Reference

#include <PeerRegistryInternal.hpp>

Inheritance diagram for zmf::discovery::PeerRegistryInternal:

Public Member Functions

 PeerRegistryInternal ()
 
virtual ~PeerRegistryInternal ()
 
void addModule (std::shared_ptr< zmf::data::ModuleHandle > toAdd, zmf::data::ModuleState state, std::vector< uint8_t > additionalState)
 
void removeModule (zmf::data::ModuleUniqueId toRemoveId)
 
void clearRegistry ()
 
std::map
< zmf::data::ModuleUniqueId,
std::shared_ptr
< zmf::data::ModuleHandle > > & 
INTERNAL_getAllPeers (bool onlyActivePeers=true)
 
std::map< uint16_t, std::list
< std::shared_ptr
< zmf::data::ModuleHandle > > > & 
INTERNAL_getAllPeersByType (bool onlyActivePeers=true)
 
void INTERNAL_updatePeerState (zmf::data::ModuleUniqueId module, zmf::data::ModuleState newState)
 
void INTERNAL_updatePeerAdditionalState (zmf::data::ModuleUniqueId module, std::vector< uint8_t > newAdditionalState)
 
std::mutex & getPeerRegistryLock ()
 
virtual void printPeerRegistry () override
 

Detailed Description

The PeerRegistry keeps track of every module in the network. It tracks their state and is able to provide information about all those modules. Derived class from PeerRegistry which implements the internal functions such as add, remove, clear and update.

Author
Jonas Grunert
Date
created 8/5/15.

Constructor & Destructor Documentation

zmf::discovery::PeerRegistryInternal::PeerRegistryInternal ( )
inline
zmf::discovery::PeerRegistryInternal::~PeerRegistryInternal ( )
virtual

Member Function Documentation

void zmf::discovery::PeerRegistryInternal::addModule ( std::shared_ptr< zmf::data::ModuleHandle >  toAdd,
zmf::data::ModuleState  state,
std::vector< uint8_t >  additionalState 
)

Adds the given module to the registry

void zmf::discovery::PeerRegistryInternal::clearRegistry ( )

Clears the registry

std::mutex& zmf::discovery::PeerRegistryInternal::getPeerRegistryLock ( )
inline
std::map<zmf::data::ModuleUniqueId, std::shared_ptr<zmf::data::ModuleHandle> >& zmf::discovery::PeerRegistryInternal::INTERNAL_getAllPeers ( bool  onlyActivePeers = true)
inline

Warning: Returns reference unsynchronized, internal datastructures Returns the internal data structure with all peers, sorted by ID Contract: No guarantee that data structure not changed concurrently. Copy recommended. Performance: Direct return of map, very fast

Parameters
onlyActivePeersReturns only all active peers
Returns
Reference to map with all peers by Id
std::map<uint16_t, std::list<std::shared_ptr<zmf::data::ModuleHandle> > >& zmf::discovery::PeerRegistryInternal::INTERNAL_getAllPeersByType ( bool  onlyActivePeers = true)
inline

Warning: Returns reference unsynchronized, internal datastructures Returns the internal data structure with all peers, sorted by Type Contract: No guarantee that data structure not changed concurrently. Copy recommended. Performance: Direct return of map, very fast

Parameters
onlyActivePeersReturns only all active peers
Returns
Reference to map with all peers by Tape
void zmf::discovery::PeerRegistryInternal::INTERNAL_updatePeerAdditionalState ( zmf::data::ModuleUniqueId  module,
std::vector< uint8_t >  newAdditionalState 
)

Updates the additional state of the given module from the registry

void zmf::discovery::PeerRegistryInternal::INTERNAL_updatePeerState ( zmf::data::ModuleUniqueId  module,
zmf::data::ModuleState  newState 
)

Updates the state of the given module from the registry

void zmf::discovery::PeerRegistryInternal::printPeerRegistry ( )
overridevirtual
void zmf::discovery::PeerRegistryInternal::removeModule ( zmf::data::ModuleUniqueId  toRemoveId)

Removes the given module from the registry


The documentation for this class was generated from the following files: