cluster

package
Version: v3.6.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: LGPL-3.0 Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager struct {
	Prefix string
	Name   string
	// contains filtered or unexported fields
}

func NewManager

func NewManager(c option.Config) (*Manager, error)

func (*Manager) GetName

func (m *Manager) GetName() string

func (*Manager) GetPrefix

func (m *Manager) GetPrefix() string

type Mutex

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

A Mutex is a mutual exclusion lock which is distributed across a cluster.

func New

func New(key string, ttl int, c client.Client) *Mutex

New creates a Mutex with the given key which must be the same across the cluster nodes.

func (*Mutex) Lock

func (m *Mutex) Lock() (err error)

Lock locks m. If the lock is already in use, the calling goroutine blocks until the mutex is available.

func (*Mutex) Unlock

func (m *Mutex) Unlock() (err error)

Unlock unlocks m. It is a run-time error if m is not locked on entry to Unlock.

A locked Mutex is not associated with a particular goroutine. It is allowed for one goroutine to lock a Mutex and then arrange for another goroutine to unlock it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL