Skip to content

greg-szabo/dsync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dsync

Overview

dsync is a sync library for distributed Go processes.

It works similarly to the built-in sync library, only it synchronizes across multiple processes - even on different machines.

This is achieved by storing the semaphore state and the value on a remote database.

Currently only DynamoDB is implemented. This might change in the future (Redis is considered currently).

Prerequisites

  • DB access for the chosen implementation

How to use

$ export AWS_ACCESS_KEY=access
$ export AWS_SECRET_KEY=secret
// ./main.go

package main

import "github.com/greg-szabo/dsync/ddb/sync"

func main() {
		m := sync.Mutex{}
		m.Lock()
		defer m.Unlock()
		// do important work here
		return
}
$ go get github.com/greg-szabo/dsync/ddb/sync
$ go run main.go

The locking mechanism will automatically create a Locks database in DynamoDB and stores the Mutex details.

Configuration parameters are described in the API documentation.

API Documentation

Acknowledgements

Shout out to Ryan Smith who created ddbsync which has a similar concept. Among others, his work inspired this library.

About

Distributed sync for go using databases

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages