Documentation
¶
Overview ¶
Package contextstore provides the storage components for the context data used by the ProjectMemory service.
Index ¶
- type ContextStore
- type SQLiteContextStore
- func (s *SQLiteContextStore) ClearAllContext() error
- func (s *SQLiteContextStore) Close() error
- func (s *SQLiteContextStore) DeleteContext(id string) error
- func (s *SQLiteContextStore) Initialize(dbPath string) error
- func (s *SQLiteContextStore) ReplaceContext(id string, summaryText string, embedding []byte, timestamp time.Time) error
- func (s *SQLiteContextStore) Search(queryEmbedding []float32, limit int) ([]string, error)
- func (s *SQLiteContextStore) Store(id string, summaryText string, embedding []byte, timestamp time.Time) error
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)
// DeleteContext deletes a specific context entry from the store by ID.
DeleteContext(id string) error
// ClearAllContext removes all context entries from the store.
ClearAllContext() error
// ReplaceContext 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.
ReplaceContext(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) ClearAllContext ¶
func (s *SQLiteContextStore) ClearAllContext() error
ClearAllContext removes all context entries from the store.
func (*SQLiteContextStore) Close ¶
func (s *SQLiteContextStore) Close() error
Close closes the store and releases any resources.
func (*SQLiteContextStore) DeleteContext ¶
func (s *SQLiteContextStore) DeleteContext(id string) error
DeleteContext 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) ReplaceContext ¶
func (s *SQLiteContextStore) ReplaceContext(id string, summaryText string, embedding []byte, timestamp time.Time) error
ReplaceContext replaces a context entry with updated information. Note: This is similar to Store with INSERT OR REPLACE, but makes the intent clearer.