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 acquistion. 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 acquistion 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 sychronization point. Unlock() error }
Locker ensure 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
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
Click to show internal directories.
Click to hide internal directories.