Class ErasureEncoder
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.io.erasurecode.coder.ErasureEncoder
- All Implemented Interfaces:
Configurable,ErasureCoder
- Direct Known Subclasses:
DummyErasureEncoder,HHXORErasureEncoder,RSErasureEncoder,XORErasureEncoder
An abstract erasure encoder that's to be inherited by new encoders.
It implements the
ErasureCoder interface.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateCoding(ECBlockGroup blockGroup) Calculate the encoding or decoding steps given a block blockGroup.protected ECBlock[]getInputBlocks(ECBlockGroup blockGroup) intThe number of data input units for the coding.intThe number of parity output units for the coding.The options of erasure coder.protected ECBlock[]getOutputBlocks(ECBlockGroup blockGroup) booleanTell if direct or off-heap buffer is preferred or not.protected abstract ErasureCodingStepprepareEncodingStep(ECBlockGroup blockGroup) Perform encoding against a block group.voidrelease()Release the resources if any.Methods inherited from class org.apache.hadoop.conf.Configured
getConf, setConfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.conf.Configurable
getConf, setConf
-
Constructor Details
-
ErasureEncoder
-
-
Method Details
-
calculateCoding
Description copied from interface:ErasureCoderCalculate the encoding or decoding steps given a block blockGroup. Note, currently only one coding step is supported. Will support complex cases of multiple coding steps.- Specified by:
calculateCodingin interfaceErasureCoder- Parameters:
blockGroup- the erasure coding block group containing all necessary information for codec calculation- Returns:
- ErasureCodingStep.
-
getNumDataUnits
public int getNumDataUnits()Description copied from interface:ErasureCoderThe number of data input units for the coding. A unit can be a byte, chunk or buffer or even a block.- Specified by:
getNumDataUnitsin interfaceErasureCoder- Returns:
- count of data input units
-
getNumParityUnits
public int getNumParityUnits()Description copied from interface:ErasureCoderThe number of parity output units for the coding. A unit can be a byte, chunk, buffer or even a block.- Specified by:
getNumParityUnitsin interfaceErasureCoder- Returns:
- count of parity output units
-
getOptions
Description copied from interface:ErasureCoderThe options of erasure coder. This option is passed to raw erasure coder as it is.- Specified by:
getOptionsin interfaceErasureCoder- Returns:
- erasure coder options
-
getInputBlocks
-
getOutputBlocks
-
preferDirectBuffer
public boolean preferDirectBuffer()Description copied from interface:ErasureCoderTell if direct or off-heap buffer is preferred or not. It's for callers to decide how to allocate coding chunk buffers, either on heap or off heap. It will return false by default.- Specified by:
preferDirectBufferin interfaceErasureCoder- Returns:
- true if direct buffer is preferred for performance consideration, otherwise false.
-
release
public void release()Description copied from interface:ErasureCoderRelease the resources if any. Good chance to invoke RawErasureCoder#release.- Specified by:
releasein interfaceErasureCoder
-
prepareEncodingStep
Perform encoding against a block group.- Parameters:
blockGroup- blockGroup.- Returns:
- encoding step for caller to do the real work
-