Class LocalAppendableColumn<DATA_TYPE>

java.lang.Object
com.illumon.iris.db.tables.appendable.BaseAppendableColumn<DATA_TYPE>
com.illumon.iris.db.tables.appendable.local.LocalAppendableColumn<DATA_TYPE>
All Implemented Interfaces:
AppendableColumn<DATA_TYPE>, BufferedAppendable, BufferedAppendableColumn<DATA_TYPE>, TableTransactionProcessor
Direct Known Subclasses:
FixedWidthObjectCodecLocalAppendableColumn, NanosBackedTimeAppendableColumn, SymbolManagerLocalAppendableColumn, VariableWidthObjectLocalAppendableColumn

public class LocalAppendableColumn<DATA_TYPE> extends BaseAppendableColumn<DATA_TYPE> implements TableTransactionProcessor, BufferedAppendableColumn<DATA_TYPE>

AppendableColumn for output to a local column location.

Application threads must synchronize in order to ensure mutually-exclusive concurrent access for all operations other than force() (which may proceed concurrently).

release() or close() must only be called after all other operations besides force() are completed, in any thread. The expectation is that after an error in writing applications will release() scarce resources, or after successful writing applications will close() the column.

Note that code assumes correct usage, and omits validation for alignment issues that would occur with incorrect usage.

  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • force

      public void force()
      Description copied from interface: BufferedAppendable
      Force all flushed data to be persisted to permanent storage. Will consistently and atomically persist the last prepared checkpoint in implementations that implement BufferedAppendable.prepareCheckpoint(). Does not imply BufferedAppendable.flush(), as this is a distinct operation in all implementations. May be called concurrently by threads other than the "writing thread".
      Specified by:
      force in interface AppendableColumn<DATA_TYPE>
      Specified by:
      force in interface BufferedAppendable
    • close

      public void close()
      Description copied from interface: BufferedAppendable
      Flush all appended data to the underlying store, release any resources held, and force all appended data to be persisted to permanent storage. This should be the final access to this appendable (if successful) with the exception of any asynchronous BufferedAppendable.force() operations. A BufferedAppendable.release() is appropriate afterwards, especially on error.
      Specified by:
      close in interface AppendableColumn<DATA_TYPE>
      Specified by:
      close in interface BufferedAppendable
    • flush

      public void flush()
      Description copied from interface: BufferedAppendable
      Write all appended data to the underlying store and prepare for subsequent writes. Does not imply BufferedAppendable.force().
      Specified by:
      flush in interface BufferedAppendable
    • doneAppending

      public void doneAppending()
      Description copied from interface: BufferedAppendableColumn
      Optionally called before BufferedAppendable.close() to release any resources that may be released prior to BufferedAppendable.close(). No data should be appended after this method is invoked.
      Specified by:
      doneAppending in interface BufferedAppendableColumn<DATA_TYPE>
    • release

      public void release()
      Description copied from interface: BufferedAppendable
      Release any resources held. Called after an error in preparation for termination. For external callers, this should be done as the final access to this column with the exception of any asynchronous BufferedAppendable.force() operations.
      Specified by:
      release in interface BufferedAppendable
    • inTransaction

      public boolean inTransaction()
      Specified by:
      inTransaction in interface TableTransactionProcessor
      Returns:
      True if this processor is currently in a transaction, else false
    • startTransaction

      public void startTransaction()
      Description copied from interface: TableTransactionProcessor
      Begin a new transaction. Causes any existing pending transaction to be aborted.
      Specified by:
      startTransaction in interface TableTransactionProcessor
    • abortTransaction

      public void abortTransaction()
      Description copied from interface: TableTransactionProcessor

      Abort the current pending transaction.

      This should not be called if there is no current transaction.

      Specified by:
      abortTransaction in interface TableTransactionProcessor
    • finishTransaction

      public void finishTransaction()
      Description copied from interface: TableTransactionProcessor

      Finish the current pending transaction.

      This makes the rows that were part of the transaction eligible to be made visible and durable, but does not in itself make them visible or durable.

      This should not be called if there is no current transaction.

      Specified by:
      finishTransaction in interface TableTransactionProcessor
    • addByte

      public void addByte(byte value)
      Description copied from interface: AppendableColumn
      Append a byte to this column.
      Specified by:
      addByte in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
    • addChar

      public void addChar(char value)
      Description copied from interface: AppendableColumn
      Append a char to this column.
      Specified by:
      addChar in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
    • addDouble

      public void addDouble(double value)
      Description copied from interface: AppendableColumn
      Append a double to this column.
      Specified by:
      addDouble in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
    • addFloat

      public void addFloat(float value)
      Description copied from interface: AppendableColumn
      Append a float to this column.
      Specified by:
      addFloat in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
    • addInt

      public void addInt(int value)
      Description copied from interface: AppendableColumn
      Append a int to this column.
      Specified by:
      addInt in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
    • addLong

      public void addLong(long value)
      Description copied from interface: AppendableColumn
      Append a long to this column.
      Specified by:
      addLong in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
    • addShort

      public void addShort(short value)
      Description copied from interface: AppendableColumn
      Append a short to this column.
      Specified by:
      addShort in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
    • addByte

      public final void addByte(byte value, long count)
      Description copied from interface: AppendableColumn
      Append a byte to this column count times.
      Specified by:
      addByte in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
      count - The number of times to append the value
    • addChar

      public final void addChar(char value, long count)
      Description copied from interface: AppendableColumn
      Append a char to this column count times.
      Specified by:
      addChar in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
      count - The number of times to append the value
    • addDouble

      public final void addDouble(double value, long count)
      Description copied from interface: AppendableColumn
      Append a double to this column count times.
      Specified by:
      addDouble in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
      count - The number of times to append the value
    • addFloat

      public final void addFloat(float value, long count)
      Description copied from interface: AppendableColumn
      Append a float to this column count times.
      Specified by:
      addFloat in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
      count - The number of times to append the value
    • addInt

      public final void addInt(int value, long count)
      Description copied from interface: AppendableColumn
      Append a int to this column count times.
      Specified by:
      addInt in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
      count - The number of times to append the value
    • addLong

      public final void addLong(long value, long count)
      Description copied from interface: AppendableColumn
      Append a long to this column count times.
      Specified by:
      addLong in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
      count - The number of times to append the value
    • addShort

      public final void addShort(short value, long count)
      Description copied from interface: AppendableColumn
      Append a short to this column count times.
      Specified by:
      addShort in interface AppendableColumn<DATA_TYPE>
      Parameters:
      value - The value to append
      count - The number of times to append the value
    • addBytes

      public void addBytes(@NotNull byte[] values, int startIndex, int length)
      Description copied from interface: AppendableColumn
      Add byte values from an array.
      Specified by:
      addBytes in interface AppendableColumn<DATA_TYPE>
      Parameters:
      values - The array of values
      startIndex - The index of the first value to add
      length - The total number of values to add
    • addBytes

      public void addBytes(@NotNull ByteBuffer inputBuffer)
      Description copied from interface: AppendableColumn
      Add byte values from a ByteBuffer, starting at buffer.position() and continuing to buffer.limit().
      Specified by:
      addBytes in interface AppendableColumn<DATA_TYPE>
      Parameters:
      inputBuffer - The buffer
    • addChars

      public void addChars(@NotNull char[] values, int startIndex, int length)
      Description copied from interface: AppendableColumn
      Add char values from an array.
      Specified by:
      addChars in interface AppendableColumn<DATA_TYPE>
      Parameters:
      values - The array of values
      startIndex - The index of the first value to add
      length - The total number of values to add
    • addDoubles

      public void addDoubles(@NotNull double[] values, int startIndex, int length)
      Description copied from interface: AppendableColumn
      Add double values from an array.
      Specified by:
      addDoubles in interface AppendableColumn<DATA_TYPE>
      Parameters:
      values - The array of values
      startIndex - The index of the first value to add
      length - The total number of values to add
    • addFloats

      public void addFloats(@NotNull float[] values, int startIndex, int length)
      Description copied from interface: AppendableColumn
      Add float values from an array.
      Specified by:
      addFloats in interface AppendableColumn<DATA_TYPE>
      Parameters:
      values - The array of values
      startIndex - The index of the first value to add
      length - The total number of values to add
    • addInts

      public void addInts(@NotNull int[] values, int startIndex, int length)
      Description copied from interface: AppendableColumn
      Add int values from an array.
      Specified by:
      addInts in interface AppendableColumn<DATA_TYPE>
      Parameters:
      values - The array of values
      startIndex - The index of the first value to add
      length - The total number of values to add
    • addLongs

      public void addLongs(@NotNull long[] values, int startIndex, int length)
      Description copied from interface: AppendableColumn
      Add long values from an array.
      Specified by:
      addLongs in interface AppendableColumn<DATA_TYPE>
      Parameters:
      values - The array of values
      startIndex - The index of the first value to add
      length - The total number of values to add
    • addShorts

      public void addShorts(@NotNull short[] values, int startIndex, int length)
      Description copied from interface: AppendableColumn
      Add short values from an array.
      Specified by:
      addShorts in interface AppendableColumn<DATA_TYPE>
      Parameters:
      values - The array of values
      startIndex - The index of the first value to add
      length - The total number of values to add
    • ensureFileExists

      public void ensureFileExists()
      When recreating our files, we need to make sure that they exist, but we do not need to actually force them to disk durably.
    • addComputed

      public void addComputed(int count, @NotNull LocalAppendableColumn.ValueSupplier<DATA_TYPE> valueSupplier) throws IOException
      Add values computed on demand from a function over an int value index. Note that this is generally sub-optimal for columns of primitive types.
      Parameters:
      count - The number of values to add
      valueSupplier - The value supplier, over domain [0, length)
      Throws:
      IOException
    • addEncoded

      public void addEncoded(int count, @NotNull IntFunction<ByteBuffer> valueSupplier)
      Add pre-encoded values computed on demand from a function over an int value index. The caller is responsible for ensuring that the encoding is correct.
      Parameters:
      count - The number of values to add
      valueSupplier - The value supplier, over domain [0, length)
    • addFromBooleanChunk

      public final void addFromBooleanChunk(@NotNull ObjectChunk<Boolean,? extends Attributes.Values> source)
      Description copied from interface: AppendableColumn
      Add all values from source in the range [0, source.size()).
      Specified by:
      addFromBooleanChunk in interface AppendableColumn<DATA_TYPE>
      Parameters:
      source - The source ObjectChunk
    • addFromByteChunk

      public final void addFromByteChunk(@NotNull ByteChunk<? extends Attributes.Values> source)
      Description copied from interface: AppendableColumn
      Add all values from source in the range [0, source.size()).
      Specified by:
      addFromByteChunk in interface AppendableColumn<DATA_TYPE>
      Parameters:
      source - The source ByteChunk
    • addFromCharChunk

      public final void addFromCharChunk(@NotNull CharChunk<? extends Attributes.Values> source)
      Description copied from interface: AppendableColumn
      Add all values from source in the range [0, source.size()).
      Specified by:
      addFromCharChunk in interface AppendableColumn<DATA_TYPE>
      Parameters:
      source - The source CharChunk
    • addFromDoubleChunk

      public final void addFromDoubleChunk(@NotNull DoubleChunk<? extends Attributes.Values> source)
      Description copied from interface: AppendableColumn
      Add all values from source in the range [0, source.size()).
      Specified by:
      addFromDoubleChunk in interface AppendableColumn<DATA_TYPE>
      Parameters:
      source - The source DoubleChunk
    • addFromFloatChunk

      public final void addFromFloatChunk(@NotNull FloatChunk<? extends Attributes.Values> source)
      Description copied from interface: AppendableColumn
      Add all values from source in the range [0, source.size()).
      Specified by:
      addFromFloatChunk in interface AppendableColumn<DATA_TYPE>
      Parameters:
      source - The source FloatChunk
    • addFromIntChunk

      public final void addFromIntChunk(@NotNull IntChunk<? extends Attributes.Values> source)
      Description copied from interface: AppendableColumn
      Add all values from source in the range [0, source.size()).
      Specified by:
      addFromIntChunk in interface AppendableColumn<DATA_TYPE>
      Parameters:
      source - The source IntChunk
    • addFromLongChunk

      public final void addFromLongChunk(@NotNull LongChunk<? extends Attributes.Values> source)
      Description copied from interface: AppendableColumn
      Add all values from source in the range [0, source.size()).
      Specified by:
      addFromLongChunk in interface AppendableColumn<DATA_TYPE>
      Parameters:
      source - The source LongChunk
    • addFromShortChunk

      public final void addFromShortChunk(@NotNull ShortChunk<? extends Attributes.Values> source)
      Description copied from interface: AppendableColumn
      Add all values from source in the range [0, source.size()).
      Specified by:
      addFromShortChunk in interface AppendableColumn<DATA_TYPE>
      Parameters:
      source - The source ShortChunk
    • addFromObjectChunk

      public final void addFromObjectChunk(@NotNull ObjectChunk<DATA_TYPE,? extends Attributes.Values> source)
      Description copied from interface: AppendableColumn
      Add all values from source in the range [0, source.size()).
      Specified by:
      addFromObjectChunk in interface AppendableColumn<DATA_TYPE>
      Parameters:
      source - The source ObjectChunk