internal

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package internal is a generated GoMock package.

Package internal is a generated GoMock package.

Package internal is a generated GoMock package.

Index

Constants

View Source
const (
	// Delimiter is a separator that separates the etcd path.
	Delimiter = '/'
)

Variables

View Source
var (
	// DialTimeout is the dial timeout.
	DialTimeout = dialTimeout
	// RequestTimeout is the request timeout.
	RequestTimeout = requestTimeout
	// NewClient is used to create etcd clients.
	NewClient = DialClient
)

Functions

func AddAccount

func AddAccount(endpoints []string, user, pass string)

AddAccount adds the username/password for the given etcd cluster.

func AddTLS

func AddTLS(endpoints []string, certFile, certKeyFile, caFile string, insecureSkipVerify bool) error

AddTLS adds the tls cert files for the given etcd cluster.

func GetTLS

func GetTLS(endpoints []string) (*tls.Config, bool)

GetTLS gets the tls config for the given etcd cluster.

Types

type Account

type Account struct {
	User string
	Pass string
}

Account holds the username/password for an etcd cluster.

func GetAccount

func GetAccount(endpoints []string) (Account, bool)

GetAccount gets the username/password for the given etcd cluster.

type EtcdClient

type EtcdClient interface {
	ActiveConnection() *grpc.ClientConn
	Close() error
	Ctx() context.Context
	Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)
	Grant(ctx context.Context, ttl int64) (*clientv3.LeaseGrantResponse, error)
	KeepAlive(ctx context.Context, id clientv3.LeaseID) (<-chan *clientv3.LeaseKeepAliveResponse, error)
	Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)
	Revoke(ctx context.Context, id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error)
	Watch(ctx context.Context, key string, opts ...clientv3.OpOption) clientv3.WatchChan
}

EtcdClient interface represents an etcd client.

func DialClient

func DialClient(endpoints []string) (EtcdClient, error)

DialClient dials an etcd cluster with given endpoints.

type KV

type KV struct {
	Key string
	Val string
}

A KV is used to store an etcd entry with key and value.

type Listener

type Listener interface {
	OnUpdate(keys, values []string, newKey string)
}

Listener interface wraps the OnUpdate method.

type MockEtcdClient

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

MockEtcdClient is a mock of EtcdClient interface

func NewMockEtcdClient

func NewMockEtcdClient(ctrl *gomock.Controller) *MockEtcdClient

NewMockEtcdClient creates a new mock instance

func (*MockEtcdClient) ActiveConnection

func (m *MockEtcdClient) ActiveConnection() *grpc.ClientConn

ActiveConnection mocks base method

func (*MockEtcdClient) Close

func (m *MockEtcdClient) Close() error

Close mocks base method

func (*MockEtcdClient) Ctx

func (m *MockEtcdClient) Ctx() context.Context

Ctx mocks base method

func (*MockEtcdClient) EXPECT

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

func (*MockEtcdClient) Get

Get mocks base method

func (*MockEtcdClient) Grant

Grant mocks base method

func (*MockEtcdClient) KeepAlive

KeepAlive mocks base method

func (*MockEtcdClient) Put

func (m *MockEtcdClient) Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)

Put mocks base method

func (*MockEtcdClient) Revoke

Revoke mocks base method

func (*MockEtcdClient) Watch

Watch mocks base method

type MockEtcdClientMockRecorder

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

MockEtcdClientMockRecorder is the mock recorder for MockEtcdClient

func (*MockEtcdClientMockRecorder) ActiveConnection

func (mr *MockEtcdClientMockRecorder) ActiveConnection() *gomock.Call

ActiveConnection indicates an expected call of ActiveConnection

func (*MockEtcdClientMockRecorder) Close

func (mr *MockEtcdClientMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockEtcdClientMockRecorder) Ctx

Ctx indicates an expected call of Ctx

func (*MockEtcdClientMockRecorder) Get

func (mr *MockEtcdClientMockRecorder) Get(ctx, key interface{}, opts ...interface{}) *gomock.Call

Get indicates an expected call of Get

func (*MockEtcdClientMockRecorder) Grant

func (mr *MockEtcdClientMockRecorder) Grant(ctx, ttl interface{}) *gomock.Call

Grant indicates an expected call of Grant

func (*MockEtcdClientMockRecorder) KeepAlive

func (mr *MockEtcdClientMockRecorder) KeepAlive(ctx, id interface{}) *gomock.Call

KeepAlive indicates an expected call of KeepAlive

func (*MockEtcdClientMockRecorder) Put

func (mr *MockEtcdClientMockRecorder) Put(ctx, key, val interface{}, opts ...interface{}) *gomock.Call

Put indicates an expected call of Put

func (*MockEtcdClientMockRecorder) Revoke

func (mr *MockEtcdClientMockRecorder) Revoke(ctx, id interface{}) *gomock.Call

Revoke indicates an expected call of Revoke

func (*MockEtcdClientMockRecorder) Watch

func (mr *MockEtcdClientMockRecorder) Watch(ctx, key interface{}, opts ...interface{}) *gomock.Call

Watch indicates an expected call of Watch

type MockUpdateListener

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

MockUpdateListener is a mock of UpdateListener interface

func NewMockUpdateListener

func NewMockUpdateListener(ctrl *gomock.Controller) *MockUpdateListener

NewMockUpdateListener creates a new mock instance

func (*MockUpdateListener) EXPECT

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

func (*MockUpdateListener) OnAdd

func (m *MockUpdateListener) OnAdd(kv KV)

OnAdd mocks base method

func (*MockUpdateListener) OnDelete

func (m *MockUpdateListener) OnDelete(kv KV)

OnDelete mocks base method

type MockUpdateListenerMockRecorder

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

MockUpdateListenerMockRecorder is the mock recorder for MockUpdateListener

func (*MockUpdateListenerMockRecorder) OnAdd

func (mr *MockUpdateListenerMockRecorder) OnAdd(kv interface{}) *gomock.Call

OnAdd indicates an expected call of OnAdd

func (*MockUpdateListenerMockRecorder) OnDelete

func (mr *MockUpdateListenerMockRecorder) OnDelete(kv interface{}) *gomock.Call

OnDelete indicates an expected call of OnDelete

type MocketcdConn

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

MocketcdConn is a mock of etcdConn interface

func NewMocketcdConn

func NewMocketcdConn(ctrl *gomock.Controller) *MocketcdConn

NewMocketcdConn creates a new mock instance

func (*MocketcdConn) EXPECT

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

func (*MocketcdConn) GetState

func (m *MocketcdConn) GetState() connectivity.State

GetState mocks base method

func (*MocketcdConn) WaitForStateChange

func (m *MocketcdConn) WaitForStateChange(ctx context.Context, sourceState connectivity.State) bool

WaitForStateChange mocks base method

type MocketcdConnMockRecorder

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

MocketcdConnMockRecorder is the mock recorder for MocketcdConn

func (*MocketcdConnMockRecorder) GetState

func (mr *MocketcdConnMockRecorder) GetState() *gomock.Call

GetState indicates an expected call of GetState

func (*MocketcdConnMockRecorder) WaitForStateChange

func (mr *MocketcdConnMockRecorder) WaitForStateChange(ctx, sourceState interface{}) *gomock.Call

WaitForStateChange indicates an expected call of WaitForStateChange

type Registry

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

A Registry is a registry that manages the etcd client connections.

func GetRegistry

func GetRegistry() *Registry

GetRegistry returns a global Registry.

func (*Registry) GetConn

func (r *Registry) GetConn(endpoints []string) (EtcdClient, error)

GetConn returns an etcd client connection associated with given endpoints.

func (*Registry) Monitor

func (r *Registry) Monitor(endpoints []string, key string, l UpdateListener) error

Monitor monitors the key on given etcd endpoints, notify with the given UpdateListener.

type UpdateListener

type UpdateListener interface {
	OnAdd(kv KV)
	OnDelete(kv KV)
}

UpdateListener wraps the OnAdd and OnDelete methods.

Jump to

Keyboard shortcuts

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