OverSim
ScribeGroup Class Reference

Capsulates the informations of a scribe multicast group. More...

#include <ScribeGroup.h>

Public Member Functions

 ScribeGroup (OverlayKey id)
 Creates a new ScribeGroup.
 ~ScribeGroup ()
std::pair< std::set
< NodeHandle >::iterator, bool > 
addChild (const NodeHandle &node)
 Adds a new child to the multicast tree.
void removeChild (const NodeHandle &node)
 Removes a child from the multicast tree.
std::set< NodeHandle >::iterator getChildrenBegin ()
 Returns an iterator to the begin of the children list.
std::set< NodeHandle >::iterator getChildrenEnd ()
 Returns an iterator to the end of the children list.
int numChildren () const
 Get the number of children.
bool isForwarder () const
 Return whether the node is forwarder for a group.
bool getAmISource () const
 Returns the amISource status.
void setAmISource (bool source)
 Set the amISource status.
bool getSubscription () const
 Returns whether the local node is subscriber of the group.
void setSubscription (bool subscribe)
 Set the subscription status.
NodeHandle getParent () const
 Return the parent in the multicast tree.
void setParent (NodeHandle &_parent)
 Sets a new parent for the multicast tree.
NodeHandle getRendezvousPoint () const
 Returns the rendevouzPoint (root) of the multicast tree for the group.
void setRendezvousPoint (const NodeHandle &_rendezvousPoint)
 Sets the rendevouzPoint (root) of the multicast tree for the group.
OverlayKey getGroupId () const
 Returns the groupId of the group.
ScribeTimergetParentTimer ()
 Returns the parent timer.
void setParentTimer (ScribeTimer *t)
 Sets the parent timer.
ScribeTimergetHeartbeatTimer ()
 Returns the heartbeat timer.
void setHeartbeatTimer (ScribeTimer *t)
 Sets the heartbeat timer.
bool operator== (const OverlayKey &id) const
 Checks whether the group has a certain groupId.
bool operator== (const ScribeGroup &a) const
 Checks whether two groups have the same ID.
bool operator< (const OverlayKey &id) const
 Checks whether the group has a smaller ID than the given key.
bool operator< (const ScribeGroup &a) const
 Checks whether the group has a smaller ID than another group.

Private Attributes

OverlayKey groupId
NodeHandle rendezvousPoint
NodeHandle parent
std::set< NodeHandlechildren
bool subscription
bool amISource
ScribeTimerparentTimer
ScribeTimerheartbeatTimer

Detailed Description

Capsulates the informations of a scribe multicast group.

Definition at line 40 of file ScribeGroup.h.

Constructor & Destructor Documentation

ScribeGroup::ScribeGroup ( OverlayKey  id)

Creates a new ScribeGroup.

Parameters
idThe group ID of the new group

Definition at line 29 of file ScribeGroup.cc.

ScribeGroup::~ScribeGroup ( )

Definition at line 39 of file ScribeGroup.cc.

{
children.clear();
}

Member Function Documentation

std::pair< std::set< NodeHandle >::iterator, bool > ScribeGroup::addChild ( const NodeHandle node)

Adds a new child to the multicast tree.

Parameters
nodeThe nodeHandle of the child
Returns
An iterator to the inserted child and a boolean value (true = new child, false = child was already present)

Definition at line 49 of file ScribeGroup.cc.

Referenced by Scribe::addChildToGroup().

{
return children.insert(node);
}
bool ScribeGroup::getAmISource ( ) const
inline

Returns the amISource status.

This status indicates if the node is a source of the multicastgroup FIXME: currently the flag is only be set to true if the node is not also a member (i.e. subscriber) of the group

Returns
True if the node is sending in multicast messages to the group

Definition at line 114 of file ScribeGroup.h.

Referenced by Scribe::checkGroupEmpty().

{ return amISource; }
std::set< NodeHandle >::iterator ScribeGroup::getChildrenBegin ( )

Returns an iterator to the begin of the children list.

Returns
the iterator

Definition at line 60 of file ScribeGroup.cc.

{
return children.begin();
}
std::set< NodeHandle >::iterator ScribeGroup::getChildrenEnd ( )

Returns an iterator to the end of the children list.

Returns
the iterator

Definition at line 65 of file ScribeGroup.cc.

{
return children.end();
}
OverlayKey ScribeGroup::getGroupId ( ) const
inline

Returns the groupId of the group.

Returns
The group ID

Definition at line 174 of file ScribeGroup.h.

Referenced by Scribe::addChildToGroup(), Scribe::checkGroupEmpty(), operator<(), and operator==().

{ return groupId; }
ScribeTimer* ScribeGroup::getHeartbeatTimer ( )
inline

Returns the heartbeat timer.

If the timer expires, the node is supposed to send heartbeat messages to all children.

Returns
The heratbetTimer

Definition at line 204 of file ScribeGroup.h.

Referenced by Scribe::checkGroupEmpty().

{ return heartbeatTimer; }
NodeHandle ScribeGroup::getParent ( ) const
inline

Return the parent in the multicast tree.

Returns
The parent. thisNode if the node is root of the tree

Definition at line 146 of file ScribeGroup.h.

Referenced by Scribe::checkGroupEmpty().

{ return parent; }
ScribeTimer* ScribeGroup::getParentTimer ( )
inline

Returns the parent timer.

The parent timer is supposed to expire if the parent fails to send heartbeat messages.

Returns
The parentTimer

Definition at line 184 of file ScribeGroup.h.

Referenced by Scribe::checkGroupEmpty().

{ return parentTimer; }
NodeHandle ScribeGroup::getRendezvousPoint ( ) const
inline

Returns the rendevouzPoint (root) of the multicast tree for the group.

Returns
The root of the multicast tree if known. UNSPECIFIED_NODE else

Definition at line 160 of file ScribeGroup.h.

{ return rendezvousPoint; }
bool ScribeGroup::getSubscription ( ) const
inline

Returns whether the local node is subscriber of the group.

Returns
True if the local node is interested in multicast messages for the group, false else

Definition at line 132 of file ScribeGroup.h.

Referenced by Scribe::checkGroupEmpty().

{ return subscription; }
bool ScribeGroup::isForwarder ( ) const

Return whether the node is forwarder for a group.

Returns
True if there are any children, false else.

Definition at line 44 of file ScribeGroup.cc.

Referenced by Scribe::checkGroupEmpty().

{
return !children.empty();
}
int ScribeGroup::numChildren ( ) const
inline

Get the number of children.

Returns
The number of children

Definition at line 96 of file ScribeGroup.h.

{ return children.size(); }
bool ScribeGroup::operator< ( const OverlayKey id) const
inline

Checks whether the group has a smaller ID than the given key.

Parameters
idThe key to compare
Returns
True if the group id is smaller than the key, false else.

Definition at line 238 of file ScribeGroup.h.

{ return id < groupId; };
bool ScribeGroup::operator< ( const ScribeGroup a) const
inline

Checks whether the group has a smaller ID than another group.

Parameters
athe group to compare
Returns
True if the (local) group id is smaller than the a's groupId, false else.

Definition at line 246 of file ScribeGroup.h.

{ return groupId < a.getGroupId(); };
bool ScribeGroup::operator== ( const OverlayKey id) const
inline

Checks whether the group has a certain groupId.

Parameters
idThe groupId to check
Returns
True if id == groupId, false else

Definition at line 222 of file ScribeGroup.h.

{ return id == groupId; };
bool ScribeGroup::operator== ( const ScribeGroup a) const
inline

Checks whether two groups have the same ID.

Parameters
aThe group to compare
Returns
True if the groups have the same ID, false else.

Definition at line 230 of file ScribeGroup.h.

{ return a.getGroupId() == groupId; };
void ScribeGroup::removeChild ( const NodeHandle node)

Removes a child from the multicast tree.

Parameters
nodeThe nodeHandle of the child

Definition at line 54 of file ScribeGroup.cc.

Referenced by Scribe::removeChildFromGroup().

{
children.erase(node);
}
void ScribeGroup::setAmISource ( bool  source)
inline

Set the amISource status.

This status indicates if the node is a source of the multicastgroup FIXME: currently the flag is only be set to true if the node is not also a member (i.e. subscriber) of the group

Parameters
sourceTrue if the node is sending in multicast messages to the group

Definition at line 125 of file ScribeGroup.h.

{ amISource = source; }
void ScribeGroup::setHeartbeatTimer ( ScribeTimer t)
inline

Sets the heartbeat timer.

If the timer expires, the node is supposed to send heartbeat messages to all children.

Parameters
tThe heartbeatTimer

Definition at line 214 of file ScribeGroup.h.

void ScribeGroup::setParent ( NodeHandle _parent)
inline

Sets a new parent for the multicast tree.

Parameters
_parentThe new Parent. Set to thisNode if node should be root of the tree

Definition at line 153 of file ScribeGroup.h.

{ parent = _parent; }
void ScribeGroup::setParentTimer ( ScribeTimer t)
inline

Sets the parent timer.

The parent timer is supposed to expire if the parent fails to send heartbeat messages.

Parameters
tThe parentTimer

Definition at line 194 of file ScribeGroup.h.

{ parentTimer = t; }
void ScribeGroup::setRendezvousPoint ( const NodeHandle _rendezvousPoint)
inline

Sets the rendevouzPoint (root) of the multicast tree for the group.

Parameters
_rendezvousPointThe root of the tree

Definition at line 167 of file ScribeGroup.h.

{ rendezvousPoint = _rendezvousPoint; }
void ScribeGroup::setSubscription ( bool  subscribe)
inline

Set the subscription status.

Parameters
subscribeTrue if the node is interested in multicast messages for the group, false else

Definition at line 139 of file ScribeGroup.h.

{ subscription = subscribe; }

Member Data Documentation

bool ScribeGroup::amISource
private

Definition at line 48 of file ScribeGroup.h.

Referenced by getAmISource(), ScribeGroup(), and setAmISource().

std::set<NodeHandle> ScribeGroup::children
private
OverlayKey ScribeGroup::groupId
private

Definition at line 43 of file ScribeGroup.h.

Referenced by getGroupId(), operator<(), and operator==().

ScribeTimer* ScribeGroup::heartbeatTimer
private

Definition at line 51 of file ScribeGroup.h.

Referenced by getHeartbeatTimer(), ScribeGroup(), and setHeartbeatTimer().

NodeHandle ScribeGroup::parent
private

Definition at line 45 of file ScribeGroup.h.

Referenced by getParent(), ScribeGroup(), and setParent().

ScribeTimer* ScribeGroup::parentTimer
private

Definition at line 50 of file ScribeGroup.h.

Referenced by getParentTimer(), ScribeGroup(), and setParentTimer().

NodeHandle ScribeGroup::rendezvousPoint
private

Definition at line 44 of file ScribeGroup.h.

Referenced by getRendezvousPoint(), ScribeGroup(), and setRendezvousPoint().

bool ScribeGroup::subscription
private

Definition at line 47 of file ScribeGroup.h.

Referenced by getSubscription(), ScribeGroup(), and setSubscription().


The documentation for this class was generated from the following files: