client

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package client is a generated GoMock package.

Package client is a generated GoMock package.

Package client is a generated GoMock package.

Package client is a generated GoMock package.

Index

Constants

View Source
const (
	DefaultUser                     = "root"
	DefaultPassword                 = "nebula"
	DefaultReconnectInitialInterval = time.Second
	DefaultReconnectMaxInterval     = 2 * time.Minute
	DefaultRetry                    = 3
	DefaultRetryInitialInterval     = time.Second
	DefaultRetryMaxInterval         = 2 * time.Minute
	DefaultRetryRandomizationFactor = 0.1
	DefaultRetryMultiplier          = 1.5
	DefaultRetryMaxElapsedTime      = time.Hour
	DefaultConcurrencyPerAddress    = 10
	DefaultQueueSize                = 1000
)

Variables

View Source
var ErrClosed = stderrors.New("client closed")

Functions

This section is empty.

Types

type Client

type Client interface {
	Open() error
	Execute(statement string) (Response, error)
	Close() error
}

func NewClient

func NewClient(opts ...Option) Client

type ExecuteResult

type ExecuteResult struct {
	Response Response
	Err      error
}

type HostAddress

type HostAddress struct {
	Host string
	Port int
}

type MockClient

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

MockClient is a mock of Client interface.

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) Close

func (m *MockClient) Close() error

Close mocks base method.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

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

func (*MockClient) Execute

func (m *MockClient) Execute(statement string) (Response, error)

Execute mocks base method.

func (*MockClient) Open

func (m *MockClient) Open() error

Open mocks base method.

type MockClientMockRecorder

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

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) Close

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

Close indicates an expected call of Close.

func (*MockClientMockRecorder) Execute

func (mr *MockClientMockRecorder) Execute(statement interface{}) *gomock.Call

Execute indicates an expected call of Execute.

func (*MockClientMockRecorder) Open

func (mr *MockClientMockRecorder) Open() *gomock.Call

Open indicates an expected call of Open.

type MockPool

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

MockPool is a mock of Pool interface.

func NewMockPool

func NewMockPool(ctrl *gomock.Controller) *MockPool

NewMockPool creates a new mock instance.

func (*MockPool) Close

func (m *MockPool) Close() error

Close mocks base method.

func (*MockPool) EXPECT

func (m *MockPool) EXPECT() *MockPoolMockRecorder

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

func (*MockPool) Execute

func (m *MockPool) Execute(statement string) (Response, error)

Execute mocks base method.

func (*MockPool) ExecuteChan

func (m *MockPool) ExecuteChan(statement string) (<-chan ExecuteResult, bool)

ExecuteChan mocks base method.

func (*MockPool) GetClient

func (m *MockPool) GetClient(opts ...Option) (Client, error)

GetClient mocks base method.

func (*MockPool) Open

func (m *MockPool) Open() error

Open mocks base method.

type MockPoolMockRecorder

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

MockPoolMockRecorder is the mock recorder for MockPool.

func (*MockPoolMockRecorder) Close

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

Close indicates an expected call of Close.

func (*MockPoolMockRecorder) Execute

func (mr *MockPoolMockRecorder) Execute(statement interface{}) *gomock.Call

Execute indicates an expected call of Execute.

func (*MockPoolMockRecorder) ExecuteChan

func (mr *MockPoolMockRecorder) ExecuteChan(statement interface{}) *gomock.Call

ExecuteChan indicates an expected call of ExecuteChan.

func (*MockPoolMockRecorder) GetClient

func (mr *MockPoolMockRecorder) GetClient(opts ...interface{}) *gomock.Call

GetClient indicates an expected call of GetClient.

func (*MockPoolMockRecorder) Open

func (mr *MockPoolMockRecorder) Open() *gomock.Call

Open indicates an expected call of Open.

type MockResponse

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

MockResponse is a mock of Response interface.

func NewMockResponse

func NewMockResponse(ctrl *gomock.Controller) *MockResponse

NewMockResponse creates a new mock instance.

func (*MockResponse) EXPECT

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

func (*MockResponse) GetError

func (m *MockResponse) GetError() error

GetError mocks base method.

func (*MockResponse) GetLatency

func (m *MockResponse) GetLatency() time.Duration

GetLatency mocks base method.

func (*MockResponse) GetRespTime

func (m *MockResponse) GetRespTime() time.Duration

GetRespTime mocks base method.

func (*MockResponse) IsPermanentError

func (m *MockResponse) IsPermanentError() bool

IsPermanentError mocks base method.

func (*MockResponse) IsRetryMoreError

func (m *MockResponse) IsRetryMoreError() bool

IsRetryMoreError mocks base method.

func (*MockResponse) IsSucceed

func (m *MockResponse) IsSucceed() bool

IsSucceed mocks base method.

type MockResponseMockRecorder

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

MockResponseMockRecorder is the mock recorder for MockResponse.

func (*MockResponseMockRecorder) GetError

func (mr *MockResponseMockRecorder) GetError() *gomock.Call

GetError indicates an expected call of GetError.

func (*MockResponseMockRecorder) GetLatency

func (mr *MockResponseMockRecorder) GetLatency() *gomock.Call

GetLatency indicates an expected call of GetLatency.

func (*MockResponseMockRecorder) GetRespTime

func (mr *MockResponseMockRecorder) GetRespTime() *gomock.Call

GetRespTime indicates an expected call of GetRespTime.

func (*MockResponseMockRecorder) IsPermanentError

func (mr *MockResponseMockRecorder) IsPermanentError() *gomock.Call

IsPermanentError indicates an expected call of IsPermanentError.

func (*MockResponseMockRecorder) IsRetryMoreError

func (mr *MockResponseMockRecorder) IsRetryMoreError() *gomock.Call

IsRetryMoreError indicates an expected call of IsRetryMoreError.

func (*MockResponseMockRecorder) IsSucceed

func (mr *MockResponseMockRecorder) IsSucceed() *gomock.Call

IsSucceed indicates an expected call of IsSucceed.

type MockSession

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

MockSession is a mock of Session interface.

func NewMockSession

func NewMockSession(ctrl *gomock.Controller) *MockSession

NewMockSession creates a new mock instance.

func (*MockSession) Close

func (m *MockSession) Close() error

Close mocks base method.

func (*MockSession) EXPECT

func (m *MockSession) EXPECT() *MockSessionMockRecorder

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

func (*MockSession) Execute

func (m *MockSession) Execute(statement string) (Response, error)

Execute mocks base method.

func (*MockSession) Open

func (m *MockSession) Open() error

Open mocks base method.

type MockSessionMockRecorder

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

MockSessionMockRecorder is the mock recorder for MockSession.

func (*MockSessionMockRecorder) Close

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

Close indicates an expected call of Close.

func (*MockSessionMockRecorder) Execute

func (mr *MockSessionMockRecorder) Execute(statement interface{}) *gomock.Call

Execute indicates an expected call of Execute.

func (*MockSessionMockRecorder) Open

func (mr *MockSessionMockRecorder) Open() *gomock.Call

Open indicates an expected call of Open.

type NewSessionFunc

type NewSessionFunc func(HostAddress) Session

type Option

type Option func(*options)

func WithAddress

func WithAddress(addresses ...string) Option

func WithClientInitFunc

func WithClientInitFunc(fn func(Client) error) Option

func WithConcurrencyPerAddress

func WithConcurrencyPerAddress(concurrencyPerAddress int) Option

func WithLogger

func WithLogger(l logger.Logger) Option

func WithNewSessionFunc

func WithNewSessionFunc(fn NewSessionFunc) Option

func WithPassword

func WithPassword(password string) Option

func WithQueueSize

func WithQueueSize(queueSize int) Option

func WithReconnectInitialInterval

func WithReconnectInitialInterval(interval time.Duration) Option

func WithRetry

func WithRetry(retry int) Option

func WithRetryInitialInterval

func WithRetryInitialInterval(interval time.Duration) Option

func WithTLSConfig

func WithTLSConfig(tlsConfig *tls.Config) Option

func WithUser

func WithUser(user string) Option

func WithUserPassword

func WithUserPassword(user, password string) Option

func WithV3

func WithV3() Option

type Pool

type Pool interface {
	Client
	GetClient(opts ...Option) (Client, error)
	ExecuteChan(statement string) (<-chan ExecuteResult, bool)
}

func NewPool

func NewPool(opts ...Option) Pool

type Response

type Response interface {
	IsSucceed() bool
	GetLatency() time.Duration
	GetRespTime() time.Duration
	GetError() error
	IsPermanentError() bool
	IsRetryMoreError() bool
}

type Session

type Session interface {
	Open() error
	Execute(statement string) (Response, error)
	Close() error
}

Jump to

Keyboard shortcuts

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