Versions in this module Expand all Collapse all v0 v0.6.0 Feb 15, 2026 v0.5.6 Feb 14, 2026 v0.5.5 Feb 14, 2026 v0.5.4 Feb 14, 2026 Changes in this version + const CurrentFormatVersion + const DefaultPageSize + const InvalidPageID + const MaxPageSize + const MinPageSize + const OverflowThreshold + const PageHeaderSize + const SuperblockMagic + const WALFileHdrSize + const WALMagic + const WALRecHdrSize + const WALVersion + func ComputePageCRC(page []byte) uint32 + func DumpTree(dbPath string, rootPageID PageID, pageSize int) (string, error) + func FreeListCapacity(pageSize int) int + func MarshalHeader(h *PageHeader, buf []byte) + func MarshalRow(row []any, buf []byte) []byte + func MarshalSuperblock(sb *Superblock, pageSize int) []byte + func NewPage(pageSize int, pt PageType, id PageID) []byte + func OverflowCapacity(pageSize int) int + func ParseRowKey(key []byte) int64 + func RowKey(rowID int64) []byte + func SetPageCRC(page []byte) + func UnmarshalRow(data []byte) ([]any, error) + func VerifyDB(dbPath string) ([]string, error) + func VerifyPageCRC(page []byte) error + type BTree struct + func CreateBTree(p *Pager, txID TxID) (*BTree, error) + func NewBTree(p *Pager, root PageID) *BTree + func (bt *BTree) Count() (int, error) + func (bt *BTree) Delete(txID TxID, key []byte) (bool, error) + func (bt *BTree) FreeAllPages() + func (bt *BTree) Get(key []byte) ([]byte, bool, error) + func (bt *BTree) Insert(txID TxID, key, value []byte) error + func (bt *BTree) Root() PageID + func (bt *BTree) ScanRange(startKey, endKey []byte, fn func(key, value []byte) bool) error + type BTreePage struct + func InitBTreePage(buf []byte, id PageID, leaf bool) *BTreePage + func WrapBTreePage(buf []byte) *BTreePage + func (bp *BTreePage) Bytes() []byte + func (bp *BTreePage) DeleteLeafEntry(pos int) error + func (bp *BTreePage) FindChild(key []byte) PageID + func (bp *BTreePage) FindLeafEntry(key []byte) (int, bool) + func (bp *BTreePage) GetAllInternalEntries() []InternalEntry + func (bp *BTreePage) GetAllLeafEntries() []LeafEntry + func (bp *BTreePage) GetInternalEntry(i int) InternalEntry + func (bp *BTreePage) GetLeafEntry(i int) LeafEntry + func (bp *BTreePage) InsertInternalEntry(entry InternalEntry) error + func (bp *BTreePage) InsertLeafEntry(entry LeafEntry) (int, error) + func (bp *BTreePage) IsLeaf() bool + func (bp *BTreePage) KeyCount() int + func (bp *BTreePage) NextLeaf() PageID + func (bp *BTreePage) PageID() PageID + func (bp *BTreePage) PrevLeaf() PageID + func (bp *BTreePage) RightChild() PageID + func (bp *BTreePage) SearchInternal(key []byte) PageID + func (bp *BTreePage) SetNextLeaf(pid PageID) + func (bp *BTreePage) SetPrevLeaf(pid PageID) + func (bp *BTreePage) SetRightChild(pid PageID) + func (bp *BTreePage) UpdateLeafEntry(pos int, entry LeafEntry) error + type BufferPoolConfig struct + MaxPages int + type Catalog struct + func OpenCatalog(p *Pager, txID TxID) (*Catalog, error) + func (c *Catalog) DeleteEntry(txID TxID, tenant, table string) error + func (c *Catalog) GetEntry(tenant, table string) (*CatalogEntry, error) + func (c *Catalog) ListTables(tenant string) ([]string, error) + func (c *Catalog) PutEntry(txID TxID, entry CatalogEntry) error + func (c *Catalog) Root() PageID + type CatalogColumn struct + Constraint int + FKColumn string + FKTable string + Name string + PtrTable string + Type int + type CatalogEntry struct + Columns []CatalogColumn + RootPageID PageID + RowCount int64 + Table string + Tenant string + Version int + type ColumnInfo struct + Constraint int + FKColumn string + FKTable string + Name string + PointerTable string + Type int + type FeatureFlag uint64 + const FeatureCompression + const FeatureEncryption + const FeatureMVCC + const FeaturePartitions + const SupportedFeatures + type FreeListPage struct + func InitFreeListPage(buf []byte, id PageID) *FreeListPage + func WrapFreeListPage(buf []byte) *FreeListPage + func (fl *FreeListPage) AddEntry(pid PageID) bool + func (fl *FreeListPage) AllEntries() []PageID + func (fl *FreeListPage) Bytes() []byte + func (fl *FreeListPage) EntryCount() int + func (fl *FreeListPage) GetEntry(i int) PageID + func (fl *FreeListPage) NextFreeList() PageID + func (fl *FreeListPage) PopEntry() PageID + func (fl *FreeListPage) SetNextFreeList(pid PageID) + type FreeManager struct + func NewFreeManager() *FreeManager + func (fm *FreeManager) AllFree() []PageID + func (fm *FreeManager) Alloc() PageID + func (fm *FreeManager) Count() int + func (fm *FreeManager) FlushToDisk(pageSize int, allocPage func() (PageID, []byte)) (PageID, [][]byte) + func (fm *FreeManager) Free(pid PageID) + func (fm *FreeManager) LoadFromDisk(head PageID, readPage func(PageID) ([]byte, error)) error + type GCResult struct + Errors []string + FreeAfter int + FreeBefore int + ReachablePages int + Reclaimed int + TotalPages int + type InternalEntry struct + ChildID PageID + Key []byte + type LSN uint64 + type LeafEntry struct + Key []byte + Overflow bool + OverflowPageID PageID + TotalSize uint32 + Value []byte + type OverflowPage struct + func InitOverflowPage(buf []byte, id PageID) *OverflowPage + func WrapOverflowPage(buf []byte) *OverflowPage + func (op *OverflowPage) Bytes() []byte + func (op *OverflowPage) Data() []byte + func (op *OverflowPage) DataLen() int + func (op *OverflowPage) NextOverflow() PageID + func (op *OverflowPage) SetData(data []byte) error + func (op *OverflowPage) SetNextOverflow(pid PageID) + type PageBackend struct + func NewPageBackend(cfg PageBackendConfig) (*PageBackend, error) + func (pb *PageBackend) Close() error + func (pb *PageBackend) DBPath() string + func (pb *PageBackend) DeleteTable(tenant, name string) error + func (pb *PageBackend) GC() (*GCResult, error) + func (pb *PageBackend) ListTableNames(tenant string) ([]string, error) + func (pb *PageBackend) LoadTable(tenant, name string) (*TableData, error) + func (pb *PageBackend) Pager() *Pager + func (pb *PageBackend) SaveTable(tenant string, td *TableData) error + func (pb *PageBackend) Stats() PageBackendStats + func (pb *PageBackend) Sync() error + func (pb *PageBackend) TableExists(tenant, name string) bool + type PageBackendConfig struct + MaxCachePages int + PageSize int + Path string + type PageBackendStats struct + CheckpointLSN LSN + DBPath string + FreePages int + LoadCount int64 + NextTxID TxID + PageCount uint64 + PageSize int + SyncCount int64 + WALPath string + type PageBufferPool struct + type PageFrame struct + type PageHeader struct + CRC uint32 + Flags uint8 + ID PageID + LSN LSN + Pad [12]byte + Reserved uint16 + Type PageType + func UnmarshalHeader(buf []byte) PageHeader + type PageID uint32 + type PageInfo struct + CRC uint32 + CRCValid bool + DataLen int + EntryCount int + Flags uint8 + FreeSpace int + ID PageID + IsLeaf bool + KeyCount int + LSN LSN + NextFreeList PageID + NextLeaf PageID + NextOverflow PageID + PrevLeaf PageID + RightChild PageID + SlotCount int + Type PageType + TypeStr string + func InspectPage(dbPath string, pageID PageID, pageSize int) (*PageInfo, error) + type PageType uint8 + const PageTypeBTreeInternal + const PageTypeBTreeLeaf + const PageTypeFreeList + const PageTypeOverflow + const PageTypeSuperblock + func (pt PageType) String() string + type Pager struct + func OpenPager(cfg PagerConfig) (*Pager, error) + func (p *Pager) AbortTx(txID TxID) error + func (p *Pager) AllocPage() (PageID, []byte) + func (p *Pager) BeginTx() (TxID, error) + func (p *Pager) Checkpoint() error + func (p *Pager) Close() error + func (p *Pager) CommitTx(txID TxID) error + func (p *Pager) FreePage(pid PageID) + func (p *Pager) PageSize() int + func (p *Pager) Path() string + func (p *Pager) ReadPage(id PageID) ([]byte, error) + func (p *Pager) Recover() error + func (p *Pager) Superblock() Superblock + func (p *Pager) UnpinPage(id PageID) + func (p *Pager) UpdateSuperblock(fn func(sb *Superblock)) + func (p *Pager) WALPath() string + func (p *Pager) WritePage(txID TxID, id PageID, buf []byte) error + type PagerConfig struct + DBPath string + MaxCachePages int + PageSize int + WALPath string + type SlotEntry struct + Length uint16 + Offset uint16 + type SlottedPage struct + func InitSlottedPage(buf []byte, pt PageType, id PageID) *SlottedPage + func WrapSlottedPage(buf []byte) *SlottedPage + func (sp *SlottedPage) Bytes() []byte + func (sp *SlottedPage) Compact() + func (sp *SlottedPage) DeleteRecord(i int) error + func (sp *SlottedPage) FreeSpace() int + func (sp *SlottedPage) FreeSpaceEnd() int + func (sp *SlottedPage) GetRecord(i int) []byte + func (sp *SlottedPage) GetSlot(i int) SlotEntry + func (sp *SlottedPage) InsertRecord(data []byte) (int, error) + func (sp *SlottedPage) IsDeleted(i int) bool + func (sp *SlottedPage) LiveRecords() int + func (sp *SlottedPage) SlotCount() int + func (sp *SlottedPage) UpdateRecord(i int, data []byte) error + type Superblock struct + CatalogRoot PageID + CheckpointLSN LSN + FeatureFlags FeatureFlag + FormatVersion uint32 + FreeListRoot PageID + NextPageID PageID + NextTxID TxID + PageCount uint64 + PageSize uint32 + func NewSuperblock(pageSize uint32) *Superblock + func UnmarshalSuperblock(buf []byte) (*Superblock, error) + type SuperblockInfo struct + CRCValid bool + CatalogRoot PageID + CheckpointLSN LSN + FeatureFlags uint64 + FormatVersion uint32 + FreeListRoot PageID + NextPageID PageID + NextTxID TxID + PageCount uint64 + PageSize uint32 + func InspectSuperblock(dbPath string) (*SuperblockInfo, error) + type TableData struct + Columns []ColumnInfo + IsTemp bool + Name string + Rows [][]any + Version int + type TxID uint64 + type WALFile struct + func OpenWALFile(path string, pageSize int) (*WALFile, error) + func (wf *WALFile) AppendRecord(rec *WALRecord) (LSN, error) + func (wf *WALFile) Close() error + func (wf *WALFile) NextLSN() LSN + func (wf *WALFile) SetNextLSN(lsn LSN) + func (wf *WALFile) Sync() error + func (wf *WALFile) Truncate() error + type WALInfo struct + Aborted int + Committed int + MaxLSN LSN + MinLSN LSN + PageImages int + PageSize int + Records int + TxCount int + func InspectWAL(walPath string) (*WALInfo, error) + type WALRecord struct + Data []byte + LSN LSN + PageID PageID + TxID TxID + Type WALRecordType + func ReadAllRecords(path string) ([]*WALRecord, error) + type WALRecordType uint8 + const WALRecordAbort + const WALRecordBegin + const WALRecordCheckpoint + const WALRecordCommit + const WALRecordPageImage + func (rt WALRecordType) String() string