Skip to content

JournalBufferWriter Methods

Base class for in-memory journal buffers used to assemble a pending journal batch.

CreateJournalStreamWriter(JournalStreamId)

View source
public JournalStreamWriter CreateJournalStreamWriter(JournalStreamId streamId)
Creates a writer for entries belonging to streamId.

Parameters

streamIdJournalStreamId
The durable state id.

Returns

A journal stream writer for the specified state.

FinishEntry(JournalStreamId)

abstract
protected abstract void FinishEntry(JournalStreamId streamId)
Writes any format-owned entry suffix or patches framing bytes.

Parameters

streamIdJournalStreamId
The durable state id.

GetBuffer

View source
public ArcBuffer GetBuffer()
Gets a pinned snapshot of the accumulated journal bytes which are safe to persist.

Returns

An ArcBuffer containing the accumulated journal bytes. The caller owns and must dispose the returned buffer.

GetEntryByte(int)

View source
protected byte GetEntryByte(int offset)
Gets a byte at the specified offset in the active entry.

Parameters

offsetint
The offset into the active entry.

Reset

View source
public void Reset()
Clears all buffered data so the writer can be reused for another batch.

StartEntry(JournalStreamId)

virtual
View source
protected virtual void StartEntry(JournalStreamId streamId)
Writes any format-owned entry prefix and prepares the payload writer.

Parameters

streamIdJournalStreamId
The durable state id.

WriteAt(int, ReadOnlySpan<byte>)

View source
protected void WriteAt(int offset, ReadOnlySpan<byte> value)
Patches format-owned framing bytes at the specified offset in the active entry.

Parameters

offsetint
The offset into the active entry.
valueReadOnlySpan<byte>
The replacement bytes.