Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rice.p2p.scribe
Class ScribeImpl

    java.lang.Object
      rice.p2p.scribe.ScribeImpl

All Implemented Interfaces:
  java.util.Observer, Destructable, Application, BaseScribe, JavaScribe, MaintainableScribe, RawScribe, Scribe

    public class ScribeImpl

extends java.lang.Object
implements Scribe, MaintainableScribe, Application, java.util.Observer

Version:
  $Id: ScribeImpl.java 4098 2008-02-13 09:36:33Z jeffh $
Author:
  Alan Mislove

Nested Class Summary
`static class` | `ScribeImpl.ScribeClientConverter` Adapts an old ScribeClient to a new ScribeMultiClient This is for reverse compatibility.
`class` | `ScribeImpl.TopicManager` Class which keeps track of a given topic

Field Summary
`java.util.HashMap<NodeHandle,java.util.Collection<Topic>>` | `allChildren` This contains a mapping of child - > all topics for which the local node has this node(hashtable key) as a child
`java.util.HashMap<NodeHandle,java.util.Collection<Topic>>` | `allParents` This contains a mapping of parent - > all topics for which the local node has this node(hashtable key) as a parent
`protected Endpoint` | `endpoint` this application's endpoint
`static int` | `INFO_2`
`protected NodeHandle` | `localHandle` the local node handle
`int` | `MAINTENANCE_INTERVAL` The interval with which to perform maintenance
`int` | `MESSAGE_TIMEOUT` the timeout for a subscribe message
`protected Node` | `node`
`java.util.Set<Topic>` | `pending` Topics that (should) have an outsanding subscription.
`protected ScribePolicy` | `policy` this scribe's policy
`java.util.Set<Topic>` | `roots` Topics that we are the root.
`java.util.Hashtable<Topic,ScribeImpl.TopicManager>` | `topicManagers` the hashtable of topic -> TopicManager

Fields inherited from interface rice.p2p.scribe.maintenance.MaintainableScribe
`MAINTENANCE_ID`

Constructor Summary
`ScribeImpl(Node node, ScribePolicy policy, java.lang.String instance)` Constructor for Scribe
`ScribeImpl(Node node, ScribePolicy policy, java.lang.String instance, ScribeMaintenancePolicy maintenancePolicy)` 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 boolean` | `addChildHelper(Topic topic, NodeHandle child)` Adds a child to the given topic, using the specified sequence number in the ack message sent to the child.
`protected void` | `addToAllChildren(Topic t, NodeHandle child)` This method should be invoked after the state change in the Topic Manager has been made.
`protected void` | `addToAllParents(Topic t, NodeHandle parent)`
`boolean` | `allParentsContains(Topic t, NodeHandle parent)`
`boolean` | `allParentsContainsParent(NodeHandle parent)`
`void` | `anycast(Topic topic, RawScribeContent content)` Anycasts the given content to a member of the given topic
`void` | `anycast(Topic topic, RawScribeContent content, NodeHandle hint)` Anycasts the given content to a member of the given topic The hint helps us to implement centralized algorithms where the hint is the cachedRoot for the topic.
`void` | `anycast(Topic topic, ScribeContent content)` Anycasts the given content to a member of the given topic
`void` | `anycast(Topic topic, ScribeContent content, NodeHandle hint)` Anycasts the given content to a member of the given topic The hint helps us to implement centralized algorithms where the hint is the cachedRoot for the topic.
`boolean` | `containsChild(Topic topic, NodeHandle child)`
`boolean` | `containsTopic(Topic topic)` Returns true if there is a TopicManager associated with this topic (any parent/children/client exists)
`protected RawScribeContent` | `convert(ScribeContent content)`
`void` | `deliver(Id id, Message message)` This method is called on the application at the destination node for the given id.
`void` | `destroy()`
`protected void` | `doSubscribe(java.util.Collection<Topic> theTopics, ScribeMultiClient client, RawScribeContent content, NodeHandle hint)` This method prevents re-subscription to topics you are already a part of.
`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
`java.util.Collection<NodeHandle>` | `getChildrenOfTopic(Topic topic)`
`java.util.Collection<ScribeClient>` | `getClients(Topic topic)` Returns the list of clients for a given topic
`java.util.Collection<ScribeMultiClient>` | `getClientsByTopic(Topic topic)`
`ScribeContentDeserializer` | `getContentDeserializer()`
`Endpoint` | `getEndpoint()`
`Environment` | `getEnvironment()`
`Id` | `getId()` Returns the Id of the local node
`protected ScribeMultiClient` | `getMultiClient(ScribeClient client)`
`NodeHandle` | `getParent(Topic topic)` Returns the parent for a given topic
`java.util.List<Id>` | `getPathToRoot(Topic topic)`
`ScribePolicy` | `getPolicy()` Returns the current policy for this scribe object
`NodeHandle` | `getRoot(Topic topic)` Returns the root of the topic, if we can determine it.
`protected java.util.Collection<ScribeClient>` | `getSimpleClients(java.util.Collection<ScribeMultiClient> multi)`
`ScribeImpl.TopicManager` | `getTopicManager(Topic topic)` Lazy constructor.
`java.util.Collection<Topic>` | `getTopics()`
`Topic[]` | `getTopics(ScribeClient client)` Returns the list of topics the given client is subscribed to.
`java.util.Collection<Topic>` | `getTopicsByChild(NodeHandle child)` This returns the topics for which the parameter 'child' is a Scribe tree child of the local node
`java.util.Collection<Topic>` | `getTopicsByClient(ScribeClient client)` Returns the list of topics the given client is subscribed to.
`java.util.Collection<Topic>` | `getTopicsByClient(ScribeMultiClient client)`
`java.util.Collection<Topic>` | `getTopicsByParent(NodeHandle parent)` This returns the topics for which the parameter 'parent' is a Scribe tree parent of the local node
`protected boolean` | `handleForwardSubscribeMessage(SubscribeMessage sMessage)` This is complicated because the SubscribeMessage may have many topics to subscribe to at once.
`boolean` | `isRoot(Topic topic)` Returns whether or not this Scribe is the root for the given topic
`int` | `numChildren(Topic topic)`
`void` | `printAllChildrenDataStructure()`
`void` | `printAllParentsDataStructure()`
`void` | `publish(Topic topic, RawScribeContent content)` Publishes the given message to the topic.
`void` | `publish(Topic topic, ScribeContent content)` Publishes the given message to the topic.
`protected void` | `recvAnycastFail(Topic topic, NodeHandle failedAtNode, ScribeContent content)`
`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
`protected void` | `removeFromAllChildren(Topic t, NodeHandle child)` Need to be holding lock: topicManagers
`protected void` | `removeFromAllParents(Topic t, NodeHandle parent)`
`void` | `setContentDeserializer(ScribeContentDeserializer deserializer)`
`void` | `setParent(Topic topic, NodeHandle parent, java.util.List<Id> pathToRoot)`
`void` | `setPolicy(ScribePolicy policy)` Sets the current policy for this scribe object
`void` | `subscribe(java.util.Collection<Topic> topics)`
`void` | `subscribe(java.util.Collection<Topic> theTopics, ScribeClient client, RawScribeContent content, NodeHandle hint)` Subscribe to multiple topics.
`void` | `subscribe(java.util.Collection<Topic> theTopics, ScribeClient client, ScribeContent content, NodeHandle hint)` Subscribe to multiple topics.
`void` | `subscribe(java.util.Collection<Topic> theTopics, ScribeMultiClient client, RawScribeContent content, NodeHandle hint)`
`void` | `subscribe(java.util.Collection<Topic> theTopics, ScribeMultiClient client, ScribeContent content, NodeHandle hint)`
`void` | `subscribe(Topic topic, ScribeClient client)` Subscribes the given client to the provided topic.
`void` | `subscribe(Topic topic, ScribeClient client, RawScribeContent content)` Subscribes the given client to the provided topic.
`void` | `subscribe(Topic topic, ScribeClient client, RawScribeContent content, NodeHandle hint)` Subscribes the given client to the provided topic.
`void` | `subscribe(Topic topic, ScribeClient client, ScribeContent content)` Subscribes the given client to the provided topic.
`void` | `subscribe(Topic topic, ScribeClient client, ScribeContent content, NodeHandle hint)` Subscribes the given client to the provided topic.
`void` | `subscribe(Topic topic, ScribeMultiClient client)` Subscribes the given client to the provided topic.
`void` | `subscribe(Topic topic, ScribeMultiClient client, RawScribeContent content, NodeHandle hint)`
`void` | `subscribe(Topic topic, ScribeMultiClient client, ScribeContent content, NodeHandle hint)`
`protected RawScribeContent` | `toRawScribeContent(ScribeContent content)`
`java.lang.String` | `toString()`
`void` | `unsubscribe(java.util.Collection<Topic> topicsToUnsubscribe, ScribeMultiClient client)` This code: for each Topic: 1) removes the client from the TopicManager 2)
`void` | `unsubscribe(Topic topic, ScribeClient client)` Unsubscribes the given client from the provided topic.getId
`void` | `unsubscribe(Topic topic, ScribeMultiClient client)`
`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.
`void` | `update(java.util.Observable o, java.lang.Object arg)` Called when a Node's liveness changes

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### INFO_2

    public static final int INFO_2

See Also:
  Constant Field Values

### MAINTENANCE_INTERVAL

    public final int MAINTENANCE_INTERVAL

  The interval with which to perform maintenance

### MESSAGE_TIMEOUT

    public final int MESSAGE_TIMEOUT

  the timeout for a subscribe message

### topicManagers

    public java.util.Hashtable<Topic,ScribeImpl.TopicManager> topicManagers

  the hashtable of topic -> TopicManager

### policy

    protected ScribePolicy policy

  this scribe's policy

### endpoint

    protected Endpoint endpoint

  this application's endpoint

### localHandle

    protected NodeHandle localHandle

  the local node handle

### node

    protected Node node

### allChildren

    public java.util.HashMap<NodeHandle,java.util.Collection<Topic>> allChildren

  This contains a mapping of child - > all topics for which the local node has this node(hashtable key) as a child

### allParents

    public java.util.HashMap<NodeHandle,java.util.Collection<Topic>> allParents

  This contains a mapping of parent - > all topics for which the local node has this node(hashtable key) as a parent

### roots

    public java.util.Set<Topic> roots

  Topics that we are the root.

### pending

    public java.util.Set<Topic> pending

  Topics that (should) have an outsanding subscription. Topics that are in this set have no parent, and we are not the root.

Constructor Detail

### ScribeImpl

    public ScribeImpl(Node node,
                      java.lang.String instance)

  Constructor for Scribe, using the default policy.

  Parameters:
    `node` - The node below this Scribe implementation
    `instance` - The unique instance name of this Scribe

### ScribeImpl

    public ScribeImpl(Node node,
                      ScribePolicy policy,
                      java.lang.String instance)

  Constructor for Scribe

  Parameters:
    `node` - The node below this Scribe implementation
    `policy` - The policy for this Scribe
    `instance` - The unique instance name of this Scribe

### ScribeImpl

    public ScribeImpl(Node node,
                      ScribePolicy policy,
                      java.lang.String instance,
                      ScribeMaintenancePolicy maintenancePolicy)

  Constructor for Scribe

  Parameters:
    `node` - The node below this Scribe implementation
    `policy` - The policy for this Scribe
    `instance` - The unique instance name of this Scribe

Method Detail

### getEnvironment

    public Environment getEnvironment()

  Specified by:
    `getEnvironment` in interface `BaseScribe`

### getPolicy

    public ScribePolicy getPolicy()

  Returns the current policy for this scribe object

  Specified by:
    `getPolicy` in interface `BaseScribe`
  Returns:
    The current policy for this scribe

### setPolicy

    public void setPolicy(ScribePolicy policy)

  Sets the current policy for this scribe object

  Specified by:
    `setPolicy` in interface `BaseScribe`
  Parameters:
    `policy` - The current policy for this scribe

### getId

    public Id getId()

  Returns the Id of the local node

  Returns:
    The Id of the local node

### numChildren

    public int numChildren(Topic topic)

  Specified by:
    `numChildren` in interface `BaseScribe`

### containsTopic

    public boolean containsTopic(Topic topic)

  Returns true if there is a TopicManager associated with this topic (any parent/children/client exists)

  Specified by:
    `containsTopic` in interface `BaseScribe`

### getClients

    public java.util.Collection<ScribeClient> getClients(Topic topic)

  Returns the list of clients for a given topic

  Specified by:
    `getClients` in interface `BaseScribe`
  Parameters:
    `topic` - The topic to return the clients of
  Returns:
    The clients of the topic

### getClientsByTopic

    public java.util.Collection<ScribeMultiClient> getClientsByTopic(Topic topic)

  Specified by:
    `getClientsByTopic` in interface `BaseScribe`

### getSimpleClients

    protected java.util.Collection<ScribeClient> getSimpleClients(java.util.Collection<ScribeMultiClient> multi)

### getMultiClient

    protected ScribeMultiClient getMultiClient(ScribeClient client)

### getChildren

    public NodeHandle[] getChildren(Topic topic)

  Returns the list of children for a given topic

  Specified by:
    `getChildren` in interface `BaseScribe`
  Parameters:
    `topic` - The topic to return the children of
  Returns:
    The children of the topic

### getChildrenOfTopic

    public java.util.Collection<NodeHandle> getChildrenOfTopic(Topic topic)

  Specified by:
    `getChildrenOfTopic` in interface `BaseScribe`

### getParent

    public NodeHandle getParent(Topic topic)

  Returns the parent for a given topic

  Specified by:
    `getParent` in interface `BaseScribe`
  Parameters:
    `topic` - The topic to return the parent of
  Returns:
    The parent of the topic

### isRoot

    public boolean isRoot(Topic topic)

  Returns whether or not this Scribe is the root for the given topic

  Specified by:
    `isRoot` in interface `BaseScribe`
  Parameters:
    `topic` - The topic in question
  Returns:
    Whether or not we are currently the root

### getRoot

    public NodeHandle getRoot(Topic topic)

  Description copied from interface: `BaseScribe`
  Returns the root of the topic, if we can determine it.

  Specified by:
    `getRoot` in interface `BaseScribe`
  Returns:
    null if beyound our knowledge range

### ackMessageReceived

    protected void ackMessageReceived(SubscribeAckMessage message)

  Internal method which processes an ack message

  Parameters:
    `message` - The ackMessage

### containsChild

    public boolean containsChild(Topic topic,
                                 NodeHandle child)

  Specified by:
    `containsChild` in interface `BaseScribe`

### subscribe

    public void subscribe(java.util.Collection<Topic> topics)

### subscribe

    public void subscribe(Topic topic,
                          ScribeMultiClient client)

  Subscribes the given client to the provided topic. Any message published to the topic will be delivered to the Client via the deliver() method.

  Parameters:
    `topic` - The topic to subscribe to
    `client` - The client to give messages to

### subscribe

    public void subscribe(Topic topic,
                          ScribeClient client)

  Subscribes the given client to the provided topic. Any message published to the topic will be delivered to the Client via the deliver() method.

  Specified by:
    `subscribe` in interface `BaseScribe`
  Parameters:
    `topic` - The topic to subscribe to
    `client` - The client to give messages to

### subscribe

    public void subscribe(Topic topic,
                          ScribeClient client,
                          ScribeContent content)

  Description copied from interface: `JavaScribe`
  Subscribes the given client to the provided topic. Any message published to the topic will be delivered to the Client via the deliver() method.

  Specified by:
    `subscribe` in interface `JavaScribe`
  Parameters:
    `topic` - The topic to subscribe to
    `client` - The client to give messages to
    `content` - The content to include in the subscribe

### subscribe

    public void subscribe(Topic topic,
                          ScribeClient client,
                          ScribeContent content,
                          NodeHandle hint)

  Description copied from interface: `JavaScribe`
  Subscribes the given client to the provided topic. Any message published to the topic will be delivered to the Client via the deliver() method.

  Specified by:
    `subscribe` in interface `JavaScribe`
  Parameters:
    `topic` - The topic to subscribe to
    `client` - The client to give messages to
    `content` - The content to include in the subscribe
    `hint` - The first hop of the message ( Helpful to implement a centralized solution)

### subscribe

    public void subscribe(Topic topic,
                          ScribeClient client,
                          RawScribeContent content)

  Description copied from interface: `RawScribe`
  Subscribes the given client to the provided topic. Any message published to the topic will be delivered to the Client via the deliver() method.

  Specified by:
    `subscribe` in interface `RawScribe`
  Parameters:
    `topic` - The topic to subscribe to
    `client` - The client to give messages to
    `content` - The content to include in the subscribe

### subscribe

    public void subscribe(Topic topic,
                          ScribeClient client,
                          RawScribeContent content,
                          NodeHandle hint)

  Description copied from interface: `RawScribe`
  Subscribes the given client to the provided topic. Any message published to the topic will be delivered to the Client via the deliver() method.

  Specified by:
    `subscribe` in interface `RawScribe`
  Parameters:
    `topic` - The topic to subscribe to
    `client` - The client to give messages to
    `content` - The content to include in the subscribe
    `hint` - The first hop of the message ( Helpful to implement a centralized solution)

### subscribe

    public void subscribe(java.util.Collection<Topic> theTopics,
                          ScribeClient client,
                          RawScribeContent content,
                          NodeHandle hint)

  Description copied from interface: `RawScribe`
  Subscribe to multiple topics.

  Specified by:
    `subscribe` in interface `RawScribe`
    `hint` - the first hop

### subscribe

    public void subscribe(java.util.Collection<Topic> theTopics,
                          ScribeClient client,
                          ScribeContent content,
                          NodeHandle hint)

  Description copied from interface: `JavaScribe`
  Subscribe to multiple topics.

  Specified by:
    `subscribe` in interface `JavaScribe`

### subscribe

    public void subscribe(Topic topic,
                          ScribeMultiClient client,
                          ScribeContent content,
                          NodeHandle hint)

  Specified by:
    `subscribe` in interface `JavaScribe`

### subscribe

    public void subscribe(Topic topic,
                          ScribeMultiClient client,
                          RawScribeContent content,
                          NodeHandle hint)

  Specified by:
    `subscribe` in interface `RawScribe`

### subscribe

    public void subscribe(java.util.Collection<Topic> theTopics,
                          ScribeMultiClient client,
                          ScribeContent content,
                          NodeHandle hint)

  Specified by:
    `subscribe` in interface `JavaScribe`

### subscribe

    public void subscribe(java.util.Collection<Topic> theTopics,
                          ScribeMultiClient client,
                          RawScribeContent content,
                          NodeHandle hint)

  Specified by:
    `subscribe` in interface `MaintainableScribe`
  Specified by:
    `subscribe` in interface `RawScribe`

### toRawScribeContent

    protected RawScribeContent toRawScribeContent(ScribeContent content)

### doSubscribe

    protected void doSubscribe(java.util.Collection<Topic> theTopics,
                               ScribeMultiClient client,
                               RawScribeContent content,
                               NodeHandle hint)

  This method prevents re-subscription to topics you are already a part of. However it allows subscription if you were the root, but there is now a root.

  Parameters:
    `theTopics` -
    `client` -
    `content` -
    `hint` -

### unsubscribe

    public void unsubscribe(Topic topic,
                            ScribeClient client)

  Unsubscribes the given client from the provided topic.getId

  Specified by:
    `unsubscribe` in interface `BaseScribe`
  Parameters:
    `topic` - The topic to unsubscribe from
    `client` - The client to unsubscribe

### unsubscribe

    public void unsubscribe(Topic topic,
                            ScribeMultiClient client)

  Specified by:
    `unsubscribe` in interface `BaseScribe`

### unsubscribe

    public void unsubscribe(java.util.Collection<Topic> topicsToUnsubscribe,
                            ScribeMultiClient client)

  This code: for each Topic: 1) removes the client from the TopicManager 2)

  Specified by:
    `unsubscribe` in interface `BaseScribe`

### publish

    public void publish(Topic topic,
                        ScribeContent content)

  Publishes the given message to the topic.

  Specified by:
    `publish` in interface `JavaScribe`
  Parameters:
    `topic` - The topic to publish to
    `content` - The content to publish

### publish

    public void publish(Topic topic,
                        RawScribeContent content)

  Description copied from interface: `RawScribe`
  Publishes the given message to the topic.

  Specified by:
    `publish` in interface `RawScribe`
  Parameters:
    `topic` - The topic to publish to
    `content` - The content to publish

### anycast

    public void anycast(Topic topic,
                        ScribeContent content)

  Anycasts the given content to a member of the given topic

  Specified by:
    `anycast` in interface `JavaScribe`
  Parameters:
    `topic` - The topic to anycast to
    `content` - The content to anycast

### anycast

    public void anycast(Topic topic,
                        ScribeContent content,
                        NodeHandle hint)

  Description copied from interface: `JavaScribe`
  Anycasts the given content to a member of the given topic The hint helps us to implement centralized algorithms where the hint is the cachedRoot for the topic. Additionally it enables us to do more fancy anycasts that explore more portions of the Scribe tree

  Specified by:
    `anycast` in interface `JavaScribe`
  Parameters:
    `topic` - The topic to anycast to
    `content` - The content to anycast
    `hint` - the first hop of the Anycast

### anycast

    public void anycast(Topic topic,
                        RawScribeContent content)

  Description copied from interface: `RawScribe`
  Anycasts the given content to a member of the given topic

  Specified by:
    `anycast` in interface `RawScribe`
  Parameters:
    `topic` - The topic to anycast to
    `content` - The content to anycast

### anycast

    public void anycast(Topic topic,
                        RawScribeContent content,
                        NodeHandle hint)

  Description copied from interface: `RawScribe`
  Anycasts the given content to a member of the given topic The hint helps us to implement centralized algorithms where the hint is the cachedRoot for the topic. Additionally it enables us to do more fancy anycasts that explore more portions of the Scribe tree

  Specified by:
    `anycast` in interface `RawScribe`
  Parameters:
    `topic` - The topic to anycast to
    `content` - The content to anycast
    `hint` - the first hop of the Anycast

### addChild

    public void addChild(Topic topic,
                         NodeHandle child)

  Adds a child to the given topic

  Specified by:
    `addChild` in interface `BaseScribe`
  Parameters:
    `topic` - The topic to add the child to
    `child` - The child to add

### setParent

    public void setParent(Topic topic,
                          NodeHandle parent,
                          java.util.List<Id> pathToRoot)

  Specified by:
    `setParent` in interface `MaintainableScribe`

### getTopicManager

    public ScribeImpl.TopicManager getTopicManager(Topic topic)

  Lazy constructor.

  Parameters:
    `topic` -
  Returns:
    never null

### addChildHelper

    protected boolean addChildHelper(Topic topic,
                                     NodeHandle child)

  Adds a child to the given topic, using the specified sequence number in the ack message sent to the child.

  Parameters:
    `topic` - The topic
    `child` - THe child to add
    `id` - THe seuqnce number
  Returns:
    true if we need to subscribe to this topic because implicitly subscribing

### removeChild

    public void removeChild(Topic topic,
                            NodeHandle child)

  Removes a child from the given topic

  Specified by:
    `removeChild` in interface `BaseScribe`
  Parameters:
    `topic` - The topic to remove the child from
    `child` - The child to remove

### removeChild

    protected void removeChild(Topic topic,
                               NodeHandle child,
                               boolean sendDrop)

  Removes a child from the given topic

  Parameters:
    `topic` - The topic to remove the child from
    `child` - The child to remove
    `sendDrop` - Whether or not to send a drop message to the chil

### getTopicsByClient

    public java.util.Collection<Topic> getTopicsByClient(ScribeClient client)

  Returns the list of topics the given client is subscribed to.

  Specified by:
    `getTopicsByClient` in interface `BaseScribe`
  Parameters:
    `client` - The client in question
  Returns:
    The list of topics

### getTopicsByClient

    public java.util.Collection<Topic> getTopicsByClient(ScribeMultiClient client)

  Specified by:
    `getTopicsByClient` in interface `BaseScribe`

### getTopics

    public Topic[] getTopics(ScribeClient client)

  Description copied from interface: `BaseScribe`
  Returns the list of topics the given client is subscribed to.

  Specified by:
    `getTopics` in interface `BaseScribe`
  Parameters:
    `client` - The client in question
  Returns:
    The list of topics

### recvAnycastFail

    protected void recvAnycastFail(Topic topic,
                                   NodeHandle failedAtNode,
                                   ScribeContent content)

### addToAllChildren

    protected void addToAllChildren(Topic t,
                                    NodeHandle child)

  This method should be invoked after the state change in the Topic Manager has been made. This helps us to know the current state of the system and thus generate WARNING messages only in cases of redundancy Need to be holding lock: topicManagers

  Parameters:
    `t` -
    `child` -

### removeFromAllChildren

    protected void removeFromAllChildren(Topic t,
                                         NodeHandle child)

  Need to be holding lock: topicManagers

  Parameters:
    `t` -
    `child` -

### addToAllParents

    protected void addToAllParents(Topic t,
                                   NodeHandle parent)

### removeFromAllParents

    protected void removeFromAllParents(Topic t,
                                        NodeHandle parent)

### allParentsContains

    public boolean allParentsContains(Topic t,
                                      NodeHandle parent)

### allParentsContainsParent

    public boolean allParentsContainsParent(NodeHandle parent)

### printAllParentsDataStructure

    public void printAllParentsDataStructure()

### printAllChildrenDataStructure

    public void printAllChildrenDataStructure()

### getTopicsByParent

    public java.util.Collection<Topic> getTopicsByParent(NodeHandle parent)

  Description copied from interface: `MaintainableScribe`
  This returns the topics for which the parameter 'parent' is a Scribe tree parent of the local node

  Specified by:
    `getTopicsByParent` in interface `MaintainableScribe`
  Parameters:
    `parent` - null/localHandle for topics rooted by us

### getTopicsByChild

    public java.util.Collection<Topic> getTopicsByChild(NodeHandle child)

  Description copied from interface: `MaintainableScribe`
  This returns the topics for which the parameter 'child' is a Scribe tree child of the local node

  Specified by:
    `getTopicsByChild` in interface `MaintainableScribe`

### forward

    public 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. Applications can change the contents of the message, specify a different nextHop (through re-routing), or completely terminate the message.

  Specified by:
    `forward` in interface `Application`
  Parameters:
    `message` - The message being sent, containing an internal message along with a destination key and nodeHandle next hop.
  Returns:
    Whether or not to forward the message further

### handleForwardSubscribeMessage

    protected boolean handleForwardSubscribeMessage(SubscribeMessage sMessage)

  This is complicated because the SubscribeMessage may have many topics to subscribe to at once. Also, for every topic we don't accept, we must branch the SubscribeMessage based on the routing table.

  Parameters:
    `sMessage` -
  Returns:
    true if it needs to be forward, false if we handled it

### deliver

    public void deliver(Id id,
                        Message message)

  This method is called on the application at the destination node for the given id.

  Specified by:
    `deliver` in interface `Application`
  Parameters:
    `id` - The destination id of the message
    `message` - The message being sent

### convert

    protected RawScribeContent convert(ScribeContent content)

### update

    public void update(java.util.Observable o,
                       java.lang.Object arg)

  Called when a Node's liveness changes

  Specified by:
    `update` in interface `java.util.Observer`

### update

    public 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.

  Specified by:
    `update` in interface `Application`
  Parameters:
    `handle` - The handle that has joined/left
    `joined` - Whether the node has joined or left

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### destroy

    public void destroy()

  Specified by:
    `destroy` in interface `Destructable`

### getEndpoint

    public Endpoint getEndpoint()

  Specified by:
    `getEndpoint` in interface `MaintainableScribe`

### setContentDeserializer

    public void setContentDeserializer(ScribeContentDeserializer deserializer)

  Specified by:
    `setContentDeserializer` in interface `RawScribe`

### getContentDeserializer

    public ScribeContentDeserializer getContentDeserializer()

  Specified by:
    `getContentDeserializer` in interface `RawScribe`

### getTopics

    public java.util.Collection<Topic> getTopics()

  Specified by:
    `getTopics` in interface `MaintainableScribe`

### getPathToRoot

    public java.util.List<Id> getPathToRoot(Topic topic)

  Specified by:
    `getPathToRoot` in interface `MaintainableScribe`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.