{"id":15567616,"url":"https://github.com/purehyperbole/rad","last_synced_at":"2025-08-23T20:03:46.500Z","repository":{"id":114512998,"uuid":"183259591","full_name":"purehyperbole/rad","owner":"purehyperbole","description":"a lock-free radix tree implementation for golang","archived":false,"fork":false,"pushed_at":"2021-11-03T09:47:58.000Z","size":52,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-24T00:04:27.840Z","etag":null,"topics":["golang","lock-free","radix","tree"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/purehyperbole.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-24T15:44:05.000Z","updated_at":"2024-12-28T15:22:00.000Z","dependencies_parsed_at":"2024-06-21T19:27:06.250Z","dependency_job_id":"953d8081-38b6-4cb8-b533-bd96fa44497c","html_url":"https://github.com/purehyperbole/rad","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purehyperbole%2Frad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purehyperbole%2Frad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purehyperbole%2Frad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purehyperbole%2Frad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purehyperbole","download_url":"https://codeload.github.com/purehyperbole/rad/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250535098,"owners_count":21446508,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","lock-free","radix","tree"],"created_at":"2024-10-02T17:12:02.303Z","updated_at":"2025-04-24T00:04:34.574Z","avatar_url":"https://github.com/purehyperbole.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rad [![GoDoc](https://godoc.org/github.com/purehyperbole/rad?status.svg)](https://godoc.org/github.com/purehyperbole/rad) [![Go Report Card](https://goreportcard.com/badge/github.com/purehyperbole/rad)](https://goreportcard.com/report/github.com/purehyperbole/rad) [![Build Status](https://travis-ci.org/purehyperbole/rad.svg?branch=master)](https://travis-ci.org/purehyperbole/rad)\n\nA concurrent lock free radix tree implementation for go.\n\nRad is threadsafe and can handle concurrent reads/writes from any number of threads.\n\n# Installation\n\nTo start using rad, you can run:\n\n`$ go get github.com/purehyperbole/rad`\n\n# Usage\n\nTo create a new radix tree\n\n```go\npackage main\n\nimport (\n    \"github.com/purehyperbole/rad\"\n)\n\nfunc main() {\n    // create a new radix tree\n    r := rad.New()\n}\n```\n\n`Lookup` can be used to retrieve a stored value\n\n```go\nvalue := r.Lookup([]byte(\"myKey1234\"))\n```\n\n`Insert` allows a value to be stored for a given key.\n\nA successful insert will return true.\n\nIf the operation conflicts with an insert from another thread, it will return false.\n\nValues must implement the `Comparable` interface to facilitate comparing one value to another.\n\nThere are some default implementations for `[]byte` and `string`. Please see the documentation for usage.\n\n```go\nif r.Insert([]byte(\"key\"), \u0026Thing{12345}) {\n    fmt.Println(\"success!\")\n} else {\n    fmt.Println(\"insert failed\")\n}\n```\n\n`MustInsert` can be used if you want to retry the insertion until it is successful.\n```go\nr.MustInsert([]byte(\"key\"), \u0026Thing{12345})\n```\n\n`Swap` can be used to atomically swap a value. It will return false if the swap was unsuccessful.\n```go\nr.Swap([]byte(\"my-key\"), \u0026Thing{\"old-value\"}, \u0026Thing{\"new-value\"})\n```\n\n`Iterate` allows for iterating keys in the tree\n\n```go\n// iterate over all keys\nr.Iterate(nil, func(key []byte, value interface{}) error {\n    ...\n    // if the returned error is not nil, the iterator will stop\n    return nil\n})\n\n// iterate over all subkeys of \"rad\"\nr.Iterate([]byte(\"rad\"), func(key []byte, value interface{}) error {\n    ...\n    return nil\n})\n```\n\n# Features/Wishlist\n\n- [x] Lock free Insert using CAS (compare \u0026 swap)\n- [x] Lookup\n- [x] Basic key iterator\n- [ ] Delete\n\n## Why?\n\nThis project was created to learn about lock free data structures. As such, it probably should not be used for any real work. Use at your own risk!\n\n## Versioning\n\nFor transparency into our release cycle and in striving to maintain backward\ncompatibility, this project is maintained under [the Semantic Versioning guidelines](http://semver.org/).\n\n## Copyright and License\n\nCode and documentation copyright since 2018 purehyperbole.\n\nCode released under\n[the MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurehyperbole%2Frad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurehyperbole%2Frad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurehyperbole%2Frad/lists"}