mutex

package
v0.0.0-...-44a5619 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func LockFileName

func LockFileName(name string) string

LockFileName get the lock file name from the lock name.

Types

type Interface

type Interface interface {
	Acquire(ctx context.Context, name string) (*Lock, error)
	Release(lock *Lock) error
}

type Lock

type Lock struct {
	Data interface{}
	Name string
}

Lock holds the lock data.

type MockInterface

type MockInterface struct {
	mock.Mock
}

MockInterface is an autogenerated mock type for the Interface type

func NewMockInterface

func NewMockInterface(t mockConstructorTestingTNewMockInterface) *MockInterface

NewMockInterface creates a new instance of MockInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockInterface) Acquire

func (_m *MockInterface) Acquire(ctx context.Context, name string) (*Lock, error)

Acquire provides a mock function with given fields: ctx, name

func (*MockInterface) EXPECT

func (_m *MockInterface) EXPECT() *MockInterface_Expecter

func (*MockInterface) Release

func (_m *MockInterface) Release(lock *Lock) error

Release provides a mock function with given fields: lock

type MockInterface_Acquire_Call

type MockInterface_Acquire_Call struct {
	*mock.Call
}

MockInterface_Acquire_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Acquire'

func (*MockInterface_Acquire_Call) Return

func (*MockInterface_Acquire_Call) Run

type MockInterface_Expecter

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

func (*MockInterface_Expecter) Acquire

func (_e *MockInterface_Expecter) Acquire(ctx interface{}, name interface{}) *MockInterface_Acquire_Call

Acquire is a helper method to define mock.On call

  • ctx context.Context
  • name string

func (*MockInterface_Expecter) Release

func (_e *MockInterface_Expecter) Release(lock interface{}) *MockInterface_Release_Call

Release is a helper method to define mock.On call

  • lock *Lock

type MockInterface_Release_Call

type MockInterface_Release_Call struct {
	*mock.Call
}

MockInterface_Release_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Release'

func (*MockInterface_Release_Call) Return

func (*MockInterface_Release_Call) Run

type Mutex

type Mutex struct {
	Logger logger.Interface
}

func (*Mutex) Acquire

func (m *Mutex) Acquire(ctx context.Context, name string) (*Lock, error)

Acquire acquire a lock for the specified name. The context could be used to set a timeout.

func (*Mutex) Release

func (m *Mutex) Release(lock *Lock) error

Release release the specified lock

Jump to

Keyboard shortcuts

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