{"id":30802172,"url":"https://github.com/clarkmcc/go-evmap","last_synced_at":"2025-09-05T21:48:12.838Z","repository":{"id":57661945,"uuid":"439685539","full_name":"clarkmcc/go-evmap","owner":"clarkmcc","description":"A Go implementation of Rust's evmap which optimizes for high-read, low-write workloads and uses eventual consistency to ensure that readers and writers never block each other.","archived":false,"fork":false,"pushed_at":"2022-08-21T14:58:09.000Z","size":16,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T03:29:42.169Z","etag":null,"topics":["concurrency","golang","hashmap","rust"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clarkmcc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-18T18:19:47.000Z","updated_at":"2023-09-13T08:29:37.000Z","dependencies_parsed_at":"2022-09-12T22:00:29.392Z","dependency_job_id":null,"html_url":"https://github.com/clarkmcc/go-evmap","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/clarkmcc/go-evmap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarkmcc%2Fgo-evmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarkmcc%2Fgo-evmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarkmcc%2Fgo-evmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarkmcc%2Fgo-evmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clarkmcc","download_url":"https://codeload.github.com/clarkmcc/go-evmap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clarkmcc%2Fgo-evmap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273827098,"owners_count":25175235,"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","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["concurrency","golang","hashmap","rust"],"created_at":"2025-09-05T21:48:10.709Z","updated_at":"2025-09-05T21:48:12.821Z","avatar_url":"https://github.com/clarkmcc.png","language":"Go","readme":"# go-evmap\n#### Note: this is not a production-ready data structure by any-means. It is currently a work-in-progress exploration of a left-right-backed concurrent map.\n\nA Go implementation of Rust's [evmap](https://github.com/jonhoo/evmap). This implementation is more of a naive implementation that does not support writer/reader handles and iterators, but this also means that the implementation is extremely simple (\u003c200 lines). It has no direct dependencies.\n\n## Usage\n```go\ncache := eventual.NewMap[string, int]()\nreader := cache.Reader()\n\n// Insert a key\ncache.Insert(\"foo\", 0)\nreader.Has(\"foo\") // false\n\n// Explicitly expose the current state of the map to the reads\ncache.Refresh()\nreader.Has(\"foo\") // true\n```\n\n## Why?\nThis data structure is optimized for high-read, low-write workloads where readers never have to coordinate with writers. This lack of coordination comes at a cost, \"The trade-off exposed by this module is one of eventual consistency: writes are not visible to readers except following explicit synchronization. Specifically, readers only see the operations that preceded the last call to `Refresh` by a writer. This lets writers decide how stale they are willing to let reads get. They can refresh the map after every write to emulate a regular map, or they can refresh only occasionally to reduce the synchronization overhead at the cost of stale reads.\" ([evmap readme](https://github.com/jonhoo/evmap))\n\n## Features\n* Readers never block writers\n* Writers never block readers\n* Reads and writes are completely thread-safe\n* 100% test coverage\n* Utilizes Go 1.18 generics\n\n## Caveats\n* Readers do not observe writes as they occur (eventual consistency)\n* Writers block other writers (writes are guarded by a mutex).\n\n## Help Needed\nI do not have the expertise to benchmark this. I've implemented a crude benchmark in [map_bench_test.go](./map_bench_test.go) but the results are all across the board.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclarkmcc%2Fgo-evmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclarkmcc%2Fgo-evmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclarkmcc%2Fgo-evmap/lists"}