How hashicorp/go-immutable-radix works
go-immutable-radix is a generic Go library for immutable, sparse radix trees. A client creates a tree, performs lookups or uses a transaction to batch inserts and deletes, then commits to obtain a new tree. Tree nodes provide exact and longest-prefix lookups, minimum/maximum values, and walking; iterators support ordered, reverse, prefix, path, and range-style traversal. The excerpts show the tree/transaction and traversal implementations, but not every public wrapper or how the raw iterator is used internally, so those links are omitted where evidence is unavailable.
Main entry points: node.go Radix Nodes · iradix.go Tree & Transactions · reverse_iter.go Reverse Iterator · iter.go Ordered Iterator
Components 8
Tree API
- Tree & Transactions
iradix.go
Radix Engine
- Radix Nodes
node.go - Edge Helpers
edges.go
Traversal
- Ordered Iterator
iter.go - Reverse Iterator
reverse_iter.go - Path Iterator
path_iter.go - Raw Iterator
raw_iter.go
Other components
- Library Client
Connections 7
- Library Client → Tree & Transactions: creates and updates
README.md - Tree & Transactions → Radix Nodes: looks up keys
iradix.go - Library Client → Radix Nodes: queries root
README.md - Radix Nodes → Ordered Iterator: creates iterator
node.go - Radix Nodes → Reverse Iterator: creates iterator
node.go - Radix Nodes → Path Iterator: creates iterator
node.go - Reverse Iterator → Ordered Iterator: reuses state
reverse_iter.go