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

@Private public abstract class ErasureEncoder extends Configured implements ErasureCoder
An abstract erasure encoder that's to be inherited by new encoders. It implements the ErasureCoder interface.
  • Constructor Details

  • Method Details

    • calculateCoding

      public ErasureCodingStep calculateCoding(ECBlockGroup blockGroup)
      Description copied from interface: ErasureCoder
      Calculate 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:
      calculateCoding in interface ErasureCoder
      Parameters:
      blockGroup - the erasure coding block group containing all necessary information for codec calculation
      Returns:
      ErasureCodingStep.
    • getNumDataUnits

      public int getNumDataUnits()
      Description copied from interface: ErasureCoder
      The number of data input units for the coding. A unit can be a byte, chunk or buffer or even a block.
      Specified by:
      getNumDataUnits in interface ErasureCoder
      Returns:
      count of data input units
    • getNumParityUnits

      public int getNumParityUnits()
      Description copied from interface: ErasureCoder
      The number of parity output units for the coding. A unit can be a byte, chunk, buffer or even a block.
      Specified by:
      getNumParityUnits in interface ErasureCoder
      Returns:
      count of parity output units
    • getOptions

      public ErasureCoderOptions getOptions()
      Description copied from interface: ErasureCoder
      The options of erasure coder. This option is passed to raw erasure coder as it is.
      Specified by:
      getOptions in interface ErasureCoder
      Returns:
      erasure coder options
    • getInputBlocks

      protected ECBlock[] getInputBlocks(ECBlockGroup blockGroup)
    • getOutputBlocks

      protected ECBlock[] getOutputBlocks(ECBlockGroup blockGroup)
    • preferDirectBuffer

      public boolean preferDirectBuffer()
      Description copied from interface: ErasureCoder
      Tell 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:
      preferDirectBuffer in interface ErasureCoder
      Returns:
      true if direct buffer is preferred for performance consideration, otherwise false.
    • release

      public void release()
      Description copied from interface: ErasureCoder
      Release the resources if any. Good chance to invoke RawErasureCoder#release.
      Specified by:
      release in interface ErasureCoder
    • prepareEncodingStep

      protected abstract ErasureCodingStep prepareEncodingStep(ECBlockGroup blockGroup)
      Perform encoding against a block group.
      Parameters:
      blockGroup - blockGroup.
      Returns:
      encoding step for caller to do the real work