|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrice.pastry.client.PastryAppl
rice.scribe.Scribe
Field Summary | |
boolean |
m_ackOnSubscribeSwitch
The AckOnSubscribe switch if true activates the immediate sending of ACK by a node when it receives a SUBSCRIBE message from its child for a topic. |
protected static Address |
m_address
The receiver address for the scribe system. |
protected java.util.Set |
m_alreadySentHBNodes
Optimization on number of HeartBeat Messages sent. |
protected java.util.Vector |
m_apps
The set of IScribeApp's that have registered to this Scribe substrate. |
protected static Credentials |
m_credentials
The Credentials object to be used for all messaging through Pastry. |
protected java.util.Hashtable |
m_distinctChildrenTable
Hashtable having mapping from a child -> list of topics for which this child is in local node's children list for that topic. |
protected java.util.Hashtable |
m_distinctParentTable
Hashtable having mapping from a parent node -> list of topics for which the parent node is local node's parent in the corresponding multicast tree for that topic. |
ScribeMaintainer |
m_maintainer
The ScribeMaintainer object handles all the tree maintenance activities like the sending of heartbeat messages and issuing tree repair events for all the topics residing on the local node. |
static int |
m_scribeMaintFreq
The time period determining Scribe Tree Maintenance Activity frequency |
java.util.Set |
m_scribeObservers
The set of applications which are interested in getting notified whenever the local node becomes an intermediate node for a topic. |
protected IScribeSecurityManager |
m_securityManager
Handles all the security verification. |
protected SendOptions |
m_sendOptions
The SendOptions object to be used for all messaging through Pastry. |
java.util.HashMap |
m_topics
Set of topics on the local scribe node. |
Fields inherited from class rice.pastry.client.PastryAppl |
address, instance, thePastryNode |
Constructor Summary | |
Scribe(PastryNode pn,
Credentials cred)
Constructor. |
Method Summary | |
boolean |
addChild(NodeHandle child,
NodeId topicId)
Add a node as a child in the children table for a topic. |
boolean |
addChild(NodeHandle child,
NodeId topicId,
java.io.Serializable data)
Add a node as a child in the children table for a topic. |
void |
addChildForTopic(NodeHandle child,
NodeId topicId)
Adds a child for a topic into the distinctChildrenTable. |
boolean |
addChildToAlreadySentHBNodes(NodeId childId)
Adds a child to the list of nodes to which this node has already send a implicit HeartBeat message in the form of Publish message in this Heartbeat period. |
void |
addParentForTopic(NodeHandle parent,
NodeId topicId)
Adds a parent for a topic into the distinctParentTable. |
boolean |
anycast(NodeId groupID,
MessageAnycast anycastMessage,
Credentials cred)
An application can create sub-classes of MessageAnycast type of messages and write their own handling functions so as to do some application-specific predicate searching. |
boolean |
anycast(NodeId groupID,
java.io.Serializable obj,
Credentials cred)
Anycast to a group/topic. |
void |
childObserver(NodeHandle child,
NodeId topicId,
boolean wasAdded,
ScribeMessage pmsg,
java.io.Serializable data)
Whenever the children table for a topic is changed, ( a child is added or removed), this method is invoked to do some handling. |
void |
clearAlreadySentHBNodes()
The set is cleared so that the set contains only those nodes to which Publish message was sent in last HeartBeat period. |
boolean |
create(NodeId topicId,
Credentials cred)
Creates a group/topic if the credentials are valid. |
boolean |
enrouteMessage(Message msg,
Id target,
NodeId nextHop,
SendOptions opt)
Called by pastry when a message is enroute and is passing through this node. |
NodeId |
generateTopicId(java.lang.String topicName)
Generate a unique id for the topic, which will determine its rendezvous point. |
Address |
getAddress()
Returns the address of this client. |
java.util.Vector |
getAlreadySentHBNodes()
Gets the vector of nodes to which an implicit HeartBeat in form of Publish message was sent in last HeartBeat period. |
java.util.Vector |
getChildren(NodeId topicId)
This returns the most current view of the children in this topic's multicast subtree rooted at the local node. |
Credentials |
getCredentials()
Returns the credentials of this client. |
java.util.Vector |
getDistinctChildren()
Gets the Vector of distinct children of this local node in multicast tree of all topics. |
java.util.Vector |
getDistinctParents()
Gets the Vector of distinct parent of this local node in the multicast trees of all topics. |
NodeId |
getFingerprintForChildTopics(NodeHandle child)
|
NodeId |
getFingerprintForParentTopics(NodeHandle parent)
|
NodeHandle |
getLocalHandle()
|
NodeHandle |
getNodeHandle()
Returns the handle of the local node on which this Scribe application resides. |
NodeHandle |
getParent(NodeId topicId)
Returns the local node's parent in this topic's multicast tree. |
PastryNode |
getPastryNode()
Returns the pastryNode for this application. |
IScribeSecurityManager |
getSecurityManager()
Returns the security manager from the Scribe node. |
SendOptions |
getSendOptions()
Returns the send options in the Scribe system. |
Topic |
getTopic(NodeId topicId)
Returns the topic object associated with topicId. |
java.util.Vector |
getTopics()
Method to access the list of topics this scribe is responsible for. |
java.util.Vector |
getTopicsForChild(NodeHandle child)
Gets the vector of topicIds for which given node is a child. |
java.util.Vector |
getTopicsForParent(NodeHandle parent)
Gets the vector of topicIds for which given node is our parent. |
int |
getTreeRepairThreshold()
Gets the tree repair threshold value. |
boolean |
isReady()
Returns true is the Scribe substrate is ready. |
boolean |
isRoot(NodeId topicId)
Returns true if the local node is currently the root(the node that is closest to the topicId) of the topic. |
boolean |
join(NodeId topicId,
IScribeApp subscriber,
Credentials cred)
Joins a multicast group/topic. |
boolean |
join(NodeId topicId,
IScribeApp subscriber,
Credentials cred,
java.io.Serializable obj)
Joins a multicast group/topic. |
void |
leafSetChange(NodeHandle nh,
boolean wasAdded)
Called by pastry when the leaf set changes. |
boolean |
leave(NodeId topicId,
IScribeApp subscriber,
Credentials cred)
Leaving a multicast group/topic. |
ScribeMessage |
makeAckOnSubscribeMessage(NodeId tid,
Credentials c)
Makes a AckOnSubscribe message using the current Pastry node as the source. |
ScribeMessage |
makeAckOnSubscribeMessage(NodeId tid,
Credentials c,
java.io.Serializable data)
Makes a AckOnSubscribe message using the current Pastry node as the source. |
ScribeMessage |
makeAnycastMessage(NodeId tid,
Credentials c)
Makes a anycast message using the current Pastry node as the source. |
ScribeMessage |
makeCreateMessage(NodeId tid,
Credentials c)
Makes a create message using the current Pastry node as the source. |
ScribeMessage |
makeHeartBeatMessage(Credentials c)
Makes a heart-beat message using the current Pastry node as the source. |
ScribeMessage |
makePublishMessage(NodeId tid,
Credentials c)
Makes a publish message using the current Pastry node as the source. |
ScribeMessage |
makeReplyFromParentMessage(Credentials c)
Makes a ReplyFromParent message using the current Pastry node as the source. |
ScribeMessage |
makeRequestToParentMessage(Credentials c)
Makes a RequestToParent message using the current Pastry node as the source. |
ScribeMessage |
makeScribeMaintenanceMessage(Credentials c)
Makes a ScribeMaintenance message using the current Pastry node as the source. |
ScribeMessage |
makeSubscribeMessage(NodeId tid,
Credentials c)
Makes a subscribe message using the current Pastry node as the source. |
ScribeMessage |
makeUnsubscribeMessage(NodeId tid,
Credentials c)
Makes an unsubscribe message using the current Pastry node as the source. |
void |
messageForAppl(Message msg)
Called by pastry when a message arrives for this client. |
boolean |
multicast(NodeId topicId,
java.io.Serializable obj,
Credentials cred)
Multicast information to a group/topic. |
void |
notifyReady()
This is called when the underlying pastry node is ready. |
void |
notifyScribeObservers(NodeId topicId)
Notifies the applications on top of scribe who are interested in knowing the events of implicit topic creation. |
int |
numChildren(NodeId topicId)
This returns the number of children in this topic's multicast subtree rooted at the local node. |
void |
registerApp(IScribeApp app)
Registers the IScribeApp to the Scribe substrate. |
void |
registerScribeObserver(IScribeObserver app)
Registers the application that implements the IScribeObserver interface. |
boolean |
removeChild(NodeHandle child,
NodeId topicId)
Removes a node as a child from the children table for a topic. |
void |
removeChildForTopic(NodeHandle child,
NodeId topicId)
Removes a child for a topic from the distinctChildrenTable. |
void |
removeParentForTopic(NodeHandle parent,
NodeId topicId)
Removes a parent for a topic fromthe distinctParentTable. |
void |
scheduleHB()
Sends heartbeat messages to this local node's children for all the topics on this local scribe node. |
boolean |
setParent(NodeHandle parent,
NodeId topicId)
Sets the parent for the topic specified by topicId. |
void |
setTreeRepairThreshold(int value)
The tree repair event for a particular topic in Scribe is triggered when a node misses a certain threshold number of heartbeat messages from its parent for the topic. |
Methods inherited from class rice.pastry.client.PastryAppl |
getLeafSet, getNodeId, getRoutingTable, isClosest, receiveMessage, registerReceiver, routeMsg, routeMsgDirect, routeSetChange, sendMessage |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.Vector m_apps
public java.util.HashMap m_topics
protected java.util.Hashtable m_distinctChildrenTable
protected java.util.Hashtable m_distinctParentTable
protected java.util.Set m_alreadySentHBNodes
public boolean m_ackOnSubscribeSwitch
protected static Address m_address
protected SendOptions m_sendOptions
protected static Credentials m_credentials
protected IScribeSecurityManager m_securityManager
public ScribeMaintainer m_maintainer
public static int m_scribeMaintFreq
public java.util.Set m_scribeObservers
Constructor Detail |
public Scribe(PastryNode pn, Credentials cred)
pn
- the pastry node that client will attach to.cred
- the credentials associated with this scribe object.Method Detail |
public void setTreeRepairThreshold(int value)
setTreeRepairThreshold
in interface IScribe
value
- The value for the tree repair threshold.public int getTreeRepairThreshold()
public boolean isReady()
public void registerApp(IScribeApp app)
registerApp
in interface IScribe
public void registerScribeObserver(IScribeObserver app)
registerScribeObserver
in interface IScribe
app
- The application interested in getting notified whenever
a topic is implicitly created.public void notifyReady()
notifyReady
in class PastryAppl
public void scheduleHB()
scheduleHB
in interface IScribe
public boolean isRoot(NodeId topicId)
public boolean create(NodeId topicId, Credentials cred)
create
in interface IScribe
cred
- The credentials of the entity creating the grouptopicId
- The ID of the group to be created
public boolean join(NodeId topicId, IScribeApp subscriber, Credentials cred)
join
in interface IScribe
subscriber
- The application joining the groupcred
- The credentials of the entity joining the grouptopicId
- The ID of the group to join to
public boolean join(NodeId topicId, IScribeApp subscriber, Credentials cred, java.io.Serializable obj)
join
in interface IScribe
cred
- The credentials of the entity joining the groupsubscriber
- The application joining the groupobj
- Additional data to be passed with the SUBSCRIBE msg, specific to
an application. Should be serializable.topicId
- The ID of the group to join to
public boolean leave(NodeId topicId, IScribeApp subscriber, Credentials cred)
leave
in interface IScribe
cred
- The credentials of the entity leaving the groupsubscriber
- The application leaving the group. Use null if
not directly called by an application.topicId
- The ID of the group to leave
public boolean multicast(NodeId topicId, java.io.Serializable obj, Credentials cred)
multicast
in interface IScribe
cred
- The credentials of the entity multicasting to the groupobj
- The information that is to be multicast.
This should be serializable.topicId
- The ID of the group to multicast.
public boolean anycast(NodeId groupID, java.io.Serializable obj, Credentials cred)
anycast
in interface IScribe
groupID
- The ID of the group to anycast.obj
- The information that is to be included in anycast message.
This should be serializable.cred
- The credentials of the entity anycasting to the group.
public boolean anycast(NodeId groupID, MessageAnycast anycastMessage, Credentials cred)
anycast
in interface IScribe
groupID
- The ID of the group to anycast.anycastMessage
- The anycast message created by application specific to its needs,
can decide how the message is going to be routed in the anycast
tree, how the message is going to be handled and so on.cred
- The credentials of the entity anycasting to the group.
public NodeId generateTopicId(java.lang.String topicName)
generateTopicId
in interface IScribe
topicName
- the name of the topic (unique to the local node)
public Address getAddress()
getAddress
in class PastryAppl
public Credentials getCredentials()
getCredentials
in class PastryAppl
public void messageForAppl(Message msg)
messageForAppl
in class PastryAppl
msg
- the message that is arriving.public boolean enrouteMessage(Message msg, Id target, NodeId nextHop, SendOptions opt)
enrouteMessage
in class PastryAppl
msg
- the message that is passing through.target
- the final destination node id.nextHop
- the next hop for the message.opt
- the send options the message was sent with.
public void leafSetChange(NodeHandle nh, boolean wasAdded)
leafSetChange
in class PastryAppl
nh
- the handle of the node that entered or left the leafset.wasAdded
- true if the node was added, false if it was removed.public NodeHandle getNodeHandle()
getNodeHandle
in class PastryAppl
public SendOptions getSendOptions()
public IScribeSecurityManager getSecurityManager()
public ScribeMessage makeSubscribeMessage(NodeId tid, Credentials c)
tid
- the topic id the message refers to.c
- the credentials that will be associated with the message
public ScribeMessage makeUnsubscribeMessage(NodeId tid, Credentials c)
tid
- the topic id the message reffers to.c
- the credentials that will be associated with the message
public ScribeMessage makeCreateMessage(NodeId tid, Credentials c)
tid
- the topic id the message reffers to.c
- the credentials that will be associated with the message
public ScribeMessage makePublishMessage(NodeId tid, Credentials c)
tid
- the topic id the message reffers to.c
- the credentials that will be associated with the message
public ScribeMessage makeAnycastMessage(NodeId tid, Credentials c)
tid
- the topic id the message reffers to.c
- the credentials that will be associated with the message
public ScribeMessage makeHeartBeatMessage(Credentials c)
c
- the credentials that will be associated with the message
public ScribeMessage makeAckOnSubscribeMessage(NodeId tid, Credentials c)
tid
- the topic id the message reffers to.c
- the credentials that will be associated with the message
public ScribeMessage makeAckOnSubscribeMessage(NodeId tid, Credentials c, java.io.Serializable data)
tid
- the topic id the message reffers to.c
- the credentials that will be associated with the messagedata
- the data to be shipped along the message
public ScribeMessage makeRequestToParentMessage(Credentials c)
c
- the credentials that will be associated with the message
public ScribeMessage makeReplyFromParentMessage(Credentials c)
c
- the credentials that will be associated with the message
public ScribeMessage makeScribeMaintenanceMessage(Credentials c)
c
- the credentials that will be associated with the message
public Topic getTopic(NodeId topicId)
topicId
- the topic id
public java.util.Vector getTopics()
public java.util.Vector getDistinctChildren()
public void addChildForTopic(NodeHandle child, NodeId topicId)
child
- The NodeHandle of ChildtopicId
- The topicId for the topic for which we are
adding this childpublic void removeChildForTopic(NodeHandle child, NodeId topicId)
child
- The NodeHandle of ChildtopicId
- The topicId for the topic for which we are
removing this childpublic java.util.Vector getTopicsForChild(NodeHandle child)
child
- The NodeHandle of child node.
public java.util.Vector getDistinctParents()
public void removeParentForTopic(NodeHandle parent, NodeId topicId)
parent
- The NodeHandle of ParenttopicId
- The topicId for the topic for which we are
removing this parentpublic void addParentForTopic(NodeHandle parent, NodeId topicId)
topicId
- The topicId for the topic for which we are
adding this parentpublic java.util.Vector getTopicsForParent(NodeHandle parent)
parent
- The NodeHandle of parent node.
public NodeId getFingerprintForParentTopics(NodeHandle parent)
public NodeId getFingerprintForChildTopics(NodeHandle child)
public boolean addChildToAlreadySentHBNodes(NodeId childId)
childId
- NodeId of child.
public java.util.Vector getAlreadySentHBNodes()
public void clearAlreadySentHBNodes()
public NodeHandle getLocalHandle()
public NodeHandle getParent(NodeId topicId)
getParent
in interface IScribe
topicId
- The id of the topic.
public boolean setParent(NodeHandle parent, NodeId topicId)
setParent
in interface IScribe
parent
- The new parent for the topictopicId
- the topic for which this parent is set
public java.util.Vector getChildren(NodeId topicId)
getChildren
in interface IScribe
topicId
- The id of the topic.
public void childObserver(NodeHandle child, NodeId topicId, boolean wasAdded, ScribeMessage pmsg, java.io.Serializable data)
child
- the child which was added/removedtopicId
- the topic for which child was added/removedwasAdded
- true if child was added, false if child was removed.data
- the data to be sent with the AckOnSubscribe Messagepublic int numChildren(NodeId topicId)
numChildren
in interface IScribe
topicId
- The id of the topic.
public boolean addChild(NodeHandle child, NodeId topicId)
addChild
in interface IScribe
child
- the child to be addedtopicId
- the topic for which this child is added
public boolean addChild(NodeHandle child, NodeId topicId, java.io.Serializable data)
child
- the child to be addedtopicId
- the topic for which this child is addeddata
- Serializable data
public boolean removeChild(NodeHandle child, NodeId topicId)
removeChild
in interface IScribe
child
- the child to be removedtopicId
- the topic for which this child is removed
public void notifyScribeObservers(NodeId topicId)
topicId
- topicId for which Topic data structure is
created (implicitly)public PastryNode getPastryNode()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |