Class LocalTableWriter

java.lang.Object
com.illumon.iris.db.tables.appendable.local.LocalTableWriter
All Implemented Interfaces:
Entry, Record, Row, TableWriter<Row>, BufferedAppendable
Direct Known Subclasses:
LocalTableWriterImpl

public abstract class LocalTableWriter extends Object implements TableWriter<Row>, BufferedAppendable
TableWriter for concurrently-readable table writing to a local table location.
  • Field Details

    • NULL_PENDING_SIZE

      protected static final long NULL_PENDING_SIZE
      Null size value for pendingSize, used to signify no current pending rows.
      See Also:
    • pendingSize

      protected long pendingSize
      The pending size of the underlying table, to become size when the current transaction finishes.
    • invalidTransaction

      protected boolean invalidTransaction
      State marker for transactions that were created in order to discard a partial transaction, e.g. a series of Row.Flags.None and Row.Flags.EndTransaction records when no Row.Flags.StartTransaction was observed.
  • Constructor Details

    • LocalTableWriter

      public LocalTableWriter()
  • Method Details

    • supportAllTypes

      public boolean supportAllTypes()
      Description copied from interface: TableWriter
      True if all data types can be written out; false otherwise.
      Specified by:
      supportAllTypes in interface TableWriter<Row>
      Returns:
      true if all data types can be written out; false otherwise.
    • getRowWriter

      public Row getRowWriter()
      Description copied from interface: TableWriter
      Get a writer for a Row entries. This is likely to be newly created, so callers should cache this value. In practice, TableWriter implementations generally cache the result of the first call to this method as a primary writer.
      Specified by:
      getRowWriter in interface TableWriter<Row>
      Returns:
      a Row, likely newly created
    • getColumn

      public abstract <CT extends LocalAppendableColumn<?>> CT getColumn(@NotNull String name, @NotNull Class<CT> clazz)
      Get a LocalAppendableColumn for use by writing code that doesn't use RowSetters.
      Parameters:
      name - The column name
      clazz - The expected column class
      Returns:
      The column
    • inTransaction

      public final boolean inTransaction()
      Check whether a transaction is in progress.
      Returns:
      Whether a transaction is in progress
    • inInvalidTransaction

      public final boolean inInvalidTransaction()
      Check whether an invalid transaction (which will never succeed) is in progress.
      Returns:
      Whether an invalid transaction is in progress
    • startTransaction

      public abstract void startTransaction()
      Begin a transaction. It is an error to call this method if a transaction is already in progress.
    • maybeStartTransaction

      public void maybeStartTransaction()
      If we're not currently in a transaction, begin one.
    • startInvalidTransaction

      public final void startInvalidTransaction()
      Begin a transaction that is guaranteed to never succeed. It is an error to call this method if a transaction is already in progress.
    • abortTransaction

      public abstract void abortTransaction()
      Abort a transaction. It is an error to call this method if a transaction is not in progress.
    • maybeAbortTransaction

      public final void maybeAbortTransaction()
      Abort a transaction if one is in progress.
    • endTransaction

      public abstract void endTransaction()
      End a transaction. It is an error to call this method if a transaction is not in progress or the current transaction is invalid.
    • maybeEndTransaction

      public final void maybeEndTransaction()
      End a transaction if one is in progress.
    • processFlagsPreWrite

      protected void processFlagsPreWrite(@NotNull Row.Flags flags)
      Process a row's flags before writing or batching data for write.
      Parameters:
      flags - The flags for this row
    • adviseRowsWritten

      public abstract void adviseRowsWritten(long count)
      Update accounting for rows were written.
      Parameters:
      count - The number of rows that were written
    • processFlagsPostWrite

      protected void processFlagsPostWrite(@NotNull Row.Flags flags)
      Process a row's flags after writing or batching data for write.
      Parameters:
      flags - The flags for this row
    • dirty

      public abstract boolean dirty()
      Test if there is data to flush.
      Returns:
      Whether there is data to flush
    • updateImportState

      public abstract void updateImportState(@NotNull UnaryOperator<ImportState> updater)
      Set the import state object (as in setImportState(ImportState)) after applying the supplied updater function to the existing import state object.
      Parameters:
      updater - The import state updater
    • setImportState

      public abstract void setImportState(ImportState importState)
      Set an import state object to be part of checkpoints for the output table.
      Parameters:
      importState - The import state
    • setImportDetails

      public abstract void setImportDetails(Properties importDetails)
      Set a trivial import state object wrapping the supplied import details to be part of checkpoints for the output table.
      Parameters:
      importDetails - The import details