Documentation
¶
Index ¶
- Constants
- Variables
- type ClosedSessionProof
- type Coordinator
- func (c *Coordinator) BeginTeardown(ctx context.Context, scope sessionctx.SessionScope, identity TeardownIdentity, ...) (*Teardown, Snapshot, error)
- func (c *Coordinator) Durable() bool
- func (c *Coordinator) Finalize(ctx context.Context, scope sessionctx.SessionScope, identity TeardownIdentity) error
- func (c *Coordinator) InspectRetained(ctx context.Context, scope sessionctx.SessionScope) (RetainedScope, error)
- func (c *Coordinator) ListRetained(ctx context.Context) ([]RetainedScope, error)
- func (c *Coordinator) Reserve(ctx context.Context, scope sessionctx.SessionScope) (*Reservation, error)
- func (c *Coordinator) Snapshot(ctx context.Context, scope sessionctx.SessionScope) (Snapshot, error)
- type Counts
- type MemoryStore
- func (s *MemoryStore) Accumulate(ctx context.Context, scope sessionctx.SessionScope, delta Counts, ...) (record, error)
- func (s *MemoryStore) AccumulatePhase(ctx context.Context, scope sessionctx.SessionScope, phase Phase, delta Counts, ...) (record, error)
- func (s *MemoryStore) BeginTeardown(ctx context.Context, scope sessionctx.SessionScope, operationID string, ...) (record, error)
- func (s *MemoryStore) Durable() bool
- func (s *MemoryStore) Finalize(ctx context.Context, scope sessionctx.SessionScope, operationID string, ...) error
- func (s *MemoryStore) Get(ctx context.Context, scope sessionctx.SessionScope) (record, error)
- func (s *MemoryStore) ListRetained(ctx context.Context) ([]record, error)
- func (s *MemoryStore) MarkComplete(ctx context.Context, scope sessionctx.SessionScope, now time.Time) (record, error)
- func (s *MemoryStore) MarkIncomplete(ctx context.Context, scope sessionctx.SessionScope, now time.Time) (record, error)
- type Phase
- type Reservation
- type RetainedScope
- type SQLiteStore
- func (s *SQLiteStore) Accumulate(ctx context.Context, scope sessionctx.SessionScope, delta Counts, ...) (record, error)
- func (s *SQLiteStore) AccumulatePhase(ctx context.Context, scope sessionctx.SessionScope, phase Phase, delta Counts, ...) (record, error)
- func (s *SQLiteStore) BeginTeardown(ctx context.Context, scope sessionctx.SessionScope, operationID string, ...) (record, error)
- func (s *SQLiteStore) Close() error
- func (s *SQLiteStore) Durable() bool
- func (s *SQLiteStore) Finalize(ctx context.Context, scope sessionctx.SessionScope, operationID string, ...) error
- func (s *SQLiteStore) Get(ctx context.Context, scope sessionctx.SessionScope) (record, error)
- func (s *SQLiteStore) ListRetained(ctx context.Context) ([]record, error)
- func (s *SQLiteStore) MarkComplete(ctx context.Context, scope sessionctx.SessionScope, now time.Time) (record, error)
- func (s *SQLiteStore) MarkIncomplete(ctx context.Context, scope sessionctx.SessionScope, now time.Time) (record, error)
- type Snapshot
- type State
- type Store
- type StoreOptions
- type Teardown
- func (teardown *Teardown) Accumulate(ctx context.Context, delta Counts) (Snapshot, error)
- func (teardown *Teardown) AccumulatePhase(ctx context.Context, phase Phase, delta Counts) (Snapshot, error)
- func (teardown *Teardown) MarkComplete(ctx context.Context, now time.Time) (Snapshot, error)
- func (teardown *Teardown) MarkIncomplete(ctx context.Context, now time.Time) (Snapshot, error)
- func (teardown *Teardown) Release()
- type TeardownIdentity
Constants ¶
const ( DefaultMaxScopes = 4_096 HardMaxScopes = 65_536 MinProofBytes = 32 MaxProofBytes = MinProofBytes )
Variables ¶
var ( ErrInvalidState = errors.New("session scope state is invalid") ErrInvalidCounts = errors.New("session scope counts are invalid") ErrSessionRevoked = errors.New("session scope is revoked") ErrFenceCapacity = errors.New("session fence capacity is exhausted") ErrScopeNotFound = errors.New("session scope is not found") ErrClosedSessionProofInvalid = errors.New("closed session proof is invalid") ErrTeardownIdentityInvalid = errors.New("session teardown identity is invalid") ErrTeardownIdentityMismatch = errors.New("session teardown identity does not match") ErrStoreRequired = errors.New("session scope store is required") ErrSchemaVersion = errors.New("session scope schema version is unsupported") )
Functions ¶
This section is empty.
Types ¶
type ClosedSessionProof ¶
type ClosedSessionProof struct {
// contains filtered or unexported fields
}
func GenerateClosedSessionProof ¶
func GenerateClosedSessionProof() (ClosedSessionProof, error)
GenerateClosedSessionProof creates a proof with 256 bits of operating-system CSPRNG entropy. Session lifecycle adapters use this function when creating a new closed-session tombstone.
func NewClosedSessionProof ¶
func NewClosedSessionProof(value []byte) (ClosedSessionProof, error)
NewClosedSessionProof reconstructs a proof previously generated by GenerateClosedSessionProof from trusted durable host storage. Entropy cannot be inferred from bytes after generation, so untrusted payloads must never call this constructor.
func (ClosedSessionProof) BytesForDurableStorage ¶
func (proof ClosedSessionProof) BytesForDurableStorage() ([]byte, error)
BytesForDurableStorage returns an owned copy for the trusted host session adapter's private durable tombstone. It must never enter HTTP or plugin IPC.
func (ClosedSessionProof) Valid ¶
func (proof ClosedSessionProof) Valid() bool
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
func NewCoordinator ¶
func NewCoordinator(store Store) (*Coordinator, error)
func (*Coordinator) BeginTeardown ¶
func (c *Coordinator) BeginTeardown(ctx context.Context, scope sessionctx.SessionScope, identity TeardownIdentity, now time.Time) (*Teardown, Snapshot, error)
func (*Coordinator) Durable ¶
func (c *Coordinator) Durable() bool
func (*Coordinator) Finalize ¶
func (c *Coordinator) Finalize(ctx context.Context, scope sessionctx.SessionScope, identity TeardownIdentity) error
func (*Coordinator) InspectRetained ¶ added in v0.6.18
func (c *Coordinator) InspectRetained(ctx context.Context, scope sessionctx.SessionScope) (RetainedScope, error)
InspectRetained returns the exact durable fence for one session scope. The teardown identity remains opaque; callers can only compare a trusted host-side identity with MatchesIdentity.
func (*Coordinator) ListRetained ¶
func (c *Coordinator) ListRetained(ctx context.Context) ([]RetainedScope, error)
func (*Coordinator) Reserve ¶
func (c *Coordinator) Reserve(ctx context.Context, scope sessionctx.SessionScope) (*Reservation, error)
func (*Coordinator) Snapshot ¶
func (c *Coordinator) Snapshot(ctx context.Context, scope sessionctx.SessionScope) (Snapshot, error)
type Counts ¶
type Counts struct {
Surfaces uint64 `json:"surfaces"`
AssetTickets uint64 `json:"asset_tickets"`
AssetSessions uint64 `json:"asset_sessions"`
PluginGatewayTokens uint64 `json:"plugin_gateway_tokens"`
ConfirmationTokens uint64 `json:"confirmation_tokens"`
StreamTickets uint64 `json:"stream_tickets"`
HandleGrants uint64 `json:"handle_grants"`
Confirmations uint64 `json:"confirmations"`
Operations uint64 `json:"operations"`
Streams uint64 `json:"streams"`
RuntimeExecutions uint64 `json:"runtime_executions"`
ActiveNetworkRequests uint64 `json:"active_network_requests"`
Sockets uint64 `json:"sockets"`
NetworkStreams uint64 `json:"network_streams"`
StorageHostcalls uint64 `json:"storage_hostcalls"`
}
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
func NewMemoryStore(options StoreOptions) (*MemoryStore, error)
func (*MemoryStore) Accumulate ¶
func (s *MemoryStore) Accumulate(ctx context.Context, scope sessionctx.SessionScope, delta Counts, now time.Time) (record, error)
func (*MemoryStore) AccumulatePhase ¶
func (s *MemoryStore) AccumulatePhase(ctx context.Context, scope sessionctx.SessionScope, phase Phase, delta Counts, now time.Time) (record, error)
func (*MemoryStore) BeginTeardown ¶
func (s *MemoryStore) BeginTeardown( ctx context.Context, scope sessionctx.SessionScope, operationID string, proof [sha256.Size]byte, now time.Time, ) (record, error)
func (*MemoryStore) Durable ¶
func (s *MemoryStore) Durable() bool
func (*MemoryStore) Finalize ¶
func (s *MemoryStore) Finalize(ctx context.Context, scope sessionctx.SessionScope, operationID string, proof [sha256.Size]byte) error
func (*MemoryStore) Get ¶
func (s *MemoryStore) Get(ctx context.Context, scope sessionctx.SessionScope) (record, error)
func (*MemoryStore) ListRetained ¶
func (s *MemoryStore) ListRetained(ctx context.Context) ([]record, error)
func (*MemoryStore) MarkComplete ¶
func (s *MemoryStore) MarkComplete(ctx context.Context, scope sessionctx.SessionScope, now time.Time) (record, error)
func (*MemoryStore) MarkIncomplete ¶
func (s *MemoryStore) MarkIncomplete(ctx context.Context, scope sessionctx.SessionScope, now time.Time) (record, error)
type Reservation ¶
type Reservation struct {
// contains filtered or unexported fields
}
func (*Reservation) Release ¶
func (reservation *Reservation) Release()
type RetainedScope ¶
type RetainedScope struct {
SessionScope sessionctx.SessionScope `json:"-"`
Snapshot Snapshot `json:"snapshot"`
// contains filtered or unexported fields
}
RetainedScope is the durable, owner-private startup reconciliation view for fenced session scopes. It never contains the teardown operation ID or proof.
func (RetainedScope) MatchesIdentity ¶
func (retained RetainedScope) MatchesIdentity(identity TeardownIdentity) bool
MatchesIdentity verifies that a trusted host-side teardown identity is bound to this exact durable fence without exposing the operation ID or proof hash.
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
func NewSQLiteStore ¶
func NewSQLiteStore(ctx context.Context, path string, options StoreOptions) (*SQLiteStore, error)
func (*SQLiteStore) Accumulate ¶
func (s *SQLiteStore) Accumulate(ctx context.Context, scope sessionctx.SessionScope, delta Counts, now time.Time) (record, error)
func (*SQLiteStore) AccumulatePhase ¶
func (s *SQLiteStore) AccumulatePhase(ctx context.Context, scope sessionctx.SessionScope, phase Phase, delta Counts, now time.Time) (record, error)
func (*SQLiteStore) BeginTeardown ¶
func (s *SQLiteStore) BeginTeardown( ctx context.Context, scope sessionctx.SessionScope, operationID string, proof [sha256.Size]byte, now time.Time, ) (record, error)
func (*SQLiteStore) Close ¶
func (s *SQLiteStore) Close() error
func (*SQLiteStore) Durable ¶
func (s *SQLiteStore) Durable() bool
func (*SQLiteStore) Finalize ¶
func (s *SQLiteStore) Finalize(ctx context.Context, scope sessionctx.SessionScope, operationID string, proof [sha256.Size]byte) error
func (*SQLiteStore) Get ¶
func (s *SQLiteStore) Get(ctx context.Context, scope sessionctx.SessionScope) (record, error)
func (*SQLiteStore) ListRetained ¶
func (s *SQLiteStore) ListRetained(ctx context.Context) ([]record, error)
func (*SQLiteStore) MarkComplete ¶
func (s *SQLiteStore) MarkComplete(ctx context.Context, scope sessionctx.SessionScope, now time.Time) (record, error)
func (*SQLiteStore) MarkIncomplete ¶
func (s *SQLiteStore) MarkIncomplete(ctx context.Context, scope sessionctx.SessionScope, now time.Time) (record, error)
type Store ¶
type Store interface {
Durable() bool
Get(context.Context, sessionctx.SessionScope) (record, error)
ListRetained(context.Context) ([]record, error)
BeginTeardown(context.Context, sessionctx.SessionScope, string, [sha256.Size]byte, time.Time) (record, error)
Accumulate(context.Context, sessionctx.SessionScope, Counts, time.Time) (record, error)
AccumulatePhase(context.Context, sessionctx.SessionScope, Phase, Counts, time.Time) (record, error)
MarkIncomplete(context.Context, sessionctx.SessionScope, time.Time) (record, error)
MarkComplete(context.Context, sessionctx.SessionScope, time.Time) (record, error)
Finalize(context.Context, sessionctx.SessionScope, string, [sha256.Size]byte) error
}
type StoreOptions ¶
type StoreOptions struct {
MaxScopes int
}
type Teardown ¶
type Teardown struct {
// contains filtered or unexported fields
}
func (*Teardown) Accumulate ¶
func (*Teardown) AccumulatePhase ¶
func (*Teardown) MarkComplete ¶
func (*Teardown) MarkIncomplete ¶
type TeardownIdentity ¶
type TeardownIdentity struct {
OperationID string `json:"-"`
// contains filtered or unexported fields
}
func NewTeardownIdentity ¶
func NewTeardownIdentity(operationID string, proof ClosedSessionProof) (TeardownIdentity, error)
func (TeardownIdentity) Matches ¶
func (identity TeardownIdentity) Matches(other TeardownIdentity) bool
func (TeardownIdentity) Valid ¶
func (identity TeardownIdentity) Valid() bool