Skip to content

pingles/glock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Glock

Go-implemented Global Lock.

Rationale

Flock provides a mutual exclusion lock built on the filesystem.

Glock also provides a mutual exclusion lock but, by using ZooKeeper, provides a global lock suitable for use across machines.

Usage

$ glock --zookeeper=localhost:2181 --path=/glock/some/task echo 'hello, world'

The glock command will first attempt to acquire a lock from ZooKeeper within wait (default 5 seconds). The process that acquires the lock will immediately execute the command.

Notes

Glock is intended to be used as a short-lived process. That is, it is intended to be used from within Crontab or other such systems. To ensure locks are properly acquired across machines it's necessary to set wait and minExec to reasonable values to cover the difference in clocks: if the command executes faster than the difference between clocks there's a chance a task would execute twice in the same cycle.

Building

Glock dependencies were managed using Govendor. You can specify GO15VENDOREXPERIMENT=1 to pull dependencies from the ./vendor directory.

License

BSD 3-clause. Please see LICENSE.

About

Go-implemented Global Lock

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published