Interface LogStreamBatchWriter

All Superinterfaces:
LogStreamWriter

public interface LogStreamBatchWriter extends LogStreamWriter
Write log entries to the log stream write buffer as batch. This ensures that the log entries are written atomically.

Note that the log entry data is buffered until LogStreamWriter.tryWrite() is called.

  • Method Details

    • sourceRecordPosition

      LogStreamBatchWriter sourceRecordPosition(long position)
      Set the source event for all log entries.
    • event

      Returns the builder to add a new log entry to the batch.
    • getMaxFragmentLength

      int getMaxFragmentLength()
    • reset

      void reset()
      Discard all non-written batch data.
    • canWriteAdditionalEvent

      boolean canWriteAdditionalEvent(int length)
      Returns whether an additional event of length length could be written to the batch or not.
      Parameters:
      length - the length of the event's value and metadata summed, i.e. LoggedEvent.getValueLength() + LoggedEvent.getMetadataLength()
      Returns:
      true if the additional event could be written, false otherwise
    • canWriteAdditionalEvent

      boolean canWriteAdditionalEvent(int eventCount, int batchSize)
      Returns true if the given eventCount with the given batchLength could potentially be written with the BatchWriter, false otherwise.
      Parameters:
      eventCount - the potential event count we want to check
      batchSize - the potential batch Size (in bytes) we want to check
      Returns:
      true if the event count with corresponding size could be written, false otherwise