Documentation ¶
Overview ¶
Package dtrie provides an implementation of the dtrie data structure, which is a persistent hash trie that dynamically expands or shrinks to provide efficient memory allocation. This data structure is based on the papers Ideal Hash Trees by Phil Bagwell and Optimizing Hash-Array Mapped Tries for Fast and Lean Immutable JVM Collections by Michael J. Steindorfer and Jurgen J. Vinju
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dtrie ¶
type Dtrie struct {
// contains filtered or unexported fields
}
Dtrie is a persistent hash trie that dynamically expands or shrinks to provide efficient memory allocation.
func New ¶
New creates an empty DTrie with the given hashing function. If nil is passed in, the default hashing function will be used.
func (*Dtrie) Get ¶
Get returns the Entry for the associated key or returns nil if the key does not exist.
func (*Dtrie) Insert ¶
Insert adds an entry to the Dtrie, replacing the existing value if the key already exists and returns the resulting Dtrie.
func (*Dtrie) Iterator ¶
Iterator returns a read-only channel of Entries from the Dtrie. If a stop channel is provided, closing it will terminate and close the iterator channel. Note that if a cancel channel is not used and not every entry is read from the iterator, a goroutine will leak.