eq::net::FullMasterCM Class Reference

An object change manager handling only full versions for the master instance. More...

#include <fullMasterCM.h>

Inheritance diagram for eq::net::FullMasterCM:
Inheritance graph
[legend]
Collaboration diagram for eq::net::FullMasterCM:
Collaboration graph
[legend]

List of all members.

Classes

struct  InstanceData

Public Member Functions

 FullMasterCM (Object *object)
virtual void makeThreadSafe ()
 Make this object thread safe.
virtual bool isMaster () const
virtual uint32_t getMasterInstanceID () const
virtual uint32_t addSlave (Command &command)
 Add a subscribed slave to the managed object.
virtual void removeSlave (NodePtr node)
 Remove a subscribed slave.
virtual const NodeVectorgetSlaveNodes () const
virtual void addOldMaster (NodePtr node, const uint32_t instanceID)
 Add the old master as a slave.
virtual void applyMapData ()
 Apply the initial data after mapping.
Versioning



virtual uint32_t commitNB ()
 Start committing a new version.
virtual uint32_t commitSync (const uint32_t commitID)
 Finalize a commit transaction.
virtual void obsolete (const uint32_t version)
 Explicitily obsolete all versions.
virtual void setAutoObsolete (const uint32_t count, const uint32_t flags)
 Automatically obsolete old versions.
virtual uint32_t getAutoObsoleteCount () const
virtual uint32_t sync (const uint32_t version)
 Sync to a given version.
virtual uint32_t getHeadVersion () const
virtual uint32_t getVersion () const
virtual uint32_t getOldestVersion () const

Protected Types

typedef std::deque
< InstanceData * > 
InstanceDataDeque
typedef std::vector
< InstanceData * > 
InstanceDataVector

Protected Member Functions

InstanceData_newInstanceData ()
void _obsolete ()
void _checkConsistency () const
CommandResult _cmdCommit (Command &pkg)
CommandResult _cmdDiscard (Command &pkg)
 CHECK_THREAD_DECLARE (_thread)

Protected Attributes

Object_object
 The managed object.
NodeVector _slaves
 The list of subsribed slave nodes.
base::UUIDHash< uint32_t > _slavesCount
 The number of object instances subscribed per slave node.
uint32_t _version
 The current version.
uint32_t _commitCount
 The number of commits, needed for auto-obsoletion.
uint32_t _nVersions
 The number of old versions to retain.
uint32_t _obsoleteFlags
 The flags for automatic version obsoletion.
base::RequestHandler _requestHandler
 Registers request packets waiting for a return value.
InstanceDataDeque _instanceDatas
 The list of full instance datas, head version last.
InstanceDataVector _instanceDataCache

Detailed Description

An object change manager handling only full versions for the master instance.

For internal use only.

Definition at line 41 of file fullMasterCM.h.


Member Function Documentation

virtual void eq::net::FullMasterCM::makeThreadSafe (  )  [inline, virtual]

Make this object thread safe.

The caller has to ensure that no other thread is using this object when this function is called. It is primarily used by the session during object instantiation.

See also:
Session::getObject().

Implements eq::net::ObjectCM.

Definition at line 47 of file fullMasterCM.h.

uint32_t eq::net::FullMasterCM::commitNB (  )  [virtual]

Start committing a new version.

Returns:
the commit identifier to be passed to commitSync
See also:
commitSync

Implements eq::net::ObjectCM.

Definition at line 82 of file fullMasterCM.cpp.

References _object, _requestHandler, eq::net::Object::getLocalNode(), eq::base::RequestHandler::registerRequest(), and eq::net::Object::send().

Here is the call graph for this function:

uint32_t eq::net::FullMasterCM::commitSync ( const uint32_t  commitID  )  [virtual]

Finalize a commit transaction.

Parameters:
commitID the commit identifier returned from commitNB
Returns:
the new head version.

Implements eq::net::ObjectCM.

Definition at line 92 of file fullMasterCM.cpp.

References _requestHandler, and eq::base::RequestHandler::waitRequest().

Here is the call graph for this function:

virtual void eq::net::FullMasterCM::obsolete ( const uint32_t  version  )  [inline, virtual]

Explicitily obsolete all versions.

Parameters:
version the version to obsolete

Implements eq::net::ObjectCM.

Definition at line 56 of file fullMasterCM.h.

virtual void eq::net::FullMasterCM::setAutoObsolete ( const uint32_t  count,
const uint32_t  flags 
) [inline, virtual]

Automatically obsolete old versions.

Parameters:
count the number of versions to retain, excluding the head version.
flags additional flags for the auto-obsoletion mechanism

Implements eq::net::ObjectCM.

Definition at line 58 of file fullMasterCM.h.

References _nVersions, and _obsoleteFlags.

virtual uint32_t eq::net::FullMasterCM::getAutoObsoleteCount (  )  const [inline, virtual]
Returns:
get the number of versions this object retains.

Implements eq::net::ObjectCM.

Definition at line 62 of file fullMasterCM.h.

References _nVersions.

virtual uint32_t eq::net::FullMasterCM::sync ( const uint32_t  version  )  [inline, virtual]

Sync to a given version.

Parameters:
version the version to synchronize, must be bigger than the current version.
Returns:
the version of the object after the operation.

Implements eq::net::ObjectCM.

Definition at line 64 of file fullMasterCM.h.

References _version.

virtual uint32_t eq::net::FullMasterCM::getHeadVersion (  )  const [inline, virtual]
Returns:
the latest available (head) version.

Implements eq::net::ObjectCM.

Definition at line 67 of file fullMasterCM.h.

References _version.

virtual uint32_t eq::net::FullMasterCM::getVersion (  )  const [inline, virtual]
Returns:
the current version.

Implements eq::net::ObjectCM.

Definition at line 68 of file fullMasterCM.h.

References _version.

uint32_t eq::net::FullMasterCM::getOldestVersion (  )  const [virtual]
Returns:
the oldest available version.

Implements eq::net::ObjectCM.

Definition at line 124 of file fullMasterCM.cpp.

References _instanceDatas, and _version.

Referenced by addSlave().

Here is the caller graph for this function:

virtual bool eq::net::FullMasterCM::isMaster (  )  const [inline, virtual]
Returns:
if this instance is the master version.

Implements eq::net::ObjectCM.

Definition at line 72 of file fullMasterCM.h.

virtual uint32_t eq::net::FullMasterCM::getMasterInstanceID (  )  const [inline, virtual]
Returns:
the instance identifier of the master object.

Implements eq::net::ObjectCM.

Definition at line 73 of file fullMasterCM.h.

uint32_t eq::net::FullMasterCM::addSlave ( Command command  )  [virtual]

Add a subscribed slave to the managed object.

Parameters:
command the subscribe command initiating the add.
Returns:
the first version the slave has to use from its cache.

Implements eq::net::ObjectCM.

Definition at line 132 of file fullMasterCM.cpp.

References _instanceDatas, _object, _slaves, _slavesCount, _version, EQ_MAX, EQINFO, EQLOG, eq::net::Object::getInstanceID(), getOldestVersion(), eq::net::DataOStream::resend(), and std::usort().

Here is the call graph for this function:

void eq::net::FullMasterCM::removeSlave ( NodePtr  node  )  [virtual]

Remove a subscribed slave.

Parameters:
node the slave node.

Implements eq::net::ObjectCM.

Definition at line 224 of file fullMasterCM.cpp.

References _slaves, and _slavesCount.

virtual const NodeVector* eq::net::FullMasterCM::getSlaveNodes (  )  const [inline, virtual]
Returns:
the vector of current slave nodes.

Reimplemented from eq::net::ObjectCM.

Definition at line 77 of file fullMasterCM.h.

References _slaves.

void eq::net::FullMasterCM::addOldMaster ( NodePtr  node,
const uint32_t  instanceID 
) [virtual]

Add the old master as a slave.

Implements eq::net::ObjectCM.

Definition at line 243 of file fullMasterCM.cpp.

References _object, _slaves, _slavesCount, _version, eq::net::Object::send(), and std::usort().

Here is the call graph for this function:

virtual void eq::net::FullMasterCM::applyMapData (  )  [inline, virtual]

Apply the initial data after mapping.

Implements eq::net::ObjectCM.

Definition at line 80 of file fullMasterCM.h.


Member Data Documentation

The managed object.

Definition at line 84 of file fullMasterCM.h.

Referenced by addOldMaster(), addSlave(), and commitNB().

The list of subsribed slave nodes.

Definition at line 87 of file fullMasterCM.h.

Referenced by addOldMaster(), addSlave(), getSlaveNodes(), and removeSlave().

The number of object instances subscribed per slave node.

Definition at line 90 of file fullMasterCM.h.

Referenced by addOldMaster(), addSlave(), and removeSlave().

uint32_t eq::net::FullMasterCM::_version [protected]

The current version.

Definition at line 93 of file fullMasterCM.h.

Referenced by addOldMaster(), addSlave(), getHeadVersion(), getOldestVersion(), getVersion(), and sync().

The number of commits, needed for auto-obsoletion.

Definition at line 96 of file fullMasterCM.h.

uint32_t eq::net::FullMasterCM::_nVersions [protected]

The number of old versions to retain.

Definition at line 99 of file fullMasterCM.h.

Referenced by getAutoObsoleteCount(), and setAutoObsolete().

The flags for automatic version obsoletion.

Definition at line 102 of file fullMasterCM.h.

Referenced by setAutoObsolete().

Registers request packets waiting for a return value.

Definition at line 105 of file fullMasterCM.h.

Referenced by commitNB(), and commitSync().

InstanceDataDeque eq::net::FullMasterCM::_instanceDatas [protected]

The list of full instance datas, head version last.

Definition at line 120 of file fullMasterCM.h.

Referenced by addSlave(), and getOldestVersion().


The documentation for this class was generated from the following files:
Generated on Sat Feb 6 13:09:20 2010 for Equalizer 0.9.1 by  doxygen 1.6.1