Documentation
¶
Index ¶
- type Store
- func (s *Store) Close() error
- func (s *Store) Delete(ctx context.Context, namespace, id string) error
- func (s *Store) DeleteIfExpiredBefore(ctx context.Context, namespace, id string, cutoff time.Time) error
- func (s *Store) DeleteNamespace(ctx context.Context, namespace string) (int64, error)
- func (s *Store) Get(ctx context.Context, namespace, id string) (*memory.Memory, error)
- func (s *Store) KeywordSearch(ctx context.Context, namespace, query string, f store.Filter, k int) ([]store.Scored, error)
- func (s *Store) List(ctx context.Context, namespace string, f store.Filter, limit int) ([]*memory.Memory, error)
- func (s *Store) ListExpired(ctx context.Context, now time.Time, limit int) ([]*memory.Memory, error)
- func (s *Store) ListNamespaces(ctx context.Context) ([]string, error)
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) Reinforce(ctx context.Context, namespace string, ids []string, accessedAt time.Time, ...) error
- func (s *Store) SetMetrics(m store.Metrics)
- func (s *Store) SetSuperseded(ctx context.Context, namespace, id, supersededBy string) error
- func (s *Store) Upsert(ctx context.Context, m *memory.Memory) error
- func (s *Store) VectorSearch(ctx context.Context, namespace string, vec []float32, f store.Filter, k int) ([]store.Scored, error)
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 a sqlite-vec backed store.Store.
func Open ¶
Open opens (creating if needed) the sqlite database at path and ensures the schema exists for the given embedding dimensionality.
func (*Store) DeleteIfExpiredBefore ¶
func (s *Store) DeleteIfExpiredBefore(ctx context.Context, namespace, id string, cutoff time.Time) error
DeleteIfExpiredBefore removes a memory only if its expiry is still at or before cutoff. Returns ErrNotFound when the memory is absent or its TTL was slid past cutoff by Reinforce since the last ListExpired call.
func (*Store) DeleteNamespace ¶ added in v0.0.8
DeleteNamespace removes every memory in a namespace, including vector and FTS index entries. Returns the number of memories deleted.
func (*Store) KeywordSearch ¶
func (s *Store) KeywordSearch(ctx context.Context, namespace, query string, f store.Filter, k int) ([]store.Scored, error)
KeywordSearch returns the k best BM25 full-text matches in the namespace.
func (*Store) List ¶
func (s *Store) List(ctx context.Context, namespace string, f store.Filter, limit int) ([]*memory.Memory, error)
List returns memories in a namespace matching f (without embeddings).
func (*Store) ListExpired ¶
func (s *Store) ListExpired(ctx context.Context, now time.Time, limit int) ([]*memory.Memory, error)
ListExpired returns up to limit memories whose TTL has passed.
func (*Store) ListNamespaces ¶
ListNamespaces returns the distinct namespaces holding memories.
func (*Store) Reinforce ¶
func (s *Store) Reinforce(ctx context.Context, namespace string, ids []string, accessedAt time.Time, newExpiry *time.Time) error
Reinforce bumps access_count/last_accessed_at and optionally slides the TTL.
func (*Store) SetMetrics ¶
SetMetrics installs an observability sink. Passing nil disables metrics.
func (*Store) SetSuperseded ¶
SetSuperseded records that a memory was replaced by supersededBy.