|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.archive.Fragment
The Fragment
class is a class to store Erasure
encoded
fragments.
Fragments
are the main mechanism that provides durability in
OceanStore. Each Fragment
is self-verifying and the
cornerstone of the archival layer's fault tolerance and automatic repair.
A Fragment
is produced from an Erasure
coding process,
where the Erasure
code treats input data as a series of
m Fragments
, which it transforms into n
Fragment
, where n > m. The resulting code's
essential perperty is that any m of the coded
Fragments
are sufficient to reconstruct the original data.
The rate of encoding is r = m/n<1. The
storage overhead is 1/r. The system can adjust the
durability of information by selecting the rate (and hence
storage overhead).
We append to the data portion of the Fragment
object the
fragment verification hashes
(i.e. VHashTree
and QSArray
), the size of the
original object
, the encoding type
(e.g. Cauchy
,
Interleaved
, or Tornado
),
the number of total fragments, the inverse rate of encoding, and the
index of particular fragment.
Erasure
,
Cauchy
,
Interleaved
,
VHashTree
,
QSArray
Field Summary | |
---|---|
static int |
blockSizeOffset
Offset of block_size in the _data field. |
static int |
dataOffset
Offset of data in the _data field. |
static int |
encodeTypeOffset
Offset for the type of encoding used to generate this fragment. |
static int |
indexOffset
Offset of index in the _data field. |
static int |
inverseRateOffset
Offset of rate of encoding in the _data field. |
static int |
numberOfFragmentsOffset
Offset of number of fragments in the _data field. |
static int |
OVERHEAD
Overhead storage requirement for a fragment (in bytes). |
Constructor Summary | |
---|---|
Fragment()
Default constructor: The Fragment has no data, and no verification info. |
|
Fragment(byte[] header,
int header_off,
int header_len,
int[] intData,
int intData_off,
int intData_len)
Constructor: FIXME: This comment needs filling in. |
|
Fragment(Erasure e,
int[] intFrags,
int index,
int blockSize)
Constructor: Initializes a Fragment with all of its data. |
|
Fragment(InputBuffer buffer)
Constructs a Fragment from its
serialized form. |
|
Fragment(int size)
Constructor. |
Method Summary | |
---|---|
Object |
clone()
This is the clone routine for Disseminatable. |
SecureHash |
computeGuid()
computeGuid Compute and return the guid of the
disseminatable. |
SecureHash |
computeGuid(SecureHashBuffer buffer)
computeGuid Compute and return the guid of the
disseminatable. |
static int |
computeMemoryRequirement(int bSize,
int numFrags,
int inverseRate,
int type)
computMemoryRequirement computes the memory requirement for
a single disseminatable. |
int |
getBlockSize()
Gets the block_size of this Fragment. |
SecureHash |
getBlockVHash()
Get the hash of the corresponding block in the verification information. |
static Object |
getBucket(Object key)
|
byte[] |
getData()
getData returns the Fragment in byte array form. |
void |
getData(byte[] data,
int data_offset,
int offset,
int length)
Gets a portion of this Fragment's data. |
int |
getDataLength()
Calculates and returns the length of a fragment's data in bytes (not including the index), based on block_size, numFrags, and rate. |
int |
getEncodeType()
Gets the encodeType. |
SecureHash |
getFHash()
Get the hash of the corresponding to the top of the fragment vhash tree (hash adjacent to blockVHash. |
int |
getIndex()
getIndex get the index of this object. |
int |
getInverseRate()
Gets the rate field from this fragment. |
int |
getNumberOfFragments()
Gets the number of fragments field from this Fragment. |
SecureHash |
getVerify(int index)
Get one of the hashes in the verification information. |
int |
getVerifyLength()
Return the length of the verification array. |
static Object |
putBucket(Object key,
Object value)
|
int |
putData(int[] buffer,
int offset)
putData copies this fragmet's index and data into the integer array. |
void |
serialize(OutputBuffer buffer)
Specified by ostore.util.QuickSerializable |
void |
setBlockSize(int blockSize)
Sets the block_size of this Fragment. |
static void |
setBlockSize(int blockSize,
byte[] data)
Sets the block_size of this Fragment. |
void |
setData(byte[] data,
int data_offset,
int offset,
int length)
Sets a portion of this Fragment's data. |
void |
setEncodeType(int encodeType)
Sets the encodeType. |
static void |
setEncodeType(int encodeType,
byte[] data)
Sets the encodeType. |
void |
setFragmentMetadata(byte[] header,
int offset,
int length)
Sets the index of this Fragment. |
void |
setIndex(int index)
Sets the index of this Fragment. |
static void |
setIndex(int index,
byte[] data)
Sets the index of this Fragment. |
void |
setInverseRate(int inverseRate)
Sets the rate field in this Fragment. |
static void |
setInverseRate(int inverseRate,
byte[] data)
Sets the rate field in this Fragment. |
void |
setNumberOfFragments(int numFrags)
Sets the number of fragments field in this Fragment. |
static void |
setNumberOfFragments(int numFrags,
byte[] data)
Sets the number of fragments field in this Fragment. |
void |
setSize(int size)
Sets the size of the data array, erasing all data. |
void |
setVerify(SecureHash hash,
int index)
Sets one of the hashes in the verification information. |
void |
setVerifySize(int size)
Sets the size of the verification information (in other words, how many levels of the verification tree exist between this Fragment's hash and the top-most hash. |
String |
toString()
Specified by java.lang.Object |
boolean |
verifyGuid(SecureHash other)
verifyGuid returns whether disseminatable
verified or not. |
boolean |
verifyGuid(SecureHash other,
SecureHashBuffer buffer)
verifyGuid returns whether disseminatable
verified or not. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int OVERHEAD
public static int blockSizeOffset
public static int encodeTypeOffset
public static int numberOfFragmentsOffset
public static int inverseRateOffset
public static int indexOffset
public static int dataOffset
Constructor Detail |
public Fragment()
public Fragment(int size)
size
- size of the data portion of a fragment (i.e. excludes
fragment overhead.public Fragment(Erasure e, int[] intFrags, int index, int blockSize)
e
- Erasure
object which created the fragments.intFrags
- integer representation of the fragments.index
- index of the Fragment to create.public Fragment(byte[] header, int header_off, int header_len, int[] intData, int intData_off, int intData_len)
public Fragment(InputBuffer buffer) throws QSException
Fragment
from its
serialized
form.
buffer
- serialized
form of object.Method Detail |
public static int computeMemoryRequirement(int bSize, int numFrags, int inverseRate, int type)
computMemoryRequirement
computes the memory requirement for
a single disseminatable.
bSize
- size of block in bytes.numFrags
- total number of fragments for block.inverseRate
- inverseRate of encoding.type
- type of erasure coding.
public static Object putBucket(Object key, Object value)
public static Object getBucket(Object key)
public byte[] getData()
getData
returns the Fragment
in byte array form.
Fragment
in a byte array form.public boolean verifyGuid(SecureHash other)
Disseminatable
verifyGuid
returns whether disseminatable
verified or not.
verifyGuid
in interface Disseminatable
public boolean verifyGuid(SecureHash other, SecureHashBuffer buffer)
Disseminatable
verifyGuid
returns whether disseminatable
verified or not.
verifyGuid
in interface Disseminatable
public SecureHash computeGuid()
Disseminatable
computeGuid
Compute and return the guid of the
disseminatable.
computeGuid
in interface Disseminatable
public SecureHash computeGuid(SecureHashBuffer buffer)
Disseminatable
computeGuid
Compute and return the guid of the
disseminatable.
computeGuid
in interface Disseminatable
public void setVerifySize(int size)
public void setVerify(SecureHash hash, int index)
hash
- hash to set.index
- index/position to set hash.public SecureHash getVerify(int index)
index
- index/position to get hash.public int getVerifyLength()
public SecureHash getBlockVHash()
public SecureHash getFHash()
public void setSize(int size)
size
- size of the data portion of a fragment (i.e. excludes
fragment overhead.public void setData(byte[] data, int data_offset, int offset, int length)
data
- data to copy into data portion of fragment.data_offset
- offset of data being copied.offset
- offset of fragment data portion which to copy into.length
- length of data to copy.public void getData(byte[] data, int data_offset, int offset, int length)
data
- array where data portion of fragment will be copyied into.data_offset
- offset into array holding copied data.offset
- offset of fragment data portion which to start copying.length
- length of data to copy.public void setBlockSize(int blockSize)
blockSize
- size of block (in bytes).public static void setBlockSize(int blockSize, byte[] data)
blockSize
- size of block (in bytes).data
- byte array to place blockSize into.public void setEncodeType(int encodeType)
encodeType
- type of encoding.public static void setEncodeType(int encodeType, byte[] data)
encodeType
- type of encoding.data
- byte array to place encodeType into.public void setNumberOfFragments(int numFrags)
numFrags
- total number of fragments.public static void setNumberOfFragments(int numFrags, byte[] data)
numFrags
- total number of fragments.data
- byte array to set numFrags into.public void setInverseRate(int inverseRate)
inverseRate
- inverse of the rate.public static void setInverseRate(int inverseRate, byte[] data)
inverseRate
- inverse of the rate.data
- byte array to set inverseRate into.public void setIndex(int index)
index
- index of fragment.public static void setIndex(int index, byte[] data)
index
- index of fragment.data
- byte array to put index into.public void setFragmentMetadata(byte[] header, int offset, int length)
header
- byte array representing Fragment metadata _EXCEPT_
index.offset
- position in byte array where header begins.length
- length of header. header length should _NOT_ include
index of fragment.public int getDataLength()
public int getBlockSize()
public int getEncodeType()
public int getNumberOfFragments()
public int getInverseRate()
public int getIndex()
Disseminatable
getIndex
get the index of this object.
getIndex
in interface Disseminatable
public int putData(int[] buffer, int offset)
buffer
- integer array to copy this Fragment's data intooffset
- offset in the array to start copying.
public Object clone() throws CloneNotSupportedException
Disseminatable
clone
in interface Disseminatable
clone
in class Object
CloneNotSupportedException
public void serialize(OutputBuffer buffer)
serialize
in interface QuickSerializable
buffer
- the output buffer to add the object topublic String toString()
toString
in class Object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |