Documentation ¶
Overview ¶
Package dltree implements red-black tree for key value pairs with domain label keys.
Index ¶
- type Pair
- type Tree
- func (t *Tree) Delete(key string) (*Tree, bool)
- func (t *Tree) Dot() string
- func (t *Tree) Enumerate() chan Pair
- func (t *Tree) Get(key string) (interface{}, bool)
- func (t *Tree) InplaceInsert(key string, value interface{})
- func (t *Tree) Insert(key string, value interface{}) *Tree
- func (t *Tree) IsEmpty() bool
- func (t *Tree) RawDelete(key string) (*Tree, bool)
- func (t *Tree) RawEnumerate() chan Pair
- func (t *Tree) RawGet(key string) (interface{}, bool)
- func (t *Tree) RawInplaceInsert(key string, value interface{})
- func (t *Tree) RawInsert(key string, value interface{}) *Tree
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pair ¶
type Pair struct { Key string Value interface{} }
Pair is a key-value pair representing tree node content.
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree is a red-black tree for key-value pairs where key is domain label.
func (*Tree) Delete ¶
Delete removes node by given key. It returns copy of tree and true if node has been indeed deleted otherwise copy of tree and false.
func (*Tree) Enumerate ¶
Enumerate returns channel which is populated by key pair values in order of keys.
func (*Tree) InplaceInsert ¶
InplaceInsert inserts or replaces given key-value pair in the tree. The method inserts data directly to current tree so make sure you have exclusive access to it.
func (*Tree) RawDelete ¶
RawDelete removes node by given key. It returns copy of tree and true if node has been indeed deleted otherwise copy of tree and false. Expects bindary domain label on input.
func (*Tree) RawEnumerate ¶
RawEnumerate returns channel which is populated by key pair values in order of keys. Returns binary domain labels.
func (*Tree) RawInplaceInsert ¶
RawInplaceInsert inserts or replaces given key-value pair in the tree. The method inserts data directly to current tree so make sure you have exclusive access to it. Expects bindary domain label on input.