SDKs
Go SDK
Zero-allocation lookups, mmap-backed. Safe for concurrent readers.
Install
bash
go get github.com/attos/attos-go@latestOpen a dataset
router.go
package router
import "github.com/attos/attos-go"
var routes = attos.MustOpen("routes.nh")
func Route(host string) (int, bool) {
500">// Returns the backend index for a host in ~20ns.
return routes.Lookup(host)
}Hot reload
go
if err := routes.Reload("routes.v2.nh"); err != nil {
return err
}
500">// Old readers keep the previous mmap until GC.Benchmarks
bash
BenchmarkLookup-16 50000000 19.7 ns/op 0 B/op 0 allocs/op