Class SinglePartitionWriterStatistics

java.lang.Object
io.deephaven.enterprise.binlog.writer.SinglePartitionWriterStatistics
All Implemented Interfaces:
SinglePartitionWriter, Closeable, AutoCloseable

public final class SinglePartitionWriterStatistics extends Object implements SinglePartitionWriter
A wrapper around an existing SinglePartitionWriter that keeps simple statistics. Not thread safe.
  • Method Details

    • of

      public static SinglePartitionWriterStatistics of(@NotNull @NotNull SinglePartitionWriter writer)
      Creates a new statistics writer.
      Parameters:
      writer - the writer
      Returns:
      the statistics writer
    • writeCount

      public long writeCount()
      The total number of write calls.
      Returns:
      the total number of write calls
    • rowCount

      public long rowCount()
      The total number of rows written.
      Returns:
      the total number of rows written
    • byteCount

      public long byteCount()
      The total number of bytes written.
      Returns:
      the total number of bytes written
    • bufferCount

      public long bufferCount()
      The total number of buffers written.
      Returns:
      the total number of buffers written
    • resetStatistics

      public void resetStatistics()
      Resets the statistics.
    • writeDataToPartition

      public void writeDataToPartition(int numRows, @NotNull @NotNull ByteBuffer buffer) throws IOException
      Description copied from interface: SinglePartitionWriter
      Write all the row data to the partition.

      A write operation will return only after writing all the bytes, with the buffer's position moved to its limit.

      On error, the buffer's position will have been updated to account for the data that was successfully written; though, it is not safe to reuse this interface in an attempt to re-write the data (given the stateful nature of this interface).

      This is not meant to be called by third parties; the signature and documentation for this method is subject to change at any time.

      This method is not guaranteed to be thread-safe. The assumption is that the caller only calls this method from exactly one thread, or uses concurrency control primitives that create a happens-before barrier between calls.

      Specified by:
      writeDataToPartition in interface SinglePartitionWriter
      Parameters:
      numRows - the number of rows represented in buffer, must be positive
      buffer - the buffer to write
      Throws:
      IOException - if an IO error occurred
    • close

      public void close() throws IOException
      Description copied from interface: SinglePartitionWriter
      Close this writer. This method is thread-safe and may be invoked asynchronously, although asynchronous closure is discouraged as it may result in partially written data.

      If this writer has already been closed then this method returns immediately.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface SinglePartitionWriter
      Throws:
      IOException - if an error occurred while closing this writer