|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ostore.archive.Erasure | +--ostore.archive.interleaved.Interleaved
This class extends class Erasure. Interleaved Reed-Solomon is a form of erasure codes and therefore inherits the ability to encode/decode and update an object.
Field Summary | |
---|---|
protected Cauchy |
_cauchy
|
protected int[] |
_cauchy_fragments
|
protected int[] |
_cauchy_message
|
protected int |
_encodeSize
encodeSize is the max number of words in any one message encoded by Cauchy |
protected int[] |
_fragments
|
static int |
_headerSize
|
protected int |
_interleaveFactor
interleaveFactor is the number of encode fragments per dissemination fragments INV: interleaveFactor = ceil(Original Message size / encodeSize) |
protected int[] |
_message
|
protected int |
_Plen
Plen is the size in words of a dissemination fragment. |
protected int |
_Plentot
Plentot is the size int words of a dissemination fragment (with index) |
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 | |
---|---|
Interleaved(int size,
int numFragments,
int rate,
int encodeBytes,
boolean verify,
NodeId node_id)
Constructor. |
Method Summary | |
---|---|
static int |
calcBlockSize(int blockSize,
int numFragments,
int rate,
int encodeBytes)
returns the message size corresponding to the input block size |
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)
encodes an object using an erasure code. |
protected void |
extractFragments(int[] eFrag,
int[] dFrag,
int interIndex,
int eSize,
int dSize,
int numFrag,
int headerSize)
copies fragments from a larger array of them to a smaller one |
protected void |
extractMessage(int[] msg,
int[] whole_msg,
int interIndex,
int msgSize,
int partSize)
copies a message from a larger message, starting at an offset specified by interIndex |
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 rate)
returns the message size corresponding to the input block size NOTE: this function assumes encodeSize has already been set |
int |
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()
Initialize all class/instance variables. |
protected void |
integrateFragments(int[] eFrag,
int[] dFrag,
int interIndex,
int eSize,
int dSize,
int numFrag,
int headerSize)
copies fragments from a smaller array of them to a larger one |
protected void |
integrateMessage(int[] msg,
int[] whole_msg,
int interIndex,
int msgSize,
int partSize)
copies a message from a smaller message into a larger one in a manner specified by interIndex |
int |
loseFragments(int[] fragments,
int[] rec_fragments,
double keepRate,
int[] pNrec)
loseFragments Decide which fragments to keep randomly. |
static int |
min(int in1,
int in2)
|
int |
numMessageFragments()
numMessageFragments returns the message number of fragments. |
int |
numRedundantFragments()
numRedundantFragments returns the redundant number of fragments. |
Methods inherited from class ostore.archive.Erasure |
---|
compareMsg, getBlockSize, getErasure, getInverseRate, getMsg, getSize, instanceRandom, instanceRandomContains, instanciateRandom |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int ENCODETYPE
protected static final boolean DEBUG
protected Cauchy _cauchy
protected int[] _message
protected int[] _rec_message
protected int[] _cauchy_message
protected int[] _fragments
protected int[] _rec_fragments
protected int[] _cauchy_fragments
protected int _interleaveFactor
protected int _Plen
protected int _Plentot
protected int _encodeSize
public static final int _headerSize
Constructor Detail |
public Interleaved(int size, int numFragments, int rate, int encodeBytes, boolean verify, NodeId node_id)
size
- == size (in bytes) of object to encode/decode.numFragments
- == number of fragments to generate.rate
- == rate of encodingencodeBytes
- == max number of bytes to encode using CauchyMethod Detail |
public static final int min(int in1, int in2)
protected boolean initialize()
protected void extractMessage(int[] msg, int[] whole_msg, int interIndex, int msgSize, int partSize)
msg
- == smaller message to be createdwhole_msg
- == larger message from which smaller message is takeninterIndex
- == current index of interleavingmsgSize
- == size, in words, of msgpartSize
- == size, in words, of pieces of whole_msg
NOTE: for all of whole_msg to survive, partSize <= msgSizeprotected void integrateMessage(int[] msg, int[] whole_msg, int interIndex, int msgSize, int partSize)
msg
- == smaller message, which is the sourcewhole_msg
- == larger message, which is the destinationinterIndex
- == current index of interleavingmsgSize
- == size, in words, of msgpartSize
- == size, in words, of pieces of whole_msg
NOTE: for all of whole_msg to survive, partSize <= msgSizeprotected void extractFragments(int[] eFrag, int[] dFrag, int interIndex, int eSize, int dSize, int numFrag, int headerSize)
eFrag
- == smaller array of fragments to be createddFrag
- == larger array of fragments, which is the sourceinterIndex
- == current index of interleavingeSize
- == size, in words, of smaller fragmentsdSize
- == size, in words, of larger fragmentsnumFrag
- == number of fragments to be stored in fragheaderSize
- == size, in words, headersprotected void integrateFragments(int[] eFrag, int[] dFrag, int interIndex, int eSize, int dSize, int numFrag, int headerSize)
eFrag
- == smaller array of fragments, which is the sourcedFrag
- == larger array of fragments, which is the destinationinterIndex
- == current index of interleavingeSize
- == size, in words, of smaller fragmentsdSize
- == size, in words, of larger fragmentsnumFrag
- == number of fragments to be stored in fragheaderSize
- == size, in words, headerspublic int getEncodeType()
getEncodeType
in class Erasure
public static int calcBlockSize(int blockSize, int numFragments, int rate, int encodeBytes)
blockSize
- == initial block sizeencodeBytes
- == max encoding size
public int getBlockSize(int blockSize, int numFragments, int rate)
getBlockSize
in class Erasure
blockSize
- = target blockSize (this is the size in bytes of the
data
to be encoded).numFragments
- = total number of fragments to encode
data
.rate
- = inverse rate of encoding to encode data
.
blockSize
, numFragments
, and
inverseRate
.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 encode(byte[] bytes, int[] msg, int[] intFrags, Stats stat) throws ErasureEncodeException
encode
in class Erasure
bytes
- = original msg before encoding (in array of byte form).msg
- = original msg before encoding (in array of int form).stat
- = a Stats object which contains the time to encode object
in milliseconds.
intFrags
from encoding
msg (in an array of int form).
ErasureEncodeException
public int loseFragments(int[] fragments, int[] rec_fragments, double keepRate, int[] pNrec)
loseFragments
in class Erasure
fragments
- == original msg before encoding.rec_fragments
- == received msg after reception and decoding.keepRate
- == percentage of fragments to keep after reception.pNrec
- == number of received fragments, this is returned.
public void decode(int[] rec_pckts, int Nrec, int[] rec_message, byte[] data, Stats stat) throws ErasureDecodeException
decode
in class Erasure
rec_pckts
- == TODONrec
- == TODOrec_message
- == received msg after reception and decoding.data
- == TODOstat
- == TODO
ErasureDecodeException
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
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |