Documentation
¶
Index ¶
- Constants
- Variables
- func BuildDynamicForest(lengths []byte)
- func Compress(src []byte, dst []byte) (int, error)
- func Decompress(src []byte, dst []byte) (int, error)
- func PerformRecovery(db *DB, walPath string) error
- func Tokenize(text string) []string
- type AndQuery
- type AtomicMetrics
- func (m *AtomicMetrics) Capture() EngineMetricsSnapshot
- func (m *AtomicMetrics) IncrBufferPoolHit()
- func (m *AtomicMetrics) IncrBufferPoolMiss()
- func (m *AtomicMetrics) RecordPageCompactionTime(d time.Duration)
- func (m *AtomicMetrics) RecordWalFlushLatency(d time.Duration)
- func (m *AtomicMetrics) SetActiveTransactions(count int64)
- type AuditInterceptor
- type BM25Scorer
- type BTree
- func (tree *BTree) FindLeaf(key []byte) (*BTreePage, error)
- func (tree *BTree) Insert(key, value []byte) error
- func (tree *BTree) Scan(prefix string) ([][]byte, [][]byte, error)
- func (tree *BTree) SplitInternalNode(node *BTreePage, lockedAncestors []*Page) error
- func (tree *BTree) SplitLeaf(node *BTreePage, lockedAncestors []*Page) error
- type BTreeCursor
- type BTreePage
- func (p *BTreePage) BTreeInit()
- func (p *BTreePage) IsSafeForInsert(requiredBytes uint32) bool
- func (p *BTreePage) NextLeafID() PageID
- func (p *BTreePage) NumCells() uint16
- func (p *BTreePage) PageType() uint16
- func (p *BTreePage) ParentID() PageID
- func (p *BTreePage) RightmostChildID() PageID
- func (p *BTreePage) SetNextLeafID(id PageID)
- func (p *BTreePage) SetNumCells(n uint16)
- func (p *BTreePage) SetPageType(t uint16)
- func (p *BTreePage) SetParentID(id PageID)
- func (p *BTreePage) SetRightmostChildID(id PageID)
- type BatchingWAL
- type BlockDevice
- type BufferPool
- type CheckpointStatement
- type ClusterQuery
- type Codec
- type DB
- func (db *DB) BeginTxn() uint64
- func (db *DB) Close() error
- func (db *DB) CommitTxn(txnID uint64)
- func (db *DB) HSet(pageID PageID, txnID uint64, hashKey, field, value []byte, ttl time.Duration) error
- func (db *DB) NewRangeCursor(pageID PageID, txnID uint64, startKey, endKey []byte) *RangeCursor
- func (db *DB) Read(pageID PageID, readTxnID uint64, key []byte) ([]byte, error)
- func (db *DB) ReadCompressed(pageID PageID, readTxnID uint64, key []byte, codec Codec) ([]byte, error)
- func (db *DB) Scan(pageID PageID, readTxnID uint64, prefix []byte, ...) error
- func (db *DB) ScanCompressed(pageID PageID, readTxnID uint64, prefix []byte, codec Codec, ...) error
- func (db *DB) Write(pageID PageID, txnID uint64, key, value []byte, ttl time.Duration) error
- func (db *DB) WriteCompressed(pageID PageID, txnID uint64, key, value []byte, ttl time.Duration, codec Codec) error
- type DeleteStatement
- type DiskManager
- type EngineMetrics
- type EngineMetricsSnapshot
- type EngineState
- type EvictionPolicy
- type ForestDensityEntry
- type HSetStatement
- type HuffmanIndexEntry
- type InsertStatement
- type IntegratedEngine
- func (ie *IntegratedEngine) AddClusterNode(nodeID, address string)
- func (ie *IntegratedEngine) InsertDocument(pageID PageID, docID string, text string) error
- func (ie *IntegratedEngine) LocalSearch(queryText string, limit int) ([]SearchResult, error)
- func (ie *IntegratedEngine) ScatterGather(ctx context.Context, subjectID []byte, queryText string, limit int) ([]SearchResult, error)
- type InternalAnalyzer
- type JoinResult
- type KVIterator
- type KVStore
- type LRUEvictionPolicy
- type Lexer
- type LockManager
- type LockMode
- type LogSequenceNumber
- type MVCCCacheStore
- type MVCCRecord
- type MemDevice
- type MemIndex
- type MetricsStatement
- type NetworkTransport
- type NotQuery
- type ORM
- type OSFileDevice
- type OrQuery
- type Page
- func (p *Page) ComputeChecksum() uint32
- func (p *Page) GetChecksum() uint32
- func (p *Page) GetLowerBoundary() uint32
- func (p *Page) GetNextPageID() PageID
- func (p *Page) GetPageType() uint32
- func (p *Page) GetSlot(idx uint32) (Slot, error)
- func (p *Page) GetSlotCount() uint32
- func (p *Page) GetUpperBoundary() uint32
- func (p *Page) Init()
- func (p *Page) IsSafeForInsert(requiredBytes uint32) bool
- func (p *Page) SetChecksum(val uint32)
- func (p *Page) SetLowerBoundary(offset uint32)
- func (p *Page) SetNextPageID(id PageID)
- func (p *Page) SetPageType(t uint32)
- func (p *Page) SetSlotCount(count uint32)
- func (p *Page) SetUpperBoundary(offset uint32)
- func (p *Page) WriteSlot(idx uint32, s Slot)
- type PageID
- type Parser
- type ParserUQL
- type Posting
- type PostingsChunk
- type Query
- type RangeCursor
- type RecoverStatement
- type RoaringBitmap
- type RoutingEntry
- type SearchResult
- type SegmentSearcher
- type SelectStatement
- type Slot
- type TermQuery
- type Token
- type TokenType
- type TxnHandle
- type UQLStatement
- type UpdateStatement
Constants ¶
const ( PageSize = 32768 // Expanded to 32 bytes to comfortably seat a 4-byte CRC, 4-byte Type, // 4-byte Slot Count, 4-byte Lower, 4-byte Upper, and an 8-byte NextPageID pointer. PageHeaderSize = 32 RecordHeaderSize = 24 BTreeHeaderSize = 24 )
const ( PageTypeInternal = 1 PageTypeLeaf = 2 PrefixHash = "H:" )
const ( MaxBlockSize = 32700 MagicHeader = 0x5348 LookaheadBits = 8 LookaheadMask = 0xFF LookaheadSize = 256 MaxQueryDepth = 50 )
const ( LogTypeBegin uint8 = iota LogTypeUpdate LogTypeCommit LogTypeAbort LogTypeCLR LogTypeCheckpoint )
const ( IndexPageID PageID = 10 MetadataPageID PageID = 11 PostingsChunkSize = 256 DefaultVirtualNodes = 64 )
Internal Registry Reservations
Variables ¶
var ErrPageFull = errors.New("page requires splitting")
var GlobalCacheStore = &MVCCCacheStore{ recs: make(map[string][]MVCCRecord), activeTx: make(map[uint64]uint64), }
var GlobalEncoderTable [256]HuffmanIndexEntry
var GlobalForestTable [LookaheadSize]ForestDensityEntry
var GlobalOverflowTree [1024]int16
Functions ¶
func BuildDynamicForest ¶ added in v1.0.3
func BuildDynamicForest(lengths []byte)
func PerformRecovery ¶ added in v1.1.0
PerformRecovery executes the complete ARIES three-pass crash recovery suite. This must be called exactly once during the initialization of the DB struct.
Types ¶
type AndQuery ¶
type AndQuery struct{ Left, Right Query }
func (*AndQuery) Execute ¶
func (q *AndQuery) Execute(s *SegmentSearcher) *RoaringBitmap
type AtomicMetrics ¶ added in v1.1.0
type AtomicMetrics struct {
// contains filtered or unexported fields
}
AtomicMetrics implements the EngineMetrics interface using high-performance, lock-free atomic operations suitable for concurrent production workloads.
func NewAtomicMetrics ¶ added in v1.1.0
func NewAtomicMetrics() *AtomicMetrics
NewAtomicMetrics initializes an empty metrics container.
func (*AtomicMetrics) Capture ¶ added in v1.1.0
func (m *AtomicMetrics) Capture() EngineMetricsSnapshot
Capture returns a point-in-time snapshot of the database diagnostics.
func (*AtomicMetrics) IncrBufferPoolHit ¶ added in v1.1.0
func (m *AtomicMetrics) IncrBufferPoolHit()
func (*AtomicMetrics) IncrBufferPoolMiss ¶ added in v1.1.0
func (m *AtomicMetrics) IncrBufferPoolMiss()
func (*AtomicMetrics) RecordPageCompactionTime ¶ added in v1.1.0
func (m *AtomicMetrics) RecordPageCompactionTime(d time.Duration)
func (*AtomicMetrics) RecordWalFlushLatency ¶ added in v1.1.0
func (m *AtomicMetrics) RecordWalFlushLatency(d time.Duration)
func (*AtomicMetrics) SetActiveTransactions ¶ added in v1.1.0
func (m *AtomicMetrics) SetActiveTransactions(count int64)
type AuditInterceptor ¶ added in v1.2.0
type BM25Scorer ¶ added in v1.2.0
type BM25Scorer struct {
// contains filtered or unexported fields
}
func NewBM25Scorer ¶ added in v1.2.0
func NewBM25Scorer() *BM25Scorer
type BTree ¶
type BTree struct {
// contains filtered or unexported fields
}
func NewBTree ¶
func NewBTree(bp *BufferPool, rootID PageID) *BTree
func (*BTree) SplitInternalNode ¶
type BTreeCursor ¶
type BTreeCursor struct {
// contains filtered or unexported fields
}
func NewBTreeCursor ¶
func NewBTreeCursor(tree *BTree) (*BTreeCursor, error)
func (*BTreeCursor) Close ¶
func (c *BTreeCursor) Close()
type BTreePage ¶
type BTreePage struct{ *Page }
func (*BTreePage) IsSafeForInsert ¶
func (*BTreePage) NextLeafID ¶
func (*BTreePage) RightmostChildID ¶
func (*BTreePage) SetNextLeafID ¶
func (*BTreePage) SetNumCells ¶
func (*BTreePage) SetPageType ¶
func (*BTreePage) SetParentID ¶
func (*BTreePage) SetRightmostChildID ¶
type BatchingWAL ¶
type BatchingWAL struct {
// contains filtered or unexported fields
}
func NewBatchingWAL ¶
func NewBatchingWAL(path string) (*BatchingWAL, error)
func (*BatchingWAL) Append ¶
func (w *BatchingWAL) Append(txnID uint64, logType uint8, pageID PageID, key, oldValue, newValue []byte) (LogSequenceNumber, error)
Append puts an operational update update vector into the group commit flusher loop.
func (*BatchingWAL) Checkpoint ¶
func (w *BatchingWAL) Checkpoint() error
func (*BatchingWAL) Close ¶
func (w *BatchingWAL) Close() error
type BlockDevice ¶ added in v1.1.0
type BlockDevice interface {
ReadAt(p []byte, off int64) (n int, err error)
WriteAt(p []byte, off int64) (n int, err error)
Sync() error
Stat() (os.FileInfo, error)
Close() error
}
BlockDevice abstracts raw, random-access I/O operations away from the OS file system. This allows the buffer pool to write to local files, memory maps, or in-memory test arrays.
type BufferPool ¶
type BufferPool struct {
// contains filtered or unexported fields
}
func NewBufferPool ¶
func NewBufferPool(disk *DiskManager, poolSize int, evictor EvictionPolicy, metrics EngineMetrics) *BufferPool
func (*BufferPool) FlushAll ¶
func (bp *BufferPool) FlushAll() error
func (*BufferPool) NewPage ¶
func (bp *BufferPool) NewPage() (*Page, error)
func (*BufferPool) UnpinPage ¶
func (bp *BufferPool) UnpinPage(id PageID, isDirty bool)
type CheckpointStatement ¶ added in v1.1.0
type CheckpointStatement struct{}
func (*CheckpointStatement) Execute ¶ added in v1.1.0
func (stmt *CheckpointStatement) Execute(db *DB, _ *MemIndex, _ *SegmentSearcher, _ LockManager, _ Codec, _ string) ([][]byte, error)
type ClusterQuery ¶ added in v1.2.0
type Codec ¶ added in v1.1.0
type Codec interface {
// ID returns a unique identification byte stored as a structural prefix flag.
ID() uint8
// Encode compresses raw payload slices into compressed bytes.
Encode(src []byte) ([]byte, error)
// Decode decompresses compressed payloads back into their original layout.
Decode(src []byte) ([]byte, error)
}
Codec standardizes block and record compression layers. Different namespaces can wrap different codec implementations depending on the performance/ratio tradeoff required.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func NewDB ¶
func NewDB(bp *BufferPool, wal *BatchingWAL, metrics EngineMetrics) *DB
func (*DB) NewRangeCursor ¶ added in v1.2.0
func (db *DB) NewRangeCursor(pageID PageID, txnID uint64, startKey, endKey []byte) *RangeCursor
NewRangeCursor initializes a bounded iteration scanner over a specific page matrix
func (*DB) ReadCompressed ¶
func (*DB) ScanCompressed ¶
type DeleteStatement ¶ added in v1.1.0
type DeleteStatement struct {
Filter Query
}
func (*DeleteStatement) Execute ¶ added in v1.1.0
func (stmt *DeleteStatement) Execute(db *DB, _ *MemIndex, s *SegmentSearcher, lockMgr LockManager, _ Codec, _ string) ([][]byte, error)
type DiskManager ¶
type DiskManager struct {
// contains filtered or unexported fields
}
func NewDiskManager ¶
func NewDiskManager(device BlockDevice) *DiskManager
type EngineMetrics ¶ added in v1.1.0
type EngineMetrics interface {
IncrBufferPoolHit()
IncrBufferPoolMiss()
RecordWalFlushLatency(d time.Duration)
RecordPageCompactionTime(d time.Duration)
SetActiveTransactions(count int64)
}
EngineMetrics handles zero-allocation event tracking across internal data paths. Injecting this interface gives you production visibility into concurrent components.
type EngineMetricsSnapshot ¶ added in v1.1.0
type EngineMetricsSnapshot struct {
BufferPoolHits uint64
BufferPoolMisses uint64
BufferPoolHitRatio float64
AvgWalFlushLatency time.Duration
AvgCompactionLatency time.Duration
ActiveTransactions int64
}
Snapshot represents a static copy of system vital signs captured at a specific point in time.
type EngineState ¶ added in v1.2.0
type EvictionPolicy ¶ added in v1.1.0
type EvictionPolicy interface {
// RecordAccess updates the internal tracking metadata whenever a page is touched.
RecordAccess(id PageID)
// Evict selects the next page candidate for recycling based on the underlying strategy.
Evict() (PageID, bool)
// Remove explicitly deletes a page from the tracking history (e.g., on page drops).
Remove(id PageID)
}
EvictionPolicy manages the page cache access history and decides which unpinned frames can be safely recycled when the buffer pool is exhausted.
type ForestDensityEntry ¶
type ForestDensityEntry uint16
func NewForestEntry ¶
func NewForestEntry(literal byte, consumedBits byte) ForestDensityEntry
func (ForestDensityEntry) Consumed ¶
func (f ForestDensityEntry) Consumed() byte
func (ForestDensityEntry) Literal ¶
func (f ForestDensityEntry) Literal() byte
type HSetStatement ¶ added in v1.1.0
func (*HSetStatement) Execute ¶ added in v1.1.0
func (stmt *HSetStatement) Execute(db *DB, _ *MemIndex, _ *SegmentSearcher, lockMgr LockManager, _ Codec, _ string) ([][]byte, error)
type HuffmanIndexEntry ¶
type HuffmanIndexEntry uint64
func NewHuffmanEntry ¶
func NewHuffmanEntry(code uint64, length byte) HuffmanIndexEntry
func (HuffmanIndexEntry) Code ¶
func (e HuffmanIndexEntry) Code() uint64
func (HuffmanIndexEntry) Length ¶
func (e HuffmanIndexEntry) Length() byte
type InsertStatement ¶ added in v1.1.0
func (*InsertStatement) Execute ¶ added in v1.1.0
func (stmt *InsertStatement) Execute(db *DB, index *MemIndex, _ *SegmentSearcher, lockMgr LockManager, codec Codec, _ string) ([][]byte, error)
type IntegratedEngine ¶ added in v1.2.0
type IntegratedEngine struct {
DB *DB
Transport NetworkTransport
Interceptor AuditInterceptor
Analyzer *InternalAnalyzer
Scorer *BM25Scorer
TotalDocs int
AvgDocLen float64
// contains filtered or unexported fields
}
func NewIntegratedEngine ¶ added in v1.2.0
func NewIntegratedEngine(db *DB, transport NetworkTransport, interceptor AuditInterceptor) (*IntegratedEngine, error)
func (*IntegratedEngine) AddClusterNode ¶ added in v1.2.0
func (ie *IntegratedEngine) AddClusterNode(nodeID, address string)
func (*IntegratedEngine) InsertDocument ¶ added in v1.2.0
func (ie *IntegratedEngine) InsertDocument(pageID PageID, docID string, text string) error
InsertDocument runs a single-pass transaction, writing data blocks and updating index chunks simultaneously
func (*IntegratedEngine) LocalSearch ¶ added in v1.2.0
func (ie *IntegratedEngine) LocalSearch(queryText string, limit int) ([]SearchResult, error)
func (*IntegratedEngine) ScatterGather ¶ added in v1.2.0
func (ie *IntegratedEngine) ScatterGather(ctx context.Context, subjectID []byte, queryText string, limit int) ([]SearchResult, error)
type InternalAnalyzer ¶ added in v1.2.0
type InternalAnalyzer struct {
// contains filtered or unexported fields
}
func NewInternalAnalyzer ¶ added in v1.2.0
func NewInternalAnalyzer() *InternalAnalyzer
func (*InternalAnalyzer) Tokenize ¶ added in v1.2.0
func (a *InternalAnalyzer) Tokenize(text string) []string
type JoinResult ¶
func SortMergeJoin ¶
func SortMergeJoin(leftTree, rightTree *BTree) ([]JoinResult, error)
type KVIterator ¶ added in v1.1.0
KVIterator provides cursor-based access across ordered structural keys.
type KVStore ¶ added in v1.1.0
type KVStore interface {
Begin() TxnHandle
Get(txn TxnHandle, key []byte) ([]byte, error)
Put(txn TxnHandle, key []byte, value []byte, ttl time.Duration) error
Delete(txn TxnHandle, key []byte) error
NewIterator(txn TxnHandle, prefix []byte) KVIterator
}
KVStore abstracts your storage engine data operations. This allows full-text search indices or execution parsers to sit on top of any backend engine configuration.
type LRUEvictionPolicy ¶ added in v1.1.0
type LRUEvictionPolicy struct {
// contains filtered or unexported fields
}
LRUEvictionPolicy implements the EvictionPolicy interface using a standard Least Recently Used (LRU) algorithm cache layout.
func NewLRUEvictionPolicy ¶ added in v1.1.0
func NewLRUEvictionPolicy() *LRUEvictionPolicy
NewLRUEvictionPolicy initializes an empty LRU policy tracking space.
func (*LRUEvictionPolicy) Evict ¶ added in v1.1.0
func (p *LRUEvictionPolicy) Evict() (PageID, bool)
Evict identifies and extracts the oldest unpinned page from the back of the tracking history list to be recycled by the buffer pool.
func (*LRUEvictionPolicy) RecordAccess ¶ added in v1.1.0
func (p *LRUEvictionPolicy) RecordAccess(id PageID)
RecordAccess promotes a page to the front of the tracking list, marking it as the most recently used element.
func (*LRUEvictionPolicy) Remove ¶ added in v1.1.0
func (p *LRUEvictionPolicy) Remove(id PageID)
Remove explicitly extracts a page identifier from the eviction history list. This is critical when files are truncated, tables dropped, or pages forced out.
type LockManager ¶ added in v1.1.0
type LockManager interface {
// Acquire requests an isolation token for a specific transaction handle.
// It blocks until the lock mode is granted or a deadlock detection timeout fires.
Acquire(txnID uint64, key string, mode LockMode) error
// Release explicitly drops an active lock held by a completed transaction.
Release(txnID uint64, key string) error
// ReleaseAll handles bulk transaction unlocks during a Commit or Abort phase (Strict 2PL).
ReleaseAll(txnID uint64) error
}
LockManager enforces concurrency boundaries across logical keys. Implementing this contract protects the engine from race conditions and write skew.
type LockMode ¶ added in v1.1.0
type LockMode uint8
LockMode defines the access privilege requested by a concurrent transaction.
const ( LockExclusive // Exclusive (X) Lock for Write isolation )
type LogSequenceNumber ¶ added in v1.1.0
type LogSequenceNumber uint64
type MVCCCacheStore ¶ added in v1.1.0
type MVCCCacheStore struct {
// contains filtered or unexported fields
}
func (*MVCCCacheStore) BeginOCC ¶ added in v1.1.0
func (c *MVCCCacheStore) BeginOCC() uint64
func (*MVCCCacheStore) Read ¶ added in v1.1.0
func (c *MVCCCacheStore) Read(txID uint64, key string) ([]byte, error)
func (*MVCCCacheStore) ValidateAndCommit ¶ added in v1.1.0
type MVCCRecord ¶ added in v1.1.0
type MemDevice ¶ added in v1.1.0
type MemDevice struct {
// contains filtered or unexported fields
}
MemDevice implements a fully concurrent virtual BlockDevice in memory.
func NewMemDevice ¶ added in v1.1.0
func NewMemDevice() *MemDevice
NewMemDevice initializes an empty, virtualized block storage device.
type MemIndex ¶
type MemIndex struct {
// contains filtered or unexported fields
}
func NewMemIndex ¶
func NewMemIndex() *MemIndex
func (*MemIndex) Add ¶
Add splits inbound text fields and appends unique Document IDs to the postings list.
func (*MemIndex) WriteSegment ¶
WriteSegment serializes the postings map into a performance-sorted binary disk segment.
type MetricsStatement ¶ added in v1.1.0
type MetricsStatement struct{}
func (*MetricsStatement) Execute ¶ added in v1.1.0
func (stmt *MetricsStatement) Execute(db *DB, _ *MemIndex, _ *SegmentSearcher, _ LockManager, _ Codec, _ string) ([][]byte, error)
type NetworkTransport ¶ added in v1.2.0
type NotQuery ¶
type NotQuery struct{ Left, Right Query }
func (*NotQuery) Execute ¶
func (q *NotQuery) Execute(s *SegmentSearcher) *RoaringBitmap
type ORM ¶ added in v1.1.0
type ORM struct {
// contains filtered or unexported fields
}
ORM provides a type-safe data mapping layer on top of ultimate_db.
func NewORM ¶ added in v1.1.0
func NewORM(db *DB, index *MemIndex, searcher *SegmentSearcher, walPath string) *ORM
NewORM instantiates a clean object mapping wrapper.
func (*ORM) Delete ¶ added in v1.1.0
Delete writes an immediate tombstong vector expiration marker across targeted keys.
func (*ORM) Find ¶ added in v1.1.0
Find performs an ID-bound direct lookup, mapping raw bytes back to structured runtime objects.
type OSFileDevice ¶ added in v1.1.0
type OSFileDevice struct {
// contains filtered or unexported fields
}
OSFileDevice implements BlockDevice using actual operating system files.
func NewOSFileDevice ¶ added in v1.1.0
func NewOSFileDevice(path string) (*OSFileDevice, error)
NewOSFileDevice initializes a file-backed physical block device.
func (*OSFileDevice) Close ¶ added in v1.1.0
func (d *OSFileDevice) Close() error
func (*OSFileDevice) ReadAt ¶ added in v1.1.0
func (d *OSFileDevice) ReadAt(p []byte, off int64) (int, error)
func (*OSFileDevice) Sync ¶ added in v1.1.0
func (d *OSFileDevice) Sync() error
type OrQuery ¶
type OrQuery struct{ Left, Right Query }
func (*OrQuery) Execute ¶
func (q *OrQuery) Execute(s *SegmentSearcher) *RoaringBitmap
type Page ¶
type Page struct {
ID PageID
Data [PageSize]byte
PinCount atomic.Int32
IsDirty bool
Latch sync.RWMutex
MemVersion uint64 // Used for Optimistic Concurrency Control (OCC) validation
}
Page represents a production-hardened 32KB slotted data block frame.
The 32-byte header layout structure on disk is mapped as follows: [0:4] CRC32 Checksum (Validates whole-page byte integrity) [4:8] Page Type Flag (Leaf vs. Internal Node layout) [8:12] Slot Count (Number of tracking elements in forwarding array) [12:16] Lower Free Space Boundary (Offset where slots directory ends; grows forward) [16:20] Upper Free Space Boundary (Offset where record payloads begin; grows backward) [24:32] Next Leaf Page ID (8-byte sequence pointer for B+ Tree leaf chain indexing)
func (*Page) ComputeChecksum ¶ added in v1.1.0
ComputeChecksum calculates the IEEE CRC32 across payload data bytes (skipping index 0:4).
func (*Page) GetChecksum ¶ added in v1.1.0
func (*Page) GetLowerBoundary ¶ added in v1.1.0
func (*Page) GetNextPageID ¶ added in v1.1.0
func (*Page) GetPageType ¶ added in v1.1.0
func (*Page) GetSlotCount ¶ added in v1.1.0
func (*Page) GetUpperBoundary ¶ added in v1.1.0
func (*Page) Init ¶
func (p *Page) Init()
Init configures an empty, completely zeroed slotted page layout.
func (*Page) IsSafeForInsert ¶ added in v1.1.0
IsSafeForInsert verifies if fragmented free space remains to comfortably host structural expansion.
func (*Page) SetChecksum ¶ added in v1.1.0
func (*Page) SetLowerBoundary ¶ added in v1.1.0
func (*Page) SetNextPageID ¶ added in v1.1.0
func (*Page) SetPageType ¶ added in v1.1.0
func (*Page) SetSlotCount ¶ added in v1.1.0
func (*Page) SetUpperBoundary ¶ added in v1.1.0
type ParserUQL ¶ added in v1.1.0
type ParserUQL struct {
// contains filtered or unexported fields
}
func NewParserUQL ¶ added in v1.1.0
type PostingsChunk ¶ added in v1.2.0
type RangeCursor ¶ added in v1.2.0
type RangeCursor struct {
// contains filtered or unexported fields
}
RangeCursor handles safe, page-crossing sequential iteration tracking
type RecoverStatement ¶ added in v1.1.0
type RecoverStatement struct{}
func (*RecoverStatement) Execute ¶ added in v1.1.0
func (stmt *RecoverStatement) Execute(db *DB, _ *MemIndex, _ *SegmentSearcher, _ LockManager, _ Codec, walPath string) ([][]byte, error)
type RoaringBitmap ¶ added in v1.1.0
func NewRoaringBitmap ¶ added in v1.1.0
func NewRoaringBitmap() *RoaringBitmap
func RoaringDifference ¶ added in v1.1.0
func RoaringDifference(r1, r2 *RoaringBitmap) *RoaringBitmap
func RoaringIntersect ¶ added in v1.1.0
func RoaringIntersect(r1, r2 *RoaringBitmap) *RoaringBitmap
func RoaringUnion ¶ added in v1.1.0
func RoaringUnion(r1, r2 *RoaringBitmap) *RoaringBitmap
func (*RoaringBitmap) Add ¶ added in v1.1.0
func (r *RoaringBitmap) Add(val uint64)
func (*RoaringBitmap) Deserialize ¶ added in v1.1.0
func (r *RoaringBitmap) Deserialize(data []byte) error
func (*RoaringBitmap) Len ¶ added in v1.1.0
func (r *RoaringBitmap) Len() int
Add this so you can call len(res) in your tests
func (*RoaringBitmap) Serialize ¶ added in v1.1.0
func (r *RoaringBitmap) Serialize() []byte
func (*RoaringBitmap) ToArray ¶ added in v1.1.0
func (r *RoaringBitmap) ToArray() []uint64
type RoutingEntry ¶ added in v1.2.0
type SearchResult ¶ added in v1.2.0
type SegmentSearcher ¶
type SegmentSearcher struct {
Data []byte
// contains filtered or unexported fields
}
func (*SegmentSearcher) FetchPostings ¶
func (s *SegmentSearcher) FetchPostings(target string) []uint64
FetchPostings extracts a raw list of sorted Document IDs matching a targeted vocabulary term string.
func (*SegmentSearcher) Search ¶
func (s *SegmentSearcher) Search(queryString string) (*RoaringBitmap, error)
Search coordinates query resolution by running the AST execution logic directly.
type SelectStatement ¶ added in v1.1.0
type SelectStatement struct {
Filter Query
Limit int
IsCompressed bool
JoinTable string
JoinOnLeft string
JoinOnRight string
}
func (*SelectStatement) Execute ¶ added in v1.1.0
func (stmt *SelectStatement) Execute(db *DB, _ *MemIndex, s *SegmentSearcher, lockMgr LockManager, codec Codec, _ string) ([][]byte, error)
type Slot ¶ added in v1.1.0
Slot represents a directory entry mapping inside the forwarding array. Each slot consumes exactly 4 bytes: [0:2] Payload Offset, [2:4] Payload Length.
type TermQuery ¶
type TermQuery struct{ Term string }
func (*TermQuery) Execute ¶
func (q *TermQuery) Execute(s *SegmentSearcher) *RoaringBitmap
type TokenType ¶ added in v1.1.0
type TokenType int
const ( TokenIllegal TokenType = iota TokenEOF TokenIdent TokenString TokenNumber // Data Keywords (CRUD) TokenSelect TokenInsert TokenInto TokenValues TokenUpdate TokenSet TokenDelete TokenFrom TokenWhere TokenJoin TokenOn TokenAnd TokenOr TokenNot TokenLimit // Engine Feature Keywords TokenHSet TokenCompressed TokenRecover TokenCheckpoint TokenShow TokenMetrics // Syntax Operators TokenLParen TokenRParen TokenAsterisk TokenComma TokenEqual TokenColon )
func LookupIdent ¶ added in v1.1.0
type TxnHandle ¶ added in v1.1.0
TxnHandle represents a logical snapshot state across isolated operations. Updated to expose its ID to lower-level subsystems like the lock manager and recovery loops.
type UQLStatement ¶ added in v1.1.0
type UQLStatement interface {
Execute(db *DB, index *MemIndex, s *SegmentSearcher, lockMgr LockManager, codec Codec, walPath string) ([][]byte, error)
}
func ParseUQL ¶ added in v1.1.0
func ParseUQL(input string) (UQLStatement, error)
type UpdateStatement ¶ added in v1.1.0
func (*UpdateStatement) Execute ¶ added in v1.1.0
func (stmt *UpdateStatement) Execute(db *DB, index *MemIndex, s *SegmentSearcher, lockMgr LockManager, _ Codec, _ string) ([][]byte, error)