ostore.archive
Interface DisseminatableBucket

All Superinterfaces:
Cacheable, QuickSerializable
All Known Implementing Classes:
FragmentBucket

public interface DisseminatableBucket
extends Cacheable, QuickSerializable

DisseminatableBucket is an interface to store all or a subset of the disseminatables created for a single GUID. DisseminatableBucket is implemented by FragmentBucket and TombstoneBucket.

Version:
$Id: DisseminatableBucket.java,v 1.11 2004/03/23 02:28:57 hweather Exp $
Author:
Hakim Weatherspoon

Method Summary
 void add(Disseminatable diss)
          add a Disseminatable to this bucket.
 boolean canDecode()
          Determine if we can decode this bucket's object.
 void clear()
          clear frees internal data structures that can be garbage collected.
 boolean getAcksRecv(int index)
          getAcksRecv return true if disseminatable at given index has been received; otherwise, false.
 Disseminatable getDisseminatable(int index)
          getDisseminatable returns a single Disseminatable at the specified index.
 long getEndTime()
          getEndTime returns the time the Bucket was destroyed (i.e. removed from table).
 SecureHash getGuid()
          getGuid returns the GUID that is the name of the Disseminatables in this bucket.
 int getLength()
          getLength return the total capacity of this bucket.
 int getNackCount()
          getNackCount returns the number of NACK's received.
 SecureHash getNextBucket()
          getNextBucket returns the SecureHash of the next Bucket in this chain.
 int getNumAcksRecv()
          getNumAcksRecv returns the number of ack's recv'd.
 int getNumBytes()
          getNumBytes returns the total number of bytes stored in this bucket.
 int getNumGood()
          getNumGood returns the total number of Disseminatables stored in this bucket.
 SecureHash getRefGuid()
          getRefGuid returns the GUID that refers to this bucket (in some higher-level hashtable).
 long getStartTime()
          getStartTime returns the time the Bucket was created (i.e. put on table).
 void incrNackCount()
          incrNackCount increments the NACK count.
 boolean receivedAllAcks(double percentRequired)
          receivedAllAcks returns true if all Disseminatables have been ack'd otherwise returns false.
 boolean recv(Disseminatable diss)
          recv receives a Disseminatable (presumably from the network) and adds it to this bucket.
 void reset(NodeId node_id, SecureHash node_guid)
          clear frees internal data structures that can be garbage collected.
 void setAckRecv(int index)
          setAckRecv set that an acknowledgement has been received at specified index.
 void setDecoded(boolean decoded)
          setDecoded sets successfully decoded to specified decoded.
 void setEndTime(long time)
          setEndTime sets the time the Bucket was destroyed (i.e. removed from table).
 void setNextBucket(SecureHash bucket)
          setNextBucket sets the next SecureHash of the next Bucket in this chain.
 void setRefGuid(SecureHash guid)
          setRefGuid sets the GUID that refers to this bucket (in some higher-level hashtable).
 void setStartTime(long time)
          setStartTime sets the time the Bucket was created (i.e. put on table).
 boolean testAndSetDecoded()
          testAndSetDecoded atomically tests if successfullyDecoded.
 
Methods inherited from interface ostore.util.QuickSerializable
serialize
 

Method Detail

getStartTime

public long getStartTime()
getStartTime returns the time the Bucket was created (i.e. put on table).

Returns:
time bucket was created (put on hash table).

getEndTime

public long getEndTime()
getEndTime returns the time the Bucket was destroyed (i.e. removed from table).

Returns:
time bucket bucket was destroyed (i.e. removed from hash table).

setStartTime

public void setStartTime(long time)
setStartTime sets the time the Bucket was created (i.e. put on table).

Parameters:
time - the time the Bucket was created (i.e. put on table).

setEndTime

public void setEndTime(long time)
setEndTime sets the time the Bucket was destroyed (i.e. removed from table).

Parameters:
time - the time the Bucket was destroyed (i.e. removed from table).

getNumBytes

public int getNumBytes()
getNumBytes returns the total number of bytes stored in this bucket.

Returns:
the total number of bytes stored in this bucket.

getNextBucket

public SecureHash getNextBucket()
getNextBucket returns the SecureHash of the next Bucket in this chain.

Returns:
the SecureHash of the next bucket in this chain.

setNextBucket

public void setNextBucket(SecureHash bucket)
setNextBucket sets the next SecureHash of the next Bucket in this chain.

Parameters:
bucket - SecureHash of the next bucket in this chain.

getRefGuid

public SecureHash getRefGuid()
getRefGuid returns the GUID that refers to this bucket (in some higher-level hashtable).

Returns:
the guid that refers to this bucket.

setRefGuid

public void setRefGuid(SecureHash guid)
setRefGuid sets the GUID that refers to this bucket (in some higher-level hashtable).

Parameters:
guid - guid that refers to this bucket.

getGuid

public SecureHash getGuid()
getGuid returns the GUID that is the name of the Disseminatables in this bucket.

Returns:
guid that is the name of the Disseminatables in this bucket.

getNumGood

public int getNumGood()
getNumGood returns the total number of Disseminatables stored in this bucket.

Returns:
total number of Disseminatables stored in this bucket.

getLength

public int getLength()
getLength return the total capacity of this bucket.

Returns:
the total capacity of this bucket.

getDisseminatable

public Disseminatable getDisseminatable(int index)
getDisseminatable returns a single Disseminatable at the specified index.

Parameters:
index - index of the Disseminatable to retrieve.
Returns:
Disseminatable that corresponds to index.

getNackCount

public int getNackCount()
getNackCount returns the number of NACK's received.

Returns:
number of NACK's received.

incrNackCount

public void incrNackCount()
incrNackCount increments the NACK count.


add

public void add(Disseminatable diss)
add a Disseminatable to this bucket.

Parameters:
diss - Disseminatable to add.

setAckRecv

public void setAckRecv(int index)
setAckRecv set that an acknowledgement has been received at specified index.

Parameters:
index - index of the Disseminatable to mark as ack'd.

getAcksRecv

public boolean getAcksRecv(int index)
getAcksRecv return true if disseminatable at given index has been received; otherwise, false.

Parameters:
index - Index of disseminatable to test if ack has been received.
Returns:
true if disseminatable at given index has been received; otherwise, false.

getNumAcksRecv

public int getNumAcksRecv()
getNumAcksRecv returns the number of ack's recv'd.

Returns:
the number of ack's recv'd.

receivedAllAcks

public boolean receivedAllAcks(double percentRequired)
receivedAllAcks returns true if all Disseminatables have been ack'd otherwise returns false.

Parameters:
percentRequired - perecent of acks we will actually count as being all of the acks.
Returns:
true if all Disseminatables have been ack'd otherwise returns false.

recv

public boolean recv(Disseminatable diss)
recv receives a Disseminatable (presumably from the network) and adds it to this bucket. INVARIANT: The Disseminatable should be verified before calling this function.

Parameters:
diss - the Disseminatable to add.
Returns:
true iff we have enough Disseminatables to safely decode.

canDecode

public boolean canDecode()
Determine if we can decode this bucket's object.

Returns:
true iff we can decode this bucket's object.

testAndSetDecoded

public boolean testAndSetDecoded()
testAndSetDecoded atomically tests if successfullyDecoded. If it is false, set it to true ALERT: Make this synchronized!.

Returns:
true iff VerifiableBlock is being decoded, false otherwise.

setDecoded

public void setDecoded(boolean decoded)
setDecoded sets successfully decoded to specified decoded. ALERT: Make this synchronized!

Parameters:
decoded - set decoded to true or false

clear

public void clear()
clear frees internal data structures that can be garbage collected.


reset

public void reset(NodeId node_id,
                  SecureHash node_guid)
clear frees internal data structures that can be garbage collected.