24 #include <co/dispatcher.h>
25 #include <co/localNode.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 uint128_t& identifier );
85 CO_API
const uint128_t&
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 = CO_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 uint128_t&
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(
const 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 void setID(const uint128_t &identifier)
Set the object's unique identifier.
virtual void notifyAttach()
Notify that this object will be registered or mapped.
CO_API uint128_t getVersion() const
CO_API const uint128_t & getID() const
CO_API Object()
Construct a new distributed object.
CO_API uint32_t getInstanceID() const
CO_API bool isMaster() const
virtual void notifyAttached()
Notify that this object has been registered or mapped.
A class for sending commands and data to local & external objects.
lunchbox::RefPtr< LocalNode > LocalNodePtr
A reference pointer for LocalNode pointers.
virtual CO_API void notifyNewHeadVersion(const uint128_t &version)
Notification that a new head version was received by a slave object.
virtual CO_API uint128_t commit(const uint32_t incarnation=CO_COMMIT_NEXT)
Commit a new version of this object.
ChangeType
Object change handling characteristics, see Programming Guide.
virtual ChangeType getChangeType() const
CO_API uint32_t getAutoObsolete() const
CO_API uint128_t getHeadVersion() const
virtual void notifyDetached()
Notify that this object has been deregistered or unmapped.
CO_API bool isAttached() const
virtual void pack(DataOStream &os)
Serialize the modifications since the last call to commit().
lunchbox::RefPtr< Node > NodePtr
A reference pointer for Node pointers.
A std::ostream-like interface for object serialization.
Object-oriented network library.
virtual CO_API ~Object()
Destruct the distributed object.
non-versioned, unbuffered, static object.
virtual void notifyNewVersion()
Notification that a new version was received by a master object.
virtual uint64_t getMaxVersions() const
Limit the number of queued versions on slave instances.
virtual void getInstanceData(DataOStream &os)
Serialize all instance information of this distributed object.
virtual bool isDirty() const
Return if this object needs a commit.
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.
Defines version macros and class for library Collage.
Object & operator=(const Object &)
NOP assignment operator.
virtual void applyInstanceData(DataIStream &is)
Deserialize the instance data.
CO_API LocalNodePtr getLocalNode()
A std::istream-like input data stream for binary data.
versioned, but don't retain versions
CO_API void setAutoObsolete(const uint32_t count)
Automatically obsolete old versions.
virtual CO_API uint128_t sync(const uint128_t &version=VERSION_HEAD)
Sync to a given version.
std::vector< NodePtr > Nodes
A vector of NodePtr's.
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.
virtual CO_API void notifyDetach()
Notify that this object will be deregistered or unmapped.
virtual CO_API uint32_t chooseCompressor() const
Return the compressor to be used for data transmission.
virtual void unpack(DataIStream &is)
Deserialize a change.
A class providing command dispatch functionality to networked objects.