valueclient

package
Version: v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSendingCap = int64(1024)
View Source
var DefaultTimeoutMls = int64(1000) // one second
View Source
var ErrIdFieldNotFound = errors.New("request id not found")
View Source
var ErrNoMessageType = errors.New("message type not found")
View Source
var ErrNoResponse = errors.New("no response")
View Source
var ErrRequestNotFound = errors.New("request not found")
View Source
var ErrTimeoutError = errors.New("timeout error")
View Source
var ErrUnsupportedMessageType = errors.New("message type not supported")

Functions

func NewRequestCtx

func NewRequestCtx(requestId int64, req value.Map, receiveCap int) *rpcRequestCtx

func NewSyncConn

func NewSyncConn() *syncConn

Types

type Client

type Client interface {
	ClientId() int64

	Connect() error

	Reconnect() error

	IsActive() bool

	Stats() map[string]int64

	SetMonitor(PerformanceMonitor)

	SetConnectionHandler(ConnectionHandler)

	SetErrorHandler(ErrorHandler)

	SetTimeout(timeoutMls int64)

	CancelRequest(requestId int64)

	CallFunction(name string, args value.Value) (value.Value, error)

	GetStream(name string, args value.Value, receiveCap int) (<-chan value.Value, int64, error)

	PutStream(name string, args value.Value, putCh <-chan value.Value) error

	Chat(name string, args value.Value, receiveCap int, putCh <-chan value.Value) (<-chan value.Value, int64, error)

	Close() error
}

func NewClient

func NewClient(address, socks5 string) Client

type ConnectionHandler

type ConnectionHandler func(connected value.Map)

type ErrorHandler

type ErrorHandler interface {
	BadConnection(err error)

	ProtocolError(resp value.Map, err error)

	StreamError(requestId int64, err error)
}

type PerformanceMonitor

type PerformanceMonitor func(name string, elapsed int64)

must be fast function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to