Package glock implements locking against a variety of backends for the Go programming language.
glock is released under the MIT license.
WARN: this package is under heavy development, API is not stable yet.
-
Simple Redis implementation. Requires redis >= 2.6 as it uses lua scripting.
This implementation is safe only if used againt a single master, with no replication. -
Cassandra implementation, inspired by datastax's "Consensus on Cassandra" blogpost.
Requires cassandra >= 2.0 as it uses lightweight transactions. -
Memory
Naive in-process implementation, only useful for testing.
go get gopkg.in/gbagnoli/glock.v1
By default, tests runs only using the memory
driver.
To run test for one or more specific backend, use build tags.
go test -tags="redis cassandra"
- Add more tests
- Add more documentation
- Add more backends (in no particular order)
- Stabilize interface.
See glock-example