sqlitejournal

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sqlitejournal keeps the delivery daemon's journal in its own SQLite file: sessions, bindings and every delivery's state, with the sequence numbers of the messages in it. It implements the delivery package's Journal port and never stores tokens or message bodies.

Index

Constants

This section is empty.

Variables

View Source
var ErrNewerSchema = errors.New("written by a newer aboard")

ErrNewerSchema means the data was written by a newer aboard, whose schema this one doesn't know; reading it could misread it, so Open refuses.

View Source
var ErrNoDelivery = errors.New("no such delivery")

ErrNoDelivery means there is no delivery with the given id.

Functions

func ReadModes

func ReadModes(ctx context.Context, path string) (map[delivery.AgentRef]delivery.Mode, error)

ReadModes returns the delivery modes recorded in the journal at path without opening it for writing or changing its schema, so it can be read while a daemon, perhaps an older one, has it open. A journal that doesn't exist, or predates modes, has none.

func ReadSessionBoots added in v0.1.5

func ReadSessionBoots(ctx context.Context, path string) ([]delivery.SessionRecord, error)

ReadSessionBoots reads lifecycle evidence without changing an older daemon's schema.

Types

type Journal

type Journal struct {
	// contains filtered or unexported fields
}

Journal is an open delivery journal.

func Open

func Open(ctx context.Context, path string) (*Journal, error)

Open opens (creating if needed) the journal at path, readable only by its owner, and applies migrations.

func (*Journal) AddDelivery

func (j *Journal) AddDelivery(ctx context.Context, d delivery.Delivery) (int64, error)

AddDelivery records a delivery and its messages in one transaction.

func (*Journal) ApprovalSeatWatches added in v0.1.4

func (j *Journal) ApprovalSeatWatches(ctx context.Context, agent delivery.AgentRef) ([]delivery.ApprovalWatch, error)

ApprovalSeatWatches exposes retained origins only for an explicitly bound permanent seat. Invalidated origins are metadata for notices, never endpoint or collection authority.

func (*Journal) ApprovalWatches added in v0.1.4

func (j *Journal) ApprovalWatches(ctx context.Context, key delivery.SessionKey) ([]delivery.ApprovalWatch, error)

ApprovalWatches loads nonsecret origins for one exact harness session.

func (*Journal) Bind

func (j *Journal) Bind(ctx context.Context, b delivery.Binding) error

Bind records the session an agent's messages go to, replacing the agent's earlier session and the session's earlier agent: a session is bound to at most one agent.

func (*Journal) BindGeneration

func (j *Journal) BindGeneration(ctx context.Context, b delivery.Binding, advance bool) (delivery.Binding, error)

BindGeneration fences a changed credential explicitly; metadata-only refreshes preserve the generation. Retaining other boards requires explicit activation.

func (*Journal) Bindings

func (j *Journal) Bindings(ctx context.Context) ([]delivery.Binding, error)

Bindings returns every agent's binding.

func (*Journal) CancelNotice added in v0.1.4

func (j *Journal) CancelNotice(ctx context.Context, id string) error

CancelNotice removes a pending notice after fresh authority is refused.

func (*Journal) Close

func (j *Journal) Close() error

Close closes the journal.

func (*Journal) ConfirmHandoff

func (j *Journal) ConfirmHandoff(ctx context.Context, id string, session delivery.SessionKey, boot string, surviving []delivery.AgentKey, at time.Time) ([]delivery.Delivery, error)

ConfirmHandoff persists evidence for the current, nonterminal whitelist only.

func (*Journal) Deliveries

func (j *Journal) Deliveries(ctx context.Context, states ...delivery.State) ([]delivery.Delivery, error)

Deliveries returns the deliveries in the given states, oldest first, with their messages' sequence numbers in order.

func (*Journal) Handoffs

func (j *Journal) Handoffs(ctx context.Context) ([]delivery.HandoffManifest, error)

Handoffs returns frozen manifests in preparation order for recovery.

func (*Journal) MarkNoticeHanded added in v0.1.4

func (j *Journal) MarkNoticeHanded(ctx context.Context, id string) error

MarkNoticeHanded records transport acceptance, not reading or delivery proof.

func (*Journal) Modes

func (j *Journal) Modes(ctx context.Context) (map[delivery.AgentRef]delivery.Mode, error)

Modes returns every agent's recorded delivery mode.

func (*Journal) Notices added in v0.1.4

Notices reads the owned seat's pending and terminal notice records.

func (*Journal) PrepareHandoff

PrepareHandoff commits the immutable manifest and every handed delivery together.

func (*Journal) QueueReporter added in v0.1.4

func (j *Journal) QueueReporter(ctx context.Context, agent delivery.AgentRef, key delivery.SessionKey, boot string, generation uint64) (delivery.QueueReporter, error)

QueueReporter loads a retained reporter for one current binding generation.

func (*Journal) ResolveIdentity

func (j *Journal) ResolveIdentity(ctx context.Context, old, resolved delivery.AgentRef) error

ResolveIdentity promotes unverified journal entries only after their own credential identifies the member. Conflicting resolved state is never overwritten.

func (*Journal) SaveApprovalWatch added in v0.1.4

func (j *Journal) SaveApprovalWatch(ctx context.Context, w delivery.ApprovalWatch) error

SaveApprovalWatch refuses to move an existing origin or save a stale binding.

func (*Journal) SaveNotice added in v0.1.4

func (j *Journal) SaveNotice(ctx context.Context, n delivery.DurableNotice) error

SaveNotice preserves the first immutable origin for a source notice.

func (*Journal) SaveQueueReporter added in v0.1.4

func (j *Journal) SaveQueueReporter(ctx context.Context, state delivery.QueueReporter) error

SaveQueueReporter records its immutable pending request before network publication.

func (*Journal) SaveSession

func (j *Journal) SaveSession(ctx context.Context, s delivery.SessionRecord) error

SaveSession records a session's boot id, its harness process, whether it is open and the agent another session took from it.

func (*Journal) SaveShown added in v0.1.4

func (j *Journal) SaveShown(ctx context.Context, records []delivery.ShownRecord) error

SaveShown atomically records exact identities against the current binding and boot.

func (*Journal) Sessions

func (j *Journal) Sessions(ctx context.Context) ([]delivery.SessionRecord, error)

Sessions returns every recorded session.

func (*Journal) SetMode

func (j *Journal) SetMode(ctx context.Context, agent delivery.AgentRef, mode delivery.Mode) error

SetMode records an agent's delivery mode, replacing any earlier one.

func (*Journal) ShownMessages added in v0.1.4

func (j *Journal) ShownMessages(ctx context.Context, key delivery.SessionKey, boot string) ([]delivery.ShownRecord, error)

ShownMessages loads observations for one boot without storing message bodies.

func (*Journal) UnstartedDeliveries added in v0.1.4

func (j *Journal) UnstartedDeliveries(ctx context.Context) ([]delivery.Delivery, error)

UnstartedDeliveries includes acknowledged queue admissions until a turn consumes them.

func (*Journal) UpdateDelivery

func (j *Journal) UpdateDelivery(ctx context.Context, d delivery.Delivery) error

UpdateDelivery saves a delivery's state, session, attempts, reason, retry time and how far it got in its session.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL