storage

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StorageSchemaVersion = "v1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HistoryRepo added in v0.12.0

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

HistoryRepo implements gollem.HistoryRepository using the storage service. It persists the latest history snapshot for a ticket, keyed by ticket ID. Save errors are handled via errutil but not returned to avoid interrupting agent execution.

func NewHistoryRepo added in v0.12.0

func NewHistoryRepo(svc *Service, ticketID types.TicketID) *HistoryRepo

NewHistoryRepo creates a new HistoryRepo for the given ticket.

func NewHistoryRepoFromContext added in v0.12.0

func NewHistoryRepoFromContext(_ context.Context, svc *Service, ticketID types.TicketID) *HistoryRepo

NewHistoryRepoFromContext creates a new HistoryRepo for the given ticket.

func (*HistoryRepo) Load added in v0.12.0

func (r *HistoryRepo) Load(ctx context.Context, _ string) (*gollem.History, error)

Load retrieves the latest history for the ticket. Returns nil History and nil error if not found.

func (*HistoryRepo) Save added in v0.12.0

func (r *HistoryRepo) Save(ctx context.Context, _ string, history *gollem.History) error

Save persists the history as the latest snapshot for the ticket. Errors are handled via errutil but not returned to avoid interrupting agent execution.

type Option

type Option func(*Service)

func WithPrefix

func WithPrefix(prefix string) Option

type Service

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

func New

func New(storageClient interfaces.StorageClient, opts ...Option) *Service

func (*Service) CopyLatestHistoryToSession added in v0.16.0

func (s *Service) CopyLatestHistoryToSession(ctx context.Context, ticketID types.TicketID, sessionID types.SessionID) (bool, error)

CopyLatestHistoryToSession performs a server-side copy from the legacy ticket-scoped latest.json path into the Session-scoped history.json path. The payload never transits the caller's process — GCS executes the rewrite internally. Returns (copied=false, nil) when the legacy file does not exist, so the migration job can count the Session as a skip instead of an error.

func (*Service) GetLatestHistory added in v0.12.0

func (s *Service) GetLatestHistory(ctx context.Context, ticketID types.TicketID) (*gollem.History, error)

GetLatestHistory retrieves the latest history snapshot for the given ticket. Returns nil History and nil error if the storage client is not configured.

func (*Service) GetSessionHistory added in v0.16.0

func (s *Service) GetSessionHistory(ctx context.Context, sessionID types.SessionID) (*gollem.History, error)

GetSessionHistory loads the gollem.History for a Session. Returns (nil, nil) when no history has been saved yet so callers can start fresh without special-casing.

func (*Service) HasSessionHistory added in v0.16.0

func (s *Service) HasSessionHistory(ctx context.Context, sessionID types.SessionID) bool

HasSessionHistory reports whether a Session-scoped history object has already been persisted. Uses a cheap GetObject probe because the StorageClient interface does not expose attribute lookups; callers should treat read errors ("object not found", etc.) as "no history yet" rather than a hard failure.

func (*Service) PutLatestHistory added in v0.12.0

func (s *Service) PutLatestHistory(ctx context.Context, ticketID types.TicketID, history *gollem.History) error

PutLatestHistory saves the history as the latest snapshot for the given ticket. The object at latest.json is overwritten on each call.

func (*Service) PutSessionHistory added in v0.16.0

func (s *Service) PutSessionHistory(ctx context.Context, sessionID types.SessionID, history *gollem.History) error

PutSessionHistory saves the gollem.History for a Session. The object is overwritten on each call (we only keep the most recent state; older turns' state is reconstructed from Messages if needed).

Jump to

Keyboard shortcuts

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