LocalLog

class LocalLog<M> @JvmOverloads constructor(rootPath: Path, codec: MessageCodec<M>, instantSource: InstantSource, val epoch: Int, val useInstantSourceForNonTx: Boolean, coroutineContext: CoroutineContext = Dispatchers.IO, baseFileName: String = "LOG", val partitions: Int = 1) : Log<M>

Constructors

Link copied to clipboard
constructor(rootPath: Path, codec: MessageCodec<M>, instantSource: InstantSource, epoch: Int, useInstantSourceForNonTx: Boolean, coroutineContext: CoroutineContext = Dispatchers.IO, baseFileName: String = "LOG", partitions: Int = 1)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
@SerialName(value = "!Local")
@Serializable
data class Factory @JvmOverloads constructor(val path: Path, var instantSource: InstantSource = InstantSource.system(), var epoch: Int = 0, var useInstantSourceForNonTx: Boolean = false, var coroutineContext: CoroutineContext = Dispatchers.IO) : Log.Factory

Used to set configuration options for a local directory based XTDB Log.

Properties

Link copied to clipboard
open override val epoch: Int
Link copied to clipboard

Functions

Link copied to clipboard
open suspend override 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
open override fun close()
Link copied to clipboard
open fun latestSubmittedMsgId(partition: Int = 0): MessageId
Link copied to clipboard
open override fun latestSubmittedOffset(partition: Int = 0): LogOffset
Link copied to clipboard
open override fun readLastMessage(partition: Int = 0): M?
Link copied to clipboard
open override 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
open suspend override 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.