store

package
v0.603.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package store provides task persistence and retrieval.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

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

FileStore implements Store using a JSON file for persistence.

func NewFileStore

func NewFileStore(path string) (*FileStore, error)

NewFileStore creates a new file-based store.

func (*FileStore) Close

func (fs *FileStore) Close() error

Close stops the background saver and performs final save. Safe to call multiple times.

func (*FileStore) Delete

func (fs *FileStore) Delete(id string) error

Delete removes a task by ID.

func (*FileStore) ForceSave

func (fs *FileStore) ForceSave() error

ForceSave immediately persists all tasks to disk.

func (*FileStore) Get

func (fs *FileStore) Get(id string) (*models.Task, error)

Get retrieves a task by ID.

func (*FileStore) List

func (fs *FileStore) List(filter ListFilter) ([]*models.Task, error)

List retrieves tasks matching the filter.

func (*FileStore) ListByParentSession added in v0.601.2

func (fs *FileStore) ListByParentSession(sessionID string) ([]*models.Task, error)

ListByParentSession returns all tasks whose ParentSessionID matches the given session id, newest first. It is a thin convenience wrapper over List.

func (*FileStore) Reload

func (fs *FileStore) Reload() error

Reload reloads the store from disk.

func (*FileStore) Save

func (fs *FileStore) Save(task *models.Task) error

Save stores or updates a task.

func (*FileStore) UpdateStatus

func (fs *FileStore) UpdateStatus(id string, status models.TaskStatus) error

UpdateStatus updates only the status of a task.

type ListFilter

type ListFilter struct {
	Status []models.TaskStatus
	Tags   []string
	Limit  int
	Offset int
	// ParentSessionID, when non-empty, restricts results to tasks whose
	// ParentSessionID matches exactly. Used for delegation correlation queries.
	ParentSessionID string
}

ListFilter defines criteria for listing tasks.

type Store

type Store interface {
	Save(task *models.Task) error
	Get(id string) (*models.Task, error)
	List(filter ListFilter) ([]*models.Task, error)
	// ListByParentSession returns tasks correlated to the given parent agent
	// session id (see Task.ParentSessionID). Used by delegation phases to find
	// the tasks spawned by a session; no consumer reads it yet.
	ListByParentSession(sessionID string) ([]*models.Task, error)
	Delete(id string) error
	UpdateStatus(id string, status models.TaskStatus) error
	Close() error
}

Store defines the interface for task storage.

Jump to

Keyboard shortcuts

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