dsync

package
v0.0.0-...-eb599cc Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalLocksmith

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

LocalLocksmith implements process-scoped locking

func NewLocalLocksmith

func NewLocalLocksmith() *LocalLocksmith

NewLocalLocksmith returns an initialised LocalLocksmith

func (*LocalLocksmith) Forge

func (l *LocalLocksmith) Forge(resource string) (Locker, error)

Forge returns a Locker for the resource

type Locker

type Locker interface {
	Lock() error
	Unlock()
}

Locker is a lock on a resource that can be locked and unlocked

func Lock

func Lock(ctx context.Context, resource string, args ...interface{}) (Locker, error)

Lock will forge a lock for the resource and try to acquire the lock

type Locksmith

type Locksmith interface {
	Forge(string) (Locker, error)
}

Locksmith can forge locks

var DefaultLocksmith Locksmith

DefaultLocksmith is a global instance of Locksmith

Jump to

Keyboard shortcuts

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