Class AutoFlushWriter

java.lang.Object
net.quasardb.qdb.ts.Writer
net.quasardb.qdb.ts.AutoFlushWriter
All Implemented Interfaces:
Flushable, AutoCloseable

public final class AutoFlushWriter extends Writer
An implementation of a Writer that automatically flushes the local cache when a certain threshold has been reached. As with Writer, usage of instances of this class is not thread-safe. Use an AutFlushWriter instance per Thread in multi-threaded situations.
  • Constructor Details

    • AutoFlushWriter

      protected AutoFlushWriter(Session session, Writer.Options options)
      Initialize a new auto-flushing batch writer with a default threshold of 50000 rows.
      Parameters:
      session - Active connection with the QdbCluster
      options - Batch writer options
    • AutoFlushWriter

      protected AutoFlushWriter(Session session, long threshold, Writer.Options options)
      Initialize a new auto-flushing batch writer.
      Parameters:
      session - Active connection with the QdbCluster
      threshold - The amount of rows to keep in local buffer before automatic flushing occurs.
      options - Writer options
  • Method Details

    • append

      public void append(Table table, Timespec timestamp, Value[] values) throws IOException
      Description copied from class: Writer
      Append a new row to the local table cache. Should be periodically flushed, unless an AutoFlushWriter is used. This function automatically looks up a table's offset by its name. For performance reason, you are encouraged to manually invoke and cache the value of #tableIndexByName whenever possible.
      Overrides:
      append in class Writer
      Parameters:
      table - Table to insert into.
      timestamp - Timestamp of the row
      values - Values being inserted, mapped to columns by their relative offset.
      Throws:
      IOException
      See Also: