{"id":38190849,"url":"https://github.com/youscan/go-azuremutex","last_synced_at":"2026-01-17T00:11:19.828Z","repository":{"id":57628891,"uuid":"405749297","full_name":"youscan/go-azuremutex","owner":"youscan","description":"Golang implementation of distributed mutex on Azure lease blobs","archived":false,"fork":false,"pushed_at":"2025-12-23T07:29:53.000Z","size":113,"stargazers_count":16,"open_issues_count":0,"forks_count":2,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-12-24T21:59:27.049Z","etag":null,"topics":["azure","distributed-computing","golang","golang-package","leader-election","mutex"],"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/youscan.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-09-12T20:44:01.000Z","updated_at":"2025-12-23T07:29:54.000Z","dependencies_parsed_at":"2024-01-25T11:09:23.541Z","dependency_job_id":"1e23842c-b927-464f-bee8-f558e09a08d9","html_url":"https://github.com/youscan/go-azuremutex","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/youscan/go-azuremutex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youscan%2Fgo-azuremutex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youscan%2Fgo-azuremutex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youscan%2Fgo-azuremutex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youscan%2Fgo-azuremutex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/youscan","download_url":"https://codeload.github.com/youscan/go-azuremutex/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youscan%2Fgo-azuremutex/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28489891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T23:55:29.509Z","status":"ssl_error","status_checked_at":"2026-01-16T23:55:29.108Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["azure","distributed-computing","golang","golang-package","leader-election","mutex"],"created_at":"2026-01-17T00:11:18.381Z","updated_at":"2026-01-17T00:11:19.807Z","avatar_url":"https://github.com/youscan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Distributed Mutex on Azure Lease Blobs\n\n[![CI](https://github.com/youscan/go-azuremutex/actions/workflows/ci.yaml/badge.svg)](https://github.com/youscan/azure-mutex/actions/workflows/ci.yaml) [![Go Reference](https://pkg.go.dev/badge/github.com/youscan/go-azuremutex.svg)](https://pkg.go.dev/github.com/youscan/go-azuremutex) [![Go Report Card](https://goreportcard.com/badge/github.com/youscan/go-azuremutex)](https://goreportcard.com/report/github.com/youscan/go-azuremutex)\n\nThis package implements distributed lock available for multiple processes. Possible use-cases include exclusive access to shared data, leader election, etc.\n\nAzure Storage supports the feature that guarantees exclusive access to the blobs using basic lease functionality: it's possible to acquire a fixed or infinite duration lease, renew and then release it. Thus it's possible to implement a basic distributed mutex on top of blobs.\n\n## Basic Abstractions\n\n`AzureMutex`\n\nA wrapper on top of Azure blobs API encapsulates API interactions and provides three primary functions: Acquire, Renew, Release.\n\n`Locker`\n\nTop-level abstractions that support background renewal of the acquired lease.\n\n## Locker Usage\n\nInstallation\n\n```\ngo get -u github.com/youscan/go-azuremutex\n```\n\nConfiguration\n\n```\nvar options = azmutex.MutexOptions{\n\tAccountName:   \"mystorageaccount\",\n\tAccountKey:    \"******\",\n\tContainerName: \"locks\",\n}\n```\n\nUse `Locker` with automated renewal\n\n```\nlocker := azmutex.NewLocker(options, \"migration\")\n\nerr = locker.Lock()\n...\n// As soon the lease was acquired we can safely do exclusive job\nRunDatabaseMigration()\n...\nerr = locker.Unlock()\n```\n\nUse `AzureMutex` with lease that will expire in 60 seconds\n\n```\nmutex := azmutex.NewMutex(options)\n\nerr = mutex.Acquire(\"migration\", 60)\n...\n// This code is only safely to run within 60 seconds window\nRunDatabaseMigration()\n...\nerr = mutex.Release(\"migration\")\n```\n\n## Reference\n\n- [Azure / Architecture / Cloud Design Patterns / Leader Election pattern](https://docs.microsoft.com/en-us/azure/architecture/patterns/leader-election)\n- [Microsoft Azure Development Cookbook Second Edition: Leasing a blob and implementing distributed locks](https://www.oreilly.com/library/view/microsoft-azure-development/9781782170327/ch03s16.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouscan%2Fgo-azuremutex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyouscan%2Fgo-azuremutex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyouscan%2Fgo-azuremutex/lists"}