client

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StateBlock block is unavailable state
	StateBlock state = 0x01 + iota
	// StateReady ready is unavailable state
	StateReady

	// StateWorking is available state
	StateWorking
)

Variables

View Source
var (
	ErrorNoneServer   = errors.New("server is none to use")
	ErrorNoSuchServer = errors.New("no such server")
)

Functions

This section is empty.

Types

type Conn

type Conn struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Conn include transport client

func (*Conn) Client

func (c *Conn) Client() transport.Client

Client get client

func (*Conn) Close

func (c *Conn) Close()

Close close client

func (*Conn) Offset

func (c *Conn) Offset() int

Offset get podLength

type Invoke

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

type InvokeOption

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

type InvokeOptions

type InvokeOptions func(*InvokeOption)

func BuffSize

func BuffSize(buffSize int) InvokeOptions

BuffSize set buff size for requestChannel

func WithAddress

func WithAddress(name, address string, version ...string) InvokeOptions

WithAddress set service discover prefix with both service serviceName and address

func WithName

func WithName(name string, version ...string) InvokeOptions

WithName set service discover prefix with service serviceName

func WithTracing

func WithTracing(t string) InvokeOptions

WithTracing set tracing

type Options

type Options func(*option)

Options invoke option

func Codec

func Codec(cc codec.Codec) Options

Codec set codec

func ConnectTimeout

func ConnectTimeout(connectTimeout time.Duration) Options

ConnectTimeout set connect timeout

func KeepaliveInterval

func KeepaliveInterval(keepaliveInterval time.Duration) Options

KeepaliveInterval set keepalive interval

func KeepaliveLifetime

func KeepaliveLifetime(keepaliveLifetime time.Duration) Options

KeepaliveLifetime set keepalive life time

func Registry

func Registry(registry registry.Registry) Options

Registry set service discover registry

func Transport

func Transport(client transport.Client) Options

Transport set transport client

type RocClient

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

func NewRocClient

func NewRocClient(opts ...Options) (lp *RocClient)

NewRocClient create a client set opts,or use default

func (*RocClient) Client

func (r *RocClient) Client() transport.Client

func (*RocClient) Close

func (r *RocClient) Close()

Close handler client close

func (*RocClient) Codec

func (r *RocClient) Codec() codec.Codec

func (*RocClient) ConnectTimeout

func (r *RocClient) ConnectTimeout() time.Duration

func (*RocClient) InvokeRC

func (r *RocClient) InvokeRC(c *context.Context, method string, req chan []byte, errIn chan error, opts ...InvokeOptions) (chan []byte, chan error)

func (*RocClient) InvokeRR

func (r *RocClient) InvokeRR(c *context.Context, method string, req, rsp proto.Message, opts ...InvokeOptions) error

InvokeRR rpc request requestResponse,it's block request,one request one response

func (*RocClient) InvokeRS

func (r *RocClient) InvokeRS(c *context.Context, method string, req proto.Message, opts ...InvokeOptions) (chan []byte, chan error)

InvokeRS rpc request requestStream,it's one request and multiple response

func (*RocClient) KeepaliveInterval

func (r *RocClient) KeepaliveInterval() time.Duration

func (*RocClient) KeepaliveLifetime

func (r *RocClient) KeepaliveLifetime() time.Duration

func (*RocClient) Registry

func (r *RocClient) Registry() registry.Registry

Registry Get the use of serviceName discovery

type Strategy

type Strategy interface {

	//Next Round-robin scheduling
	Next(scope string) (next *Conn, err error)

	//Straight direct call
	Straight(scope, address string) (next *Conn, err error)

	//Close Strategy
	Close()
}

Jump to

Keyboard shortcuts

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