state

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package state defines the plugin-scoped state store facade (design §8, tasks 4.1, 6–6.1).

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingExecutionContext = errors.New("lipsdk/state: missing execution context for this scope")

ErrMissingExecutionContext means the context has no execution views attached (or required ids are empty) for request/session/principal scoped operations (tasks 6–6.1).

View Source
var ErrMissingPrincipal = errors.New("lipsdk/state: principal scope requires authenticated principal id")

ErrMissingPrincipal means principal-scoped operations were called without a non-empty principal id (tasks 6–6.1).

View Source
var ErrNotConfigured = errors.New("lipsdk/state: state store not configured")

ErrNotConfigured means no state service is bound for this execution snapshot (task 4.1).

Functions

This section is empty.

Types

type DisabledStore

type DisabledStore struct{}

DisabledStore is a placeholder binding that rejects all mutating use until core wiring exists.

func (DisabledStore) Delete

func (DisabledStore) Get

func (DisabledStore) InspectTTL

func (DisabledStore) Put

type Scope

type Scope string

Scope selects the persistence boundary for a key (design §8).

const (
	ScopeRequest   Scope = "request"
	ScopeSession   Scope = "session"
	ScopePrincipal Scope = "principal"
	ScopeGlobal    Scope = "global"
)

type Store

type Store interface {
	Get(ctx context.Context, scope Scope, ns, key string, out any) (found bool, err error)
	Put(ctx context.Context, scope Scope, ns, key string, value any, ttl time.Duration) error
	Delete(ctx context.Context, scope Scope, ns, key string) error
	InspectTTL(ctx context.Context, scope Scope, ns, key string) (ttl time.Duration, found bool, err error)
}

Store is the narrow plugin-facing state API (design §8).

func BindPlugin

func BindPlugin(store Store, pluginID string) Store

BindPlugin returns a Store that prefixes the namespace segment with pluginID so keys from different plugins cannot collide when they share logical namespace names (R6, tasks 6–6.1). pluginID must be non-empty after trimming; otherwise returns DisabledStore.

Jump to

Keyboard shortcuts

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