client

package
v0.0.0-...-d989b54 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 20 Imported by: 10

Documentation

Index

Constants

View Source
const (
	SchemeTypeRpc  = "prpc"
	SchemeTypeGrpc = "grpc"
)

Variables

View Source
var (
	Debug            = false
	Stdout io.Writer = os.Stdout
	Stderr io.Writer = os.Stderr
)
View Source
var (
	ErrEventDataInvalid = errors.New("event data invalid")
	ErrArgs             = errors.New("gokeeper client useage: ./bin/component -d=domain -n=nodeid -k=keeper_address")

	ConnectTimeout = time.Duration(10) * time.Second
	ReadTimeout    = time.Duration(300) * time.Second
	WriteTimeout   = time.Duration(300) * time.Second
	EventInterval  = time.Duration(5) * time.Second
)
View Source
var (
	ErrTypeInValid = errors.New("stream from pool is invalid")
	ErrSendTimeout = errors.New("stream send timeout")
)
View Source
var EventCallback = newEventCall()
View Source
var (
	ProcInfo *model.ProcInfo
)
View Source
var (
	SignalHandlerCallback = newSignalHandler()
)

Functions

func NewSyncStreamPool

func NewSyncStreamPool(client pb.SyncClient, initCap, maxCap int, idleTimeout time.Duration) (pool.Pool, error)

func SignalNotifyDeamon

func SignalNotifyDeamon(c *Client)

SignalNotifyDeamon listen signal @todo registerCallFunc registe Client or Client implement callback interface

func Sync

func Sync(p pool.Pool, evtReq *pb.ConfigEvent, opts ...OpSyncCallOption) (evtResp *pb.ConfigEvent, err error)

@todo 如果server端处理能力不足,导致server recv buffer full(stream level),此时Send会阻塞,这时应该如何处理???

Types

type Client

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

Client ...

func New

func New(keeperAddr, domain, nodeID, component string, rawSubscription []string, tags map[string]string, opts ...Option) *Client

New return client struct

func (*Client) LoadData

func (c *Client) LoadData(objContainer model.ObjContainer) *Client

LoadData register data

func (*Client) RegisterCallback

func (c *Client) RegisterCallback(args ...func()) *Client

RegisterCallback event

func (*Client) Work

func (c *Client) Work() error

Work get data from keeper service and listen data change

type EventCall

type EventCall struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*EventCall) RegisterCallFunc

func (this *EventCall) RegisterCallFunc(e int, function interface{})

type OpSyncCallOption

type OpSyncCallOption func(o *syncCallOption)

func WithSyncCallRetryTimes

func WithSyncCallRetryTimes(retryTimes int) OpSyncCallOption

func WithSyncCallTimeout

func WithSyncCallTimeout(timeout time.Duration) OpSyncCallOption

type Option

type Option func(c *Client)

func WithGrpc

func WithGrpc() Option

type SignalHandler

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

SignalHandler ...

type SyncStream

type SyncStream struct {
	pb.Sync_SyncClient
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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