Collage  1.4.0
High-performance C++ library for developing object-oriented distributed applications.
co::Distributable< T > Class Template Reference

Distributable Collage object for any servus::Serializable object. More...

#include <distributable.h>

+ Inheritance diagram for co::Distributable< T >:
+ Collaboration diagram for co::Distributable< T >:

Public Member Functions

 Distributable ()
 Construct a new distributable object. More...
 
 Distributable (const Distributable &rhs)
 Copy-construct a distributable object. More...
 
bool isDirty () const final
 
uint128_t commit (const uint32_t incarnation=CO_COMMIT_NEXT) final
 
void notifyChanged () final
 Call whenever the object has been modified so it can be distributed.
 
- Public Member Functions inherited from co::Object
virtual CO_API ~Object ()
 Destruct the distributed object. More...
 
CO_API bool isAttached () const
 
CO_API LocalNodePtr getLocalNode ()
 
CO_API void setID (const uint128_t &identifier)
 Set the object's unique identifier. More...
 
CO_API const uint128_t & getID () const
 
CO_API uint32_t getInstanceID () const
 
CO_API bool isBuffered () const
 
CO_API bool isMaster () const
 
virtual uint64_t getMaxVersions () const
 Limit the number of queued versions on slave instances. More...
 
virtual CO_API uint32_t chooseCompressor () const
 Return the compressor to be used for data transmission. More...
 
CO_API void push (const uint128_t &groupID, const uint128_t &objectType, const Nodes &nodes)
 Push the instance data of the object to the given nodes. More...
 
CO_API void setAutoObsolete (const uint32_t count)
 Automatically obsolete old versions. More...
 
CO_API uint32_t getAutoObsolete () const
 
virtual CO_API uint128_t sync (const uint128_t &version=VERSION_HEAD)
 Sync to a given version. More...
 
CO_API uint128_t getHeadVersion () const
 
CO_API uint128_t getVersion () const
 
virtual CO_API void notifyNewHeadVersion (const uint128_t &version)
 Notification that a new head version was received by a slave object. More...
 
virtual void notifyNewVersion ()
 Notification that a new version was received by a master object. More...
 
virtual void pack (DataOStream &os)
 Serialize the modifications since the last call to commit(). More...
 
virtual void unpack (DataIStream &is)
 Deserialize a change. More...
 
CO_API ObjectOCommand send (NodePtr node, const uint32_t cmd, const uint32_t instanceID=CO_INSTANCE_ALL)
 Send a command with optional data to object instance(s) on another node. More...
 
virtual void notifyAttach ()
 Notify that this object will be registered or mapped. More...
 
virtual void notifyAttached ()
 Notify that this object has been registered or mapped. More...
 
virtual CO_API void notifyDetach ()
 Notify that this object will be deregistered or unmapped. More...
 
virtual void notifyDetached ()
 Notify that this object has been deregistered or unmapped. More...
 
uint32_t getMasterInstanceID () const
 
NodePtr getMasterNode ()
 
CO_API void removeSlave (NodePtr node, const uint32_t instanceID)
 
CO_API void removeSlaves (NodePtr node)
 
void setMasterNode (NodePtr node)
 
void addInstanceDatas (const ObjectDataIStreamDeque &, const uint128_t &)
 
void setupChangeManager (const Object::ChangeType type, const bool master, LocalNodePtr localNode, const uint32_t masterInstanceID)
 
virtual CO_API void attach (const uint128_t &id, const uint32_t instanceID)
 
virtual CO_API void detach ()
 
void transfer (Object *from)
 
void applyMapData (const uint128_t &version)
 
void sendInstanceData (Nodes &nodes)
 
- Public Member Functions inherited from co::Dispatcher
Dispatcheroperator= (const Dispatcher &)
 
template<typename T >
void registerCommand (const uint32_t command, const CommandFunc< T > &func, CommandQueue *queue)
 Register a command member function for a command. More...
 
virtual CO_API bool dispatchCommand (ICommand &command)
 Dispatch a command from the receiver thread to the registered queue. More...
 

Additional Inherited Members

- Public Types inherited from co::Object
enum  ChangeType {
  NONE, STATIC, INSTANCE, DELTA,
  UNBUFFERED
}
 Object change handling characteristics, see Programming Guide. More...
 
- Public Types inherited from co::Dispatcher
typedef CommandFunc< DispatcherFunc
 The signature of the base Dispatcher callback. More...
 
- Protected Member Functions inherited from co::Object
CO_API Object ()
 Construct a new distributed object. More...
 
Objectoperator= (const Object &)
 NOP assignment operator. More...
 
CO_API Object (const Object &)
 Copy construct a new, unattached object. More...
 
- Protected Member Functions inherited from co::Dispatcher
CO_API Dispatcher (const Dispatcher &from)
 
CO_API bool _cmdUnknown (ICommand &command)
 The default handler for handling commands. More...
 

Detailed Description

template<class T>
class co::Distributable< T >

Distributable Collage object for any servus::Serializable object.

Clients instantiate this object with a concrete Zerobuf object (or other servus::Serializable) using CRTP. The base class T needs to implement and call an abstract change notification method "virtual void notifyChanged() = 0;" (Zerobuf does this).

Definition at line 39 of file distributable.h.

Constructor & Destructor Documentation

template<class T >
co::Distributable< T >::Distributable ( )
inline

Construct a new distributable object.

Version
1.4

Definition at line 43 of file distributable.h.

template<class T >
co::Distributable< T >::Distributable ( const Distributable< T > &  rhs)
inline

Copy-construct a distributable object.

Version
1.4

Definition at line 46 of file distributable.h.

Member Function Documentation

template<class T >
uint128_t co::Distributable< T >::commit ( const uint32_t  incarnation = CO_COMMIT_NEXT)
inlinefinalvirtual
See also
Object::commit()

Reimplemented from co::Object.

Definition at line 55 of file distributable.h.

References co::Object::commit().

+ Here is the call graph for this function:

template<class T >
bool co::Distributable< T >::isDirty ( ) const
inlinefinalvirtual
See also
Object::dirty()

Reimplemented from co::Object.

Definition at line 52 of file distributable.h.


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