{"id":47313274,"url":"https://github.com/ronin13/goimutmap","last_synced_at":"2026-03-17T12:56:25.585Z","repository":{"id":52451710,"uuid":"81756191","full_name":"ronin13/goimutmap","owner":"ronin13","description":"An immutable lockless Golang map","archived":false,"fork":false,"pushed_at":"2021-04-28T22:13:35.000Z","size":27,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-07-27T16:35:30.652Z","etag":null,"topics":["golang-library","golang-map","immutable","lockless","map"],"latest_commit_sha":null,"homepage":null,"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/ronin13.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}},"created_at":"2017-02-12T20:50:39.000Z","updated_at":"2020-02-12T21:57:01.000Z","dependencies_parsed_at":"2022-08-25T06:01:00.906Z","dependency_job_id":null,"html_url":"https://github.com/ronin13/goimutmap","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/ronin13/goimutmap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronin13%2Fgoimutmap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronin13%2Fgoimutmap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronin13%2Fgoimutmap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronin13%2Fgoimutmap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ronin13","download_url":"https://codeload.github.com/ronin13/goimutmap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ronin13%2Fgoimutmap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30624038,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-17T11:26:08.186Z","status":"ssl_error","status_checked_at":"2026-03-17T11:24:37.311Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["golang-library","golang-map","immutable","lockless","map"],"created_at":"2026-03-17T12:56:22.717Z","updated_at":"2026-03-17T12:56:25.574Z","avatar_url":"https://github.com/ronin13.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Sourcegraph](https://sourcegraph.com/github.com/ronin13/goimutmap/-/badge.svg)](https://sourcegraph.com/github.com/ronin13/goimutmap?badge)\n[![Go Report Card](https://goreportcard.com/badge/github.com/ronin13/goimutmap)](https://goreportcard.com/report/github.com/ronin13/goimutmap)\n[![Build Status](https://travis-ci.org/ronin13/goimutmap.svg?branch=master)](https://travis-ci.org/ronin13/goimutmap)\n\n[![license](http://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/ronin13/goimutmap/master/LICENSE)\n[![GoDoc](https://godoc.org/github.com/ronin13/goimutmap?status.svg)](https://godoc.org/github.com/ronin13/goimutmap)\n\n\n# goimutmap\n\n## Introduction\n\nThis library provides:\n\n1) A lockless Golang map implementing the Context interface.  (ContextMapper)\n\n2) An immutable multi-versioned map built on top of the lockless map, similarly implementing the Context interface.  (ImmutMapper)\n\n### Supports: (with similar semantics as that of golang map)\n\na) Add\n\nb) Exists\n\nc) Delete\n\nd) Iterate\n\n### ContextMapper\n\n```\ntype IterMap struct {\n\tkey, value interface{}\n}\n\ntype ContextMapper interface {\n\tExists(interface{}) (interface{}, bool)\n\tAdd(interface{}, interface{}) interface{}\n\tDelete(interface{})\n\tIterate() \u003c-chan IterMap\n}\n```\n\nAs can be seen from above, it implements an interface similar to that of regular map.\n\n### ImmutMapper\n\n```\ntype IntfMap map[interface{}]interface{}\n\ntype ImutMapper interface {\n\tExists(interface{}) (interface{}, bool, IntfMap)\n\tAdd(interface{}, interface{}) IntfMap\n\tDelete(interface{})\n}\n```\n\nImmutMapper implements similar interface, except it returns a 3rd value \nwhich is a `snapshot` of the map into which the operation was done.\n\nBoth ContextMapper and ImmutMapper  encapsulate context.Context:\n\n```\ntype baseMap struct {\n\tcontext.Context\n\t// Other internal fields\n}\n\n```\n\nand provide constructors such as:\n\n```\nNewcontextMapper(ctx context.Context) (ContextMapper, context.CancelFunc)\n```\n\nand \n\n```\nNewImutMapper(ctx context.Context) (ImutMapper, context.CancelFunc)\n```\n\nand finally,\n\n```\ntype ContextImutMapper interface {\n\tExists(interface{}) (interface{}, bool, ContextMapper)\n\tAdd(interface{}, interface{}) ContextMapper\n}\n```\n\nwhich combines both ContextMapper and ImmutMapper.\n\n\n\n#### Note\nThe key and values inserted can by of any type and heterogenous.\n\nPlease refer to [godoc](https://godoc.org/github.com/ronin13/goimutmap) for more details.\n\n## Used by\n* http://github.com/ronin13/dotler : Multiple crawler goroutines use ContextMapper to avoid duplicate crawling and for in-memory graph. \n\n## Examples:\n* Usage: https://github.com/ronin13/dotler/blob/master/wire/nodemap.go#L11\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronin13%2Fgoimutmap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fronin13%2Fgoimutmap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronin13%2Fgoimutmap/lists"}