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 ¶
- Variables
- func ReadModes(ctx context.Context, path string) (map[delivery.AgentRef]delivery.Mode, error)
- type Journal
- func (j *Journal) AddDelivery(ctx context.Context, d delivery.Delivery) (int64, error)
- func (j *Journal) Bind(ctx context.Context, b delivery.Binding) error
- func (j *Journal) BindGeneration(ctx context.Context, b delivery.Binding, advance bool) (delivery.Binding, error)
- func (j *Journal) Bindings(ctx context.Context) ([]delivery.Binding, error)
- func (j *Journal) Close() error
- func (j *Journal) ConfirmHandoff(ctx context.Context, id string, session delivery.SessionKey, boot string, ...) ([]delivery.Delivery, error)
- func (j *Journal) Deliveries(ctx context.Context, states ...delivery.State) ([]delivery.Delivery, error)
- func (j *Journal) Handoffs(ctx context.Context) ([]delivery.HandoffManifest, error)
- func (j *Journal) Modes(ctx context.Context) (map[delivery.AgentRef]delivery.Mode, error)
- func (j *Journal) PrepareHandoff(ctx context.Context, m delivery.HandoffManifest) (delivery.HandoffManifest, error)
- func (j *Journal) ResolveIdentity(ctx context.Context, old, resolved delivery.AgentRef) error
- func (j *Journal) SaveSession(ctx context.Context, s delivery.SessionRecord) error
- func (j *Journal) Sessions(ctx context.Context) ([]delivery.SessionRecord, error)
- func (j *Journal) SetMode(ctx context.Context, agent delivery.AgentRef, mode delivery.Mode) error
- func (j *Journal) UpdateDelivery(ctx context.Context, d delivery.Delivery) error
Constants ¶
This section is empty.
Variables ¶
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.
var ErrNoDelivery = errors.New("no such delivery")
ErrNoDelivery means there is no delivery with the given id.
Functions ¶
Types ¶
type Journal ¶
type Journal struct {
// contains filtered or unexported fields
}
Journal is an open delivery journal.
func Open ¶
Open opens (creating if needed) the journal at path, readable only by its owner, and applies migrations.
func (*Journal) AddDelivery ¶
AddDelivery records a delivery and its messages in one transaction.
func (*Journal) Bind ¶
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) 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) PrepareHandoff ¶
func (j *Journal) PrepareHandoff(ctx context.Context, m delivery.HandoffManifest) (delivery.HandoffManifest, error)
PrepareHandoff commits the immutable manifest and every handed delivery together.
func (*Journal) ResolveIdentity ¶
ResolveIdentity promotes unverified journal entries only after their own credential identifies the member. Conflicting resolved state is never overwritten.
func (*Journal) SaveSession ¶
SaveSession records a session's boot id, its harness process, whether it is open and the agent another session took from it.