statemanager

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DurableStateManager

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

DurableStateManager orchestrates state persistence and recovery for Manglekit sessions. It wraps the core.StateProvider interface and adds semantic recovery capabilities.

func New

func New(provider core.StateProvider, engine core.Evaluator, logger core.Logger) *DurableStateManager

New creates a new DurableStateManager.

func (*DurableStateManager) Checkpoint

func (m *DurableStateManager) Checkpoint(ctx context.Context, state *core.SessionState) error

Checkpoint saves the current session state to the underlying provider. This should only be called after a successful Reflect phase to prevent persisting invalid or "poisoned" states.

func (*DurableStateManager) Close

func (m *DurableStateManager) Close(ctx context.Context) error

Close cleans up resources held by the state manager.

func (*DurableStateManager) Delete

func (m *DurableStateManager) Delete(ctx context.Context, sessionID string) error

Delete removes the state for a session.

func (*DurableStateManager) ExtractFacts

func (m *DurableStateManager) ExtractFacts(ctx context.Context, envelope core.Envelope) ([]string, error)

ExtractFacts extracts Datalog facts from an envelope. This is used during checkpoint to capture the logical state.

func (*DurableStateManager) Hydrate

func (m *DurableStateManager) Hydrate(ctx context.Context, sessionID string) (*core.SessionState, error)

Hydrate loads and reconstructs a session state from the underlying provider. It performs semantic re-constitution including: - Type reconstruction using Envelope.ContentType - Engine priming by re-injecting LogicalFacts into the Mangle runtime - Feedback alignment by restoring FeedbackHistory

Returns nil, nil if the session does not exist (first run).

Jump to

Keyboard shortcuts

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