pgstore

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Limits              memorykit.Limits
	EmbeddingProfileID  string
	EmbeddingDimensions int
}

Config contains the validation and embedding contract shared by every Store operation.

type Store

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

Store owns PostgreSQL persistence. ownsDB distinguishes Open from caller-controlled OpenDB.

func Open

func Open(ctx context.Context, dsn string, cfg Config) (*Store, error)

Open creates and owns a pgx-backed database pool.

func OpenDB

func OpenDB(ctx context.Context, db *sql.DB, cfg Config) (*Store, error)

OpenDB initializes a Store without taking ownership of the supplied pool.

func (*Store) Activate

func (s *Store) Activate(ctx context.Context, command memorykit.VersionedCommand) (memorykit.Memory, error)

func (*Store) ClaimExtraction

func (s *Store) ClaimExtraction(
	ctx context.Context,
	workerID string,
	leaseDuration time.Duration,
	maxAttempts int,
	now time.Time,
) (memorykit.ExtractionJob, error)

func (*Store) Close

func (s *Store) Close() error

Close closes only pools created by Open. Caller-supplied OpenDB pools remain untouched.

func (*Store) CompleteExtraction

func (s *Store) CompleteExtraction(ctx context.Context, id, workerID string, expectedAttempt int, now time.Time) error

func (*Store) Correct

func (s *Store) Correct(ctx context.Context, request memorykit.CorrectRequest) (memorykit.Memory, error)

func (*Store) Create

func (s *Store) Create(ctx context.Context, request memorykit.CreateRequest) (memorykit.Memory, error)

func (*Store) Dismiss

func (s *Store) Dismiss(ctx context.Context, command memorykit.VersionedCommand) (memorykit.Memory, error)

func (*Store) EnqueueExtraction

func (s *Store) EnqueueExtraction(ctx context.Context, job memorykit.ExtractionJob) error

func (*Store) Erase

func (s *Store) Erase(ctx context.Context, command memorykit.VersionedCommand) error

func (*Store) FailExtraction

func (s *Store) FailExtraction(
	ctx context.Context,
	id, workerID string,
	expectedAttempt int,
	failureCode string,
	maxAttempts int,
	now time.Time,
) error

func (*Store) Forget

func (s *Store) Forget(ctx context.Context, command memorykit.VersionedCommand) (memorykit.Memory, error)

func (*Store) Get

func (s *Store) Get(ctx context.Context, scope memorykit.Scope, id string) (memorykit.Memory, error)

func (*Store) List

func (s *Store) List(ctx context.Context, query memorykit.ListQuery) ([]memorykit.Memory, error)

func (*Store) PendingEmbeddings

func (s *Store) PendingEmbeddings(ctx context.Context, query memorykit.PendingEmbeddingQuery) ([]memorykit.EmbeddingInput, error)

func (*Store) PutEmbedding

func (s *Store) PutEmbedding(ctx context.Context, request memorykit.PutEmbeddingRequest) error

func (*Store) Revisions

func (s *Store) Revisions(ctx context.Context, query memorykit.RevisionQuery) ([]memorykit.Revision, error)

func (*Store) SearchCandidates

func (s *Store) SearchCandidates(ctx context.Context, query memorykit.CandidateQuery) (memorykit.CandidateSet, error)

func (*Store) Sources

func (s *Store) Sources(ctx context.Context, scope memorykit.Scope, id string) ([]memorykit.Source, error)

Jump to

Keyboard shortcuts

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