How mxdvf/orange works
Orange is a persistent, copy-on-write B-tree storage engine: callers insert, search, and delete byte keys and values, with writes committed in batches and reads served from the tree. The tree encodes nodes into fixed-size pages; page management provides mapped-file I/O, allocation, and durability, while the master page tracks the root and reusable pages. The README also documents crash-safe fsync, memory mapping, and group commit. Some B-tree and node-manager excerpts are partial, so the graph omits uncertain internal links.
Main entry points: btree.go Persistent B-Tree · engine.go Engine API · btree_util.go Tree Page Helpers · page_manager.go Page Manager
Components 9
API and Commit
- Engine API
engine/engine.go - Batch Commit
engine/engine.go
B-Tree Operations
- Persistent B-Tree
btree/btree.go - Tree Page Helpers
btree/btree_util.go
Page Storage
- Page Manager
pagemanager/page_manager.go - Platform Allocator
pagemanager/page_manager_linux.go - Mapped File
pagemanager/page_manager.go
Node Format
- Node Encoding
nodemanager/node_manager.go
Other components
- Application
Connections 12
- Application → Engine API: calls API
- Engine API → Batch Commit: queues writes
- Engine API → Persistent B-Tree: searches
- Batch Commit → Persistent B-Tree: applies batch
- Batch Commit → Persistent B-Tree: syncs and publishes
- Persistent B-Tree → Tree Page Helpers: loads and saves pages
- Persistent B-Tree → Node Encoding: reads and edits nodes
- Tree Page Helpers → Node Encoding: decodes pages
- Tree Page Helpers → Page Manager: reads and writes
- Page Manager → Platform Allocator: allocates pages
- Page Manager → Mapped File: maps and accesses
- Platform Allocator → Mapped File: extends mapping