client

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyRequest = &grpc2.Request{}

Functions

func ForceGetClient

func ForceGetClient(path string, opts ...Option) (p interfaces.GrpcClient, err error)

func GetClient

func GetClient(path string, opts ...Option) (c interfaces.GrpcClient, err error)

func GetClientPool

func GetClientPool(path string) (p interfaces.GrpcClientPool, err error)

func NewClient

func NewClient(opts ...Option) (res interfaces.GrpcClient, err error)

func NewNewPool

func NewNewPool(opts ...PoolOption) (p interfaces.GrpcClientPool, err error)

func ProvideClient

func ProvideClient(path string, opts ...Option) func() (res interfaces.GrpcClient, err error)

func ProvideClientPool

func ProvideClientPool(path string) func() (interfaces.GrpcClientPool, error)

func ProvideGetClient

func ProvideGetClient(path string, opts ...Option) func() (res interfaces.GrpcClient, err error)

Types

type Client

type Client struct {

	// grpc clients
	ModelDelegateClient    grpc2.ModelDelegateClient
	ModelBaseServiceClient grpc2.ModelBaseServiceClient
	NodeClient             grpc2.NodeServiceClient
	TaskClient             grpc2.TaskServiceClient
	PluginClient           grpc2.PluginServiceClient
	MessageClient          grpc2.MessageServiceClient
	// contains filtered or unexported fields
}

func (*Client) Context

func (c *Client) Context() (ctx context.Context, cancel context.CancelFunc)

func (*Client) Err

func (c *Client) Err() (err error)

func (*Client) GetConfigPath

func (c *Client) GetConfigPath() (path string)

func (*Client) GetMessageChannel

func (c *Client) GetMessageChannel() (msgCh chan *grpc2.StreamMessage)

func (*Client) GetMessageClient

func (c *Client) GetMessageClient() grpc2.MessageServiceClient

func (*Client) GetModelBaseServiceClient

func (c *Client) GetModelBaseServiceClient() (res grpc2.ModelBaseServiceClient)

func (*Client) GetModelDelegateClient

func (c *Client) GetModelDelegateClient() (res grpc2.ModelDelegateClient)

func (*Client) GetNodeClient

func (c *Client) GetNodeClient() grpc2.NodeServiceClient

func (*Client) GetPluginClient

func (c *Client) GetPluginClient() grpc2.PluginServiceClient

func (*Client) GetStream

func (c *Client) GetStream() (stream grpc2.NodeService_SubscribeClient)

func (*Client) GetTaskClient

func (c *Client) GetTaskClient() grpc2.TaskServiceClient

func (*Client) Init

func (c *Client) Init() (err error)

func (*Client) IsClosed

func (c *Client) IsClosed() (res bool)

func (*Client) IsStarted

func (c *Client) IsStarted() (res bool)

func (*Client) NewModelBaseServiceRequest

func (c *Client) NewModelBaseServiceRequest(id interfaces.ModelId, params interfaces.GrpcBaseServiceParams) (req *grpc2.Request, err error)

func (*Client) NewPluginRequest

func (c *Client) NewPluginRequest(d interface{}) (req *grpc2.PluginRequest)

func (*Client) NewRequest

func (c *Client) NewRequest(d interface{}) (req *grpc2.Request)

func (*Client) Register

func (c *Client) Register() (err error)

func (*Client) Restart

func (c *Client) Restart() (err error)

func (*Client) SetAddress

func (c *Client) SetAddress(address interfaces.Address)

func (*Client) SetConfigPath

func (c *Client) SetConfigPath(path string)

func (*Client) SetHandleMessage

func (c *Client) SetHandleMessage(handleMessage bool)

func (*Client) SetSubscribeType

func (c *Client) SetSubscribeType(value string)

func (*Client) SetTimeout

func (c *Client) SetTimeout(timeout time.Duration)

func (*Client) Start

func (c *Client) Start() (err error)

func (*Client) Stop

func (c *Client) Stop() (err error)

type Option

type Option func(client interfaces.GrpcClient)

func WithAddress

func WithAddress(address interfaces.Address) Option

func WithConfigPath

func WithConfigPath(path string) Option

func WithHandleMessage

func WithHandleMessage(handleMessage bool) Option

func WithSubscribeType

func WithSubscribeType(subscribeType string) Option

func WithTimeout

func WithTimeout(timeout time.Duration) Option

type Pool

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

func (*Pool) GetClient

func (p *Pool) GetClient() (c interfaces.GrpcClient, err error)

func (*Pool) GetConfigPath

func (p *Pool) GetConfigPath() (path string)

func (*Pool) Init

func (p *Pool) Init() (err error)

func (*Pool) NewClient

func (p *Pool) NewClient() (err error)

func (*Pool) SetConfigPath

func (p *Pool) SetConfigPath(path string)

func (*Pool) SetSize

func (p *Pool) SetSize(size int)

type PoolOption

type PoolOption func(p interfaces.GrpcClientPool)

func WithPoolConfigPath

func WithPoolConfigPath(path string) PoolOption

func WithPoolSize

func WithPoolSize(size int) PoolOption

Jump to

Keyboard shortcuts

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