Log

interface Log<M> : AutoCloseable

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
interface Factory
Link copied to clipboard
class MessageMetadata(val epoch: Int, val logOffset: LogOffset, val logTimestamp: LogTimestamp)
Link copied to clipboard
class MessageTooLargeException(message: String, cause: Throwable? = null) : RuntimeException
Link copied to clipboard
class Record<out M>(val epoch: Int, val logOffset: LogOffset, val logTimestamp: Instant, val message: M)
Link copied to clipboard
fun interface RecordProcessor<in M>
Link copied to clipboard
interface Registration
Link copied to clipboard
interface Tail<out M>

One consumer's position in a partition, valid only for the duration of withTail.

Properties

Link copied to clipboard
abstract val epoch: Int

Functions

Link copied to clipboard
abstract suspend fun appendMessage(message: M, partition: Int = 0): Log.MessageMetadata
Link copied to clipboard
open fun appendMessageBlocking(message: M, partition: Int = 0): Log.MessageMetadata
Link copied to clipboard
abstract fun close()
Link copied to clipboard
open fun latestSubmittedMsgId(partition: Int = 0): MessageId
Link copied to clipboard
abstract fun latestSubmittedOffset(partition: Int = 0): LogOffset
Link copied to clipboard
abstract fun readLastMessage(partition: Int = 0): M?
Link copied to clipboard
abstract fun readRecords(partition: Int, fromMsgId: MessageId, toMsgId: MessageId): Sequence<Log.Record<M>>

Reads records in the range [fromMsgId, toMsgId) (start-inclusive, end-exclusive). Returns a lazy sequence of decoded records in offset order. If toMsgId exceeds the latest submitted offset, reads up to the latest available record.

Link copied to clipboard
open suspend fun tailAll(partition: Int, afterMsgId: MessageId, pollTimeout: Duration = 1.seconds, processor: Log.RecordProcessor<M>)

Polls a tail until cancelled, handing every poll to processor, including empty polls.

Link copied to clipboard
abstract suspend fun <R> withTail(partition: Int, afterMsgId: MessageId, action: suspend (Log.Tail<M>) -> R): R

Runs action with a tail positioned after afterMsgId. The tail and its subscription are valid only until action returns.