Collage
0.6.1
|
A networked, versioned barrier. More...
#include <barrier.h>
Public Member Functions | |
CO_API | Barrier (NodePtr master, const uint32_t height=0) |
Construct a new barrier. | |
CO_API | Barrier () |
Construct a new barrier, to be mapped to the master version. | |
virtual CO_API | ~Barrier () |
Destruct the barrier. | |
Data Access | |
After a change, the barrier should be committed and synced to the same version on all nodes entering the barrier. | |
CO_API void | setHeight (const uint32_t height) |
Set the number of participants in the barrier. | |
CO_API void | increase () |
Add one participant to the barrier. | |
CO_API uint32_t | getHeight () const |
Operations | |
CO_API void | enter (const uint32_t timeout=LB_TIMEOUT_INDEFINITE) |
Enter the barrier, blocks until the barrier has been reached. | |
Protected Member Functions | |
virtual void | attach (const UUID &id, const uint32_t instanceID) |
virtual ChangeType | getChangeType () const |
virtual void | getInstanceData (DataOStream &os) |
Serialize all instance information of this distributed object. | |
virtual void | applyInstanceData (DataIStream &is) |
Deserialize the instance data. | |
virtual void | pack (DataOStream &os) |
Serialize the modifications since the last call to commit(). | |
virtual void | unpack (DataIStream &is) |
Deserialize a change. |
CO_API co::Barrier::Barrier | ( | NodePtr | master, |
const uint32_t | height = 0 |
||
) |
Construct a new barrier.
The master node will maintain the barrier state. It has to be reachable from all other nodes participating in the barrier.
The instance created using this constructor should be registered as the master version of the barrier with the LocalNode. Note the node of the object master, i.e., this instance, and the barrier's master node might be different.
CO_API co::Barrier::Barrier | ( | ) |
Construct a new barrier, to be mapped to the master version.
virtual CO_API co::Barrier::~Barrier | ( | ) | [virtual] |
Destruct the barrier.
virtual void co::Barrier::applyInstanceData | ( | DataIStream & | is | ) | [protected, virtual] |
Deserialize the instance data.
This method is called during object mapping to populate slave instances with the master object's data.
is | the input stream. |
Implements co::Object.
CO_API void co::Barrier::enter | ( | const uint32_t | timeout = LB_TIMEOUT_INDEFINITE | ) |
Enter the barrier, blocks until the barrier has been reached.
The implementation currently assumes that the master node instance also enters the barrier. If a timeout happens a timeout exception is thrown.
virtual ChangeType co::Barrier::getChangeType | ( | ) | const [inline, protected, virtual] |
Reimplemented from co::Object.
Definition at line 85 of file barrier.h.
References co::Object::DELTA.
CO_API uint32_t co::Barrier::getHeight | ( | ) | const |
virtual void co::Barrier::getInstanceData | ( | DataOStream & | os | ) | [protected, virtual] |
Serialize all instance information of this distributed object.
os | The output stream. |
Implements co::Object.
CO_API void co::Barrier::increase | ( | ) |
Add one participant to the barrier.
virtual void co::Barrier::pack | ( | DataOStream & | os | ) | [protected, virtual] |
Serialize the modifications since the last call to commit().
No new version will be created if no data is written to the output stream.
os | the output stream. |
Reimplemented from co::Object.
CO_API void co::Barrier::setHeight | ( | const uint32_t | height | ) |
Set the number of participants in the barrier.
virtual void co::Barrier::unpack | ( | DataIStream & | is | ) | [protected, virtual] |