store

package
v1.5.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInMemoryCheckPointStore

func NewInMemoryCheckPointStore() compose.CheckPointStore

NewInMemoryCheckPointStore creates a new in-memory checkpoint store

func NewInMemoryStore

func NewInMemoryStore() compose.CheckPointStore

Types

type InMemoryCheckPointStore

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

InMemoryCheckPointStore wraps a compose.CheckPointStore with additional functionality

func NewHybridCheckPointStore

func NewHybridCheckPointStore(persistence *PersistenceStore) *InMemoryCheckPointStore

NewHybridCheckPointStore creates a hybrid store that uses both memory and persistence

func (*InMemoryCheckPointStore) Get

func (s *InMemoryCheckPointStore) Get(ctx context.Context, key string) ([]byte, bool, error)

Get first checks memory, then falls back to persistence

func (*InMemoryCheckPointStore) Set

func (s *InMemoryCheckPointStore) Set(ctx context.Context, key string, value []byte) error

Set delegates to the base store and also persists

type PersistenceStore

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

PersistenceStore implements CheckPointStore with simple JSON file persistence Each session uses two files: - .json file: stores checkpoint data (key-value pairs) - .jsonl file: stores messages in append-only mode (one JSON object per line)

func NewPersistenceStore

func NewPersistenceStore(sessionID string) (*PersistenceStore, error)

NewPersistenceStore creates a new persistence store for the given session ID

func (*PersistenceStore) Clear

func (s *PersistenceStore) Clear() error

Clear removes all persisted data for this session

func (*PersistenceStore) Close

func (s *PersistenceStore) Close() error

Close releases resources (no-op for file-based storage)

func (*PersistenceStore) Get

func (s *PersistenceStore) Get(ctx context.Context, key string) ([]byte, bool, error)

Get retrieves the checkpoint data from file

func (*PersistenceStore) LoadMessages

func (s *PersistenceStore) LoadMessages() ([]*schema.Message, error)

LoadMessages loads all messages from the JSONL file Each line in the JSONL file is a separate schema.Message object

func (*PersistenceStore) SaveMessage

func (s *PersistenceStore) SaveMessage(msg *schema.Message) error

SaveMessage appends a single message to the JSONL file in append-only mode Each message is written as a separate JSON object on its own line This method should be called with one message at a time for incremental storage

func (*PersistenceStore) SaveMessages

func (s *PersistenceStore) SaveMessages(messages []*schema.Message) error

SaveMessages appends multiple messages to the JSONL file For normal operation, prefer calling SaveMessage once per new message

func (*PersistenceStore) SaveMessagesOverwrite

func (s *PersistenceStore) SaveMessagesOverwrite(messages []*schema.Message) error

SaveMessagesOverwrite overwrites the entire JSONL file with the provided messages This is used when historical messages are modified (e.g., after compression) It completely rewrites the file instead of appending

func (*PersistenceStore) Set

func (s *PersistenceStore) Set(ctx context.Context, key string, value []byte) error

Set persists the checkpoint data to file

Jump to

Keyboard shortcuts

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