distlock

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package distlock is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Locker

type Locker interface {
	// Lock must block until a mutually exclusive lock is obtained. this lock
	// acquisition must guarantee that any other process calling Lock() with the same key
	// will block. Implementors must ensure that acquiring the lock is an atomic operation
	// use a ctx to timeout lock acquisition. Implementor can determine if they will return
	// an error case for ctx timeout or not.
	Lock(ctx context.Context, key string) error
	// TryLock is similar to the above however will not block on lock acquisition failure.
	// if the lock was acquired TryLock must return a true and if the lock was not acquired
	// a false.
	TryLock(ctx context.Context, key string) (bool, error)
	// Unlock should return the distributed lock to the implemented synchronization point.
	Unlock() error
}

Locker ensures that no two distributed processes are performing a particular action at the same time. This should not support recursive locking or in other words multiple locks by the same key are not allowed.

type MockLocker

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

MockLocker is a mock of Locker interface

func NewMockLocker

func NewMockLocker(ctrl *gomock.Controller) *MockLocker

NewMockLocker creates a new mock instance

func (*MockLocker) EXPECT

func (m *MockLocker) EXPECT() *MockLockerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockLocker) Lock

func (m *MockLocker) Lock(arg0 context.Context, arg1 string) error

Lock mocks base method

func (*MockLocker) TryLock

func (m *MockLocker) TryLock(arg0 context.Context, arg1 string) (bool, error)

TryLock mocks base method

func (*MockLocker) Unlock

func (m *MockLocker) Unlock() error

Unlock mocks base method

type MockLockerMockRecorder

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

MockLockerMockRecorder is the mock recorder for MockLocker

func (*MockLockerMockRecorder) Lock

func (mr *MockLockerMockRecorder) Lock(arg0, arg1 interface{}) *gomock.Call

Lock indicates an expected call of Lock

func (*MockLockerMockRecorder) TryLock

func (mr *MockLockerMockRecorder) TryLock(arg0, arg1 interface{}) *gomock.Call

TryLock indicates an expected call of TryLock

func (*MockLockerMockRecorder) Unlock

func (mr *MockLockerMockRecorder) Unlock() *gomock.Call

Unlock indicates an expected call of Unlock

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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