{"id":15674544,"url":"https://github.com/sethvargo/go-gcslock","last_synced_at":"2025-05-06T23:21:26.245Z","repository":{"id":143198724,"uuid":"614570515","full_name":"sethvargo/go-gcslock","owner":"sethvargo","description":"A Go library for acquiring a forward-looking lock in Google Cloud Storage.","archived":false,"fork":false,"pushed_at":"2025-03-13T00:36:23.000Z","size":159,"stargazers_count":14,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T03:51:41.600Z","etag":null,"topics":["google-cloud","google-cloud-storage"],"latest_commit_sha":null,"homepage":"","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/sethvargo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","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":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-15T21:29:16.000Z","updated_at":"2024-12-12T15:46:21.000Z","dependencies_parsed_at":"2023-05-23T19:00:32.975Z","dependency_job_id":"2639f479-9c1f-4cf9-996a-567380dc1e95","html_url":"https://github.com/sethvargo/go-gcslock","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethvargo%2Fgo-gcslock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethvargo%2Fgo-gcslock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethvargo%2Fgo-gcslock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethvargo%2Fgo-gcslock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sethvargo","download_url":"https://codeload.github.com/sethvargo/go-gcslock/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252783887,"owners_count":21803572,"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":["google-cloud","google-cloud-storage"],"created_at":"2024-10-03T15:46:33.333Z","updated_at":"2025-05-06T23:21:26.229Z","avatar_url":"https://github.com/sethvargo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc](https://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godoc]\n\n# go-gcslock\n\nGCS Lock creates a forward-looking lock using Google Cloud Storage. The lock is\nforward-looking because it is not actually \"held\" like a mutex. This is useful\nin situations where you want something to occur at most once over a duration,\nbut multiple independent processes could trigger the event.\n\n\"Identity\" is tied to the object itself; different locks should use different\nobject names.\n\n\n## Usage\n\n```go\nlock, err := gcslock.New(ctx, \"my-bucket\", \"my-object\")\nif err != nil {\n  panic(err) // TODO: handle error\n}\ndefer lock.Close(ctx)\n\n// Acquire the lock for 30 minutes. Upon successful return from this method,\n// the lock is held.\nif err := lock.Acquire(ctx, 30*time.Minute); err != nil {\n  var lockErr *ErrLockHeld\n  if errors.As(err, \u0026lockErr) {\n    // Lock is already held\n    log.Printf(\"lock is held until %s\", lockErr.NotBefore())\n  }\n\n  panic(err) // TODO: handle error\n}\n```\n\n\n[godoc]: https://pkg.go.dev/github.com/sethvargo/go-gcslock\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsethvargo%2Fgo-gcslock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsethvargo%2Fgo-gcslock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsethvargo%2Fgo-gcslock/lists"}