storage

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadgerStore

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

func NewBadgerStore

func NewBadgerStore(path string) (*BadgerStore, error)

func (*BadgerStore) Close

func (s *BadgerStore) Close()

func (*BadgerStore) Count added in v0.3.0

func (s *BadgerStore) Count(ctx context.Context) (int64, error)

Count returns the total number of keys in the store

func (*BadgerStore) Delete

func (s *BadgerStore) Delete(ctx context.Context, key string) error

func (*BadgerStore) DeleteByPrefix added in v0.3.0

func (s *BadgerStore) DeleteByPrefix(ctx context.Context, prefix string) (int, error)

DeleteByPrefix deletes all keys with the given prefix

func (*BadgerStore) Get

func (s *BadgerStore) Get(ctx context.Context, key string) ([]byte, error)

func (*BadgerStore) GetAllEmbeddings

func (s *BadgerStore) GetAllEmbeddings(ctx context.Context) (map[string][]byte, error)

func (*BadgerStore) GetAllKeys added in v0.3.0

func (s *BadgerStore) GetAllKeys(ctx context.Context, prefix string) ([]string, error)

GetAllKeys returns all keys with the given prefix

func (*BadgerStore) GetPrompt

func (s *BadgerStore) GetPrompt(ctx context.Context, key string) (string, error)

func (*BadgerStore) RunGC added in v0.3.0

func (s *BadgerStore) RunGC() error

RunGC runs garbage collection on the database

func (*BadgerStore) Set

func (s *BadgerStore) Set(ctx context.Context, key string, value []byte) error

func (*BadgerStore) SetWithTTL added in v0.3.0

func (s *BadgerStore) SetWithTTL(ctx context.Context, key string, value []byte, ttl time.Duration) error

SetWithTTL sets a key-value pair with a time-to-live

func (*BadgerStore) Sync added in v0.3.0

func (s *BadgerStore) Sync() error

Sync flushes all writes to disk

type Storage

type Storage interface {
	Set(ctx context.Context, key string, value []byte) error
	Get(ctx context.Context, key string) ([]byte, error)
	Delete(ctx context.Context, key string) error
	GetAllEmbeddings(ctx context.Context) (map[string][]byte, error)
	GetPrompt(ctx context.Context, key string) (string, error)
	Close()
}

Jump to

Keyboard shortcuts

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