rice.scribe
Interface IScribe
- public interface IScribe
- Version:
- $Id: IScribe.java,v 1.8 2002/09/07 22:17:05 animesh Exp $
- Author:
- Romer Gil
- Eric Engineer
- Atul Singh
- Animesh Nandi
registerApp
public void registerApp(rice.scribe.IScribeApp app)
- Registers the IScribeApp to the Scribe substrate. This is required for the IScribeApp to get the upcall scribeIsReady() notifying it that the underlying Scribe substrate is ready. The IScribeApp should call create, join, leave, multicast only after they are notified that the underlying Scribe substrate is ready, otherwise these operations fail.
create
public boolean create(rice.pastry.NodeId groupID,
rice.pastry.security.Credentials cred)
- Creates a group/topic if the credentials are valid. Nodes must then join this group in order to get information multicast to it.
- Parameters:
cred
- The credentials of the entity creating the group
groupID
- The ID of the group to be created
- Returns:
- true if the operation was successful, false if the operation failed because the underlying Scribe substrate was not ready.
join
public boolean join(rice.pastry.NodeId groupID,
rice.scribe.IScribeApp subscriber,
rice.pastry.security.Credentials cred)
- Joins a multicast group/topic. When a node joins a multicast group, it receives all messages multicast to that group.
- Parameters:
cred
- The credentials of the entity joining the group
groupID
- The ID of the group to join to
subscriber
- The application joining the group
- Returns:
- true if the operation was successful, false if the operation failed because the underlying Scribe substrate was not ready.
leave
public boolean leave(rice.pastry.NodeId groupID,
rice.scribe.IScribeApp subscriber,
rice.pastry.security.Credentials cred)
- Leaving a multicast group/topic. After a node leaves a group, it will no longer receive messages multicast to this group.
- Parameters:
cred
- The credentials of the entity leaving the group
groupID
- The ID of the group to leave
subscriber
- The application leaving the group. Use null if not directly called by an application.
- Returns:
- true if the operation was successful, false if the operation failed because the underlying Scribe substrate was not ready.
multicast
public boolean multicast(rice.pastry.NodeId groupID,
java.lang.Object obj,
rice.pastry.security.Credentials cred)
- Multicast information to a group/topic. Data will be delivered to All nodes that have joined the group. The message will trickle from the root of the multicast tree for the group DOWN the tree, with each node sending this message to its children for the group.
- Parameters:
cred
- The credentials of the entity multicasting to the group
groupID
- The ID of the group to multicast.
obj
- The information that is to be multicast. This should be serializable.
- Returns:
- true if the operation was successful, false if the operation failed because the underlying Scribe substrate was not ready.
scheduleHB
public void scheduleHB()
- Sends heartbeat messages to this local node's children for all the topics on this local scribe node. This method should be invoked periodically by the driver with the same frequency in all nodes. In addition to initiating sending of heartbeat messages from this local node, this method also implicitly notifies the local node that it should expect a heartbeat message from its parents for all the topics on this local node. So, if it fails to receive a threshold value of such heartbeat messages from any parent for a particular topic, a tree repair event is triggered for that topic.
setTreeRepairThreshold
public void setTreeRepairThreshold(int value)
- The tree repair event for a particular topic in Scribe is triggered when a node misses a certain treeRepairThreshold number of heartbeat messages from its parent for the topic. This threshold value can be set using this method.
- Parameters:
value
- The value for the treeRepairThreshold.
generateTopicId
public rice.pastry.NodeId generateTopicId(java.lang.String topicName)
- Generate a unique id for the topic, which will determine its rendezvous point. This is a helper method. Applications can use their own methods to generate TopicId.
- Parameters:
topicName
- The name of the topic (unique to the local node)
- Returns:
- the TopicId
getParent
public rice.pastry.NodeHandle getParent(rice.pastry.NodeId topicId)
- Returns the local node's parent in this topic's multicast tree.
- Parameters:
topicId
- The id of the topic.
- Returns:
- the parent node.
getChildren
public java.util.Vector getChildren(rice.pastry.NodeId topicId)
- This returns the most current view of the children in this topic's multicast subtree rooted at the local node.
- Parameters:
topicId
- The id of the topic.
- Returns:
- vector of children nodehandles.