{"id":17520430,"url":"https://github.com/xaf/gcslock-ruby","last_synced_at":"2026-07-06T08:31:47.757Z","repository":{"id":56873698,"uuid":"265368300","full_name":"XaF/gcslock-ruby","owner":"XaF","description":"Google Cloud Storage distributed locking for Ruby","archived":false,"fork":false,"pushed_at":"2020-11-02T22:24:41.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-02T21:48:49.465Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/XaF.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":"2020-05-19T21:13:53.000Z","updated_at":"2020-11-02T22:24:43.000Z","dependencies_parsed_at":"2022-08-20T22:30:11.330Z","dependency_job_id":null,"html_url":"https://github.com/XaF/gcslock-ruby","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XaF%2Fgcslock-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XaF%2Fgcslock-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XaF%2Fgcslock-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XaF%2Fgcslock-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XaF","download_url":"https://codeload.github.com/XaF/gcslock-ruby/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246113637,"owners_count":20725501,"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":[],"created_at":"2024-10-20T11:04:54.663Z","updated_at":"2025-10-14T18:40:17.188Z","avatar_url":"https://github.com/XaF.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gcslock-ruby\n\nThis is inspired by [the Golang version](https://github.com/marcacohen/gcslock).\n\n## Google Cloud Storage setup\n\n1. Setup a new project at the [Google APIs Console](https://console.developers.google.com) and enable the Cloud Storage API.\n1. Install the [Google Cloud SDK](https://cloud.google.com/sdk/downloads) tool and configure your project and your OAuth credentials.\n1. Create a bucket in which to store your lock file using the command `gsutil mb gs://your-bucket-name`.\n1. Enable object versioning in your bucket using the command `gsutil versioning set on gs://your-bucket-name`.\n\n### Using a mutex\n\nIn your Ruby code, require `gcslock/mutex` and use it as follows:\n\n```ruby\nrequire 'gcslock/mutex'\n\nm = GCSLock::Mutex.new('your-bucket-name', 'my-file.lock')\nm.synchronize do\n  # Protected and globally serialized computation happens here.\nend\n```\n\n### Using a semaphore\n\nIn your Ruby code, require `gcslock/semaphore` and use it as follows:\n\n```ruby\nrequire 'gcslock/semaphore'\n\nnumber_of_permits = 10\ns = GCSLock::Semaphore.new('your-bucket-name', 'my-file.lock', number_of_permits)\ns.acquire\n# Work that should be done when semaphore is acquired\ns.release\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaf%2Fgcslock-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxaf%2Fgcslock-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaf%2Fgcslock-ruby/lists"}