Documentation
¶
Overview ¶
Package vec is the embedded library API for the vec vector database (spec 14).
vec stores vectors, ANN indexes, scalar metadata columns, the catalog, and free space in one self-describing file with the look and feel of SQLite. This root package is the public facade: it wires the storage engine, catalog, query planner and executor, ANN index SPI, and VectorSQL binder behind a small, goroutine-safe surface centered on *DB, *Collection, *Txn, and *QueryBuilder.
The typical lifecycle is open a database, create a collection, upsert points, build an index, and run filtered ANN queries:
db, err := vec.Open("articles.vec")
if err != nil { log.Fatal(err) }
defer db.Close()
db.CreateCollection(ctx, vec.CollectionSchema{
Name: "articles",
Columns: []vec.ColumnDef{
{Name: "embedding", Type: vec.TypeVector, Dim: 768, Metric: vec.MetricCosine},
{Name: "author", Type: vec.TypeText},
},
})
coll, _ := db.Collection("articles")
coll.UpsertBatch(ctx, points)
db.BuildIndex(ctx, "articles", "hnsw_embedding", vec.IndexParams{"m": 32})
rows, _ := coll.Query("embedding", q).K(10).Filter("author = ?", "alice").Exec(ctx)
A *DB is safe for concurrent use; a *Txn and a *Rows are owned by one goroutine from creation to close (spec 14 §11).
Index ¶
- Variables
- func BuildInfo() (ver, commitHash, buildDate string)
- func PragmaInt(db *DB, name string) (int64, error)
- func PragmaString(db *DB, name string) (string, error)
- func RedactFieldKey(name string) bool
- func Version() string
- type APIKey
- type AnyVector
- type BatchOpt
- type BulkWriter
- type BulkWriterOptions
- type CheckpointMode
- type CheckpointStats
- type Collection
- func (c *Collection) Count(ctx context.Context) (int64, error)
- func (c *Collection) Delete(txn *Txn, id PointID) error
- func (c *Collection) DeleteBatch(ctx context.Context, ids []PointID, opts ...BatchOpt) error
- func (c *Collection) Export(ctx context.Context, w io.Writer, opts ExportOptions) error
- func (c *Collection) Get(txn *Txn, id PointID) (Point, error)
- func (c *Collection) GetBatch(txn *Txn, ids []PointID) ([]Point, error)
- func (c *Collection) Insert(txn *Txn, p Point) (PointID, error)
- func (c *Collection) MultiQuery(column string, q MultiVector) *QueryBuilder
- func (c *Collection) Name() string
- func (c *Collection) Query(column string, q Vector) *QueryBuilder
- func (c *Collection) Scan(ctx context.Context, fn func(Point) error) error
- func (c *Collection) Schema(ctx context.Context) (CollectionSchema, error)
- func (c *Collection) SparseQuery(column string, q SparseVector) *QueryBuilder
- func (c *Collection) Upsert(txn *Txn, p Point) (PointID, error)
- func (c *Collection) UpsertBatch(ctx context.Context, points []Point) ([]PointID, error)
- type CollectionInfo
- type CollectionSchema
- type ColumnDef
- type ColumnType
- type Config
- type CorruptError
- type DB
- func (db *DB) AlterCollection(ctx context.Context, name string, add ...ColumnDef) error
- func (db *DB) Backup(ctx context.Context, w io.Writer) error
- func (db *DB) Begin(ctx context.Context, writable bool) (*Txn, error)
- func (db *DB) BuildIndex(ctx context.Context, collection string) error
- func (db *DB) BuildIndexAsync(ctx context.Context, collection string) (*IndexBuild, error)
- func (db *DB) BulkLoad(ctx context.Context, collection string, fn LoadFunc, opts BulkWriterOptions) error
- func (db *DB) ChangePassphrase(ctx context.Context, oldPass, newPass Passphrase) error
- func (db *DB) Checkpoint(ctx context.Context, mode CheckpointMode) (CheckpointStats, error)
- func (db *DB) Close() error
- func (db *DB) Collection(name string) (*Collection, error)
- func (db *DB) Collections() ([]*Collection, error)
- func (db *DB) Config() Config
- func (db *DB) CreateCollection(ctx context.Context, schema CollectionSchema) error
- func (db *DB) CreateIndex(ctx context.Context, collection string, spec IndexSpec) error
- func (db *DB) DropCollection(ctx context.Context, name string) error
- func (db *DB) DropIndex(ctx context.Context, collection, name string) error
- func (db *DB) Encryption() EncryptionInfo
- func (db *DB) Exec(ctx context.Context, sql string) (*Rows, error)
- func (db *DB) ExecTxn(ctx context.Context, txn *Txn, sql string) (*Rows, error)
- func (db *DB) GetCollection(ctx context.Context, name string) (CollectionInfo, error)
- func (db *DB) IndexStats(ctx context.Context, collection string) (IndexStatsDetail, error)
- func (db *DB) ListCollections(ctx context.Context) ([]CollectionInfo, error)
- func (db *DB) ListIndexes(ctx context.Context, collection string) ([]IndexInfo, error)
- func (db *DB) Metrics() *obs.Metrics
- func (db *DB) NewBulkWriter(ctx context.Context, collection string, opts BulkWriterOptions) (*BulkWriter, error)
- func (db *DB) NewSortedBulkWriter(ctx context.Context, collection string, opts BulkWriterOptions) (*BulkWriter, error)
- func (db *DB) Path() string
- func (db *DB) Pragma(ctx context.Context, name, value string) (string, error)
- func (db *DB) PragmaInt(ctx context.Context, name string) (int64, error)
- func (db *DB) PragmaString(ctx context.Context, name string) (string, error)
- func (db *DB) ReadSnapshot(ctx context.Context) (*Snapshot, error)
- func (db *DB) Reindex(ctx context.Context, collection string) error
- func (db *DB) RekeyVacuum(ctx context.Context, secret Passphrase) (RekeyVacuumStats, error)
- func (db *DB) RenameCollection(ctx context.Context, oldName, newName string) error
- func (db *DB) RotateDEK(ctx context.Context, secret Passphrase) error
- func (db *DB) Update(ctx context.Context, fn func(txn *Txn) error) error
- func (db *DB) View(ctx context.Context, fn func(txn *Txn) error) error
- type DimError
- type EncryptionInfo
- type EncryptionKey
- type ErrInvalidConfig
- type ErrPragmaImmutable
- type ErrPragmaReadOnly
- type ErrSnapshotTooOld
- type ErrUnknownPragma
- type ExportOptions
- type IndexBuild
- type IndexBuildStats
- type IndexInfo
- type IndexParams
- type IndexSpec
- type IndexStatsDetail
- type IndexType
- type JWTSecret
- type LoadFunc
- type Logger
- type Metric
- type MetricSink
- type MultiVector
- type Option
- func OptionsFromEnv(environ []string) ([]Option, error)
- func ParseOptions(pragmas map[string]string) ([]Option, error)
- func WithBusyTimeout(d time.Duration) Option
- func WithCacheSize(bytes int64) Option
- func WithCipher(c crypto.Cipher) Option
- func WithCreateIfMissing(v bool) Option
- func WithEncryptionKey(key EncryptionKey) Option
- func WithLogger(l Logger) Option
- func WithMMap(on bool) Option
- func WithMaxRetries(n int) Option
- func WithMetrics(m MetricSink) Option
- func WithPageSize(bytes int) Option
- func WithParallelism(n int) Option
- func WithPassphrase(p Passphrase) Option
- func WithPragma(name, value string) Option
- func WithProgress(fn func(IndexBuildStats)) Option
- func WithReadOnly(v bool) Option
- func WithSynchronous(level SyncLevel) Option
- func WithTracer(t Tracer) Option
- type Passphrase
- type PhaseStats
- type Point
- type PointID
- type ProfileResult
- type QueryBuilder
- func (qb *QueryBuilder) All(ctx context.Context) ([]Result, error)
- func (qb *QueryBuilder) BM25(field, queryText string) *QueryBuilder
- func (qb *QueryBuilder) Ef(ef int) *QueryBuilder
- func (qb *QueryBuilder) Exec(ctx context.Context) (*Rows, error)
- func (qb *QueryBuilder) ExecTxn(ctx context.Context, txn *Txn) (*Rows, error)
- func (qb *QueryBuilder) Explain(ctx context.Context) (string, error)
- func (qb *QueryBuilder) Filter(expr string, args ...any) *QueryBuilder
- func (qb *QueryBuilder) First(ctx context.Context) (Result, error)
- func (qb *QueryBuilder) K(k int) *QueryBuilder
- func (qb *QueryBuilder) Nprobe(n int) *QueryBuilder
- func (qb *QueryBuilder) OrderBy(column string, desc bool) *QueryBuilder
- func (qb *QueryBuilder) Profile(ctx context.Context) (*ProfileResult, error)
- func (qb *QueryBuilder) RRF(k float64) *QueryBuilder
- func (qb *QueryBuilder) Rerank(r int) *QueryBuilder
- func (qb *QueryBuilder) Select(columns ...string) *QueryBuilder
- func (qb *QueryBuilder) WithFetchSize(n int) *QueryBuilder
- func (qb *QueryBuilder) WithIndex(indexName string) *QueryBuilder
- func (qb *QueryBuilder) WithScoreMode(annWeight, bm25Weight float64) *QueryBuilder
- func (qb *QueryBuilder) WithVectors(columns ...string) *QueryBuilder
- type RekeyVacuumStats
- type Result
- type Rows
- type SchemaError
- type SessionConfig
- type Snapshot
- type Span
- type SparseVector
- type SyncLevel
- type Tracer
- type Txn
- type Value
- type Vector
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = errors.New("vec: not found") ErrAlreadyExists = errors.New("vec: already exists") ErrConflict = errors.New("vec: write conflict") ErrReadOnly = errors.New("vec: read only") ErrClosed = errors.New("vec: closed") ErrDimMismatch = errors.New("vec: dimension mismatch") ErrSchemaViolation = errors.New("vec: schema violation") ErrCorrupt = errors.New("vec: corrupt") ErrNeedsRecovery = errors.New("vec: needs recovery") ErrBusy = errors.New("vec: database is busy") ErrTxnTooBig = errors.New("vec: transaction too big") ErrOptionConflict = errors.New("vec: option conflicts with stored value") ErrUnknownColumn = errors.New("vec: unknown column") ErrUnknownParam = errors.New("vec: unknown index param") ErrNotTrainable = errors.New("vec: not enough vectors for training") ErrInvalidSparse = errors.New("vec: invalid sparse vector") ErrOutOfOrder = errors.New("vec: points out of order") ErrCanceled = errors.New("vec: canceled") ErrVersionMismatch = errors.New("vec: version mismatch") ErrEncrypted = errors.New("vec: file is encrypted") ErrKeyRequired = errors.New("vec: encryption key required") ErrWrongPassphrase = errors.New("vec: authentication failed") ErrNotEncrypted = errors.New("vec: database is not encrypted") )
Sentinel errors form the stable error vocabulary of the library (spec 14 §10.1). Each has the numeric code used by the C ABI (spec 14 §13) and the server's JSON responses, so a Go caller, a Python binding, and a REST client all branch on the same integer. Callers test these with errors.Is and extract structured detail with errors.As against the typed error structs below.
Functions ¶
func BuildInfo ¶
func BuildInfo() (ver, commitHash, buildDate string)
BuildInfo returns the version, commit, and build date. The commit and date are empty for a build that was not made by the release pipeline.
func PragmaInt ¶
PragmaInt is the package-level helper shown in spec 22 §19.5; it reads with a background context.
func PragmaString ¶
PragmaString is the package-level string helper (spec 22 §19.5).
func RedactFieldKey ¶
RedactFieldKey reports whether a structured-log field name names a secret and its value should be replaced with [REDACTED] (spec 23 section 12.3 item 2). The match is case-insensitive on the substrings key, secret, password, token, and passphrase. The logger calls this before writing each field.
Types ¶
type APIKey ¶
type APIKey string
APIKey is a server bearer token that redacts itself. It is the wire form an operator pastes into a client; the auth package stores only its hash.
func (APIKey) MarshalJSON ¶
type AnyVector ¶
type AnyVector struct {
Dense Vector
Sparse *SparseVector
Multi MultiVector
}
AnyVector is the vector payload for one column of a point (spec 14 §3.4). Exactly one of Dense, Sparse, or Multi is set, matching the column kind.
type BatchOpt ¶
type BatchOpt func(*batchConfig)
BatchOpt tunes a batch write (spec 14 §4.4). Options are additive; the zero value is the default behavior.
func WithDurableBatch ¶
func WithDurableBatch() BatchOpt
WithDurableBatch asks a batch to fsync on commit regardless of the open sync level.
type BulkWriter ¶
type BulkWriter struct {
// contains filtered or unexported fields
}
BulkWriter is the append-only ingest sink returned by NewBulkWriter (spec 14 §6, spec 17). The streaming ingest pipeline lands with the bulk subsystem; the writer is defined here so the option and loader signatures are stable.
func (*BulkWriter) Add ¶
func (bw *BulkWriter) Add(p Point) error
Add appends a point to the bulk stream (spec 14 §6). The streaming ingest path is delivered with the bulk subsystem (spec 17).
func (*BulkWriter) Close ¶
func (bw *BulkWriter) Close() error
Close finalizes the bulk load (spec 14 §6).
func (*BulkWriter) Flush ¶
func (bw *BulkWriter) Flush() error
Flush flushes buffered points (spec 14 §6).
type BulkWriterOptions ¶
type BulkWriterOptions struct {
// Sorted declares the input is already sorted by id, enabling the fast path.
Sorted bool
// BatchSize bounds the points buffered before a flush.
BatchSize int
// BuildIndex builds the ANN index as part of the load when true.
BuildIndex bool
}
BulkWriterOptions tunes a BulkWriter (spec 14 §6).
type CheckpointMode ¶
type CheckpointMode int
CheckpointMode selects how aggressively a checkpoint runs (spec 14 §9).
const ( // CheckpointPassive checkpoints what it can without blocking writers. CheckpointPassive CheckpointMode = iota // CheckpointFull blocks new writers until the WAL is fully applied. CheckpointFull // CheckpointTruncate is a full checkpoint that also truncates the WAL. CheckpointTruncate )
type CheckpointStats ¶
type CheckpointStats struct {
Mode CheckpointMode
PagesWritten int64
WALFrames int64
}
CheckpointStats reports the result of a checkpoint (spec 14 §9).
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection is a stateless, goroutine-safe reference to a named collection (spec 14 §4.3). It carries no mutable state of its own; every operation resolves the live collection through the *DB.
func (*Collection) Count ¶
func (c *Collection) Count(ctx context.Context) (int64, error)
Count returns the number of live points in the collection (spec 14 §4.4).
func (*Collection) Delete ¶
func (c *Collection) Delete(txn *Txn, id PointID) error
Delete deletes a point by id inside txn (spec 14 §4.4).
func (*Collection) DeleteBatch ¶
DeleteBatch removes multiple points (spec 14 §4.4).
func (*Collection) Export ¶
func (c *Collection) Export(ctx context.Context, w io.Writer, opts ExportOptions) error
Export writes all points to w in the specified format (spec 14 §4.4). The export pipeline is delivered with the bulk subsystem (spec 17).
func (*Collection) Get ¶
func (c *Collection) Get(txn *Txn, id PointID) (Point, error)
Get fetches a point by id (spec 14 §4.4).
func (*Collection) GetBatch ¶
func (c *Collection) GetBatch(txn *Txn, ids []PointID) ([]Point, error)
GetBatch fetches multiple points (spec 14 §4.4).
func (*Collection) Insert ¶
func (c *Collection) Insert(txn *Txn, p Point) (PointID, error)
Insert inserts a point, failing with ErrAlreadyExists if the id exists.
func (*Collection) MultiQuery ¶
func (c *Collection) MultiQuery(column string, q MultiVector) *QueryBuilder
MultiQuery begins a multi-vector ANN query builder (spec 14 §5). Multi-vector columns are not yet stored, so executing the builder returns an unsupported error.
func (*Collection) Query ¶
func (c *Collection) Query(column string, q Vector) *QueryBuilder
Query begins a fluent ANN query builder over a dense vector column (spec 14 §5).
func (*Collection) Scan ¶
Scan calls fn for every live point in the collection at a read snapshot taken when Scan begins (spec 17 §3.1). It is the enumeration primitive the bulk dump and logical export paths build on. fn returning a non-nil error stops the scan and that error is returned. Points are visited in storage order, which is not the insertion order after compaction.
func (*Collection) Schema ¶
func (c *Collection) Schema(ctx context.Context) (CollectionSchema, error)
Schema returns the current schema (spec 14 §4.5).
func (*Collection) SparseQuery ¶
func (c *Collection) SparseQuery(column string, q SparseVector) *QueryBuilder
SparseQuery begins a sparse ANN query builder (spec 14 §5). Sparse columns are not yet stored, so executing the builder returns ErrInvalidSparse.
func (*Collection) Upsert ¶
func (c *Collection) Upsert(txn *Txn, p Point) (PointID, error)
Upsert inserts or replaces a point inside txn (spec 14 §4.4).
func (*Collection) UpsertBatch ¶
UpsertBatch writes many points in a single implicit transaction (spec 14 §4.4).
type CollectionInfo ¶
CollectionInfo is a snapshot of a collection's identity and size (spec 14 §4.6).
type CollectionSchema ¶
CollectionSchema describes a collection at creation (spec 14 §4.1).
type ColumnDef ¶
type ColumnDef struct {
Name string
Type ColumnType
Dim int // vector columns only: element count
Metric Metric // vector columns only: distance metric
NotNull bool
Default *Value
}
ColumnDef declares one column of a collection schema (spec 14 §4.2).
type ColumnType ¶
type ColumnType uint8
ColumnType is the declared type of a collection column (spec 14 §4.2). A vector column carries a dimension and a metric; the remaining types are scalar metadata columns.
const ( TypeVector ColumnType = iota // a fixed-length dense vector column TypeInt64 TypeFloat64 TypeBool TypeText TypeBytes TypeJSON TypeTimestamp )
func (ColumnType) String ¶
func (t ColumnType) String() string
String renders a ColumnType as its canonical type name.
type Config ¶
type Config struct {
PageSize int
CacheBytes int64
Synchronous string
MMap bool
Session SessionConfig
}
Config is a read-only snapshot of the effective configuration at Open time plus any Options applied (spec 22 §26.3). It does not update when a PRAGMA is set after Open; use db.PragmaInt/PragmaString for the current stored value.
func (Config) CacheSizeBytes ¶
CacheSizeBytes returns the cache budget in bytes (spec 22 §26.3).
type CorruptError ¶
CorruptError carries the corrupted page or offset (spec 14 §10.3).
func (*CorruptError) Error ¶
func (e *CorruptError) Error() string
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is the long-lived, goroutine-safe handle to one vec database (spec 14 §2). It owns the storage engine and catalog and assembles the query stack on demand. In this build the engine is process-resident: a file path names the database for diagnostics and future on-disk durability, while :memory: is explicitly ephemeral. All collection metadata and points live for the life of the *DB.
func Open ¶
Open opens or creates a database at path (spec 14 §2.1). A path of ":memory:" (or a DSN naming mode=memory) creates an ephemeral database.
func OpenDSN ¶
OpenDSN opens using a DSN/URI with options in the query string (spec 14 §2.1), for example "file:data.vec?mode=ro&cache=256mb".
func OpenReadOnly ¶
OpenReadOnly opens path for reading only (spec 14 §2.1).
func (*DB) AlterCollection ¶
AlterCollection applies a schema change (spec 14 §4.9). Only adding a metadata column is supported in this build; other alterations report unsupported.
func (*DB) Backup ¶
Backup writes a consistent copy of the database to w (spec 14 §8). The backup pipeline lands with the backup subsystem (spec 17).
func (*DB) Begin ¶
Begin starts a transaction (spec 14 §11.1). A writable transaction blocks until the previous writer commits or rolls back, or until ctx is canceled.
func (*DB) BuildIndex ¶
BuildIndex rebuilds the index recorded on the collection (spec 14 §6.2).
func (*DB) BuildIndexAsync ¶
BuildIndexAsync starts an index build and returns a handle to await it (spec 14 §6.6). The embedded build is synchronous, so the returned handle is already done.
func (*DB) BulkLoad ¶
func (db *DB) BulkLoad(ctx context.Context, collection string, fn LoadFunc, opts BulkWriterOptions) error
BulkLoad runs a load function against a fresh bulk writer (spec 14 §6).
func (*DB) ChangePassphrase ¶
func (db *DB) ChangePassphrase(ctx context.Context, oldPass, newPass Passphrase) error
ChangePassphrase replaces the passphrase that unlocks the database (spec 23 §9.1). The old passphrase is verified first; a wrong one returns ErrWrongPassphrase and changes nothing.
In a persisted database this is an O(1) operation: the master key is wrapped by a key-encryption key derived from the passphrase, so only the wrapped-key envelope in the header is rewritten and no data page is touched. That envelope lives with the on-disk header, which lands with the pager wiring. This build is process-resident with no persisted header, so the call re-derives the key material under the new passphrase in memory after checking the old one.
func (*DB) Checkpoint ¶
func (db *DB) Checkpoint(ctx context.Context, mode CheckpointMode) (CheckpointStats, error)
Checkpoint flushes the write-ahead log into the main database (spec 14 §9). The embedded engine is process-resident, so a checkpoint is a no-op that reports zero pending frames; it becomes meaningful with the on-disk durability subsystem.
func (*DB) Collection ¶
func (db *DB) Collection(name string) (*Collection, error)
Collection returns a handle to the named collection (spec 14 §4.5).
func (*DB) Collections ¶
func (db *DB) Collections() ([]*Collection, error)
Collections returns handles to all collections (spec 14 §4.5).
func (*DB) CreateCollection ¶
func (db *DB) CreateCollection(ctx context.Context, schema CollectionSchema) error
CreateCollection creates a new collection (spec 14 §4.1). It is an error if the collection already exists.
func (*DB) CreateIndex ¶
CreateIndex creates and builds an ANN index over a collection's vector column (spec 14 §6.1). In this build CREATE INDEX populates the index synchronously from the live points; BuildIndex and Reindex rebuild it.
func (*DB) DropCollection ¶
DropCollection drops a collection and all its indexes (spec 14 §4.7).
func (*DB) Encryption ¶
func (db *DB) Encryption() EncryptionInfo
Encryption returns the encryption state (spec 23 §3). It never returns key material; the fields describe the configuration, not the secrets.
func (*DB) Exec ¶
Exec runs a VectorSQL statement and returns a cursor (spec 14 §12). Only kNN SELECT statements with a literal query vector execute in this build; DDL and DML flow through the typed collection API.
func (*DB) GetCollection ¶
GetCollection returns info for one collection (spec 14 §4.6).
func (*DB) IndexStats ¶
IndexStats reports live statistics for the index on a collection (spec 14 §6.5).
func (*DB) ListCollections ¶
func (db *DB) ListCollections(ctx context.Context) ([]CollectionInfo, error)
ListCollections lists all collections (spec 14 §4.6).
func (*DB) ListIndexes ¶
ListIndexes lists the indexes on a collection (spec 14 §6.4).
func (*DB) Metrics ¶
Metrics returns the database's observability registry (spec 18 §1.3). The same instance backs the library hooks and the server's /metrics endpoint, so there is one set of counters and no double count. It is created on first use.
func (*DB) NewBulkWriter ¶
func (db *DB) NewBulkWriter(ctx context.Context, collection string, opts BulkWriterOptions) (*BulkWriter, error)
NewBulkWriter opens a streaming bulk-ingest writer (spec 14 §6). The streaming ingest pipeline lands with the bulk subsystem (spec 17).
func (*DB) NewSortedBulkWriter ¶
func (db *DB) NewSortedBulkWriter(ctx context.Context, collection string, opts BulkWriterOptions) (*BulkWriter, error)
NewSortedBulkWriter opens a bulk writer that assumes id-sorted input (spec 14 §6).
func (*DB) Pragma ¶
Pragma reads or sets a database knob by name (spec 22 §19). An empty value reads the current effective value; a non-empty value sets it and returns the canonical stored form. Reads of diagnostic and configuration PRAGMAs are also handled here. Unknown names return *ErrUnknownPragma; read-only and create-time knobs reject writes with *ErrPragmaReadOnly and *ErrPragmaImmutable.
func (*DB) PragmaInt ¶
PragmaInt reads a knob as an int64. It is the typed counterpart of Pragma for integer knobs (spec 22 §19.5).
func (*DB) PragmaString ¶
PragmaString reads a knob as its string form (spec 22 §19.5).
func (*DB) ReadSnapshot ¶
ReadSnapshot opens a read snapshot at the current committed sequence (spec 14 §11.4). A snapshot does not take the write lock and never blocks writers.
func (*DB) RekeyVacuum ¶
func (db *DB) RekeyVacuum(ctx context.Context, secret Passphrase) (RekeyVacuumStats, error)
RekeyVacuum rewrites every page under a fresh epoch and retires every older key (spec 23 §9.3). It is the heavy counterpart to RotateDEK: where rotation is lazy and leaves old-epoch pages in place, a vacuum re-encrypts the whole database so the old DEKs can be released.
The rewrite walks the pager, which this process-resident build does not persist to yet, so there are no on-disk pages to rewrite. The method rotates the epoch and reports zero pages rewritten; it becomes a full pass once the pager writes encrypted pages to a file.
func (*DB) RenameCollection ¶
RenameCollection renames a collection (spec 14 §4.8). The engine keeps the collection by id, so the rename updates the catalog name binding.
func (*DB) RotateDEK ¶
func (db *DB) RotateDEK(ctx context.Context, secret Passphrase) error
RotateDEK advances the data encryption key to a new epoch (spec 23 §9.2). New page writes use the new key; pages written under earlier epochs stay readable because their epoch is recorded in each page and the old key stays loaded. The supplied secret re-authenticates the caller and re-derives the master key, which the database does not keep in memory between calls.
Rotation is lazy: existing pages are not rewritten here. RekeyVacuum forces a full re-encryption when an operator wants to retire an old epoch's key.
type DimError ¶
DimError carries dimension mismatch detail (spec 14 §10.3). It unwraps to ErrDimMismatch so callers can both errors.Is and errors.As.
type EncryptionInfo ¶
type EncryptionInfo struct {
Enabled bool
Cipher string // "AES-256-GCM" or "ChaCha20-Poly1305"
KDF string // "argon2id" or "raw-key"
Epoch uint16 // the current write epoch
}
EncryptionInfo reports the at-rest encryption state of a database (spec 23 §3). For an unencrypted database Enabled is false and the other fields are zero.
type EncryptionKey ¶
type EncryptionKey []byte
EncryptionKey is a raw key that redacts itself. The real bytes are reachable only through Bytes, which the crypto package calls explicitly; nothing prints them.
func (EncryptionKey) Bytes ¶
func (k EncryptionKey) Bytes() []byte
Bytes returns the underlying key material. Callers must not log or store the result; it exists so the crypto layer can derive the master key.
func (EncryptionKey) GoString ¶
func (EncryptionKey) GoString() string
func (EncryptionKey) MarshalJSON ¶
func (EncryptionKey) MarshalJSON() ([]byte, error)
func (EncryptionKey) String ¶
func (EncryptionKey) String() string
type ErrInvalidConfig ¶
ErrInvalidConfig reports a knob value that fails validation (spec 22 §27). It carries the knob name, the offending value, and a human-readable reason so a caller can branch on errors.As and still log something useful.
func (*ErrInvalidConfig) Error ¶
func (e *ErrInvalidConfig) Error() string
type ErrPragmaImmutable ¶
ErrPragmaImmutable reports an attempt to set a create-time PRAGMA on a database that already exists (spec 22 §27). The create-time value in the header wins.
func (*ErrPragmaImmutable) Error ¶
func (e *ErrPragmaImmutable) Error() string
type ErrPragmaReadOnly ¶
type ErrPragmaReadOnly struct {
Pragma string
}
ErrPragmaReadOnly reports an attempt to set a read-only PRAGMA (spec 22 §27).
func (*ErrPragmaReadOnly) Error ¶
func (e *ErrPragmaReadOnly) Error() string
type ErrSnapshotTooOld ¶
ErrSnapshotTooOld reports a read transaction that outlived max_snapshot_age (spec 22 §16.2, §27).
func (*ErrSnapshotTooOld) Error ¶
func (e *ErrSnapshotTooOld) Error() string
type ErrUnknownPragma ¶
type ErrUnknownPragma struct {
Pragma string
}
ErrUnknownPragma reports a PRAGMA name that is not in the registry (spec 22 §27).
func (*ErrUnknownPragma) Error ¶
func (e *ErrUnknownPragma) Error() string
type ExportOptions ¶
type ExportOptions struct {
// Format is the output encoding: "jsonl" (default), "csv", or "fvecs".
Format string
// IncludeVectors writes the stored vectors alongside metadata.
IncludeVectors bool
// BatchSize bounds how many points are buffered per flush.
BatchSize int
}
ExportOptions controls Collection.Export (spec 14 §4.4).
type IndexBuild ¶
type IndexBuild struct {
// contains filtered or unexported fields
}
IndexBuild is a handle to an asynchronous index build (spec 14 §6.6).
func (*IndexBuild) Done ¶
func (b *IndexBuild) Done() bool
Done reports whether the build has finished.
func (*IndexBuild) Progress ¶
func (b *IndexBuild) Progress() IndexBuildStats
Progress returns the latest build progress.
func (*IndexBuild) Wait ¶
func (b *IndexBuild) Wait() error
Wait blocks until the build finishes and returns its error.
type IndexBuildStats ¶
IndexBuildStats is the progress callback payload during an index build (spec 14 §6.6, §7.7).
type IndexInfo ¶
type IndexInfo struct {
Name string
Column string
Type IndexType
Params IndexParams
}
IndexInfo describes one ANN index on a collection (spec 14 §6.4).
type IndexParams ¶
IndexParams holds index-build tuning knobs by name (spec 14 §6.3), such as "m" and "ef_construction" for HNSW or "nlist" and "nprobe" for IVF.
type IndexSpec ¶
type IndexSpec struct {
Name string
Column string
Type IndexType
Params IndexParams
}
IndexSpec describes an index to create on a collection (spec 14 §6.1).
type IndexStatsDetail ¶
type IndexStatsDetail struct {
Name string
Type IndexType
NodeCount int64
TombstoneCount int64
MemoryBytes int64
}
IndexStatsDetail reports live statistics for one index (spec 14 §6.5).
type IndexType ¶
type IndexType uint8
IndexType selects the ANN index implementation for a vector column (spec 14 §6.2). IndexFlat is the exact brute-force oracle; the rest are approximate.
type JWTSecret ¶
type JWTSecret []byte
JWTSecret is the HS256 shared signing secret that redacts itself.
func (JWTSecret) MarshalJSON ¶
type LoadFunc ¶
type LoadFunc func(ctx context.Context, bw *BulkWriter) error
LoadFunc is the callback signature for BulkLoad (spec 14 §8).
type Logger ¶
type Logger interface {
// Log is called with a level ("DEBUG", "INFO", "WARN", "ERROR"), a message,
// and key-value pairs.
Log(level, msg string, kvs ...any)
}
Logger receives internal log events (spec 14 §12.2). Implement it to route vec's logs into slog, zap, logrus, or any other framework.
var DefaultLogger Logger = stderrLogger{}
DefaultLogger writes to stderr in a structured format (spec 14 §12.2).
type Metric ¶
type Metric uint8
Metric is the distance metric bound to a vector column (spec 14 §4.3). It is fixed at collection creation and governs both index construction and query distance computation.
type MetricSink ¶
type MetricSink interface {
Counter(name string, delta int64, tags ...string)
Gauge(name string, value float64, tags ...string)
Histogram(name string, value float64, tags ...string)
}
MetricSink receives metric observations (spec 14 §12.4).
type MultiVector ¶
type MultiVector []Vector
MultiVector is a set of dense vectors for late-interaction retrieval (spec 14 §3.3), such as ColBERT token embeddings.
type Option ¶
type Option func(*openConfig)
Option configures a database at open time (spec 14 §2.2). Options are applied in order; a later option overrides an earlier one.
func OptionsFromEnv ¶
OptionsFromEnv reads VEC_ environment variables from environ (each "KEY=value") and turns the database-level ones into Options (spec 22 §22.2). The variable name is the knob name uppercased with VEC_ prepended and dots as underscores; the section prefixes (SERVER_, DATABASE_, etc.) are stripped so VEC_EF_SEARCH and VEC_DATABASE_CACHE_SIZE both resolve. Names that match no knob are skipped.
func ParseOptions ¶
ParseOptions converts a map of PRAGMA name to value into a slice of Options (spec 22 §26.2). It is the bridge for opening a database from a DSN query string, an environment, or any external key-value source. An unknown name or an invalid value returns an error and no options.
func WithBusyTimeout ¶
WithBusyTimeout sets how long Begin waits for the write lock before ErrBusy.
func WithCacheSize ¶
WithCacheSize sets the buffer-pool budget in bytes.
func WithCipher ¶
WithCipher selects the page cipher for a newly created encrypted database (spec 23 §2.2). The default is AES-256-GCM; ChaCha20-Poly1305 is the choice for hosts without AES hardware acceleration. The setting is ignored when opening an existing encrypted database, which uses the cipher recorded in its header.
func WithCreateIfMissing ¶
WithCreateIfMissing controls whether Open creates the file when it is absent.
func WithEncryptionKey ¶
func WithEncryptionKey(key EncryptionKey) Option
WithEncryptionKey enables at-rest encryption with a caller-supplied 32-byte raw key (spec 23 §3), for deployments that manage keys in an external KMS or HSM and inject the key at open time. The key is used as the master key directly with no passphrase KDF.
func WithMaxRetries ¶
WithMaxRetries caps the conflict-retry count for Update.
func WithMetrics ¶
func WithMetrics(m MetricSink) Option
WithMetrics routes metric observations to m.
func WithPageSize ¶
WithPageSize sets the database page size in bytes; it must be a power of two and is fixed for the life of the file (spec 14 §2.2).
func WithParallelism ¶
WithParallelism sets the goroutine count for index builds and batch upserts.
func WithPassphrase ¶
func WithPassphrase(p Passphrase) Option
WithPassphrase enables at-rest encryption with a passphrase (spec 23 §3). The master key is derived with Argon2id; opening the same database later needs the same passphrase, and a wrong one fails with ErrWrongPassphrase before any data page is read.
func WithPragma ¶
WithPragma sets one knob through the Option surface (spec 22 §26.1). The value is validated and canonicalized when Open applies the option; an invalid value surfaces as an *ErrInvalidConfig from Open.
func WithProgress ¶
func WithProgress(fn func(IndexBuildStats)) Option
WithProgress registers an index-build progress callback.
func WithReadOnly ¶
WithReadOnly opens the database for reading only.
func WithSynchronous ¶
WithSynchronous sets the WAL sync level.
type Passphrase ¶
type Passphrase string
Passphrase is a human-entered secret that redacts itself.
func (Passphrase) GoString ¶
func (Passphrase) GoString() string
func (Passphrase) MarshalJSON ¶
func (Passphrase) MarshalJSON() ([]byte, error)
func (Passphrase) Reveal ¶
func (p Passphrase) Reveal() string
Reveal returns the passphrase text. Used only at the key-derivation call site.
func (Passphrase) String ¶
func (Passphrase) String() string
type PhaseStats ¶
PhaseStats is one timed phase of query execution.
type Point ¶
Point is a row to upsert: its identity, its vectors keyed by column name, and its metadata keyed by column name (spec 14 §3.6). For a single-vector collection the Vectors map has one entry.
type PointID ¶
PointID is the identity of a point (spec 14 §3.5). A collection uses one form, fixed at creation: an integer N, or a byte/text key B with IsBytes set.
type ProfileResult ¶
type ProfileResult struct {
Plan string
Phases []PhaseStats
Total time.Duration
RowsRead int64
}
ProfileResult is the per-query profile (spec 14 §12.5). Phase-level timings land with the observability subsystem (spec 18).
type QueryBuilder ¶
type QueryBuilder struct {
// contains filtered or unexported fields
}
QueryBuilder builds and executes ANN queries with a fluent API (spec 14 §5). It is created by Collection.Query and is not goroutine-safe; build and execute it from one goroutine.
func (*QueryBuilder) All ¶
func (qb *QueryBuilder) All(ctx context.Context) ([]Result, error)
All executes the query and returns every result (spec 14 §5).
func (*QueryBuilder) BM25 ¶
func (qb *QueryBuilder) BM25(field, queryText string) *QueryBuilder
BM25 adds a lexical BM25 scoring term over a text field (spec 14 §5, hybrid).
func (*QueryBuilder) Ef ¶
func (qb *QueryBuilder) Ef(ef int) *QueryBuilder
Ef sets the HNSW ef_search beam width for this query.
func (*QueryBuilder) Exec ¶
func (qb *QueryBuilder) Exec(ctx context.Context) (*Rows, error)
Exec executes the query and returns a streaming cursor (spec 14 §5).
func (*QueryBuilder) Explain ¶
func (qb *QueryBuilder) Explain(ctx context.Context) (string, error)
Explain returns the query plan without executing it (spec 14 §12.5).
func (*QueryBuilder) Filter ¶
func (qb *QueryBuilder) Filter(expr string, args ...any) *QueryBuilder
Filter adds a VectorSQL WHERE clause with positional ? arguments.
func (*QueryBuilder) First ¶
func (qb *QueryBuilder) First(ctx context.Context) (Result, error)
First executes the query and returns the single nearest result (spec 14 §5).
func (*QueryBuilder) K ¶
func (qb *QueryBuilder) K(k int) *QueryBuilder
K sets the number of results to return.
func (*QueryBuilder) Nprobe ¶
func (qb *QueryBuilder) Nprobe(n int) *QueryBuilder
Nprobe sets the IVF probe count for this query.
func (*QueryBuilder) OrderBy ¶
func (qb *QueryBuilder) OrderBy(column string, desc bool) *QueryBuilder
OrderBy adds a secondary ordering by a metadata column.
func (*QueryBuilder) Profile ¶
func (qb *QueryBuilder) Profile(ctx context.Context) (*ProfileResult, error)
Profile executes the query and returns a profile report (spec 14 §12.5). The phase-level breakdown lands with the observability subsystem (spec 18).
func (*QueryBuilder) RRF ¶
func (qb *QueryBuilder) RRF(k float64) *QueryBuilder
RRF sets the reciprocal-rank-fusion constant for hybrid queries.
func (*QueryBuilder) Rerank ¶
func (qb *QueryBuilder) Rerank(r int) *QueryBuilder
Rerank requests an exact rerank over r widened candidates.
func (*QueryBuilder) Select ¶
func (qb *QueryBuilder) Select(columns ...string) *QueryBuilder
Select restricts the projected metadata columns.
func (*QueryBuilder) WithFetchSize ¶
func (qb *QueryBuilder) WithFetchSize(n int) *QueryBuilder
WithFetchSize sets the streaming fetch size for the cursor.
func (*QueryBuilder) WithIndex ¶
func (qb *QueryBuilder) WithIndex(indexName string) *QueryBuilder
WithIndex pins a named index for this query.
func (*QueryBuilder) WithScoreMode ¶
func (qb *QueryBuilder) WithScoreMode(annWeight, bm25Weight float64) *QueryBuilder
WithScoreMode is reserved for weighted hybrid fusion (spec 14 §5).
func (*QueryBuilder) WithVectors ¶
func (qb *QueryBuilder) WithVectors(columns ...string) *QueryBuilder
WithVectors requests the stored vectors of the named columns in each Result.
type RekeyVacuumStats ¶
RekeyVacuumStats reports the result of a full re-encryption pass (spec 23 §9.3).
type Result ¶
type Result struct {
ID PointID
Distance float32
Score float32
Point Point
// contains filtered or unexported fields
}
Result is one row from a query (spec 14 §5.6).
func (Result) DistanceValue ¶
DistanceValue returns the distance of the result.
func (Result) Meta ¶
Meta returns the projected metadata columns of the result keyed by name. The CLI uses it to render a result row without knowing the projection in advance.
func (Result) Scan ¶
Scan copies the id and distance of the result into dest. Supported destinations are *uint64/*int64 (id) and *float32/*float64 (distance), in that order.
func (Result) Similarity ¶
Similarity returns a similarity score derived from the distance.
type Rows ¶
type Rows struct {
// contains filtered or unexported fields
}
Rows is a streaming result cursor (spec 14 §5.6). It is not goroutine-safe.
type SchemaError ¶
SchemaError carries schema violation detail (spec 14 §10.3).
func (*SchemaError) Error ¶
func (e *SchemaError) Error() string
func (*SchemaError) Unwrap ¶
func (e *SchemaError) Unwrap() error
Unwrap returns ErrSchemaViolation.
type SessionConfig ¶
SessionConfig holds the session-tier defaults a connection starts with.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
Snapshot is a read-only view pinned at a committed sequence (spec 14 §11.4).
type SparseVector ¶
SparseVector is a sparse vector as parallel index/value arrays (spec 14 §3.2). Indices must be strictly increasing.
type SyncLevel ¶
type SyncLevel int
SyncLevel controls how aggressively the WAL is flushed to stable storage on commit (spec 14 §2.3, mirroring the WAL sync levels of spec 05).
type Tracer ¶
Tracer receives span events for distributed tracing (spec 14 §12.3). vec creates one span per query, transaction, and index build.
type Txn ¶
type Txn struct {
// contains filtered or unexported fields
}
Txn is a transaction (spec 14 §11.4). It is NOT goroutine-safe: one goroutine owns it from Begin to Commit or Rollback. The closure forms View and Update avoid sharing a Txn across goroutines entirely.
func (*Txn) Commit ¶
Commit commits the transaction (spec 14 §11). A write conflict returns ErrConflict; the transaction is finished either way.
func (*Txn) Rollback ¶
Rollback rolls back the transaction (spec 14 §11). It is safe to call after a commit or a previous rollback.
func (*Txn) RollbackTo ¶
RollbackTo rolls back to a savepoint (spec 14 §11). The engine does not yet support partial rollback, so this is reported as unsupported when the savepoint has uncommitted work to discard.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is a typed metadata value (spec 14 §5). It is a discriminated union over the scalar, text, bytes, and timestamp types a metadata column may hold. The zero Value is NULL. Construct values with the *Value functions and read them back with the typed accessors.
func TimestampValue ¶
TimestampValue builds a timestamp value.
type Vector ¶
type Vector []float32
Vector is a dense float32 vector (spec 14 §3.1). It is the in-memory form a caller passes to Upsert and Query; the engine stores one copy per point and the indexes reference positions, never copies.
func FromSlice32 ¶
FromSlice32 wraps a float32 slice as a Vector without copying.
func FromSlice64 ¶
FromSlice64 builds a Vector from a float64 slice, narrowing each element.
func (Vector) HalfPrecision ¶
HalfPrecision rounds each element to the nearest IEEE half-precision value, returning a float32 vector. It models the precision loss of an fp16 column so a caller can preview quantization effects.
func (Vector) Normalize ¶
Normalize returns a unit-length copy of the vector; a zero vector is returned unchanged.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package audit implements the security audit log from spec 23 section 11: an append-only NDJSON record of who did what to which collection at what time.
|
Package audit implements the security audit log from spec 23 section 11: an append-only NDJSON record of who did what to which collection at what time. |
|
Package auth implements the server authentication and authorization surface from spec 23 sections 6 and 7: API keys, JWT validation, mutual-TLS principal mapping, local password accounts, the role model, and the collection-scoped access control list.
|
Package auth implements the server authentication and authorization surface from spec 23 sections 6 and 7: API keys, JWT validation, mutual-TLS principal mapping, local password accounts, the role model, and the collection-scoped access control list. |
|
Package bench is the benchmark harness from spec 20: dataset loaders for the standard ANN file formats, recall computation against ground truth, a latency recorder with coordinated-omission-correct percentiles, the parameter sweep that drives a searcher across effort values, the result JSON and TSV writers, and the CI regression gate.
|
Package bench is the benchmark harness from spec 20: dataset loaders for the standard ANN file formats, recall computation against ground truth, a latency recorder with coordinated-omission-correct percentiles, the parameter sweep that drives a searcher across effort values, the result JSON and TSV writers, and the CI regression gate. |
|
Package bulk implements the bulk import, logical dump/load, and backup-format pieces of spec 17 on top of the public vec facade.
|
Package bulk implements the bulk import, logical dump/load, and backup-format pieces of spec 17 on top of the public vec facade. |
|
Package catalog implements the vec data model and schema authority (spec 02): the value type system, point identity, distance-metric binding, collection schemas, the three system collections, schema definition and evolution rules, constraints, and the write-path validation every insert and upsert must pass.
|
Package catalog implements the vec data model and schema authority (spec 02): the value type system, point identity, distance-metric binding, collection schemas, the three system collections, schema definition and evolution rules, constraints, and the write-path validation every insert and upsert must pass. |
|
Package cli implements the vec command-line tool: the interactive shell, the batch SQL surface, and the administrative subcommands (spec 15).
|
Package cli implements the vec command-line tool: the interactive shell, the batch SQL surface, and the administrative subcommands (spec 15). |
|
cmd
|
|
|
vec
command
Command vec is the single-file vector database shell and tool.
|
Command vec is the single-file vector database shell and tool. |
|
Package config is the knob catalogue for vec (spec 22).
|
Package config is the knob catalogue for vec (spec 22). |
|
Package crypto implements vec's encryption at rest: the page-level AEAD envelope, the key hierarchy (master key, per-epoch DEK, per-page key, per-write nonce), key rotation, and the verification tag that detects a wrong passphrase before any data page is read.
|
Package crypto implements vec's encryption at rest: the page-level AEAD envelope, the key hierarchy (master key, per-epoch DEK, per-page key, per-write nonce), key rotation, and the verification tag that detects a wrong passphrase before any data page is read. |
|
Package distance implements vec's scalar distance kernels and the kernel dispatch architecture (spec 09 §11-13).
|
Package distance implements vec's scalar distance kernels and the kernel dispatch architecture (spec 09 §11-13). |
|
Package format defines the on-disk byte layout of a vec database file: the database header, the common page header, page types, varint and record encodings, and the page checksum.
|
Package format defines the on-disk byte layout of a vec database file: the database header, the common page header, page types, varint and record encodings, and the page checksum. |
|
Package hybrid implements vec's lexical and multi-modal retrieval layer (spec 11): the BM25 keyword index (§9), reciprocal-rank and score-normalized fusion (§10), learned-sparse (SPLADE) dot-product search (§11), and multi-vector (ColBERT) MaxSim late interaction (§12).
|
Package hybrid implements vec's lexical and multi-modal retrieval layer (spec 11): the BM25 keyword index (§9), reciprocal-rank and score-normalized fusion (§10), learned-sparse (SPLADE) dot-product search (§11), and multi-vector (ColBERT) MaxSim late interaction (§12). |
|
Package index implements vec's vector index access paths behind one SPI: the flat brute-force baseline and the HNSW graph (spec 07).
|
Package index implements vec's vector index access paths behind one SPI: the flat brute-force baseline and the HNSW graph (spec 07). |
|
Package mvcc implements vec's multi-version concurrency control: snapshot isolation by default, an optional serializable level, a monotonic commit clock, per-key version chains (the delta-over-base model), a watermark oracle that governs version reclamation, and first-committer-wins conflict detection (spec 06).
|
Package mvcc implements vec's multi-version concurrency control: snapshot isolation by default, an optional serializable level, a monotonic commit clock, per-key version chains (the delta-over-base model), a watermark oracle that governs version reclamation, and first-committer-wins conflict detection (spec 06). |
|
Package obs is the observability surface from spec 18: the metrics catalogue, the structured slow-query log, the flat-oracle recall sampler, and the health and readiness report.
|
Package obs is the observability surface from spec 18: the metrics catalogue, the structured slow-query log, the flat-oracle recall sampler, and the health and readiness report. |
|
Package pager is the layer between the storage and index cores and the file (spec 05).
|
Package pager is the layer between the storage and index cores and the file (spec 05). |
|
Package quant implements vec's vector codecs: flat (no compression), scalar quantization (SQ int8), product quantization (PQ), optimized product quantization (OPQ), binary (1-bit Hamming), and RaBitQ (spec 09 §2-8).
|
Package quant implements vec's vector codecs: flat (no compression), scalar quantization (SQ int8), product quantization (PQ), optimized product quantization (OPQ), binary (1-bit Hamming), and RaBitQ (spec 09 §2-8). |
|
Package query is vec's read-path query engine: the cost-based planner that turns a bound logical query into a physical plan (spec 13) and the vectorized executor that runs that plan against the index SPI, the storage engine, and the distance kernels (spec 10).
|
Package query is vec's read-path query engine: the cost-based planner that turns a bound logical query into a physical plan (spec 13) and the vectorized executor that runs that plan against the index SPI, the storage engine, and the distance kernels (spec 10). |
|
Package server turns the embedded vec library into a networked service (spec 16).
|
Package server turns the embedded vec library into a networked service (spec 16). |
|
pgwire
Package pgwire implements the PostgreSQL v3 frontend/backend wire protocol over net.Conn so pgvector clients (psql, psycopg, pgx, asyncpg, JDBC) talk to the vec engine without code changes (spec 16 §4, §17, §18).
|
Package pgwire implements the PostgreSQL v3 frontend/backend wire protocol over net.Conn so pgvector clients (psql, psycopg, pgx, asyncpg, JDBC) talk to the vec engine without code changes (spec 16 §4, §17, §18). |
|
vecpb
Package vecpb is a hand-written proto3 wire codec for the VecService messages (spec 16 §2.2).
|
Package vecpb is a hand-written proto3 wire codec for the VecService messages (spec 16 §2.2). |
|
Package storage implements the vec storage engine (spec 04): fixed-stride columnar vector segments, a separate columnar metadata store, and an id-map that mediates between stable application point ids and dense engine positions.
|
Package storage implements the vec storage engine (spec 04): fixed-stride columnar vector segments, a separate columnar metadata store, and an id-map that mediates between stable application point ids and dense engine positions. |
|
Package vectorsql implements the VectorSQL language surface of spec 12: a hand-written recursive-descent lexer and parser over the formal grammar (§15), the AST the parser emits (§17.2), the strict error model (§14), and a binder that resolves a parsed statement against the catalog and lowers a kNN SELECT to the planner's BoundQuery.
|
Package vectorsql implements the VectorSQL language surface of spec 12: a hand-written recursive-descent lexer and parser over the formal grammar (§15), the AST the parser emits (§17.2), the strict error model (§14), and a binder that resolves a parsed statement against the catalog and lowers a kNN SELECT to the planner's BoundQuery. |
|
Package verify holds vec's correctness machinery from spec 21: the recall oracle, the reference model, the conformance and metamorphic drivers, and the fault-injecting VFS used for crash testing.
|
Package verify holds vec's correctness machinery from spec 21: the recall oracle, the reference model, the conformance and metamorphic drivers, and the fault-injecting VFS used for crash testing. |
|
Package vfs is the file-I/O seam for vec (spec 05).
|
Package vfs is the file-I/O seam for vec (spec 05). |
|
Package wal is the write-ahead log: the durability spine the database commits through (spec 05).
|
Package wal is the write-ahead log: the durability spine the database commits through (spec 05). |