raftlease

package
v0.0.0-...-b0bff92 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

Package raftlease implements the API for sending raft lease messages between api servers.

Package raftlease is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

API provides access to the pubsub API.

func NewAPI

func NewAPI(caller base.APICaller) *API

NewAPI creates a new client-side pubsub API.

func (*API) ApplyLease

func (api *API) ApplyLease(command string) error

ApplyLease attempts to apply a lease against the given controller. If the controller is not the leader, then an error to redirect to a new leader will be given.

type Client

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

func NewClient

func NewClient(config Config) (*Client, error)

NewClient creates a new client for connecting to remote controllers.

func (*Client) Close

func (c *Client) Close() error

Close closes the client.

func (*Client) Request

func (c *Client) Request(ctx context.Context, command *raftlease.Command) error

Request attempts to perform a raft lease command against the leader.

type ClientMetrics

type ClientMetrics interface {
	RecordOperation(string, string, time.Time)
}

ClientMetrics represents the metrics during a client request.

type Config

type Config struct {
	APIInfo        *api.Info
	Hub            *pubsub.StructuredHub
	ForwardTimeout time.Duration
	NewRemote      func(RemoteConfig) Remote
	ClientMetrics  ClientMetrics
	Clock          clock.Clock
	Logger         Logger
	Random         *rand.Rand
}

func (Config) Validate

func (config Config) Validate() error

Validate validates the raft lease worker configuration.

type Logger

type Logger interface {
	Errorf(string, ...interface{})
	Warningf(string, ...interface{})
	Infof(string, ...interface{})
	Debugf(string, ...interface{})
	Tracef(string, ...interface{})
}

Logger is a in place interface to represent a logger for consuming.

type MockRaftLeaseApplier

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

MockRaftLeaseApplier is a mock of RaftLeaseApplier interface.

func NewMockRaftLeaseApplier

func NewMockRaftLeaseApplier(ctrl *gomock.Controller) *MockRaftLeaseApplier

NewMockRaftLeaseApplier creates a new mock instance.

func (*MockRaftLeaseApplier) ApplyLease

func (m *MockRaftLeaseApplier) ApplyLease(arg0 string) error

ApplyLease mocks base method.

func (*MockRaftLeaseApplier) EXPECT

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

type MockRaftLeaseApplierMockRecorder

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

MockRaftLeaseApplierMockRecorder is the mock recorder for MockRaftLeaseApplier.

func (*MockRaftLeaseApplierMockRecorder) ApplyLease

func (mr *MockRaftLeaseApplierMockRecorder) ApplyLease(arg0 interface{}) *gomock.Call

ApplyLease indicates an expected call of ApplyLease.

type MockRemote

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

MockRemote is a mock of Remote interface.

func NewMockRemote

func NewMockRemote(ctrl *gomock.Controller) *MockRemote

NewMockRemote creates a new mock instance.

func (*MockRemote) Address

func (m *MockRemote) Address() string

Address mocks base method.

func (*MockRemote) EXPECT

func (m *MockRemote) EXPECT() *MockRemoteMockRecorder

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

func (*MockRemote) ID

func (m *MockRemote) ID() string

ID mocks base method.

func (*MockRemote) Kill

func (m *MockRemote) Kill()

Kill mocks base method.

func (*MockRemote) Request

func (m *MockRemote) Request(arg0 context.Context, arg1 *raftlease.Command) error

Request mocks base method.

func (*MockRemote) SetAddress

func (m *MockRemote) SetAddress(arg0 string)

SetAddress mocks base method.

func (*MockRemote) Wait

func (m *MockRemote) Wait() error

Wait mocks base method.

type MockRemoteMockRecorder

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

MockRemoteMockRecorder is the mock recorder for MockRemote.

func (*MockRemoteMockRecorder) Address

func (mr *MockRemoteMockRecorder) Address() *gomock.Call

Address indicates an expected call of Address.

func (*MockRemoteMockRecorder) ID

ID indicates an expected call of ID.

func (*MockRemoteMockRecorder) Kill

func (mr *MockRemoteMockRecorder) Kill() *gomock.Call

Kill indicates an expected call of Kill.

func (*MockRemoteMockRecorder) Request

func (mr *MockRemoteMockRecorder) Request(arg0, arg1 interface{}) *gomock.Call

Request indicates an expected call of Request.

func (*MockRemoteMockRecorder) SetAddress

func (mr *MockRemoteMockRecorder) SetAddress(arg0 interface{}) *gomock.Call

SetAddress indicates an expected call of SetAddress.

func (*MockRemoteMockRecorder) Wait

func (mr *MockRemoteMockRecorder) Wait() *gomock.Call

Wait indicates an expected call of Wait.

type RaftLeaseApplier

type RaftLeaseApplier interface {
	ApplyLease(command string) error
}

RaftLeaseApplier defines a client for applying leases.

type Remote

type Remote interface {
	worker.Worker
	ID() string
	Address() string
	SetAddress(string)
	Request(context.Context, *raftlease.Command) error
}

Remote defines an interface for managing remote connections for the client.

func NewRemote

func NewRemote(config RemoteConfig) Remote

NewRemote creates a new Remote from a given address.

type RemoteConfig

type RemoteConfig struct {
	ID      string
	APIInfo *api.Info
	Clock   clock.Clock
	Logger  Logger
}

RemoteConfig defines the configuration for creating a NewRemote.

Jump to

Keyboard shortcuts

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