{"id":39990643,"url":"https://github.com/g0194776/dlock","last_synced_at":"2026-01-19T00:38:16.225Z","repository":{"id":57708506,"uuid":"163495747","full_name":"g0194776/dlock","owner":"g0194776","description":"ETCD-based distributed lock implementation.","archived":false,"fork":false,"pushed_at":"2019-01-02T06:12:15.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-20T06:29:34.857Z","etag":null,"topics":["distributed-lock","distributed-locking","etcdv3"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/g0194776.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":"2018-12-29T09:05:07.000Z","updated_at":"2024-06-20T06:29:34.857Z","dependencies_parsed_at":"2022-09-14T13:12:11.149Z","dependency_job_id":null,"html_url":"https://github.com/g0194776/dlock","commit_stats":null,"previous_names":["g0194776/distributed-lock"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/g0194776/dlock","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g0194776%2Fdlock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g0194776%2Fdlock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g0194776%2Fdlock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g0194776%2Fdlock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/g0194776","download_url":"https://codeload.github.com/g0194776/dlock/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/g0194776%2Fdlock/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28554717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T23:48:35.235Z","status":"ssl_error","status_checked_at":"2026-01-18T23:47:49.178Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["distributed-lock","distributed-locking","etcdv3"],"created_at":"2026-01-19T00:38:11.465Z","updated_at":"2026-01-19T00:38:16.221Z","avatar_url":"https://github.com/g0194776.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Distributed Lock\n\n## Preface\nAfter considered many of implementations of distributed lock with Golang, I prefered like to write it by myself. \n\nThis is an ETCD-based implementation and used v3 protocol for performance enhancement. Simple \u0026 Easy, enjoy it!\n\n## How to use it?\n\n#### 1. Start an ETCD instance using Docker container\n```shell\ndocker run -d --name etcd-server \\\n--publish 2379:2379 \\\n--publish 2380:2380 \\\n--env ALLOW_NONE_AUTHENTICATION=yes \\\n--env ETCD_ADVERTISE_CLIENT_URLS=http://etcd-server:2379 \\\nbitnami/etcd:latest\n```\n\n#### 2. Code Sample\n```go\ndl, err := dlock.NewDistributedLock(DistributedLockOptions{\n    Key:         \"/KEY-SPEC-100\",\n    ETCDAddress: \"http://127.0.0.1:2379\", //accessible ETCD instance.\n    TTL:         5,\n    //hook function to receive an event while acquiring the lock.\n    HoldingLockFunc: func() {\n        fmt.Println(\"You are master now...!\")\n\n    },\n    //hook function to receive an event while losing the lock.\n    LosingLockFunc: func() {\n        fmt.Println(\"You've lost master role, waiting...\")\n    },\n})\nif err != nil {\n    panic(err)\n}\n\ndl.TryGetLock()\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg0194776%2Fdlock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fg0194776%2Fdlock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fg0194776%2Fdlock/lists"}