Class MultiPartitionWriterStatistics

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

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

    • of

      public static MultiPartitionWriterStatistics of(@NotNull @NotNull MultiPartitionWriter 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(@NotNull @NotNull String columnPartition, int numRows, @NotNull @NotNull ByteBuffer buffer) throws IOException
      Description copied from interface: MultiPartitionWriter
      Write all the row data to the given column 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. thread-safe access as appropriate.

      Specified by:
      writeDataToPartition in interface MultiPartitionWriter
      Parameters:
      columnPartition - the column partition that the buffer should be written to
      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: MultiPartitionWriter
      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 MultiPartitionWriter
      Throws:
      IOException - if an error occurred while closing this writer