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>, TableTransactionProcessor
Direct Known Subclasses:
LocalAppendableColumnImpl

public abstract class LocalAppendableColumn<DATA_TYPE> extends BaseAppendableColumn<DATA_TYPE> implements TableTransactionProcessor

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 AppendableColumn.force() (which may proceed concurrently).

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

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

  • Constructor Details

    • LocalAppendableColumn

      public LocalAppendableColumn(@NotNull @NotNull String name, @NotNull @NotNull Class<DATA_TYPE> type)
      Construct a LocalAppendableColumn.
      Parameters:
      name - The column name
      type - The column data type
  • Method Details

    • getSizeInBytes

      public abstract long getSizeInBytes()
      Get the size (in bytes) of the underlying data file region for this column.
      Returns:
      The size (in bytes) of the underlying data file region
    • ensureFileExists

      public abstract 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 @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 @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)
    • addFromObjectChunk

      public final void addFromObjectChunk(@NotNull @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