Ada>> art>> 返回
项目作者: purehyperbole

项目描述 :
an Adaptive Radix Tree implementation in go
高级语言: Go
项目地址: git://github.com/purehyperbole/art.git
创建时间: 2019-10-04T19:30:44Z
项目社区:https://github.com/purehyperbole/art

开源协议:MIT License

下载


Art GoDoc Go Report Card Build Status

A thread safe Adaptive Radix Tree implementation in go

Installation

To start using art, you can run:

$ go get github.com/purehyperbole/art

Usage

To create a new radix tree

  1. package main
  2. import (
  3. "github.com/purehyperbole/art"
  4. )
  5. func main() {
  6. // create a new art tree
  7. r := art.New()
  8. }

Lookup can be used to retrieve a stored value

  1. value := r.Lookup([]byte("myKey1234"))

Insert allows a value to be stored for a given key.

  1. r.Insert([]byte("key"), &Thing{12345})

Iterate allows for iterating keys in the tree

  1. // iterate over all keys
  2. r.Iterate(nil, func(key []byte, value interface{}) {
  3. ...
  4. })
  5. // iterate over all subkeys of "art"
  6. r.Iterate([]byte("art"), func(key []byte, value interface{}) {
  7. ...
  8. })

Why?

This project was created to explore the performance tradeoffs of a more memory efficient radix tree with my other lock free implementation (github.com/purehyperbole/rad).

Versioning

For transparency into our release cycle and in striving to maintain backward
compatibility, this project is maintained under the Semantic Versioning guidelines.

Code and documentation copyright since 2019 purehyperbole.

Code released under
the MIT License.