24 #include <co/dispatcher.h>
25 #include <co/localNode.h>
27 #include <co/version.h>
28 #include <lunchbox/bitOperation.h>
32 namespace detail {
class Object; }
34 typedef lunchbox::RefPtr< ObjectCM > ObjectCMPtr;
36 # define CO_COMMIT_NEXT LB_UNDEFINED_UINT32
82 CO_API
void setID(
const UUID& identifier );
85 CO_API
const UUID&
getID()
const;
91 CO_API
bool isBuffered()
const;
124 {
return std::numeric_limits< uint64_t >::max(); }
169 CO_API
void push(
const uint128_t& groupID,
const uint128_t& objectType,
170 const Nodes& nodes );
205 CO_API
virtual uint128_t
commit(
const uint32_t incarnation =
252 CO_API
virtual uint128_t
sync(
const uint128_t& version = VERSION_HEAD );
341 const uint32_t instanceID = EQ_INSTANCE_ALL );
387 uint32_t getMasterInstanceID()
const;
393 CO_API
void removeSlave(
NodePtr node,
const uint32_t instanceID );
394 CO_API
void removeSlaves(
NodePtr node );
395 void setMasterNode(
NodePtr node );
397 void addInstanceDatas(
const ObjectDataIStreamDeque&,
const uint128_t&);
411 const uint32_t masterInstanceID );
414 CO_API
virtual void attach(
const UUID&
id,
415 const uint32_t instanceID );
420 CO_API
virtual void detach();
423 void transfer(
Object* from );
425 void applyMapData(
const uint128_t& version );
426 void sendInstanceData(
Nodes& nodes );
440 detail::Object*
const impl_;
441 void _setChangeManager( ObjectCMPtr cm );
443 ObjectCMPtr _getChangeManager();
444 friend class ObjectStore;
446 LB_TS_VAR( _thread );
450 CO_API std::ostream& operator << ( std::ostream&,
const Object& );
459 { byteswap( reinterpret_cast< uint32_t& >( value )); }
461 #endif // CO_OBJECT_H
CO_API bool isMaster() const
non-versioned, unbuffered, static object.
CO_API uint32_t getInstanceID() const
CO_API bool isAttached() const
virtual void pack(DataOStream &os)
Serialize the modifications since the last call to commit().
const Object & operator=(const Object &)
NOP assignment operator.
A class providing command dispatch functionality to networked objects.
virtual ChangeType getChangeType() const
lunchbox::RefPtr< LocalNode > LocalNodePtr
A reference pointer for LocalNode pointers.
A class for sending commands and data to local & external objects.
virtual CO_API void notifyDetach()
Notify that this object will be deregistered or unmapped.
virtual bool isDirty() const
Return if this object needs a commit.
CO_API LocalNodePtr getLocalNode()
ChangeType
Object change handling characteristics, see Programming Guide.
virtual CO_API uint128_t commit(const uint32_t incarnation=CO_COMMIT_NEXT)
Commit a new version of this object.
CO_API Object()
Construct a new distributed object.
virtual CO_API uint32_t chooseCompressor() const
Return the compressor to be used for data transmission.
CO_API uint128_t getVersion() const
CO_API ObjectOCommand send(NodePtr node, const uint32_t cmd, const uint32_t instanceID=EQ_INSTANCE_ALL)
Send a command with optional data to object instance(s) on another node.
lunchbox::RefPtr< Node > NodePtr
A reference pointer for Node pointers.
virtual void notifyAttach()
Notify that this object will be registered or mapped.
A std::istream-like input data stream for binary data.
virtual uint64_t getMaxVersions() const
Limit the number of queued versions on slave instances.
virtual void notifyDetached()
Notify that this object has been deregistered or unmapped.
virtual CO_API uint128_t sync(const uint128_t &version=VERSION_HEAD)
Sync to a given version.
virtual CO_API ~Object()
Destruct the distributed object.
CO_API uint128_t getHeadVersion() const
CO_API void setAutoObsolete(const uint32_t count)
Automatically obsolete old versions.
CO_API uint32_t getAutoObsolete() const
A std::ostream-like interface for object serialization.
virtual void getInstanceData(DataOStream &os)=0
Serialize all instance information of this distributed object.
virtual void applyInstanceData(DataIStream &is)=0
Deserialize the instance data.
versioned, but don't retain versions
virtual void notifyAttached()
Notify that this object has been registered or mapped.
std::vector< NodePtr > Nodes
A vector of NodePtr's.
CO_API void setID(const UUID &identifier)
Set the object's unique identifier.
virtual void notifyNewVersion()
Notification that a new version was received by a master object.
virtual CO_API void notifyNewHeadVersion(const uint128_t &version)
Notification that a new head version was received by a slave object.
CO_API const UUID & getID() const
virtual void unpack(DataIStream &is)
Deserialize a change.
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.