Rice Pastry API

rice.p2p.splitstream
Class Channel

java.lang.Object
  extended by rice.p2p.splitstream.Channel

public class Channel
extends java.lang.Object

The channel controls all the meta data associated with a group of stripes. It contains the stripes themselves, and one of the stripe is the primary stripe for this channel. A stripe whose topicId matches some prefix with local node id, then it becomes its primary stripe. A channelId uniquely identifies a channel. Number of stripes is obtained by pow(2, STRIPE_BASE), so for STRIPE_BASE = 4, it is 16. Stripe identifiers are obtained by replacing first digit by every possible value of a digit and second digit by 8. So, if channelId is <0x1AB88..>, then stripe id's generated are <0x08B88..>, <0x18B88..>, <0x28B88..> etc.

Version:
$Id: Channel.java 3613 2007-02-15 14:45:14Z jstewart $
Author:
Ansley Post, Alan Mislove, Atul Singh

Field Summary
protected  ChannelId channelId
          ChannelId for this channel
protected  Id localId
          The Id of the local node
protected  Stripe[] stripes
          The list of stripeIds for this channel
 
Constructor Summary
Channel(ChannelId channelId, Scribe scribe, java.lang.String instance, IdFactory factory, Id localId, int stripeBase, int maxFailedSubscriptions)
          Constructor to create a new channel from scratch
 
Method Summary
protected  StripeId[] generateStripeIds(ChannelId id, IdFactory factory)
          Creates and returns the Ids associated with the provided channelId
 ChannelId getChannelId()
          Gets the channelId for this channel
 Id getLocalId()
          Gets the local node id.
protected  Stripe getPrimaryStripe()
          The primary stripe is the stripe that the user must have.
 int getStripeBase()
           
 Stripe[] getStripes()
          At any moment a node is subscribed to at least 1 but possibly more stripes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

channelId

protected ChannelId channelId
ChannelId for this channel


stripes

protected Stripe[] stripes
The list of stripeIds for this channel


localId

protected Id localId
The Id of the local node

Constructor Detail

Channel

public Channel(ChannelId channelId,
               Scribe scribe,
               java.lang.String instance,
               IdFactory factory,
               Id localId,
               int stripeBase,
               int maxFailedSubscriptions)
Constructor to create a new channel from scratch

Parameters:
channelId - The Id of the channel
scribe - The underlying stripe object
factory - The Id factory
localId - The local Id
Method Detail

getLocalId

public Id getLocalId()
Gets the local node id.

Returns:
The local node id

getChannelId

public ChannelId getChannelId()
Gets the channelId for this channel

Returns:
ChannelId the channelId for this channel

getStripes

public Stripe[] getStripes()
At any moment a node is subscribed to at least 1 but possibly more stripes. They will always be subscribed to their primary Stripe.

Returns:
Vector the Stripes this node is subscribed to.

getPrimaryStripe

protected Stripe getPrimaryStripe()
The primary stripe is the stripe that the user must have.

Returns:
Stripe The Stripe object that is the primary stripe.

getStripeBase

public int getStripeBase()

generateStripeIds

protected StripeId[] generateStripeIds(ChannelId id,
                                       IdFactory factory)
Creates and returns the Ids associated with the provided channelId

Parameters:
channelId - The id of the channel
Returns:
The array of stripeIds based on this channelId

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection