Documentation
¶
Index ¶
- Constants
- Variables
- func CountFacts(seq iter.Seq2[Fact, error]) (int, error)
- func Filter(seq iter.Seq2[Fact, error], pred func(Fact) bool) iter.Seq2[Fact, error]
- func Map[T any](seq iter.Seq2[Fact, error], fn func(Fact) (T, error)) iter.Seq2[T, error]
- func MustValue[T any](f Fact) T
- func ShouldPruneTriple(value []byte, wantEntityType uint16, wantPublic bool) bool
- func Value[T any](f Fact) (T, bool)
- func ValueOrDefault[T any](f Fact, defaultVal T) T
- type BatchWriter
- type Builder
- func (b *Builder) CandidateMultiplier(multiplier int) *Builder
- func (b *Builder) Execute(ctx context.Context) ([]Result, error)
- func (b *Builder) FilterFirst() *Builder
- func (b *Builder) InTopic(topicID uint32) *Builder
- func (b *Builder) JoinWithLFTJ(relations []query.RelationPattern, resultVars []string) *Builder
- func (b *Builder) Limit(n int) *Builder
- func (b *Builder) SimilarTo(vec []float32) *Builder
- func (b *Builder) SimilarToWithThreshold(vec []float32, threshold float32) *Builder
- func (b *Builder) Where(predicate string, object interface{}) *Builder
- type Fact
- type FilterOpt
- type MEBStore
- func (m *MEBStore) Add(atom ast.Atom) bool
- func (m *MEBStore) AddDocument(docKey string, content []byte, vec []float32, metadata map[string]any) error
- func (m *MEBStore) AddDocumentWithTopic(topicID uint32, docKey string, content []byte, vec []float32, ...) error
- func (m *MEBStore) AddFact(fact Fact) error
- func (m *MEBStore) AddFactBatch(facts []Fact) error
- func (m *MEBStore) CircuitBreaker() *circuit.Breaker
- func (m *MEBStore) CircuitBreakerMetrics() circuit.Metrics
- func (m *MEBStore) CircuitBreakerMetricsSnapshot() circuit.MetricsSnapshot
- func (m *MEBStore) Close() error
- func (m *MEBStore) Compact(ratio float64) error
- func (m *MEBStore) Contains(atom ast.Atom) bool
- func (m *MEBStore) Count() uint64
- func (m *MEBStore) DebugInfo() StoreHealth
- func (m *MEBStore) DeleteDocument(docKey string) error
- func (m *MEBStore) DeleteDocumentWithTopic(docKey string, topicID uint32) error
- func (m *MEBStore) DeleteFactsBySubject(subject string) error
- func (m *MEBStore) Dict() dict.Dictionary
- func (st *MEBStore) EnableHNSW(cfg *vector.HNSWConfig) error
- func (st *MEBStore) EnableIVFPQ(cfg *vector.IVFPQConfig) error
- func (m *MEBStore) Exists(s, p, o string) bool
- func (m *MEBStore) Find() *Builder
- func (m *MEBStore) FindSubjectsByObject(ctx context.Context, predicate, object string) iter.Seq[string]
- func (m *MEBStore) GetContent(id uint64) ([]byte, error)
- func (m *MEBStore) GetContentByKey(docKey string) ([]byte, error)
- func (m *MEBStore) GetDocumentMetadata(docKey string) (map[string]any, error)
- func (m *MEBStore) GetFacts(atom ast.Atom, callback func(ast.Atom) error) error
- func (m *MEBStore) GetTriples(triples []TripleKey) ([]TripleResult, error)
- func (m *MEBStore) GetVectors(ids []uint64) ([]VectorResult, error)
- func (st *MEBStore) HNSWIndex() *vector.HNSWIndex
- func (m *MEBStore) HasDocument(docKey string) (bool, error)
- func (m *MEBStore) Health() StoreHealth
- func (st *MEBStore) IVFPQIndex() *vector.IVFPQIndex
- func (m *MEBStore) LFTJEngine() *query.LFTJEngine
- func (m *MEBStore) ListPredicates() []ast.PredicateSym
- func (m *MEBStore) LookupID(key string) (uint64, bool)
- func (m *MEBStore) Merge(other factstore.ReadOnlyFactStore) error
- func (m *MEBStore) MergeBatch(other factstore.ReadOnlyFactStore, batchSize int) error
- func (m *MEBStore) NewBatchWriter() *BatchWriter
- func (m *MEBStore) RecalculateStats() (uint64, error)
- func (m *MEBStore) RegisterTelemetrySink(sink TelemetrySink)
- func (m *MEBStore) Reset() error
- func (m *MEBStore) ResolveID(id uint64) (string, error)
- func (m *MEBStore) RunValueLogGC(ratio float64) error
- func (m *MEBStore) Scan(s, p, o string) iter.Seq2[Fact, error]
- func (m *MEBStore) ScanContext(ctx context.Context, s, p, o string) iter.Seq2[Fact, error]
- func (m *MEBStore) ScanInTopic(topicID uint32, s, p, o string) iter.Seq2[Fact, error]
- func (m *MEBStore) ScanInTopicContext(ctx context.Context, topicID uint32, s, p, o string) iter.Seq2[Fact, error]
- func (m *MEBStore) ScanSubjects(ctx context.Context) iter.Seq[string]
- func (m *MEBStore) ScanSubjectsByPrefix(ctx context.Context, prefix string) iter.Seq[string]
- func (m *MEBStore) ScanWithFilters(s, p, o string, filters []PredicateFilter) iter.Seq2[Fact, error]
- func (m *MEBStore) ScanWithFiltersContext(ctx context.Context, s, p, o string, filters []PredicateFilter) iter.Seq2[Fact, error]
- func (m *MEBStore) ScanWithPruning(ctx context.Context, s, p, o string, entityType uint16, wantPublic bool) iter.Seq2[Fact, error]
- func (m *MEBStore) SetCircuitBreakerConfig(config *circuit.Config)
- func (m *MEBStore) SetContent(id uint64, data []byte) error
- func (m *MEBStore) SetDefaultEntityType(entityType uint16)
- func (m *MEBStore) SetDefaultFlags(flags uint16)
- func (m *MEBStore) SetRetention(maxFacts uint64) error
- func (m *MEBStore) SetTopicID(topicID uint32)
- func (m *MEBStore) TopicID() uint32
- func (st *MEBStore) TrainIVFPQ(topicID uint32) error
- func (m *MEBStore) UnregisterTelemetrySink(sink TelemetrySink)
- func (m *MEBStore) Update(fn func(*StoreTxn) error) error
- func (m *MEBStore) Vectors() *vector.VectorRegistry
- func (m *MEBStore) View(fn func(*StoreTxn) error) error
- type NumericRange
- type PredicateFilter
- type PredicateFilterType
- type QueryFilter
- type Result
- type Results
- type Store
- type StoreHealth
- type StoreTxn
- func (t *StoreTxn) AddFact(fact Fact) error
- func (t *StoreTxn) AddFactBatch(facts []Fact) error
- func (t *StoreTxn) AddFactBatchWithTopic(facts []Fact, topicID uint32) error
- func (t *StoreTxn) AddHNSWVector(topicID uint32, localID uint64, fullVec []float32) error
- func (t *StoreTxn) AddIVFVector(topicID uint32, localID uint64, fullVec []float32) error
- func (t *StoreTxn) AddVector(id uint64, vec []float32) error
- func (t *StoreTxn) AddVectorWithHash(id uint64, vec []float32, semanticHash uint8) error
- func (t *StoreTxn) BadgerTxn() *badger.Txn
- func (t *StoreTxn) DeleteDocument(docKey string) error
- func (t *StoreTxn) DeleteDocumentWithTopic(docKey string, topicID uint32) error
- func (t *StoreTxn) DeleteFactsBySubject(subject string) error
- func (t *StoreTxn) DeleteVector(id uint64) bool
- func (t *StoreTxn) Exists(s, p, o string) bool
- func (t *StoreTxn) GetContent(id uint64) ([]byte, error)
- func (t *StoreTxn) GetID(s string) (uint64, error)
- func (t *StoreTxn) GetOrCreateID(s string) (uint64, error)
- func (t *StoreTxn) GetString(id uint64) (string, error)
- func (t *StoreTxn) HasVector(id uint64) bool
- func (t *StoreTxn) Scan(ctx context.Context, s, p, o string) iterSeq2FactError
- func (t *StoreTxn) ScanInTopic(ctx context.Context, topicID uint32, s, p, o string) iterSeq2FactError
- func (t *StoreTxn) SearchHNSW(ctx context.Context, topicID uint32, queryVec []float32, k int) ([]Result, error)
- func (t *StoreTxn) SearchHybrid(ctx context.Context, queryVec []float32, k int) ([]Result, error)
- func (t *StoreTxn) SearchHybridWithFilters(ctx context.Context, queryVec []float32, k int, filters []FilterOpt) ([]Result, error)
- func (t *StoreTxn) SearchIVFPQ(ctx context.Context, topicID uint32, queryVec []float32, k int) ([]Result, error)
- func (t *StoreTxn) SetContent(id uint64, data []byte) error
- type TelemetryEvent
- type TelemetrySink
- type TripleKey
- type TripleResult
- type VectorResult
- type WAL
Constants ¶
const (
DefaultCandidateMultiplier = 10
)
Variables ¶
var ( // ErrInvalidFact is returned when a Fact has missing required fields // (empty Subject or Predicate) or an Object of an unsupported type. ErrInvalidFact = fmt.Errorf("invalid fact") // ErrStoreReadOnly is returned when a write operation is attempted on a // store opened with Config.ReadOnly = true. ErrStoreReadOnly = fmt.Errorf("store is read-only") // ErrInvalidQuery is returned when a query is malformed (e.g. empty // predicate in a context that requires one). ErrInvalidQuery = fmt.Errorf("invalid query") // ErrFactNotFound is returned by lookup helpers when no matching fact // is found. ErrFactNotFound = fmt.Errorf("fact not found") // ErrEmptyBatch is returned when a batch write is called with no facts. ErrEmptyBatch = fmt.Errorf("empty batch") // ErrStoreClosed is returned when an operation is attempted on a store or // batch writer that has been closed. ErrStoreClosed = fmt.Errorf("store is closed") // ErrWALClosed is returned by WAL.Append or WAL.Clear when the WAL has // been closed or is mid-clear. Callers should treat this as a hard // failure rather than a silent drop. ErrWALClosed = fmt.Errorf("WAL is closed") // ErrUnknownTriplePrefix is returned by key encoders when an unknown // prefix byte is passed. Surfaces bugs that would otherwise be silently // mis-encoded as SPO. ErrUnknownTriplePrefix = fmt.Errorf("unknown triple key prefix") )
Functions ¶
func ShouldPruneTriple ¶
ShouldPruneTriple reads semantic hints from a 16-byte triple value and returns true if the triple should be pruned based on the requested entity type and public flag.
func ValueOrDefault ¶
Types ¶
type BatchWriter ¶ added in v0.7.0
type BatchWriter struct {
// contains filtered or unexported fields
}
BatchWriter accumulates bulk triple writes and commits them through a single BadgerDB WriteBatch, amortizing fsync/commit overhead across many facts. It is intended for bulk/A^-style imports. Facts must be added via AddFacts; the batch is committed with Flush (or discarded with Cancel). A BatchWriter is single-goroutine and must not be reused after Flush or Cancel.
func (*BatchWriter) AddFacts ¶ added in v0.7.0
func (bw *BatchWriter) AddFacts(facts []Fact) error
AddFacts queues the given facts for the batch. Facts whose triple already exists in the store (or was added earlier in this batch) are skipped and do not affect Flush's count, matching the transaction path's numFacts semantics.
func (*BatchWriter) Cancel ¶ added in v0.7.0
func (bw *BatchWriter) Cancel()
Cancel discards the batch without committing, releasing the WriteBatch.
func (*BatchWriter) Count ¶ added in v0.7.0
func (bw *BatchWriter) Count() uint64
Count returns the number of new facts queued in this batch so far (i.e. those that will be reflected in the store's fact count after Flush).
func (*BatchWriter) Flush ¶ added in v0.7.0
func (bw *BatchWriter) Flush() error
Flush commits the buffered writes, updates the store fact count with the number of newly inserted triples, and closes the batch. Flush may be called only once. Like the transaction path, it relies on Badger durability and does not write the WAL (see BatchWriter doc on AddFacts).
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func (*Builder) CandidateMultiplier ¶
func (*Builder) Execute ¶
Execute runs the query using RBO to automatically select the optimal strategy. FilterFirst() is kept as an explicit override for manual control.
func (*Builder) FilterFirst ¶
FilterFirst enables candidate-set pre-filtering for this query. When enabled, filters are evaluated against the graph index FIRST, building a set of matching subject IDs. Vector search results that aren't in this set are then skipped in the result loop (post-filter).
Important: This is NOT true predicate pushdown — vector search still scans all vectors and computes similarities for all candidates. The benefit comes from skipping dictionary lookups and content fetches for non-matching vectors. Most effective when:
- Filters are highly selective (< 10% match rate)
- Content fetch or dict lookup is expensive relative to vector search
func (*Builder) InTopic ¶
InTopic restricts the search to a specific topic. The TopicID is used for topic-aware vector search and scan operations.
func (*Builder) JoinWithLFTJ ¶
func (b *Builder) JoinWithLFTJ(relations []query.RelationPattern, resultVars []string) *Builder
JoinWithLFTJ adds LFTJ relations for structural expansion after vector search. The seedVar must match a variable name used in the relations. Results are streamed — no intermediate materialization.
func (*Builder) SimilarToWithThreshold ¶
type FilterOpt ¶
type FilterOpt struct {
Predicate string
Object interface{}
}
FilterOpt is a filter option for hybrid search.
type MEBStore ¶
type MEBStore struct {
// contains filtered or unexported fields
}
func (*MEBStore) AddDocument ¶
func (*MEBStore) AddDocumentWithTopic ¶
func (*MEBStore) AddFactBatch ¶
func (*MEBStore) CircuitBreaker ¶
func (*MEBStore) CircuitBreakerMetrics ¶
func (*MEBStore) CircuitBreakerMetricsSnapshot ¶
func (m *MEBStore) CircuitBreakerMetricsSnapshot() circuit.MetricsSnapshot
func (*MEBStore) Compact ¶ added in v0.7.0
Compact runs Badger value-log garbage collection, rewriting stale values to reclaim disk space. ratio is the fraction of a value log file's bytes that must be discardable to justify rewriting it (0-1; badger.ErrNoRewrite is returned when there is nothing to reclaim). The store's configured GCRatio is used if ratio is <= 0.
func (*MEBStore) DebugInfo ¶ added in v0.6.0
func (m *MEBStore) DebugInfo() StoreHealth
DebugInfo returns a snapshot of store health metrics. Safe to call concurrently; all reads are atomic or lock-protected.
func (*MEBStore) DeleteDocument ¶
func (*MEBStore) DeleteDocumentWithTopic ¶
func (*MEBStore) DeleteFactsBySubject ¶
func (*MEBStore) Dict ¶
func (m *MEBStore) Dict() dict.Dictionary
func (*MEBStore) EnableHNSW ¶
func (st *MEBStore) EnableHNSW(cfg *vector.HNSWConfig) error
func (*MEBStore) EnableIVFPQ ¶
func (st *MEBStore) EnableIVFPQ(cfg *vector.IVFPQConfig) error
func (*MEBStore) Exists ¶
Exists performs an efficient key-only existence check without decoding strings.
func (*MEBStore) FindSubjectsByObject ¶
func (m *MEBStore) FindSubjectsByObject(ctx context.Context, predicate, object string) iter.Seq[string]
FindSubjectsByObject returns all subjects matching exact predicate and object. Uses SPO index scan across ALL topics - does not filter by current topicID. Returns empty iterator if no matches found (never returns error for "not found").
func (*MEBStore) GetContentByKey ¶
func (*MEBStore) GetDocumentMetadata ¶
func (*MEBStore) GetTriples ¶ added in v0.7.0
func (m *MEBStore) GetTriples(triples []TripleKey) ([]TripleResult, error)
GetTriples performs a batched point lookup for the given triple keys, resolving all dictionary IDs within a single read transaction. The result slice has the same length as keys, in the same order; Found is false for any key that does not resolve (unknown subject/predicate/object) or has no matching fact.
func (*MEBStore) GetVectors ¶ added in v0.7.0
func (m *MEBStore) GetVectors(ids []uint64) ([]VectorResult, error)
GetVectors performs a batched read of the stored vectors for the given IDs, dequantizing each within a single read transaction. Missing IDs are reported with Found=false.
func (*MEBStore) Health ¶ added in v0.7.0
func (m *MEBStore) Health() StoreHealth
Health returns a snapshot of store health metrics. It is a convenience alias for DebugInfo, suited to monitoring/health endpoints. Safe to call at any time (including after Close); values simply reflect the closed state.
func (*MEBStore) IVFPQIndex ¶
func (st *MEBStore) IVFPQIndex() *vector.IVFPQIndex
func (*MEBStore) LFTJEngine ¶
func (m *MEBStore) LFTJEngine() *query.LFTJEngine
func (*MEBStore) ListPredicates ¶
func (m *MEBStore) ListPredicates() []ast.PredicateSym
func (*MEBStore) MergeBatch ¶
func (m *MEBStore) MergeBatch(other factstore.ReadOnlyFactStore, batchSize int) error
MergeBatch imports facts from another store in batches, avoiding the O(N²) per-fact Exists() check. Existing facts are silently skipped.
func (*MEBStore) NewBatchWriter ¶ added in v0.7.0
func (m *MEBStore) NewBatchWriter() *BatchWriter
NewBatchWriter opens a new bulk writer against the store's default topic. Callers must either Flush or Cancel to release the underlying WriteBatch.
func (*MEBStore) RecalculateStats ¶
func (*MEBStore) RegisterTelemetrySink ¶
func (m *MEBStore) RegisterTelemetrySink(sink TelemetrySink)
func (*MEBStore) RunValueLogGC ¶
func (*MEBStore) ScanContext ¶
func (*MEBStore) ScanInTopic ¶
ScanInTopic scans facts within a specific topic. The TopicID is packed into the ID structure for data locality. This enables scanning only the prefix range belonging to the requested topic.
func (*MEBStore) ScanInTopicContext ¶
func (m *MEBStore) ScanInTopicContext(ctx context.Context, topicID uint32, s, p, o string) iter.Seq2[Fact, error]
ScanInTopicContext scans facts within a specific topic with context.
func (*MEBStore) ScanSubjects ¶
ScanSubjectsByPrefix returns all subjects starting with the given prefix string. Uses SPO index with LSM-tree prefix scan - O(log N + k) where k is number of results. The prefix is matched against the full subject string (e.g., "project/pkg/" matches all subjects under that path like "project/pkg/server/server.go:NewServer"). Returns empty iterator if no matches found (never returns error for "not found"). ScanSubjects returns all subjects in the store by scanning the SPO index. Warning: This performs a full table scan.
func (*MEBStore) ScanSubjectsByPrefix ¶
func (*MEBStore) ScanWithFilters ¶
func (*MEBStore) ScanWithFiltersContext ¶
func (*MEBStore) ScanWithPruning ¶
func (m *MEBStore) ScanWithPruning(ctx context.Context, s, p, o string, entityType uint16, wantPublic bool) iter.Seq2[Fact, error]
ScanWithPruning scans facts with semantic hints pruning. entityType: only yield triples matching this entity type (0 = no pruning). wantPublic: if true, only yield triples with IsPublic flag.
func (*MEBStore) SetCircuitBreakerConfig ¶
func (*MEBStore) SetDefaultEntityType ¶
SetDefaultEntityType sets the default entity type for semantic hints. Use keys.EntityFunc, EntityVar, EntityClass, etc.
func (*MEBStore) SetDefaultFlags ¶
SetDefaultFlags sets the default flags for semantic hints. Use keys.FlagIsPublic, FlagIsDeprecated, FlagIsTest, FlagIsGenerated.
func (*MEBStore) SetRetention ¶
func (*MEBStore) SetTopicID ¶
SetTopicID sets the 24-bit topic ID for symmetric bit-packing. All facts added after this call will use the new topic ID. Supports up to 16M isolated namespaces (topics). Panics if topicID is 0 (reserved as invalid).
func (*MEBStore) TrainIVFPQ ¶
func (*MEBStore) UnregisterTelemetrySink ¶
func (m *MEBStore) UnregisterTelemetrySink(sink TelemetrySink)
func (*MEBStore) Update ¶
Update executes a read-write transaction with automatic commit/rollback. In-memory side effects (counters, mmap caches, dict caches) are applied only after the Badger transaction commits successfully, using accumulated deltas. BadgerDB SyncWrites: true ensures durability for the transaction path. If a post-commit side effect fails the committed transaction is NOT rolled back; the error is returned so callers can detect the inconsistency.
func (*MEBStore) Vectors ¶
func (m *MEBStore) Vectors() *vector.VectorRegistry
type NumericRange ¶
NumericRange represents a closed [Min, Max] numeric range for PredicateRange filters.
type PredicateFilter ¶
type PredicateFilter struct {
Type PredicateFilterType
Value interface{} // string for regex/contains; float64 for gt/lt/gte/lte; NumericRange for range
// contains filtered or unexported fields
}
func MustPredicateFilter ¶
func MustPredicateFilter(filterType PredicateFilterType, value interface{}) *PredicateFilter
MustPredicateFilter creates a PredicateFilter, panicking on invalid input.
func NewPredicateFilter ¶
func NewPredicateFilter(filterType PredicateFilterType, value interface{}) (*PredicateFilter, error)
NewPredicateFilter creates a PredicateFilter, pre-compiling regex patterns.
type PredicateFilterType ¶
type PredicateFilterType string
const ( PredicateRegex PredicateFilterType = "regex" PredicateRange PredicateFilterType = "range" PredicateGT PredicateFilterType = "gt" PredicateLT PredicateFilterType = "lt" PredicateGTE PredicateFilterType = "gte" PredicateLTE PredicateFilterType = "lte" PredicateContains PredicateFilterType = "contains" )
type QueryFilter ¶
type QueryFilter struct {
Predicate string
Object interface{}
}
type Result ¶
type Result struct {
ID uint64 // Internal dictionary ID
Key string // Human-readable key (decoded from dictionary)
Score float32 // Similarity score (0-1, higher is better)
Content string // Document content (empty if not found)
}
Result represents a single neuro-symbolic search result.
type StoreHealth ¶ added in v0.6.0
type StoreHealth struct {
NumFacts uint64 `json:"num_facts"`
NumVectors int64 `json:"num_vectors"`
VectorFullDim int `json:"vector_full_dim"`
VectorCapacity int `json:"vector_capacity"`
WALSizeBytes int64 `json:"wal_size_bytes,omitempty"`
ReadOnly bool `json:"read_only"`
CircuitBreakerState string `json:"circuit_breaker_state"`
CircuitBreakerMetrics circuit.MetricsSnapshot `json:"circuit_breaker_metrics,omitempty"`
LastGCTimeNano int64 `json:"last_gc_time_nano"`
StoreOpen bool `json:"store_open"`
LSMSize int64 `json:"lsm_size_bytes,omitempty"`
ValueLogSize int64 `json:"value_log_size_bytes,omitempty"`
DiskUsage int64 `json:"disk_usage_bytes,omitempty"`
MemoryInUse uint64 `json:"memory_in_use_bytes,omitempty"`
}
StoreHealth provides operational metrics for debugging and monitoring. All values are atomically or lock-protected reads; safe to call concurrently.
type StoreTxn ¶
type StoreTxn struct {
// contains filtered or unexported fields
}
StoreTxn wraps a BadgerDB transaction with store-specific helpers. Created via MEBStore.View() or MEBStore.Update().
func (*StoreTxn) AddFactBatch ¶
AddFactBatch adds multiple facts within the transaction. Uses the store's current topicID. Durability is provided by BadgerDB SyncWrites: true (no WAL needed for txn path).
func (*StoreTxn) AddFactBatchWithTopic ¶
AddFactBatchWithTopic adds multiple facts within the transaction using a specific topicID. Durability is provided by BadgerDB SyncWrites: true (no WAL needed for txn path).
func (*StoreTxn) AddHNSWVector ¶
AddHNSWVector adds a vector to the HNSW index.
func (*StoreTxn) AddIVFVector ¶
AddIVFVector adds a vector to the IVF-PQ index.
func (*StoreTxn) AddVector ¶
AddVector adds a vector within the transaction. The Badger write is done in-txn; the mmap cache update is deferred to post-commit.
func (*StoreTxn) AddVectorWithHash ¶
AddVectorWithHash adds a vector with a semantic hash within the transaction.
func (*StoreTxn) DeleteDocument ¶
DeleteDocument atomically deletes a document (content, vector, facts, dict entry) within the transaction. Uses the store's current topicID. In-memory vector/dict mutations are deferred to post-commit.
func (*StoreTxn) DeleteDocumentWithTopic ¶
DeleteDocumentWithTopic atomically deletes a document using a specific topicID.
func (*StoreTxn) DeleteFactsBySubject ¶
DeleteFactsBySubject deletes all facts for the given subject within the transaction. Uses the store's current topicID.
func (*StoreTxn) DeleteVector ¶
DeleteVector deletes a vector within the transaction. In-memory registry mutation is deferred to post-commit.
func (*StoreTxn) GetContent ¶
GetContent retrieves content by ID within the transaction.
func (*StoreTxn) GetOrCreateID ¶
GetOrCreateID gets or creates a dictionary ID for the given string within the transaction.
func (*StoreTxn) GetString ¶
GetString resolves a dictionary ID to its string within the transaction.
func (*StoreTxn) Scan ¶
Scan iterates over facts matching the given subject, predicate, object. Uses the store's current topicID.
func (*StoreTxn) ScanInTopic ¶
func (t *StoreTxn) ScanInTopic(ctx context.Context, topicID uint32, s, p, o string) iterSeq2FactError
ScanInTopic iterates over facts matching the given subject, predicate, object within the specified topic.
func (*StoreTxn) SearchHNSW ¶
func (t *StoreTxn) SearchHNSW(ctx context.Context, topicID uint32, queryVec []float32, k int) ([]Result, error)
SearchHNSW searches the HNSW index directly (bypassing RBO).
func (*StoreTxn) SearchHybrid ¶
SearchHybrid uses the RBO to select the optimal search strategy.
func (*StoreTxn) SearchHybridWithFilters ¶
func (t *StoreTxn) SearchHybridWithFilters(ctx context.Context, queryVec []float32, k int, filters []FilterOpt) ([]Result, error)
SearchHybridWithFilters is like SearchHybrid but accepts optional FilterOpt filters.
type TelemetryEvent ¶
type TelemetrySink ¶
type TelemetrySink interface {
OnEvent(event TelemetryEvent)
}
type TripleKey ¶ added in v0.7.0
TripleKey identifies a triple for point lookup. Unlike a scan (which matches by prefix/wildcard), every component must be fully bound. The Object may be any value the store can encode (string, bool, int32, float32, or a dictionary-backed scalar).
type TripleResult ¶ added in v0.7.0
TripleResult carries the outcome of a single GetTriples lookup.
type VectorResult ¶ added in v0.7.0
VectorResult carries the outcome of a single GetVectors lookup. The vector is the lossy dequantized reconstruction of the stored block-quantized hybrid data (matches what search operates on), not the original input vector.
type WAL ¶
type WAL struct {
// contains filtered or unexported fields
}
func NewWAL ¶
NewWAL opens or creates a v2 WAL file. Returns an error if an existing WAL file has an unsupported format (e.g. v1) — the caller should delete the file.
func (*WAL) Append ¶
Append writes a single entry to the WAL with CRC32C. Returns nil if no WAL is configured (in-memory mode). Returns ErrWALClosed if the WAL has been closed or is currently being cleared, rather than silently dropping the entry.
func (*WAL) AppendBatch ¶ added in v0.6.0
AppendBatch writes multiple entries in a single write and single Sync call. Returns nil if no WAL is configured (in-memory mode). Returns ErrWALClosed if the WAL has been closed or is currently being cleared.
func (*WAL) Clear ¶
Clear atomically clears the WAL file. Uses atomic rename to avoid the race between ReadAll (os.ReadFile) and Clear (close+delete+reopen).
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
bench
|
|
|
datasets
Package datasets provides embedded test datasets for MEB benchmarks.
|
Package datasets provides embedded test datasets for MEB benchmarks. |
|
cmd
|
|
|
bench
command
Command bench runs the MEB benchmark suite and outputs a JSON report.
|
Command bench runs the MEB benchmark suite and outputs a JSON report. |
|
Package vector — ADC accumulation dispatch.
|
Package vector — ADC accumulation dispatch. |