|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.archive.Erasure | +--ostore.archive.cauchy.Cauchy
This class extends class Erasure. Cauchy is a form of erasure codes and therefore inherits the ability to encode/decode and update an object.
Field Summary | |
---|---|
protected int[] |
_fragments
|
protected int[] |
_message
|
protected Parameters |
_p
|
protected int[] |
_rec_fragments
|
protected int[] |
_rec_message
|
protected static boolean |
DEBUG
|
static int |
ENCODETYPE
|
Fields inherited from class ostore.archive.Erasure |
---|
_fragmentDataLength, _fragmentIndexLength, _fragmentTotalLength, _inverseRate, _node_id, _numFragments, _numMessageFragments, _numRedundantFragments, _size, _verify, sizeOfLong |
Constructor Summary | |
---|---|
Cauchy(int size,
int numFragments,
int inverseRate,
boolean verify,
NodeId node_id)
CONSTRUCTOR |
Method Summary | |
---|---|
static int |
calcBlockSize(int blockSize,
int numFragments,
int inverseRate)
calcBlockSize returns the message size corresponding to the input block size. |
static int |
calcLfield(int blockSize,
int numFragments,
int inverseRate)
Calculates the best Lfield for a given blockSize. |
static int |
calcNsegs(int blockSize,
int numFragments,
int inverseRate,
int Lfield)
Calculates the best Nsegs for a given blockSize. |
boolean |
compareMsg(int[] msg,
int[] rec_msg)
compareMsg compares the original msg with the encoded/decoded message. |
void |
decode(int[] rec_pckts,
int Nrec,
int[] rec_message,
byte[] data,
Stats stat)
decodes an object using an erasure code. |
void |
encode(byte[] bytes,
int[] msg,
int[] intFrags,
Stats stat)
encode encodes an object using an erasure code. |
int |
fragmentDataLength()
fragmentDataLength is the fragment length in bytes of each fragment excluding the overhead for storing the index. |
int |
fragmentIndexLength()
fragmentIndexLength is the overhead for storing the index. |
int |
fragmentTotalLength()
fragmentTotalLength is the fragment length in bytes including the overhead for storing the index after encoding. |
int |
getBlockSize(int blockSize,
int numFragments,
int inverseRate)
getBlockSize returns the message size corresponding to the input block size. |
int |
getEncodeType()
getEncodeType returns the encode type of this Erasure coder. |
int |
getFragmentArrayLength()
getFragmentArrayLength returns the length of the
Fragment array divisible by Erasure.sizeOfLong . |
int |
getMsgArrayLength()
getMsgArrayLength returns the length of the msg
array divisible by Erasure.sizeOfLong . |
int |
getNumFragments()
numFragments returns the number of fragments after encoding (without loss of fragments). |
protected boolean |
initialize(int size,
int numMsgFragments)
Initialize all class/instance variables. |
void |
initializeForEncoding()
Prepares this Cauchy object to encode a block. |
int |
Lfield()
Lfield returns the length of the Galois Field. |
int |
Mlen()
Mlen returns the length of the message, in words. |
int |
Nseg()
Nseg returns the number of segments in each fragment. |
int |
numMessageFragments()
numMessageFragments returns the message number of fragments. |
int |
numRedundantFragments()
numRedundantFragments returns the redundant number of fragments. |
int |
Plen()
Plen returns the length of the packets, in words. |
int |
Plentot()
Plentot returns the length of the packets, in words, including the index. |
Methods inherited from class ostore.archive.Erasure |
---|
compareMsg, getBlockSize, getErasure, getInverseRate, getMsg, getSize, instanceRandom, instanceRandomContains, instanciateRandom, loseFragments |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final boolean DEBUG
public static final int ENCODETYPE
protected Parameters _p
protected int[] _message
protected int[] _rec_message
protected int[] _fragments
protected int[] _rec_fragments
Constructor Detail |
public Cauchy(int size, int numFragments, int inverseRate, boolean verify, NodeId node_id)
size
- == size, in bytes, of the block to be encodednumFragments
- == number of total fragments to produceinverseRate
- == inverseRate of encodingMethod Detail |
protected boolean initialize(int size, int numMsgFragments)
size
- == set size of object to encode/decode.numMsgFragments
- == number of message fragments.public static int calcLfield(int blockSize, int numFragments, int inverseRate)
blockSize
- == size in bytes of the block to be encoded.numFragments
- == number of fragments.inverseRate
- == inverse of inverseRate of encoding.
public static int calcNsegs(int blockSize, int numFragments, int inverseRate, int Lfield)
blockSize
- == size in bytes of the block to be encoded.numFragments
- == number of fragments.inverseRate
- == inverse of inverseRate of encoding.Lfield
- == best Lfield for the other parameters.
public static int calcBlockSize(int blockSize, int numFragments, int inverseRate)
blockSize
- == size in bytes of the block to be encoded.numFragments
- == number of fragments.inverseRate
- == inverse of inverseRate of encoding.
public int getEncodeType()
getEncodeType
in class Erasure
public int getBlockSize(int blockSize, int numFragments, int inverseRate)
getBlockSize
in class Erasure
blockSize
- == size of block in bytes.numFragments
- == total number of fragments for block.inverseRate
- = inverseRate of encoding.
public int getFragmentArrayLength()
Erasure
getFragmentArrayLength
returns the length of the
Fragment
array divisible by Erasure.sizeOfLong
.
getFragmentArrayLength
in class Erasure
Fragment
array divisible by
Erasure.sizeOfLong
.public int getMsgArrayLength()
Erasure
getMsgArrayLength
returns the length of the msg
array divisible by Erasure.sizeOfLong
.
getMsgArrayLength
in class Erasure
Erasure.sizeOfLong
.public void initializeForEncoding() throws ErasureEncodeException
ErasureEncodeException
public void encode(byte[] bytes, int[] msg, int[] intFrags, Stats stat) throws ErasureEncodeException
encode
in class Erasure
msg
- == original msg before encoding (in array of int form).stat
- = a Stats object which contains the time to encode object
in milliseconds.bytes
- = original msg before encoding (in array of byte form).
intFrags
from encoding
msg (in an array of int form).
ErasureEncodeException
public void decode(int[] rec_pckts, int Nrec, int[] rec_message, byte[] data, Stats stat) throws ErasureDecodeException
decode
in class Erasure
rec_pckts
- == received fragments after encoding.Nrec
- == number of fragments received.rec_message
- == TODOdata
- == TODOstat
- == time to decode object in milliseconds.
ErasureDecodeException
public boolean compareMsg(int[] msg, int[] rec_msg)
msg
- == original msg before encoding.rec_msg
- == received msg after reception and decoding.
INVARIANT: _size is defined at constructor (size in bytes);
public int getNumFragments()
getNumFragments
in class Erasure
public int numMessageFragments()
numMessageFragments
in class Erasure
public int numRedundantFragments()
numRedundantFragments
in class Erasure
public int fragmentDataLength()
fragmentDataLength
in class Erasure
public int fragmentIndexLength()
fragmentIndexLength
in class Erasure
public int fragmentTotalLength()
fragmentTotalLength
in class Erasure
public int Nseg()
public int Lfield()
public int Mlen()
public int Plen()
public int Plentot()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |