-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathart.go
More file actions
47 lines (38 loc) · 912 Bytes
/
Copy pathart.go
File metadata and controls
47 lines (38 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright © 2019, Oleksandr Krykovliuk <k33nice@gmail.com>.
// Use of this source code is governed by the
// MIT license that can be found in the LICENSE file.
package art
// Kind - adaptive radix tree node type.
type Kind uint8
// Types of node.
const (
Leaf Kind = iota
Node4
Node16
Node48
Node256
)
// Key type. Can be any sequence of characters.
type Key = []byte
// Value type.
type Value = interface{}
// Node - delineate node entity.
type Node interface {
Kind() Kind
Key() Key
Value() Value
}
// Callback - callback function that is passed in Each.
type Callback func(node Node)
// Tree - delineate adaptive radix tree entity.
type Tree interface {
Insert(key Key, value Value)
Search(key Key) (value Value)
Delete(key Key) (deleted bool)
Each(cb Callback, options ...int)
Size() int
}
// New - creates a new instace of adaptive radix tree.
func New() Tree {
return newArt()
}