Documentation
¶
Index ¶
- type BadgerStore
- func (s *BadgerStore) Close()
- func (s *BadgerStore) Count(ctx context.Context) (int64, error)
- func (s *BadgerStore) Delete(ctx context.Context, key string) error
- func (s *BadgerStore) DeleteByPrefix(ctx context.Context, prefix string) (int, error)
- func (s *BadgerStore) Get(ctx context.Context, key string) ([]byte, error)
- func (s *BadgerStore) GetAllEmbeddings(ctx context.Context) (map[string][]byte, error)
- func (s *BadgerStore) GetAllKeys(ctx context.Context, prefix string) ([]string, error)
- func (s *BadgerStore) GetPrompt(ctx context.Context, key string) (string, error)
- func (s *BadgerStore) RunGC() error
- func (s *BadgerStore) Set(ctx context.Context, key string, value []byte) error
- func (s *BadgerStore) SetWithTTL(ctx context.Context, key string, value []byte, ttl time.Duration) error
- func (s *BadgerStore) Sync() error
- type Storage
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) DeleteByPrefix ¶ added in v0.3.0
DeleteByPrefix deletes all keys with the given prefix
func (*BadgerStore) GetAllEmbeddings ¶
func (*BadgerStore) GetAllKeys ¶ added in v0.3.0
GetAllKeys returns all keys with the given prefix
func (*BadgerStore) RunGC ¶ added in v0.3.0
func (s *BadgerStore) RunGC() error
RunGC runs garbage collection on the database
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()
}
Click to show internal directories.
Click to hide internal directories.