Documentation
¶
Overview ¶
Package journal is the append-only event log of everything the colony does: the durable spine under the D2 event stream and the source for replay (doc 01 section 8). The log leads and the stream follows: an event reaches subscribers only after the writer has sequenced and written it, so any "I saw up to N" is a valid resume cursor.
Index ¶
Constants ¶
const DefaultRotateBytes = 8 << 20
DefaultRotateBytes is the size a journal file grows to before the writer rolls to the next index (doc 01 section 8.3).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Journal ¶
type Journal struct {
// contains filtered or unexported fields
}
Journal is the append-only event log. Append stamps Seq and Time under a lock and enqueues; one writer goroutine drains the queue in order, writes each line, then hands the event to the sink.
func Open ¶
Open prepares a journal in dir, scanning existing files so Seq continues gap-free across restarts. No goroutine starts until Start.
func (*Journal) Append ¶
Append stamps Seq and Time and enqueues the event for durable logging. It returns the stamped event after it is queued, not after it is on disk; ordering is the single writer's, durability its flush policy. Between Close and the process end the stamp still happens but nothing is logged or fanned out; the colony stops producing before it closes.
func (*Journal) Cursor ¶
Cursor is the last Seq assigned, the resume point a fresh subscriber's hello carries.