mock

package
v3.24.1-rc0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BalancerMock

type BalancerMock struct {
	OnNext        func(ctx context.Context, allowBanned bool) conn.Conn
	OnCreate      func(conns []conn.Conn) balancer.Balancer
	OnNeedRefresh func(ctx context.Context) bool
}

func Balancer

func Balancer() *BalancerMock

func (*BalancerMock) Create

func (s *BalancerMock) Create(conns []conn.Conn) balancer.Balancer

func (*BalancerMock) NeedRefresh

func (s *BalancerMock) NeedRefresh(ctx context.Context) bool

func (*BalancerMock) Next

func (s *BalancerMock) Next(ctx context.Context, allowBanned bool) conn.Conn

type ConnMock

type ConnMock struct {
	AddrField     string
	LocalDCField  bool
	LocationField string
	NodeIdField   uint32
	State         conn.State
	PingErr       error
}

func (*ConnMock) Endpoint

func (c *ConnMock) Endpoint() endpoint.Endpoint

func (*ConnMock) GetState

func (c *ConnMock) GetState() conn.State

func (*ConnMock) Invoke

func (c *ConnMock) Invoke(ctx context.Context, method string, args interface{}, reply interface{}, opts ...grpc.CallOption) error

func (*ConnMock) IsState

func (c *ConnMock) IsState(states ...conn.State) bool

func (*ConnMock) LastUsage

func (c *ConnMock) LastUsage() time.Time

func (*ConnMock) NewStream

func (c *ConnMock) NewStream(ctx context.Context, desc *grpc.StreamDesc, method string, opts ...grpc.CallOption) (grpc.ClientStream, error)

func (*ConnMock) Park

func (c *ConnMock) Park(ctx context.Context) (err error)

func (*ConnMock) Ping

func (c *ConnMock) Ping(ctx context.Context) error

func (*ConnMock) Release

func (c *ConnMock) Release(ctx context.Context) error

func (*ConnMock) SetState

func (c *ConnMock) SetState(state conn.State) conn.State

type EndpointMock

type EndpointMock struct {
	AddrField     string
	LocalDCField  bool
	LocationField string
	NodeIdField   uint32
}

func (*EndpointMock) Address

func (e *EndpointMock) Address() string

func (*EndpointMock) Copy

func (e *EndpointMock) Copy() endpoint.Endpoint

func (*EndpointMock) LastUpdated

func (e *EndpointMock) LastUpdated() time.Time

func (*EndpointMock) LoadFactor

func (e *EndpointMock) LoadFactor() float32

func (*EndpointMock) LocalDC

func (e *EndpointMock) LocalDC() bool

func (*EndpointMock) Location

func (e *EndpointMock) Location() string

func (*EndpointMock) NodeID

func (e *EndpointMock) NodeID() uint32

func (*EndpointMock) String

func (e *EndpointMock) String() string

func (*EndpointMock) Touch

func (e *EndpointMock) Touch(opts ...endpoint.Option)

Jump to

Keyboard shortcuts

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