statemanager

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: Apache-2.0 Imports: 4 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

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