Interface TableWriter<R extends Row>

All Superinterfaces:
Entry, Record, Row
All Known Implementing Classes:
AbstractBinaryStoreWriter, ArrayBackedTableWriter, BinaryStoreAggregatorWriterMultiPartition, BinaryStoreAggregatorWriterStandard, BinaryStoreWriterV2, DiskTableWriter, DynamicTableWriter, HybridWriter, InMemoryTableWriter, InMemoryTableWriter, LocalTableWriter, RowOrientedArrayBackedTableWriter, StreamTableWriter

public interface TableWriter<R extends Row>
extends Entry
Interface for writing table data out.
  • Field Details

  • Method Details

    • getSetter

      RowSetter getSetter​(String name)
      Gets a setter for a column.

      The implementation is likely to delegate to Row.getSetter(String) in a default Row instance.

      Specified by:
      getSetter in interface Row
      Parameters:
      name - column name
      Returns:
      setter for the column.
    • getSetter

      default <T> RowSetter<T> getSetter​(@NotNull String name, @NotNull Class<T> tClass)
      Gets a typed setter for a column.

      The implementation is likely to delegate to Row.getSetter(String, Class) in a default Row instance.

      Specified by:
      getSetter in interface Row
      Parameters:
      name - column name
      tClass - the type for the typed RowSetter
      Returns:
      setter for the column.
    • setFlags

      void setFlags​(Row.Flags flags)

      The implementation is likely to delegate to Row.setFlags(Flags) in a default Row instance.

      Specified by:
      setFlags in interface Row
    • getRowWriter

      R getRowWriter()
      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.
      Returns:
      a Row, likely newly created
    • writeRow

      void writeRow() throws IOException
      Writes out a new row (values set using setters).

      The implementation is likely to delegate to Row.writeRow() in a default Row instance.

      Specified by:
      writeRow in interface Row
      Throws:
      IOException - problem writing the row
      ImplNote:
      This method is used as part of the import portion of the table recording process in TableListeners
    • writeDeferredRow

      default void writeDeferredRow​(@NotNull WritableRowContainer<R> row) throws IOException

      Write the row to disk.

      Implementations of this method may choose to buffer rows for more efficient use of the underlying storage. Users should invoke flushDeferredRows() to tell the implementation to write any buffered rows.

      Parameters:
      row - The row to write (or potentially buffer)
      Throws:
      IOException - if an error occurs during write.
    • flushDeferredRows

      default void flushDeferredRows() throws IOException
      Write any rows buffered by writeDeferredRow(WritableRowContainer) to storage.
      Throws:
      IOException - if an error occurs during write. Implementations that may write to more than one channel will write through to each channel and throw a MultiException wrapped in an IOException that contains the details on errors that occurred per channel.
    • getRecordWriter

      default Record getRecordWriter()
      Get new writer for Record entries. This is likely to be newly created, so callers should cache this value. In practice, implementers generally cache the result of the first call to this method as a primary writer.
      Returns:
      a Record, likely newly created
    • getRecordSetter

      default Record.RecordSetter<RecordData> getRecordSetter()
      Gets a record setter for an entry.

      The implementation is likely to delegate to Record.getRecordSetter() in a default Record instance.

      Specified by:
      getRecordSetter in interface Record
      Returns:
      setter for the record.
    • getRecordSetter

      default <T extends RecordData> Record.RecordSetter<T> getRecordSetter​(Class<T> tClass)
      Gets a typed record setter for an entry.

      The implementation is likely to delegate to Record.getRecordSetter(Class) in a default Record instance.

      Specified by:
      getRecordSetter in interface Record
      Returns:
      setter for the record.
    • writeRecord

      default void writeRecord​(WritableByteChannel channel) throws IOException
      Write a record entry to the provided output channel. The implementor is responsible for providing the data buffer.

      The TableWriter implementation is likely to delegate to Record.writeRecord(WritableByteChannel) in a default Record instance.

      Specified by:
      writeRecord in interface Record
      Throws:
      IOException
    • close

      void close() throws IOException
      Closes the writer.
      Throws:
      IOException - problem closing the writer.
    • getColumnTypes

      Class[] getColumnTypes()
      Gets the column types for the table.
      Returns:
      column types for the table.
    • getColumnNames

      String[] getColumnNames()
      Gets the column names for the table.
      Returns:
      column names for the table.
    • flush

      void flush() throws IOException
      Flushes data out.
      Throws:
      IOException - problem flushing data out.
    • supportAllTypes

      boolean supportAllTypes()
      True if all data types can be written out; false otherwise.
      Returns:
      true if all data types can be written out; false otherwise.