|
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.ScribePolicy.DefaultScribePolicy 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<ChannelId,java.lang.Integer> |
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 |
Fields inherited from class rice.p2p.scribe.ScribePolicy.DefaultScribePolicy |
---|
environment |
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,
java.util.Collection<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 |
intermediateNode(ScribeMessage message)
This is invoked whenever this message arrives on any overlay node, this gives the ScribeClient's power to tap into some datastructures they might wanna edit |
void |
recvAnycastFail(Topic topic,
NodeHandle failedAtNode,
ScribeContent content)
This notifies us when we receive a failure for a anycast |
void |
setMaxChildren(ChannelId id,
int children)
Adjust the max bandwidth for this channel. |
Methods inherited from class rice.p2p.scribe.ScribePolicy.DefaultScribePolicy |
---|
allowSubscribe, divideContent |
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<ChannelId,java.lang.Integer> 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 class ScribePolicy.DefaultScribePolicy
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, java.util.Collection<NodeHandle> children)
directAnycast
in interface ScribePolicy
directAnycast
in class ScribePolicy.DefaultScribePolicy
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
childAdded
in class ScribePolicy.DefaultScribePolicy
topic
- The topic to unsubscribe fromchild
- The child that was addedpublic void childRemoved(Topic topic, NodeHandle child)
childRemoved
in interface ScribePolicy
childRemoved
in class ScribePolicy.DefaultScribePolicy
topic
- The topic to unsubscribe fromchild
- The child that was removedpublic void intermediateNode(ScribeMessage message)
ScribePolicy
intermediateNode
in interface ScribePolicy
intermediateNode
in class ScribePolicy.DefaultScribePolicy
public void recvAnycastFail(Topic topic, NodeHandle failedAtNode, ScribeContent content)
ScribePolicy
recvAnycastFail
in interface ScribePolicy
recvAnycastFail
in class ScribePolicy.DefaultScribePolicy
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |