-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathdoc.go
50 lines (50 loc) · 1.36 KB
/
doc.go
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
48
49
50
// Package art implements an Adapative Radix Tree(ART) in pure Go.
// Note that this implementation is not thread-safe but it could be really easy to implement.
//
// The design of ART is based on "The Adaptive Radix Tree: ARTful Indexing for Main-Memory Databases" [1].
//
// Usage:
//
// package main
//
// import (
// "fmt"
//
// art "github.com/plar/go-adaptive-radix-tree/v2"
// )
//
// func main() {
//
// tree := art.New()
//
// tree.Insert(art.Key("Hi, I'm Key"), "Nice to meet you, I'm Value")
// value, found := tree.Search(art.Key("Hi, I'm Key"))
// if found {
// fmt.Printf("Search value=%v\n", value)
// }
//
// tree.ForEach(func(node art.Node) bool {
// fmt.Printf("Callback value=%v\n", node.Value())
// return true
// })
//
// for it := tree.Iterator(); it.HasNext(); {
// value, _ := it.Next()
// fmt.Printf("Iterator value=%v\n", value.Value())
// }
// }
//
// Output:
//
// Search value=Nice to meet you, I'm Value
// Callback value=Nice to meet you, I'm Value
// Iterator value=Nice to meet you, I'm Value
//
// Also the current implementation was inspired by [2] and [3]
//
// [1] http://db.in.tum.de/~leis/papers/ART.pdf (Specification)
//
// [2] https://github.com/armon/libart (C99 implementation)
//
// [3] https://github.com/kellydunn/go-art (other Go implementation)
package art