|
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.Stripe
public class Stripe
This class encapsulates all data about an individual stripe. It is the basic unit in the system. It is rooted at the stripeId for the stripe. It is through the stripe that data is sent. It can be subscribed to in which case data is recieved or it can be unsubscribed from. A stripe can have some number of children and controlling this is the way that bandwidth is controlled. If a stripe is dropped then it searches for a new parent.
Field Summary | |
---|---|
protected Channel |
channel
This stripe's channel |
protected java.util.Vector |
clients
The list of SplitStreamClients interested in data from this client |
protected java.util.Hashtable |
failed
The count of failed subscribe messages |
protected java.lang.String |
instance
|
protected boolean |
isPrimary
A flag whether or not this stripe is the primary stripe for this node |
int |
MAX_FAILED_SUBSCRIPTION
The maximum number of failed subscriptions |
protected Scribe |
scribe
The scribe object |
protected StripeId |
stripeId
The stripeId for this stripe |
protected Topic |
topic
The topic corresponding to this stripeId |
Constructor Summary | |
---|---|
Stripe(StripeId stripeId,
Scribe scribe,
java.lang.String instance,
Channel channel,
int maxFailedSubscriptions)
The constructor used when creating a stripe from scratch. |
Method Summary | |
---|---|
boolean |
anycast(Topic topic,
ScribeContent content)
This method is invoked when an anycast is received for a topic which this client is interested in. |
void |
childAdded(Topic topic,
NodeHandle child)
Informs this client that a child was added to a topic in which it was interested in. |
void |
childRemoved(Topic topic,
NodeHandle child)
Informs this client that a child was removed from a topic in which it was interested in. |
void |
deliver(Topic topic,
ScribeContent content)
This method is invoked when a message is delivered for a topic this client is interested in. |
NodeHandle[] |
getChildren()
Utility method. |
NodeHandle |
getParent()
Utility method. |
StripeId |
getStripeId()
gets the StripeID for this stripe |
boolean |
isPrimary()
Returns whether or not this stripe is the primary stripe for the local node |
boolean |
isRoot()
Utility method. |
boolean |
isSubscribed()
get the state of the Stripe |
void |
publish(byte[] data)
Publishes the given data to this stripe |
void |
subscribe(SplitStreamClient client)
Adds a client to this stripe - the client will be informed whenever data arrives for this stripe |
void |
subscribeFailed(Topic topic)
Informs this client that a subscription failed |
java.lang.String |
toString()
Returns a String representation of this Stripe |
void |
unsubscribe(SplitStreamClient client)
Removes a client from this stripe - the client will no longer be informed whenever data arrives for this stripe |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final int MAX_FAILED_SUBSCRIPTION
protected StripeId stripeId
protected Topic topic
protected Scribe scribe
protected boolean isPrimary
protected java.util.Vector clients
protected Channel channel
protected java.util.Hashtable failed
protected java.lang.String instance
Constructor Detail |
---|
public Stripe(StripeId stripeId, Scribe scribe, java.lang.String instance, Channel channel, int maxFailedSubscriptions)
stripeId
- the stripeId that this stripe will be rooted atscribe
- the scribe the stripe is running on top ofMethod Detail |
---|
public StripeId getStripeId()
public boolean isPrimary()
public boolean isSubscribed()
public void subscribe(SplitStreamClient client)
client
- The client to addpublic void unsubscribe(SplitStreamClient client)
client
- The client to removepublic void publish(byte[] data)
data
- The data to publishpublic boolean anycast(Topic topic, ScribeContent content)
anycast
in interface ScribeClient
topic
- The topic the message was anycasted tocontent
- The content which was anycasted
public void deliver(Topic topic, ScribeContent content)
deliver
in interface ScribeClient
topic
- The topic the message was published tocontent
- The content which was publishedpublic void childAdded(Topic topic, NodeHandle child)
childAdded
in interface ScribeClient
topic
- The topic to unsubscribe fromchild
- The child that was addedpublic void childRemoved(Topic topic, NodeHandle child)
childRemoved
in interface ScribeClient
topic
- The topic to unsubscribe fromchild
- The child that was removedpublic void subscribeFailed(Topic topic)
subscribeFailed
in interface ScribeClient
topic
- The topic that failedpublic java.lang.String toString()
toString
in class java.lang.Object
public NodeHandle[] getChildren()
public NodeHandle getParent()
public boolean isRoot()
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |