memory

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 10 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

Overview

Package memory is an in-process store.Store for unit tests and for `kojo eval --local`. It keeps everything in maps behind one mutex and forgets it on exit: production always runs on Postgres.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store is the in-memory store. The zero value is not usable: call New.

func New

func New() *Store

New returns an empty store.

func (*Store) ActivateRevision

func (s *Store) ActivateRevision(_ context.Context, id string) (*store.Revision, error)

ActivateRevision implements store.Store.

func (*Store) ActiveRevision

func (s *Store) ActiveRevision(_ context.Context, scope, object string) (*store.Revision, error)

ActiveRevision implements store.Store.

func (*Store) ActiveRevisions

func (s *Store) ActiveRevisions(_ context.Context, scope string) ([]store.Revision, error)

ActiveRevisions implements store.Store.

func (*Store) AddMemory

func (s *Store) AddMemory(_ context.Context, m *store.Memory) error

AddMemory implements store.Store.

func (*Store) AddSessionMessage

func (s *Store) AddSessionMessage(_ context.Context, m *store.SessionMessage, max int) error

AddSessionMessage implements store.Store.

func (*Store) AppendAudit

func (s *Store) AppendAudit(_ context.Context, e store.AuditEntry) error

AppendAudit implements store.Store.

func (*Store) AppendStep

func (s *Store) AppendStep(_ context.Context, st *store.Step) error

AppendStep implements store.Store.

func (*Store) Claim

func (s *Store) Claim(_ context.Context, worker string, lease time.Duration) (*store.Session, error)

Claim implements store.Store.

func (*Store) Close

func (s *Store) Close()

Close implements store.Store.

func (*Store) DecideApproval

func (s *Store) DecideApproval(_ context.Context, id, status, by string) (*store.Approval, error)

DecideApproval implements store.Store.

func (*Store) DeleteDraft

func (s *Store) DeleteDraft(_ context.Context, id string) error

DeleteDraft implements store.Store.

func (*Store) DeleteMemory

func (s *Store) DeleteMemory(_ context.Context, id string) error

DeleteMemory implements store.Store.

func (*Store) Enqueue

func (s *Store) Enqueue(_ context.Context, req store.Request) (*store.Session, error)

Enqueue implements store.Store.

func (*Store) GetApproval

func (s *Store) GetApproval(_ context.Context, id string) (*store.Approval, error)

GetApproval implements store.Store.

func (*Store) GetDraft

func (s *Store) GetDraft(_ context.Context, id string) (*store.SkillDraft, error)

GetDraft implements store.Store.

func (*Store) GetEvalRun

func (s *Store) GetEvalRun(_ context.Context, id string) (*store.EvalRun, error)

GetEvalRun implements store.Store.

func (*Store) GetMemory

func (s *Store) GetMemory(_ context.Context, id string) (*store.Memory, error)

GetMemory implements store.Store.

func (*Store) GetProposal

func (s *Store) GetProposal(_ context.Context, id string) (*store.Proposal, error)

GetProposal implements store.Store.

func (*Store) GetPullRequest

func (s *Store) GetPullRequest(_ context.Context, repo string, number int) (*store.PullRequest, error)

GetPullRequest implements store.Store.

func (*Store) GetRevision

func (s *Store) GetRevision(_ context.Context, id string) (*store.Revision, error)

GetRevision implements store.Store.

func (*Store) GetScheduleState

func (s *Store) GetScheduleState(_ context.Context, key string) (*store.ScheduleState, error)

GetScheduleState implements store.Store.

func (*Store) GetSession

func (s *Store) GetSession(_ context.Context, id string) (*store.Session, error)

GetSession implements store.Store.

func (*Store) Heartbeat

func (s *Store) Heartbeat(_ context.Context, sessionID, worker string, lease time.Duration) error

Heartbeat implements store.Store.

func (*Store) ListAudit

func (s *Store) ListAudit(_ context.Context, f store.AuditFilter) ([]store.AuditEntry, error)

ListAudit implements store.Store.

func (*Store) ListDrafts

func (s *Store) ListDrafts(_ context.Context, scope string) ([]store.SkillDraft, error)

ListDrafts implements store.Store.

func (*Store) ListEvalRuns

func (s *Store) ListEvalRuns(_ context.Context, skill string, limit int) ([]store.EvalRun, error)

ListEvalRuns implements store.Store.

func (*Store) ListMemory

func (s *Store) ListMemory(_ context.Context, f store.MemoryFilter) ([]store.Memory, error)

ListMemory implements store.Store.

func (*Store) ListProposals

func (s *Store) ListProposals(_ context.Context, f store.ProposalFilter) ([]store.Proposal, error)

ListProposals implements store.Store.

func (*Store) ListPullRequests

func (s *Store) ListPullRequests(_ context.Context, f store.PullRequestFilter) ([]store.PullRequest, error)

ListPullRequests implements store.Store.

func (*Store) ListRevisions

func (s *Store) ListRevisions(_ context.Context, scope, object string, limit int) ([]store.Revision, error)

ListRevisions implements store.Store.

func (*Store) ListSessionMessages

func (s *Store) ListSessionMessages(_ context.Context, sessionID string) ([]store.SessionMessage, error)

ListSessionMessages implements store.Store.

func (*Store) ListSessions

func (s *Store) ListSessions(_ context.Context, f store.SessionFilter) ([]store.Session, error)

ListSessions implements store.Store.

func (*Store) ListSkillIndex

func (s *Store) ListSkillIndex(_ context.Context, repo string) ([]store.SkillIndexEntry, error)

ListSkillIndex implements store.Store.

func (*Store) ListSteps

func (s *Store) ListSteps(_ context.Context, sessionID string) ([]store.Step, error)

ListSteps implements store.Store.

func (*Store) ListUsers

func (s *Store) ListUsers(_ context.Context) ([]store.User, error)

ListUsers implements store.Store.

func (*Store) MarkSessionMessages

func (s *Store) MarkSessionMessages(_ context.Context, sessionID string, ids []string, status, to string) ([]store.SessionMessage, error)

MarkSessionMessages implements store.Store.

func (*Store) Ping

func (s *Store) Ping(context.Context) error

Ping implements store.Store.

func (*Store) PutApproval

func (s *Store) PutApproval(_ context.Context, a *store.Approval) error

PutApproval implements store.Store.

func (*Store) PutDraft

func (s *Store) PutDraft(_ context.Context, d *store.SkillDraft) error

PutDraft implements store.Store.

func (*Store) PutEvalRun

func (s *Store) PutEvalRun(_ context.Context, r *store.EvalRun) error

PutEvalRun implements store.Store.

func (*Store) PutProposal

func (s *Store) PutProposal(_ context.Context, p *store.Proposal) error

PutProposal implements store.Store.

func (*Store) PutRevision

func (s *Store) PutRevision(_ context.Context, r store.Revision, activate bool) (*store.Revision, error)

PutRevision implements store.Store.

func (*Store) PutScheduleState

func (s *Store) PutScheduleState(_ context.Context, st store.ScheduleState) error

PutScheduleState implements store.Store.

func (*Store) RecordPullRequest

func (s *Store) RecordPullRequest(_ context.Context, pr store.PullRequest) error

RecordPullRequest implements store.Store.

func (*Store) Release

func (s *Store) Release(_ context.Context, sessionID, worker string, status store.SessionStatus, runAfter time.Time) error

Release implements store.Store.

func (*Store) ReplaceSkillIndex

func (s *Store) ReplaceSkillIndex(_ context.Context, repo string, entries []store.SkillIndexEntry) error

ReplaceSkillIndex implements store.Store.

func (*Store) RequestCancel

func (s *Store) RequestCancel(_ context.Context, id string) error

RequestCancel implements store.Store.

func (*Store) SearchMemory

func (s *Store) SearchMemory(_ context.Context, q store.MemoryQuery) ([]store.Memory, error)

SearchMemory implements store.Store.

func (*Store) SetClock

func (s *Store) SetClock(now func() time.Time)

SetClock replaces the store's clock, for tests of leases and schedules.

func (*Store) SpendSince

func (s *Store) SpendSince(_ context.Context, t time.Time) (float64, error)

SpendSince implements store.Store.

func (*Store) TryLead

func (s *Store) TryLead(_ context.Context, name string) (func(), bool, error)

TryLead implements store.Store.

func (*Store) UndeliveredMessages

func (s *Store) UndeliveredMessages(_ context.Context, sessionID string) ([]store.SessionMessage, error)

UndeliveredMessages implements store.Store.

func (*Store) UpdatePullRequest

func (s *Store) UpdatePullRequest(_ context.Context, pr *store.PullRequest) error

UpdatePullRequest implements store.Store.

func (*Store) UpdateSession

func (s *Store) UpdateSession(_ context.Context, in *store.Session) error

UpdateSession implements store.Store.

func (*Store) UpdateStep

func (s *Store) UpdateStep(_ context.Context, st *store.Step) error

UpdateStep implements store.Store.

func (*Store) UpsertUser

func (s *Store) UpsertUser(_ context.Context, u store.User) error

UpsertUser implements store.Store.

func (*Store) WatchConfig

func (s *Store) WatchConfig(ctx context.Context) (<-chan store.ConfigChange, error)

WatchConfig implements store.Store.

Jump to

Keyboard shortcuts

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