Rice Pastry API

rice.p2p.scribe
Interface ScribePolicy

All Known Implementing Classes:
RawScribeRegrTest.TestScribePolicy, ScribePolicy.DefaultScribePolicy, ScribePolicy.LimitedScribePolicy, ScribeRegrTest.TestScribePolicy, SplitStreamScribePolicy

public interface ScribePolicy

Version:
$Id: ScribePolicy.java 3524 2007-01-09 14:09:27Z jeffh $
Author:
Alan Mislove

Nested Class Summary
static class ScribePolicy.DefaultScribePolicy
          The default policy for Scribe, which always allows new children to join and adds children in the order in which they are provided, implicitly providing a depth-first search.
static class ScribePolicy.LimitedScribePolicy
          An optional policy for Scribe, which allows up to a specified number of children per topic.
 
Method Summary
 boolean allowSubscribe(SubscribeMessage message, ScribeClient[] clients, NodeHandle[] children)
          This method is called when the newChild is about to become our child, and the policy should return whether or not the child should be allowed to become our child.
 void childAdded(Topic topic, NodeHandle child)
          Informs this policy that a child was added to a topic - the topic is free to ignore this upcall if it doesn't care.
 void childRemoved(Topic topic, NodeHandle child)
          Informs this policy that a child was removed from a topic - the topic is free to ignore this upcall if it doesn't care.
 void directAnycast(AnycastMessage message, NodeHandle parent, NodeHandle[] children)
          This method is called when an anycast is received which is not satisfied at the local node.
 

Method Detail

allowSubscribe

boolean allowSubscribe(SubscribeMessage message,
                       ScribeClient[] clients,
                       NodeHandle[] children)
This method is called when the newChild is about to become our child, and the policy should return whether or not the child should be allowed to become our child. If the length of children and clients is both 0, allowing the child to join will have the effect of implicitly subscribing this node the the given topic.

Parameters:
message - The subscribe message in question
children - The list of children who are currently subscribed to this topic
clients - The list of clients are are currently subscribed to this topic
Returns:
Whether or not this child should be allowed add.

directAnycast

void directAnycast(AnycastMessage message,
                   NodeHandle parent,
                   NodeHandle[] children)
This method is called when an anycast is received which is not satisfied at the local node. This method should add both the parent and child nodes to the anycast's to-search list, but this method allows different policies concerning the order of the adding as well as selectively adding nodes.

Parameters:
message - The anycast message in question
parent - Our current parent for this message's topic
children - Our current children for this message's topic

childAdded

void childAdded(Topic topic,
                NodeHandle child)
Informs this policy that a child was added to a topic - the topic is free to ignore this upcall if it doesn't care.

Parameters:
topic - The topic to unsubscribe from
child - The child that was added

childRemoved

void childRemoved(Topic topic,
                  NodeHandle child)
Informs this policy that a child was removed from a topic - the topic is free to ignore this upcall if it doesn't care.

Parameters:
topic - The topic to unsubscribe from
child - The child that was removed

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection