sessionpolicy

package
v0.1.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package sessionpolicy provides the standard featurehost-owned, bounded policy store for terminal-decision session overrides. It retains only scoped opaque identity and actor tri-state values; concrete feature semantics remain in plugins, while request admission consumes an immutable snapshot.

Package sessionpolicy owns the bounded process policy used by the terminal-decision feature. The store is deliberately small: it keeps only safe scope identity and actor tri-state values, and has no expiry or eviction policy.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCapacity means that a write would create a new key beyond MaxKeys.
	ErrCapacity = errors.New("terminal decision policy: capacity reached")
	// ErrBounds means that a key or stored actor value exceeds its configured bound.
	ErrBounds = errors.New("terminal decision policy: bounds exceeded")
	// ErrUnauthorized means that the supplied authority does not own the key.
	ErrUnauthorized = errors.New("terminal decision policy: unauthorized scope")
	// ErrClosed means that the process-owned store has been closed.
	ErrClosed = errors.New("terminal decision policy: store closed")
)

Functions

This section is empty.

Types

type Actor

type Actor string

Actor identifies the independently writable policy value.

const (
	ActorClient   Actor = "client"
	ActorOperator Actor = "operator"
)

type Authority

type Authority struct {
	SecureSessionIncarnation string
	ALegID                   string
	Authorized               bool
}

Authority is the already-authenticated scope supplied by the caller. The store checks it against Key; it does not perform authentication itself.

type Config

type Config struct {
	MaxKeys       int
	MaxKeyBytes   int
	MaxValueBytes int
}

Config bounds the in-process policy store. Values remain until explicitly changed or the owning process restarts; Config intentionally has no TTL or eviction fields.

type Key

type Key struct {
	SecureSessionIncarnation string
	ALegID                   string
	FeatureID                string
}

Key is the only identity retained by the policy store. It contains no credentials, tokens, secrets, or request content.

type Snapshot

type Snapshot struct {
	ClientState      TriState
	OperatorState    TriState
	EffectiveEnabled bool
	Revision         uint64
}

Snapshot is an immutable admission-time view of one policy key.

type Store

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

Store is a process-owned, bounded policy map. Its mutex serializes key writes and makes each returned Snapshot a coherent linearization point.

func NewStore

func NewStore(config Config) *Store

NewStore constructs an empty process policy store.

func (*Store) Close

func (s *Store) Close() error

Close prevents all later writes and is idempotent. There are no background goroutines or external resources owned by this store.

func (*Store) Set

func (s *Store) Set(ctx context.Context, authority Authority, key Key, actor Actor, state TriState) (Snapshot, error)

Set atomically replaces one actor's tri-state value and returns the new coherent snapshot. Every accepted write advances the store revision, including an explicit unset on a new key, so the key boundary is observable.

func (*Store) Snapshot

func (s *Store) Snapshot(ctx context.Context, authority Authority, key Key, generationDefault bool) (Snapshot, error)

Snapshot returns one coherent admission-time view. It never creates a key, so reads cannot consume bounded capacity.

type TriState

type TriState string

TriState represents an actor override. Unset delegates to the other actor or the generation default.

const (
	TriStateUnset    TriState = "unset"
	TriStateEnabled  TriState = "enabled"
	TriStateDisabled TriState = "disabled"
)

Jump to

Keyboard shortcuts

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