|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.p2p.scribe.ScribeImpl
public class ScribeImpl
Nested Class Summary | |
---|---|
class |
ScribeImpl.TopicManager
Class which keeps track of a given topic |
Field Summary | |
---|---|
protected Endpoint |
endpoint
this application's endpoint |
protected NodeHandle |
handle
the local node handle |
int |
MAINTENANCE_INTERVAL
The interval with which to perform maintenance |
int |
MESSAGE_TIMEOUT
the timeout for a subscribe message |
protected ScribePolicy |
policy
this scribe's policy |
java.util.Hashtable |
topics
the hashtable of topic -> TopicManager |
Constructor Summary | |
---|---|
ScribeImpl(Node node,
ScribePolicy policy,
java.lang.String instance)
Constructor for Scribe |
|
ScribeImpl(Node node,
java.lang.String instance)
Constructor for Scribe, using the default policy. |
Method Summary | |
---|---|
protected void |
ackMessageReceived(SubscribeAckMessage message)
Internal method which processes an ack message |
void |
addChild(Topic topic,
NodeHandle child)
Adds a child to the given topic |
protected void |
addChild(Topic topic,
NodeHandle child,
int id)
Adds a child to the given topic, using the specified sequence number in the ack message sent to the child. |
void |
anycast(Topic topic,
RawScribeContent content)
|
void |
anycast(Topic topic,
ScribeContent content)
Anycasts the given content to a member of the given topic |
void |
deliver(Id id,
Message message)
This method is called on the application at the destination node for the given id. |
void |
destroy()
|
boolean |
forward(RouteMessage message)
This method is invoked on applications when the underlying node is about to forward the given message with the provided target to the specified next hop. |
NodeHandle[] |
getChildren(Topic topic)
Returns the list of children for a given topic |
ScribeClient[] |
getClients(Topic topic)
Returns the list of clients for a given topic |
Environment |
getEnvironment()
|
Id |
getId()
Returns the Id of the local node |
NodeHandle |
getParent(Topic topic)
Returns the parent for a given topic |
ScribePolicy |
getPolicy()
Returns the current policy for this scribe object |
Topic[] |
getTopics(ScribeClient client)
Returns the list of topics the given client is subscribed to. |
boolean |
isRoot(Topic topic)
Returns whether or not this Scribe is the root for the given topic |
void |
publish(Topic topic,
RawScribeContent content)
|
void |
publish(Topic topic,
ScribeContent content)
Publishes the given message to the topic. |
void |
removeChild(Topic topic,
NodeHandle child)
Removes a child from the given topic |
protected void |
removeChild(Topic topic,
NodeHandle child,
boolean sendDrop)
Removes a child from the given topic |
void |
setContentDeserializer(ScribeContentDeserializer deserializer)
|
void |
setPolicy(ScribePolicy policy)
Sets the current policy for this scribe object |
void |
subscribe(Topic topic,
ScribeClient client)
Subscribes the given client to the provided topic. |
void |
subscribe(Topic topic,
ScribeClient client,
RawScribeContent content)
|
void |
subscribe(Topic topic,
ScribeClient client,
ScribeContent content)
Subscribes the given client to the provided topic. |
void |
unsubscribe(Topic topic,
ScribeClient client)
Unsubscribes the given client from the provided topic. |
void |
update(NodeHandle handle,
boolean joined)
This method is invoked to inform the application that the given node has either joined or left the neighbor set of the local node, as the set would be returned by the neighborSet call. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final int MAINTENANCE_INTERVAL
public final int MESSAGE_TIMEOUT
public java.util.Hashtable topics
protected ScribePolicy policy
protected Endpoint endpoint
protected NodeHandle handle
Constructor Detail |
---|
public ScribeImpl(Node node, java.lang.String instance)
node
- The node below this Scribe implementationinstance
- The unique instance name of this Scribepublic ScribeImpl(Node node, ScribePolicy policy, java.lang.String instance)
node
- The node below this Scribe implementationpolicy
- The policy for this Scribeinstance
- The unique instance name of this ScribeMethod Detail |
---|
public Environment getEnvironment()
getEnvironment
in interface Scribe
public ScribePolicy getPolicy()
getPolicy
in interface Scribe
public void setPolicy(ScribePolicy policy)
setPolicy
in interface Scribe
policy
- The current policy for this scribepublic Id getId()
public ScribeClient[] getClients(Topic topic)
topic
- The topic to return the clients of
public NodeHandle[] getChildren(Topic topic)
getChildren
in interface Scribe
topic
- The topic to return the children of
public NodeHandle getParent(Topic topic)
getParent
in interface Scribe
topic
- The topic to return the parent of
public boolean isRoot(Topic topic)
isRoot
in interface Scribe
topic
- The topic in question
protected void ackMessageReceived(SubscribeAckMessage message)
message
- The ackMessagepublic void subscribe(Topic topic, ScribeClient client)
subscribe
in interface Scribe
topic
- The topic to subscribe toclient
- The client to give messages topublic void subscribe(Topic topic, ScribeClient client, ScribeContent content)
subscribe
in interface Scribe
topic
- The topic to subscribe toclient
- The client to give messages tocontent
- The content to include in the subscribepublic void subscribe(Topic topic, ScribeClient client, RawScribeContent content)
subscribe
in interface Scribe
public void unsubscribe(Topic topic, ScribeClient client)
unsubscribe
in interface Scribe
topic
- The topic to unsubscribe fromclient
- The client to unsubscribepublic void publish(Topic topic, ScribeContent content)
publish
in interface Scribe
topic
- The topic to publish tocontent
- The content to publishpublic void publish(Topic topic, RawScribeContent content)
publish
in interface Scribe
public void anycast(Topic topic, ScribeContent content)
anycast
in interface Scribe
topic
- The topic to anycast tocontent
- The content to anycastpublic void anycast(Topic topic, RawScribeContent content)
anycast
in interface Scribe
public void addChild(Topic topic, NodeHandle child)
addChild
in interface Scribe
topic
- The topic to add the child tochild
- The child to addprotected void addChild(Topic topic, NodeHandle child, int id)
topic
- The topicchild
- THe child to addid
- THe seuqnce numberpublic void removeChild(Topic topic, NodeHandle child)
removeChild
in interface Scribe
topic
- The topic to remove the child fromchild
- The child to removeprotected void removeChild(Topic topic, NodeHandle child, boolean sendDrop)
topic
- The topic to remove the child fromchild
- The child to removesendDrop
- Whether or not to send a drop message to the chilpublic Topic[] getTopics(ScribeClient client)
getTopics
in interface Scribe
client
- The client in question
public boolean forward(RouteMessage message)
forward
in interface Application
message
- The message being sent, containing an internal message along with a destination
key and nodeHandle next hop.
public void deliver(Id id, Message message)
deliver
in interface Application
id
- The destination id of the messagemessage
- The message being sentpublic void update(NodeHandle handle, boolean joined)
update
in interface Application
handle
- The handle that has joined/leftjoined
- Whether the node has joined or leftpublic void destroy()
destroy
in interface Destructable
destroy
in interface Scribe
public void setContentDeserializer(ScribeContentDeserializer deserializer)
setContentDeserializer
in interface Scribe
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |