|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.archive.FragmentBucket
FragmentBucket is a class to store all or a subset of the fragments for a single OceanStore block.
Field Summary | |
---|---|
protected boolean[] |
_ackFrags
Array to store whether a fragment has been acknowledged after dissemination. |
protected boolean |
_archiveInterpretFlag
Flag determines whether the archive should do "something" special with the decoded block i.e create data obj. |
protected long |
_blockType
blockType is the type of block we are encoding or decoding. |
protected boolean |
_canDecode
boolean on whether can decode. |
protected long |
_endTime
startTime and endTime are timers for dissemination and recoalescing of a disseminatable bucket. |
protected Fragment[] |
_frags
Array to store the fragments (its length is based on whether we are waiting to disseminate, or are recoalescing, the fragments) |
protected int |
_frags_free_space
Current free space pointer into _frags |
protected int |
_nackCount
Number of NACK's received. |
protected SecureHash |
_nextBucket
Points to the next FragmentBucket in a chain of FragmentBuckets. |
protected NodeId |
_node_id
_node_id is the NodeId of the local
server where this class is running. |
protected int |
_numAcksRecv
Number of ack's recv'd for disseminated fragments belonging to a particular fragmentBucket. |
protected SecureHash |
_refGuid
reference to guid of top most root block (GUID which refers to this FB). |
protected long |
_startTime
startTime and endTime are timers for dissemination and recoalescing of a disseminatable bucket. |
protected boolean |
_successfullyDecoded
boolean on whether can decode. |
static boolean |
COMPARE_MESSAGES
This determines if messages are compared after having been decoded in Reconstructor...for debuggin purposes only. |
int[] |
enc_msg
|
int[] |
old_msg
|
Constructor Summary | |
---|---|
FragmentBucket(InputBuffer buffer)
Constructs a FragmentBucket from its
serialized form. |
|
FragmentBucket(int numFrags,
NodeId node_id,
SecureHash node_guid)
Constructor: initializes FragmentBucket to contain a number of fragments. |
|
FragmentBucket(NodeId node_id,
SecureHash node_guid)
Default constructor |
Method Summary | |
---|---|
void |
add(Disseminatable diss)
Add a disseminatable object to this bucket. |
boolean |
canDecode()
Determine if we can decode this bucket's object. |
void |
clear()
clear s internal data structures. |
static int |
computeMemoryRequirement(int bSize,
int numFrags,
int inverseRate,
int type)
computMemoryRequirement computes the memory requirement for a single disseminatable. |
boolean |
getAcksRecv(int index)
getAcksRecv return true if fragment at given index
has been received; otherwise, false. |
boolean |
getArchiveInterpretFlag()
returns archive interpret decoded block flag. |
long |
getBlockType()
getBlockType returns the type of block that we are encoding or decoding. |
Disseminatable |
getDisseminatable(int index)
Retrieve a single Disseminatable object |
long |
getEndTime()
getEndTime returns the time the Bucket was destroyed(removed from table). |
Fragment |
getFragment(int index)
Retrieve a single Disseminatable object |
SecureHash |
getGuid()
Get GUID that is the name of the diss objects in this bucket. |
int |
getLength()
Retrieve the total capacity of this bucket. |
int |
getNackCount()
getNackCount returns the number of NACK's received. |
SecureHash |
getNextBucket()
Get the next Bucket in this chain. |
int |
getNumAcksRecv()
getNumAcksRecv returns the number of ack's recv'd |
int |
getNumBytes()
Retrieve the total number of bytes stored in this bucket. |
int |
getNumGood()
Retrieve the total number of disseminatables stored in this bucket. |
SecureHash |
getRefGuid()
Get GUID that refers to this bucket (in some higher-level hashtable). |
long |
getStartTime()
getStartTime returns the time the Bucket was created(put on table). |
void |
incrNackCount()
incrNackCount increments the NACK count. |
protected static boolean |
instanceRandomContains(NodeId node_id)
instanceRandomContains returns true if map of instance
instance variables contains node_id , false otherwise. |
protected static void |
instanciateRandom(int seed,
NodeId node_id)
instanciateRandom creates an instance of a
Random associated with NodeId and
instanciated with the seed . |
void |
loseFragments(double fractionToKeep)
This routine is used for debuggin; |
static int |
OVERHEAD(int numFrags)
overhead of a fragment bucket (in bytes). |
boolean |
receivedAllAcks(double percentRequired)
ReceivedAllAcks returns true if all disseminated fragments have been ack'd otherwise returns false. |
boolean |
recv(Disseminatable diss)
Receive a disseminatable object (presumably from the network) and add it to this bucket. |
void |
reset(NodeId node_id,
SecureHash node_guid)
reset s internal data structures. |
void |
serialize(OutputBuffer buffer)
Specified by ostore.util.QuickSerializable |
void |
setAckRecv(int index)
Receive an acknowledgement |
void |
setArchiveInterpretFlag(boolean flag)
set's archive interpret decode block flag. |
void |
setBlockType(long type)
setBlockType sets the type of block that we are encoding or decoding. |
void |
setDecoded(boolean success)
Set successfullyDecoded ... |
void |
setEndTime(long time)
setEndTime sets the time the Bucket was destroyed(removed from table). |
void |
setNextBucket(SecureHash bucket)
Set the next Bucket in this chain. |
void |
setRefGuid(SecureHash guid)
Set GUID that refers to this bucket (in some higher-level hashtable). |
void |
setStartTime(long time)
setStartTime sets the time the Bucket was created(put on table). |
boolean |
testAndSetDecoded()
Atomically test successfullyDecoded. |
String |
toString()
Specified by java.lang.Object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static boolean COMPARE_MESSAGES
public int[] old_msg
public int[] enc_msg
protected long _startTime
protected long _endTime
protected long _blockType
protected Fragment[] _frags
protected boolean[] _ackFrags
protected int _numAcksRecv
protected int _nackCount
protected int _frags_free_space
protected SecureHash _nextBucket
protected SecureHash _refGuid
protected boolean _canDecode
protected boolean _successfullyDecoded
protected boolean _archiveInterpretFlag
protected NodeId _node_id
_node_id
is the NodeId
of the local
server where this class is running.
Constructor Detail |
public FragmentBucket(NodeId node_id, SecureHash node_guid)
public FragmentBucket(int numFrags, NodeId node_id, SecureHash node_guid)
public FragmentBucket(InputBuffer buffer) throws QSException
FragmentBucket
from its
serialized
form.
buffer
- serialized
form of object.Method Detail |
public static int OVERHEAD(int numFrags)
public static int computeMemoryRequirement(int bSize, int numFrags, int inverseRate, int type)
bSize
- = size of block in bytes.numFrags
- = total number of fragments for block.inverseRate
- = inverseRate of encoding.type
- = type of erasure coding.
protected static void instanciateRandom(int seed, NodeId node_id)
instanciateRandom
creates an instance of a
Random
associated with NodeId
and
instanciated with the seed
.
seed
- = seed to instanciate Random
variable with.node_id
- = NodeId
to associate with
Random
variable.protected static boolean instanceRandomContains(NodeId node_id)
instanceRandomContains
returns true if map of instance
instance variables contains node_id
, false otherwise.
node_id
- = NodeId
to test.
node_id
, false otherwise.public void clear()
clear
s internal data structures.
clear
in interface DisseminatableBucket
public void reset(NodeId node_id, SecureHash node_guid)
reset
s internal data structures.
reset
in interface DisseminatableBucket
public void serialize(OutputBuffer buffer)
serialize
in interface QuickSerializable
buffer
- the output buffer to add the object topublic long getBlockType()
public long getStartTime()
getStartTime
in interface DisseminatableBucket
public long getEndTime()
getEndTime
in interface DisseminatableBucket
public boolean getArchiveInterpretFlag()
public void setBlockType(long type)
type
- = type of block that we are encoding or decoding.public void setStartTime(long time)
setStartTime
in interface DisseminatableBucket
time
- = the time the Bucket was created.public void setEndTime(long time)
setEndTime
in interface DisseminatableBucket
time
- == the time the Bucket was destroyed.public void setArchiveInterpretFlag(boolean flag)
flag
- == archive interpret decode block flag.public int getNumBytes()
getNumBytes
in interface DisseminatableBucket
public SecureHash getNextBucket()
getNextBucket
in interface DisseminatableBucket
public void setNextBucket(SecureHash bucket)
setNextBucket
in interface DisseminatableBucket
bucket
- == the next bucket in this chain.public SecureHash getRefGuid()
getRefGuid
in interface DisseminatableBucket
public void setRefGuid(SecureHash guid)
setRefGuid
in interface DisseminatableBucket
guid
- == guid that refers to this bucket.public SecureHash getGuid()
getGuid
in interface DisseminatableBucket
public int getNumGood()
getNumGood
in interface DisseminatableBucket
public int getLength()
getLength
in interface DisseminatableBucket
public Disseminatable getDisseminatable(int index)
getDisseminatable
in interface DisseminatableBucket
index
- == index of the disseminatable object to retrieve.
public Fragment getFragment(int index)
index
- == index of the disseminatable object to retrieve.
public int getNackCount()
getNackCount
in interface DisseminatableBucket
public void incrNackCount()
incrNackCount
in interface DisseminatableBucket
public void add(Disseminatable diss)
add
in interface DisseminatableBucket
diss
- == the object to add.public void setAckRecv(int index)
setAckRecv
in interface DisseminatableBucket
index
- == index of the Disseminatable to mark as ack'ed.public boolean getAcksRecv(int index)
getAcksRecv
return true if fragment at given index
has been received; otherwise, false.
getAcksRecv
in interface DisseminatableBucket
index
- Index of disseminatable to test if ack has been received.
public int getNumAcksRecv()
getNumAcksRecv
returns the number of ack's recv'd
getNumAcksRecv
in interface DisseminatableBucket
public boolean receivedAllAcks(double percentRequired)
receivedAllAcks
in interface DisseminatableBucket
percentRequired
- == perecent of acks we will actually
count as being "all" of the acks.
public boolean recv(Disseminatable diss)
recv
in interface DisseminatableBucket
diss
- the object to add.
public boolean canDecode()
canDecode
in interface DisseminatableBucket
public boolean testAndSetDecoded()
testAndSetDecoded
in interface DisseminatableBucket
public void setDecoded(boolean success)
setDecoded
in interface DisseminatableBucket
success
- == set decoded to true or falsepublic void loseFragments(double fractionToKeep)
fractionToKeep
- == fraction of fragments to keep.public String toString()
toString
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |