- Notifications
You must be signed in to change notification settings - Fork0
xaf/gcslock-ruby
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This is inspired bythe Golang version.
- Setup a new project at theGoogle APIs Console and enable the Cloud Storage API.
- Install theGoogle Cloud SDK tool and configure your project and your OAuth credentials.
- Create a bucket in which to store your lock file using the command
gsutil mb gs://your-bucket-name. - Enable object versioning in your bucket using the command
gsutil versioning set on gs://your-bucket-name.
In your Ruby code, requiregcslock/mutex and use it as follows:
require'gcslock/mutex'm=GCSLock::Mutex.new('your-bucket-name','my-file.lock')m.synchronizedo# Protected and globally serialized computation happens here.end
In your Ruby code, requiregcslock/semaphore and use it as follows:
require'gcslock/semaphore'number_of_permits=10s=GCSLock::Semaphore.new('your-bucket-name','my-file.lock',number_of_permits)s.acquire# Work that should be done when semaphore is acquireds.release
About
Google Cloud Storage distributed locking for Ruby
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.