Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryandotsmith/ddbsync
DynamoDB Mutual Exclusion Locking for Go
https://github.com/ryandotsmith/ddbsync
Last synced: 2 months ago
JSON representation
DynamoDB Mutual Exclusion Locking for Go
- Host: GitHub
- URL: https://github.com/ryandotsmith/ddbsync
- Owner: ryandotsmith
- License: bsd-2-clause
- Created: 2012-10-14T07:05:22.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2016-08-01T19:21:16.000Z (over 8 years ago)
- Last Synced: 2024-10-13T17:47:19.586Z (3 months ago)
- Language: Go
- Size: 299 KB
- Stars: 46
- Watchers: 3
- Forks: 10
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# ddbsync
DynamoDB/sync
This package is designed to emulate the behaviour of `pkg/sync` on top of Amazon's DynamoDB. If you need a distributed locking mechanism, consider using this package and DynamoDB before standing up paxos or Zookeeper.
[GoPkgDoc](http://go.pkgdoc.org/github.com/ryandotsmith/ddbsync)
## Usage
Create a DynamoDB table named *Locks*.
```bash
$ export AWS_ACCESS_KEY=access
$ export AWS_SECRET_KEY=secret
``````go
// ./main.gopackage main
import(
"time"
"github.com/ryandotsmith/ddbsync"
)func main() {
m := new(ddbsync.Mutex)
m.Name = "some-name"
m.Ttl = 10 * time.Second
m.Lock()
defer m.Unlock()
// do important work here
return
}
``````bash
$ go get github.com/ryandotsmith/ddbsync
$ go run main.go
```## Related
[lock-smith](https://github.com/ryandotsmith/lock-smith)