contextstore

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package contextstore provides the storage components for the context data used by the ProjectMemory service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextStore

type ContextStore interface {
	// Initialize initializes the store with configuration options.
	Initialize(dbPath string) error

	// Close closes the store and releases any resources.
	Close() error

	// Store stores the context data in the database.
	Store(id string, summaryText string, embedding []byte, timestamp time.Time) error

	// Search searches for context entries similar to the given embedding.
	Search(queryEmbedding []float32, limit int) ([]string, error)

	// Delete deletes a specific context entry from the store by ID.
	Delete(id string) error

	// Clear removes all context entries from the store.
	// Returns the number of entries that were deleted.
	Clear() (int, error)

	// Replace replaces a context entry with updated information.
	// Note: The current Store method performs replacement when an ID already exists,
	// but this method makes the intent clearer.
	Replace(id string, summaryText string, embedding []byte, timestamp time.Time) error
}

ContextStore defines the interface for storing and retrieving context data.

type SQLiteContextStore

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

SQLiteContextStore is an implementation of ContextStore that uses SQLite.

func NewSQLiteContextStore

func NewSQLiteContextStore() *SQLiteContextStore

NewSQLiteContextStore creates a new SQLiteContextStore instance.

func (*SQLiteContextStore) Clear added in v0.1.3

func (s *SQLiteContextStore) Clear() (int, error)

Clear removes all context entries from the store. Returns the number of entries that were deleted.

func (*SQLiteContextStore) Close

func (s *SQLiteContextStore) Close() error

Close closes the store and releases any resources.

func (*SQLiteContextStore) Delete added in v0.1.3

func (s *SQLiteContextStore) Delete(id string) error

Delete deletes a specific context entry from the store by ID.

func (*SQLiteContextStore) Initialize

func (s *SQLiteContextStore) Initialize(dbPath string) error

Initialize initializes the store with the given database path.

func (*SQLiteContextStore) Replace added in v0.1.3

func (s *SQLiteContextStore) Replace(id string, summaryText string, embedding []byte, timestamp time.Time) error

Replace replaces a context entry with updated information.

func (*SQLiteContextStore) Search

func (s *SQLiteContextStore) Search(queryEmbedding []float32, limit int) ([]string, error)

Search searches for context entries similar to the given embedding.

func (*SQLiteContextStore) Store

func (s *SQLiteContextStore) Store(id string, summaryText string, embedding []byte, timestamp time.Time) error

Store stores the context data in the database.

Jump to

Keyboard shortcuts

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