etcdsync

package
v1.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2015 License: ISC, Apache-2.0 Imports: 4 Imported by: 0

README

etcd-sync

An etcd-based sync module, aiming at implementing the Go sync pkg over etcd for cluster-wide synchronization.

Installation

go get github.com/leeor/etcd-sync

Usage

At this time, only a simple mutex has been implemented.

EtcdMutex

mutex := NewMutexFromServers([]string{"http://127.0.0.1:4001"}, key, 0)
mutex.Lock()
// do some critical stuff
mutex.Unlock()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EtcdMutex

type EtcdMutex struct {
	// contains filtered or unexported fields
}

func NewMutexFromClient

func NewMutexFromClient(client *etcd.Client, key string, ttl uint64) *EtcdMutex

func NewMutexFromServers

func NewMutexFromServers(servers []string, key string, ttl uint64) *EtcdMutex

func (*EtcdMutex) Lock

func (m *EtcdMutex) Lock() error

func (*EtcdMutex) Unlock

func (m *EtcdMutex) Unlock()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL