Documentation
¶
Overview ¶
Package cortex wraps the spec-pinned CortexDB PostgreSQL core. Provision is explicit; New never migrates, starts routines, or owns its supplied SQL pool.
Index ¶
- Constants
- func Provision(ctx context.Context, db *sql.DB, c Config) error
- func ProvisionDisposalGate(ctx context.Context, db *sql.DB) error
- func ProvisionRetention(ctx context.Context, db *sql.DB) error
- type Config
- type Generations
- func (r *Generations) Candidates(ctx context.Context, t, g, s, q string, n int) ([]model.SearchCandidate, error)
- func (r *Generations) CheckConnectivity(ctx context.Context) error
- func (r *Generations) DescribeRetrieval(ctx context.Context, t, g string) (model.RetrievalIdentity, error)
- func (r *Generations) DisposeProjection(ctx context.Context, d model.ProjectionDisposal) error
- func (r *Generations) Put(ctx context.Context, d model.ProjectionDocument) error
- func (r *Generations) SealProjectionForDisposal(ctx context.Context, k model.GenerationKey, fence int64) error
- func (r *Generations) SetProjectionGate(ctx context.Context, k model.GenerationKey, f int64, s bool) error
- func (r *Generations) VerifyProjection(ctx context.Context, k model.GenerationKey, f int64, ...) (model.ProjectionCheck, error)
- func (r *Generations) VerifyProjectionPages(ctx context.Context, k model.GenerationKey, fence int64, ...) (model.ProjectionCheck, error)
- type Index
- func (i *Index) Candidates(ctx context.Context, tenant, generation, scope, query string, limit int) ([]model.SearchCandidate, error)
- func (i *Index) Close() error
- func (i *Index) DescribeRetrieval(_ context.Context, tenant, generation string) (model.RetrievalIdentity, error)
- func (i *Index) DisposeProjection(ctx context.Context, r model.ProjectionDisposal) error
- func (i *Index) Lexical() *LexicalIndex
- func (i *Index) Put(ctx context.Context, d model.ProjectionDocument) error
- func (i *Index) SealProjectionForDisposal(ctx context.Context, k model.GenerationKey, fence int64) error
- func (i *Index) SetProjectionGate(ctx context.Context, k model.GenerationKey, fence int64, sealed bool) error
- func (i *Index) VerifyProjection(ctx context.Context, k model.GenerationKey, fence int64, ...) (model.ProjectionCheck, error)
- func (i *Index) VerifyProjectionPages(ctx context.Context, k model.GenerationKey, fence int64, ...) (model.ProjectionCheck, error)
- type LexicalIndex
- func (i *LexicalIndex) Candidates(ctx context.Context, tenant, generation, scope, query string, limit int) ([]model.SearchCandidate, error)
- func (i *LexicalIndex) DescribeRetrieval(_ context.Context, tenant, generation string) (model.RetrievalIdentity, error)
- func (i *LexicalIndex) DisposeProjection(ctx context.Context, r model.ProjectionDisposal) error
- func (i *LexicalIndex) Put(ctx context.Context, d model.ProjectionDocument) error
- func (i *LexicalIndex) SealProjectionForDisposal(ctx context.Context, k model.GenerationKey, fence int64) error
- type Router
- func (r Router) Candidates(ctx context.Context, t, g, s, q string, n int) ([]model.SearchCandidate, error)
- func (r Router) DescribeRetrieval(ctx context.Context, t, g string) (model.RetrievalIdentity, error)
- func (r Router) DisposeProjection(ctx context.Context, d model.ProjectionDisposal) error
- func (r Router) Put(ctx context.Context, d model.ProjectionDocument) error
- func (r Router) SealProjectionForDisposal(ctx context.Context, k model.GenerationKey, fence int64) error
Constants ¶
const Version = "v2.129.0" // eaf996b62f75d5e499d1b9ca7fab470a23700385
Variables ¶
This section is empty.
Functions ¶
func Provision ¶
Provision requires a fresh, dedicated database and privileged migration pool. Runtime identities must be granted only SELECT/INSERT/UPDATE on embeddings, SELECT on collections/identity/tombstones, and SELECT/INSERT on receipts.
func ProvisionDisposalGate ¶
ProvisionDisposalGate upgrades a previously provisioned retention index with writers stopped, using the migration owner. Refresh role grants afterwards.
func ProvisionRetention ¶
ProvisionRetention upgrades an existing dedicated index database once, using an owner connection with writers stopped. New databases receive this schema through Provision. Refresh runtime/retention grants before restarting writers.
Types ¶
type Config ¶
Config binds one separately provisioned database to exactly one tenant and generation. Rebuild into a new database; switching the host binding is explicit.
type Generations ¶
type Generations struct {
// contains filtered or unexported fields
}
Generations is an immutable host routing table. It never switches the active generation; managed recall reads that decision from the ledger registry.
func NewGenerations ¶
func NewGenerations(indexes ...*Index) (*Generations, error)
func (*Generations) Candidates ¶
func (r *Generations) Candidates(ctx context.Context, t, g, s, q string, n int) ([]model.SearchCandidate, error)
func (*Generations) CheckConnectivity ¶
func (r *Generations) CheckConnectivity(ctx context.Context) error
CheckConnectivity checks configured pools only. It does not establish search coverage, active-generation selection, index integrity or embedding health.
func (*Generations) DescribeRetrieval ¶
func (r *Generations) DescribeRetrieval(ctx context.Context, t, g string) (model.RetrievalIdentity, error)
func (*Generations) DisposeProjection ¶
func (r *Generations) DisposeProjection(ctx context.Context, d model.ProjectionDisposal) error
func (*Generations) Put ¶
func (r *Generations) Put(ctx context.Context, d model.ProjectionDocument) error
func (*Generations) SealProjectionForDisposal ¶
func (r *Generations) SealProjectionForDisposal(ctx context.Context, k model.GenerationKey, fence int64) error
func (*Generations) SetProjectionGate ¶
func (r *Generations) SetProjectionGate(ctx context.Context, k model.GenerationKey, f int64, s bool) error
func (*Generations) VerifyProjection ¶
func (r *Generations) VerifyProjection(ctx context.Context, k model.GenerationKey, f int64, d []model.ProjectionDocument) (model.ProjectionCheck, error)
func (*Generations) VerifyProjectionPages ¶
func (r *Generations) VerifyProjectionPages(ctx context.Context, k model.GenerationKey, fence int64, load model.ProjectionPageLoader) (model.ProjectionCheck, error)
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func NewRetention ¶
NewRetention opens an existing destination for cleanup without configuring an embedding provider. Identity, schema, role and pool checks match New. The caller supplies separately provisioned retention credentials; this does not grant privileges or migrate the index.
func (*Index) Candidates ¶
func (*Index) DescribeRetrieval ¶
func (*Index) DisposeProjection ¶
func (*Index) Lexical ¶
func (i *Index) Lexical() *LexicalIndex
func (*Index) SealProjectionForDisposal ¶
func (i *Index) SealProjectionForDisposal(ctx context.Context, k model.GenerationKey, fence int64) error
SealProjectionForDisposal permanently invalidates a sealed generation's proof. The trusted coordinator must first establish that the ledger generation is retired or abandoned, and enforce authorization, retention policy and holds. This adapter has no ledger connection and cannot establish those conditions.
func (*Index) SetProjectionGate ¶
func (*Index) VerifyProjection ¶
func (i *Index) VerifyProjection(ctx context.Context, k model.GenerationKey, fence int64, documents []model.ProjectionDocument) (model.ProjectionCheck, error)
VerifyProjection checks every stored receipt and canonical row, not a sample. The sealed gate is held throughout inspection. It validates vector shape, not semantic embedding quality or reproducibility of an external model.
func (*Index) VerifyProjectionPages ¶
func (i *Index) VerifyProjectionPages(ctx context.Context, k model.GenerationKey, fence int64, load model.ProjectionPageLoader) (model.ProjectionCheck, error)
VerifyProjectionPages retains the sealed gate lock and one destination snapshot across all source pages. Exact cardinalities plus unique expected IDs rule out missing rows, extra rows and orphan receipts without an in-memory set of the entire inventory.
type LexicalIndex ¶
type LexicalIndex struct {
// contains filtered or unexported fields
}
LexicalIndex is an explicit lexical read view over a bound generation. Writes still use the generation's configured indexing method. No automatic switch can silently change the retrieval identity retained by PrepareContext.
func (*LexicalIndex) Candidates ¶
func (i *LexicalIndex) Candidates(ctx context.Context, tenant, generation, scope, query string, limit int) ([]model.SearchCandidate, error)
func (*LexicalIndex) DescribeRetrieval ¶
func (i *LexicalIndex) DescribeRetrieval(_ context.Context, tenant, generation string) (model.RetrievalIdentity, error)
func (*LexicalIndex) DisposeProjection ¶
func (i *LexicalIndex) DisposeProjection(ctx context.Context, r model.ProjectionDisposal) error
func (*LexicalIndex) Put ¶
func (i *LexicalIndex) Put(ctx context.Context, d model.ProjectionDocument) error
func (*LexicalIndex) SealProjectionForDisposal ¶
func (i *LexicalIndex) SealProjectionForDisposal(ctx context.Context, k model.GenerationKey, fence int64) error
type Router ¶
Router is host-provisioned; a tenant must have its own bound Index/database.