|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.p2p.splitstream.SplitStreamScribePolicy
public class SplitStreamScribePolicy
This class represents SplitStream's policy for Scribe, which only allows children according to the bandwidth manager and makes anycasts first traverse all nodes who have the stripe in question as their primary stripe, and then the nodes who do not.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface rice.p2p.scribe.ScribePolicy |
---|
ScribePolicy.DefaultScribePolicy, ScribePolicy.LimitedScribePolicy |
Field Summary | |
---|---|
int |
DEFAULT_MAXIMUM_CHILDREN
The default maximum number of children per channel |
protected java.util.Hashtable |
policy
A mapping from channelId -> maximum children |
protected Scribe |
scribe
A reference to this policy's scribe object |
protected SplitStream |
splitStream
A reference to this policy's splitstream object |
Constructor Summary | |
---|---|
SplitStreamScribePolicy(Scribe scribe,
SplitStream splitStream)
Constructor which takes a splitStream object |
Method Summary | |
---|---|
boolean |
allowSubscribe(SubscribeMessage message,
ScribeClient[] clients,
NodeHandle[] children)
This method implements the "locating parent" algorithm of SplitStream. |
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 adds the parent and child in such a way that the nodes who have this stripe as their primary strpe are examined first. |
NodeHandle |
freeBandwidth(Channel channel,
NodeHandle newChild,
Id stripeId)
This method attempts to free bandwidth from our primary stripe. |
java.util.Vector |
freeBandwidthUltimate(Id stripeId)
This method makes an attempt to free up bandwidth from non-primary, non-root stripes (for which local node is not root). |
int |
getMaxChildren(ChannelId id)
Gets the max bandwidth for a channel. |
static int |
getPrefixMatch(Id target,
Id sample,
int digitLength)
Helper method for finding prefix match between two Ids. |
int |
getTotalChildren(Channel channel)
Returns the total number of children for the given channel |
void |
setMaxChildren(ChannelId id,
int children)
Adjust the max bandwidth for this channel. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final int DEFAULT_MAXIMUM_CHILDREN
protected SplitStream splitStream
protected Scribe scribe
protected java.util.Hashtable policy
Constructor Detail |
---|
public SplitStreamScribePolicy(Scribe scribe, SplitStream splitStream)
splitStream
- The local splitstreamMethod Detail |
---|
public int getMaxChildren(ChannelId id)
id
- The id to get the max bandwidth of
public void setMaxChildren(ChannelId id, int children)
id
- The id to get the max bandwidth ofchildren
- The new maximum bandwidth for this channelpublic boolean allowSubscribe(SubscribeMessage message, ScribeClient[] clients, NodeHandle[] children)
allowSubscribe
in interface ScribePolicy
message
- The subscribe message in questionchildren
- The list of children who are currently subscribed to this topicclients
- The list of clients are are currently subscribed to this topic
public void directAnycast(AnycastMessage message, NodeHandle parent, NodeHandle[] children)
directAnycast
in interface ScribePolicy
message
- The anycast message in questionparent
- Our current parent for this message's topicchildren
- Our current children for this message's topicpublic int getTotalChildren(Channel channel)
channel
- The channel to get the children for
public java.util.Vector freeBandwidthUltimate(Id stripeId)
public NodeHandle freeBandwidth(Channel channel, NodeHandle newChild, Id stripeId)
public static int getPrefixMatch(Id target, Id sample, int digitLength)
public void childAdded(Topic topic, NodeHandle child)
childAdded
in interface ScribePolicy
topic
- The topic to unsubscribe fromchild
- The child that was addedpublic void childRemoved(Topic topic, NodeHandle child)
childRemoved
in interface ScribePolicy
topic
- The topic to unsubscribe fromchild
- The child that was removed
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |