leaderelection

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package leaderelection is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	LeaseDuration int64    `yaml:"lease_duration"`
	Name          string   `yaml:"name"`
	KeyPrefix     string   `yaml:"key_prefix"`
	EtcdEndpoints []string `yaml:"etcd"`
}

type LeaderCallbacks

type LeaderCallbacks struct {
	// OnStartedLeading is called when starts leading
	OnStartedLeading func(context.Context)
	// OnStoppedLeading is called when stops leading
	OnStoppedLeading func(context.Context)
}

type Manager

type Manager interface {
	Start(ctx context.Context, callbacks LeaderCallbacks) error
	Stop(ctx context.Context) error
}

func NewLeaderElection

func NewLeaderElection(c *Config) Manager

type MockManager

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

MockManager is a mock of Manager interface.

func NewMockManager

func NewMockManager(ctrl *gomock.Controller) *MockManager

NewMockManager creates a new mock instance.

func (*MockManager) EXPECT

func (m *MockManager) EXPECT() *MockManagerMockRecorder

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

func (*MockManager) Start

func (m *MockManager) Start(ctx context.Context, callbacks LeaderCallbacks) error

Start mocks base method.

func (*MockManager) Stop

func (m *MockManager) Stop(ctx context.Context) error

Stop mocks base method.

type MockManagerMockRecorder

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

MockManagerMockRecorder is the mock recorder for MockManager.

func (*MockManagerMockRecorder) Start

func (mr *MockManagerMockRecorder) Start(ctx, callbacks interface{}) *gomock.Call

Start indicates an expected call of Start.

func (*MockManagerMockRecorder) Stop

func (mr *MockManagerMockRecorder) Stop(ctx interface{}) *gomock.Call

Stop indicates an expected call of Stop.

type MockMutex

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

MockMutex is a mock of Mutex interface.

func NewMockMutex

func NewMockMutex(ctrl *gomock.Controller) *MockMutex

NewMockMutex creates a new mock instance.

func (*MockMutex) EXPECT

func (m *MockMutex) EXPECT() *MockMutexMockRecorder

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

func (*MockMutex) TryLock

func (m *MockMutex) TryLock(ctx context.Context) error

TryLock mocks base method.

func (*MockMutex) Unlock

func (m *MockMutex) Unlock(ctx context.Context) error

Unlock mocks base method.

type MockMutexMockRecorder

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

MockMutexMockRecorder is the mock recorder for MockMutex.

func (*MockMutexMockRecorder) TryLock

func (mr *MockMutexMockRecorder) TryLock(ctx interface{}) *gomock.Call

TryLock indicates an expected call of TryLock.

func (*MockMutexMockRecorder) Unlock

func (mr *MockMutexMockRecorder) Unlock(ctx interface{}) *gomock.Call

Unlock indicates an expected call of Unlock.

type Mutex

type Mutex interface {
	TryLock(ctx context.Context) error
	Unlock(ctx context.Context) error
}

Jump to

Keyboard shortcuts

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