Rice Pastry API

rice.p2p.scribe
Interface Scribe

All Superinterfaces:
Destructable
All Known Implementing Classes:
ScribeImpl

public interface Scribe
extends Destructable

Version:
$Id: Scribe.java 3650 2007-03-18 19:33:01Z jeffh $
Author:
Alan Mislove

Method Summary
 void addChild(Topic topic, NodeHandle child)
          Adds a child to the given topic
 void anycast(Topic topic, RawScribeContent content)
           
 void anycast(Topic topic, RawScribeContent content, NodeHandle hint)
           
 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 myTopic, NodeHandle child)
           
 boolean containsTopic(Topic myTopic)
          Returns true if there is a TopicManager object corresponding to this topic
 void destroy()
           
 NodeHandle[] getChildren(Topic topic)
          Returns the list of children for a given topic
 ScribeContentDeserializer getContentDeserializer()
           
 Environment getEnvironment()
           
 NodeHandle getParent(Topic myTopic)
          Returns the parent node 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
 int numChildren(Topic 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
 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, RawScribeContent content, NodeHandle hint)
           
 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.
 Topic[] topicsAsChild(NodeHandle child)
          This returns the topics for which the parameter 'child' is a Scribe tree child of the local node
 Topic[] topicsAsParent(NodeHandle parent)
          This returns the topics for which the parameter 'parent' is a Scribe tree parent of the local node
 void unsubscribe(Topic topic, ScribeClient client)
          Unsubscribes the given client from the provided topic.
 

Method Detail

subscribe

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.

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

subscribe

void subscribe(Topic topic,
               ScribeClient client,
               ScribeContent content)
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
content - The content to include in the subscribe

subscribe

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

subscribe

void subscribe(Topic topic,
               ScribeClient client,
               ScribeContent content,
               NodeHandle hint)
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
content - The content to include in the subscribe
hint - The first hop of the message ( Helpful to implement a centralized solution)

subscribe

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

unsubscribe

void unsubscribe(Topic topic,
                 ScribeClient client)
Unsubscribes the given client from the provided topic.

Parameters:
topic - The topic to unsubscribe from
client - The client to unsubscribe

addChild

void addChild(Topic topic,
              NodeHandle child)
Adds a child to the given topic

Parameters:
topic - The topic to add the child to
child - The child to add

removeChild

void removeChild(Topic topic,
                 NodeHandle child)
Removes a child from the given topic

Parameters:
topic - The topic to remove the child from
child - The child to remove

publish

void publish(Topic topic,
             ScribeContent content)
Publishes the given message to the topic.

Parameters:
topic - The topic to publish to
content - The content to publish

publish

void publish(Topic topic,
             RawScribeContent content)

anycast

void anycast(Topic topic,
             ScribeContent content)
Anycasts the given content to a member of the given topic

Parameters:
topic - The topic to anycast to
content - The content to anycast

anycast

void anycast(Topic topic,
             RawScribeContent content)

anycast

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. Additionally it enables us to do more fancy anycasts that explore more portions of the Scribe tree

Parameters:
topic - The topic to anycast to
content - The content to anycast
hint - the first hop of the Anycast

anycast

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

isRoot

boolean isRoot(Topic topic)
Returns whether or not this Scribe is the root for the given topic

Parameters:
topic - The topic in question
Returns:
Whether or not we are currently the root

getChildren

NodeHandle[] getChildren(Topic topic)
Returns the list of children for a given topic

Parameters:
topic - The topic to return the children of
Returns:
The children of the topic

getParent

NodeHandle getParent(Topic myTopic)
Returns the parent node for a given topic

Parameters:
myTopic - The topic to return the parent of
Returns:
The parent of the topic

getTopics

Topic[] getTopics(ScribeClient client)
Returns the list of topics the given client is subscribed to.

Parameters:
client - The client in question
Returns:
The list of topics

topicsAsParent

Topic[] topicsAsParent(NodeHandle parent)
This returns the topics for which the parameter 'parent' is a Scribe tree parent of the local node


topicsAsChild

Topic[] topicsAsChild(NodeHandle child)
This returns the topics for which the parameter 'child' is a Scribe tree child of the local node


numChildren

int numChildren(Topic topic)

containsTopic

boolean containsTopic(Topic myTopic)
Returns true if there is a TopicManager object corresponding to this topic


containsChild

boolean containsChild(Topic myTopic,
                      NodeHandle child)

getPolicy

ScribePolicy getPolicy()
Returns the current policy for this scribe object

Returns:
The current policy for this scribe

setPolicy

void setPolicy(ScribePolicy policy)
Sets the current policy for this scribe object

Parameters:
policy - The current policy for this scribe

getEnvironment

Environment getEnvironment()

destroy

void destroy()
Specified by:
destroy in interface Destructable

setContentDeserializer

void setContentDeserializer(ScribeContentDeserializer deserializer)

getContentDeserializer

ScribeContentDeserializer getContentDeserializer()

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.