locker

package
v5.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package locker

Laravel yyds!

Package locker is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var WireLocker = wire.NewSet(NewLocker)

Functions

This section is empty.

Types

type Locker

type Locker interface {
	ID() string
	Type() string
	Acquire(key string, seconds int64) bool
	RenewalAcquire(key string, seconds int64, renewalSeconds int64) (releaseFn func(), acquired bool)
	Release(key string) bool
	ForceRelease(key string) bool
	Owner(key string) string
}

func NewDatabaseLock

func NewDatabaseLock(timer timer.Timer, lottery [2]int, data data.Data, logger mlog.Logger) Locker

func NewLocker

func NewLocker(cfg *config.Config, data data.Data, logger mlog.Logger, timer timer.Timer) (Locker, error)

func NewMemoryLock

func NewMemoryLock(timer timer.Timer, lottery [2]int, store *MemStore, logger mlog.Logger) Locker

type MemItem

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

type MemStore

type MemStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewMemStore

func NewMemStore() *MemStore

func (*MemStore) Add

func (s *MemStore) Add(key string, item *MemItem)

func (*MemStore) Count

func (s *MemStore) Count() int

func (*MemStore) Delete

func (s *MemStore) Delete(key string)

func (*MemStore) Get

func (s *MemStore) Get(key string) *MemItem

func (*MemStore) Range

func (s *MemStore) Range(fn func(string, *MemItem, map[string]*MemItem))

func (*MemStore) Update

func (s *MemStore) Update(key string, item *MemItem)

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) Acquire

func (m *MockLocker) Acquire(arg0 string, arg1 int64) bool

Acquire mocks base method.

func (*MockLocker) EXPECT

func (m *MockLocker) EXPECT() *MockLockerMockRecorder

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

func (*MockLocker) ForceRelease

func (m *MockLocker) ForceRelease(arg0 string) bool

ForceRelease mocks base method.

func (*MockLocker) ID

func (m *MockLocker) ID() string

ID mocks base method.

func (*MockLocker) Owner

func (m *MockLocker) Owner(arg0 string) string

Owner mocks base method.

func (*MockLocker) Release

func (m *MockLocker) Release(arg0 string) bool

Release mocks base method.

func (*MockLocker) RenewalAcquire

func (m *MockLocker) RenewalAcquire(arg0 string, arg1, arg2 int64) (func(), bool)

RenewalAcquire mocks base method.

func (*MockLocker) Type

func (m *MockLocker) Type() string

Type mocks base method.

type MockLockerMockRecorder

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

MockLockerMockRecorder is the mock recorder for MockLocker.

func (*MockLockerMockRecorder) Acquire

func (mr *MockLockerMockRecorder) Acquire(arg0, arg1 any) *gomock.Call

Acquire indicates an expected call of Acquire.

func (*MockLockerMockRecorder) ForceRelease

func (mr *MockLockerMockRecorder) ForceRelease(arg0 any) *gomock.Call

ForceRelease indicates an expected call of ForceRelease.

func (*MockLockerMockRecorder) ID

ID indicates an expected call of ID.

func (*MockLockerMockRecorder) Owner

func (mr *MockLockerMockRecorder) Owner(arg0 any) *gomock.Call

Owner indicates an expected call of Owner.

func (*MockLockerMockRecorder) Release

func (mr *MockLockerMockRecorder) Release(arg0 any) *gomock.Call

Release indicates an expected call of Release.

func (*MockLockerMockRecorder) RenewalAcquire

func (mr *MockLockerMockRecorder) RenewalAcquire(arg0, arg1, arg2 any) *gomock.Call

RenewalAcquire indicates an expected call of RenewalAcquire.

func (*MockLockerMockRecorder) Type

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

Type indicates an expected call of Type.

Jump to

Keyboard shortcuts

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