sqlite

package
v0.0.0-...-2c7f779 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package sqlite implements the workspace index on a single SQLite file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Store)

func WithClock

func WithClock(now func() time.Time) Option

type Store

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

func Open

func Open(path string, vectorDims int, opts ...Option) (*Store, error)

path must already be resolved; no "~" expansion happens here. vectorDims sizes chunk_vectors on a fresh file and is then fixed: reopening with a different width fails, because the vec0 table keeps its original dimensions.

func (*Store) Close

func (s *Store) Close() error

func (*Store) Cursor

func (s *Store) Cursor(ctx context.Context, connector string) (entities.Cursor, error)

func (*Store) DeletePendingRefs

func (s *Store) DeletePendingRefs(ctx context.Context, refs []entities.PendingRef) error

func (*Store) DocumentsByID

func (s *Store) DocumentsByID(ctx context.Context, ids []entities.DocID) ([]entities.DocumentMeta, error)

The body column is deliberately not read.

func (*Store) DocumentsWithBody

func (s *Store) DocumentsWithBody(ctx context.Context, ids []entities.DocID) ([]entities.Document, error)

func (*Store) HeartbeatLease

func (s *Store) HeartbeatLease(ctx context.Context, holder string) error

No row updated means the lease was lost, wrapping repositories.ErrLeaseLost.

func (*Store) Lease

func (s *Store) Lease(ctx context.Context) (*entities.LeaseState, error)

func (*Store) Meta

func (s *Store) Meta(ctx context.Context, key string) (string, error)

func (*Store) Neighbors

func (s *Store) Neighbors(
	ctx context.Context,
	ids []entities.DocID,
	kinds []entities.EdgeKind,
	dir entities.Direction,
) ([]entities.Edge, error)

func (*Store) PendingRefs

func (s *Store) PendingRefs(ctx context.Context) ([]entities.PendingRef, error)

func (*Store) ReleaseLease

func (s *Store) ReleaseLease(ctx context.Context, holder string) error

The holder check is in the statement, so a deferred release after a takeover cannot delete the new holder's lease.

func (*Store) ReplaceChunks

func (s *Store) ReplaceChunks(ctx context.Context, docID entities.DocID, chunks []entities.Chunk) error

chunks_fts and chunk_vectors are keyed by the chunk's rowid, so both derived rows are written with the id SQLite assigned the chunk.

func (*Store) ResolveRef

func (s *Store) ResolveRef(ctx context.Context, ref string) ([]entities.DocumentMeta, error)

Every shape the ref could be is queried, because some strings are legitimately two shapes at once — "1234567" is both an abbreviated SHA and an issue number.

func (*Store) SearchLexical

func (s *Store) SearchLexical(ctx context.Context, query string, f entities.Filters, k int) ([]entities.ChunkHit, error)

func (*Store) SearchVector

func (s *Store) SearchVector(ctx context.Context, embedding []float32, f entities.Filters, k int) ([]entities.ChunkHit, error)

func (*Store) SetCursor

func (s *Store) SetCursor(ctx context.Context, connector string, c entities.Cursor) error

The stored timestamp is the store clock, not one read out of the Cursor.

func (*Store) SetMeta

func (s *Store) SetMeta(ctx context.Context, key, value string) error

The identity keys are refused: Open validates them against this build, so overwriting one would make the file unopenable.

func (*Store) Stats

func (s *Store) Stats(ctx context.Context) (entities.IndexStats, error)

func (*Store) TryAcquireLease

func (s *Store) TryAcquireLease(ctx context.Context, holder string) (bool, error)

func (*Store) UpsertDocuments

func (s *Store) UpsertDocuments(ctx context.Context, docs []entities.Document) error

func (*Store) UpsertEdges

func (s *Store) UpsertEdges(ctx context.Context, edges []entities.Edge) error

func (*Store) UpsertPendingRefs

func (s *Store) UpsertPendingRefs(ctx context.Context, refs []entities.PendingRef) error

func (*Store) WipeChunks

func (s *Store) WipeChunks(ctx context.Context) error

Jump to

Keyboard shortcuts

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