Interface MultiPartitionWriter
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
LogAggregatorWriterMultiPartition,MultiPartitionWriterStatistics
This interface is used when the logger determines the column partition to write to.
The writer may use a one or more channels for each partition (e.g. to roll log files on a regular basis)
This is not meant to be a extended by third parties - this is simply a way for callers to abstract over the different writer implementation that Deephaven provides.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this writer.static MultiPartitionWriterempty()Creates a new "empty" writer that simply discards any data written to it.voidwriteDataToPartition(@NotNull String columnPartition, int numRows, @NotNull ByteBuffer buffer) Write all the row data to the given column partition.
-
Method Details
-
empty
Creates a new "empty" writer that simply discards any data written to it.- Returns:
- a new empty writer
-
writeDataToPartition
@InternalUseOnly void writeDataToPartition(@NotNull @NotNull String columnPartition, int numRows, @NotNull @NotNull ByteBuffer buffer) throws IOException 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.
- Parameters:
columnPartition- the column partition that the buffer should be written tonumRows- the number of rows represented inbuffer, must be positivebuffer- the buffer to write.- Throws:
IOException- if an IO error occurred
-
close
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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- if an error occurred while closing this writer
-