threadreadstate

package
v0.13.12 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrThreadRetired = errors.New("thread read state retired")

Functions

func Backup added in v0.13.0

func Backup(ctx context.Context, source, destination string) error

Backup snapshots read state while its service generation is closed.

func ExistingPath added in v0.13.0

func ExistingPath(stateDir string) (string, error)

ExistingPath selects the existing authoritative store without changing paths.

func Inspect added in v0.13.0

func Inspect(path string) (sqliteutil.Inspection, error)

Inspect validates the read-state store before a coordinated Flower upgrade.

func PreparePath added in v0.13.0

func PreparePath(ctx context.Context, stateDir string) (string, error)

PreparePath moves the selected legacy store only after the caller has saved its upgrade snapshot. Publishing one complete database avoids split WAL moves.

Types

type FlowerSnapshot

type FlowerSnapshot struct {
	ActivityRevision int64
}

type Record

type Record struct {
	EndpointID               string  `json:"endpoint_id"`
	ScopeID                  string  `json:"scope_id"`
	Surface                  Surface `json:"surface"`
	ThreadID                 string  `json:"thread_id"`
	LastSeenActivityRevision int64   `json:"last_seen_activity_revision"`
	UpdatedAtUnixMs          int64   `json:"updated_at_unix_ms"`
}

type Store

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

func Open

func Open(path string) (*Store, error)

func (*Store) AdvanceFlower

func (s *Store) AdvanceFlower(
	ctx context.Context,
	endpointID string,
	userPublicID string,
	threadID string,
	snapshot FlowerSnapshot,
) (Record, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) EnsureFlower

func (s *Store) EnsureFlower(
	ctx context.Context,
	endpointID string,
	userPublicID string,
	snapshots map[string]FlowerSnapshot,
) (map[string]Record, error)

func (*Store) RetireFlowerThreadReadState added in v0.10.0

func (s *Store) RetireFlowerThreadReadState(ctx context.Context, endpointID string, threadID string) error

type Surface

type Surface string
const (
	SurfaceFlower Surface = "flower"
)

Jump to

Keyboard shortcuts

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