command

package
v0.0.0-...-4f7885e Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 23 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 command persists command identity and receiver-side fencing before dispatch. It retains receipts and watermarks after resource deletion.

Index

Constants

View Source
const EpochSequenceBits = 40
View Source
const MaxEnrollmentGrants = 256
View Source
const MaxEpoch = (1 << 23) - 1
View Source
const Schema = `` /* 296-byte string literal not displayed */

Variables

This section is empty.

Functions

func CopyContext

func CopyContext(parent, source context.Context) context.Context

func WithContext

func WithContext(ctx context.Context, envelope Envelope) context.Context

WithContext carries an already-admitted command to its next executor hop. Receivers still validate and persist their own watermark before dispatch.

Types

type Authority

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

func OpenAuthority

func OpenAuthority(path string) (*Authority, error)

func (*Authority) Activation

func (a *Authority) Activation(phase string) (*model.ActivationReceipt, error)

func (*Authority) Active

func (a *Authority) Active(phase string) bool

func (*Authority) CheckActivation

func (a *Authority) CheckActivation(request model.ActivationRequest, key, receiver string) (*model.ActivationReceipt, error)

CheckActivation validates a monotone chain. The host handler must separately recompute its own complete physical inventory while frozen before committing reads or mutations. This journal never accepts an operator boolean proof.

func (*Authority) CommitActivation

func (a *Authority) CommitActivation(receipt model.ActivationReceipt) error

func (*Authority) CommitFence

func (a *Authority) CommitFence(receipt model.FencingReceipt) error

func (*Authority) FenceReceipt

func (a *Authority) FenceReceipt() (*model.FencingReceipt, error)

func (*Authority) RequireActive

func (a *Authority) RequireActive(phase string) error

func (*Authority) State

func (a *Authority) State() (AuthorityState, error)

type AuthorityState

type AuthorityState struct {
	Version int    `json:"version"`
	ID      string `json:"authority"`
	Epoch   uint64 `json:"epoch"`
	Phase   string `json:"phase"`
	Key     string `json:"key"`
}

AuthorityState lives outside the SQLite restore scope. Root operators advance it before recovery; a restored database cannot lower this receiver's epoch. Epochs alone are not physical host fencing or permission to resume work.

type EnrollmentStore

type EnrollmentStore struct{ Directory string }

EnrollmentStore is independent of SQLite restore. Its generated directory identity, separately anchored count and paired claim records prevent missing metadata from manufacturing fresh enrollment permission (INV-03/04/05/14).

func CreateEnrollmentStore

func CreateEnrollmentStore(parent string, key string) (EnrollmentStore, error)

CreateEnrollmentStore publishes a fresh generated directory below an existing private parent. It cannot recreate a deleted configured identity by name.

func (EnrollmentStore) Check

func (EnrollmentStore) Claim

Claim commits before membership mutation. Reconciliation may reuse only the exact original command identity; another key never reuses this grant.

func (EnrollmentStore) Complete

func (EnrollmentStore) Issue

func (s EnrollmentStore) Issue(authority string, epoch uint64, key string, r model.EnrollmentRequest) (string, error)

Issue binds a random token to one authority epoch and exact reviewed receiver. Only its private file contains the token value; records retain its digest. Exact issuance replay returns the original value, never new authority.

func (EnrollmentStore) Receipt

Receipt replays the independently retained original business result even if the SQLite command-cache publication was lost. It does not probe membership.

func (EnrollmentStore) Validate

func (s EnrollmentStore) Validate() error

type Envelope

type Envelope struct {
	Authority   string `json:"authority,omitempty"`
	Epoch       uint64 `json:"epoch,omitempty"`
	Subject     string `json:"subject"`
	Group       string `json:"group,omitempty"`
	Generation  uint64 `json:"generation"`
	Token       uint64 `json:"token"`
	Key         string `json:"key"`
	Fingerprint string `json:"fingerprint"`
}

func FromContext

func FromContext(ctx context.Context) (Envelope, bool)

type Journal

type Journal struct {
	Authority *Authority
	Conn      *sql.Conn
	Mu        *sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(conn *sql.Conn, mu *sync.Mutex) *Journal

func (*Journal) CheckCurrentLocked

func (s *Journal) CheckCurrentLocked(ctx context.Context) error

CheckCurrentLocked revalidates admitted authority after waiting for the host mutation lock. The caller must hold Journal.Mu through its effect (INV-04).

func (*Journal) ControlHTTP

func (s *Journal) ControlHTTP(w http.ResponseWriter, r *http.Request)

func (*Journal) ControlReport

func (s *Journal) ControlReport() (model.ControlReport, error)

func (*Journal) ControlSubject

func (s *Journal) ControlSubject() (string, error)

func (*Journal) IdleExcept

func (s *Journal) IdleExcept(subject string) bool

func (*Journal) MutationsAllowed

func (s *Journal) MutationsAllowed() bool

func (*Journal) SetAuthority

func (s *Journal) SetAuthority(path string) error

func (*Journal) Wrap

func (s *Journal) Wrap(next http.Handler, supports func(*http.Request) bool, resolve func(*http.Request, []byte) (string, error)) http.Handler

Jump to

Keyboard shortcuts

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