diff options
Diffstat (limited to 'vendor/github.com/armon/go-radix/README.md')
-rw-r--r-- | vendor/github.com/armon/go-radix/README.md | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/vendor/github.com/armon/go-radix/README.md b/vendor/github.com/armon/go-radix/README.md new file mode 100644 index 0000000..26f42a2 --- /dev/null +++ b/vendor/github.com/armon/go-radix/README.md | |||
@@ -0,0 +1,38 @@ | |||
1 | go-radix [![Build Status](https://travis-ci.org/armon/go-radix.png)](https://travis-ci.org/armon/go-radix) | ||
2 | ========= | ||
3 | |||
4 | Provides the `radix` package that implements a [radix tree](http://en.wikipedia.org/wiki/Radix_tree). | ||
5 | The package only provides a single `Tree` implementation, optimized for sparse nodes. | ||
6 | |||
7 | As a radix tree, it provides the following: | ||
8 | * O(k) operations. In many cases, this can be faster than a hash table since | ||
9 | the hash function is an O(k) operation, and hash tables have very poor cache locality. | ||
10 | * Minimum / Maximum value lookups | ||
11 | * Ordered iteration | ||
12 | |||
13 | For an immutable variant, see [go-immutable-radix](https://github.com/hashicorp/go-immutable-radix). | ||
14 | |||
15 | Documentation | ||
16 | ============= | ||
17 | |||
18 | The full documentation is available on [Godoc](http://godoc.org/github.com/armon/go-radix). | ||
19 | |||
20 | Example | ||
21 | ======= | ||
22 | |||
23 | Below is a simple example of usage | ||
24 | |||
25 | ```go | ||
26 | // Create a tree | ||
27 | r := radix.New() | ||
28 | r.Insert("foo", 1) | ||
29 | r.Insert("bar", 2) | ||
30 | r.Insert("foobar", 2) | ||
31 | |||
32 | // Find the longest prefix match | ||
33 | m, _, _ := r.LongestPrefix("foozip") | ||
34 | if m != "foo" { | ||
35 | panic("should be foo") | ||
36 | } | ||
37 | ``` | ||
38 | |||