Equalizer 1.0
|
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. | |
void | setHeight (const uint32_t height) |
Set the number of participants in the barrier. | |
void | increase () |
Add one participant to the barrier. | |
uint32_t | getHeight () const |
Operations | |
CO_API void | enter () |
Enter the barrier, blocks until the barrier has been reached. | |
Protected Member Functions | |
virtual void | attach (const base::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 | ( | ) |
Enter the barrier, blocks until the barrier has been reached.
The implementation currently assumes that the master node instance also enters the barrier.
virtual ChangeType co::Barrier::getChangeType | ( | ) | const [inline, protected, virtual] |
Reimplemented from co::Object.
Definition at line 84 of file barrier.h.
References co::Object::DELTA.
uint32_t co::Barrier::getHeight | ( | ) | const [inline] |
virtual void co::Barrier::getInstanceData | ( | DataOStream & | os | ) | [protected, virtual] |
Serialize all instance information of this distributed object.
os | The output stream. |
Implements co::Object.
void co::Barrier::increase | ( | ) | [inline] |
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.
void co::Barrier::setHeight | ( | const uint32_t | height | ) | [inline] |
virtual void co::Barrier::unpack | ( | DataIStream & | is | ) | [protected, virtual] |