contextstore

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 12, 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)

	// 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.

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