rpc

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(discovery proxy.Discovery, name string, serviceName string, options ...ClientOptionFunc) (*Client, error)

func (*Client) Broadcast

func (c *Client) Broadcast(ctx context.Context, method string, args interface{}, reply interface{}) error

func (*Client) Callback

func (c *Client) Callback(ctx context.Context, method string, args interface{}, reply interface{}, f func(reply interface{}, err error))

func (*Client) Close

func (c *Client) Close() error

func (*Client) Invoke

func (c *Client) Invoke(ctx context.Context, method string, args interface{}, reply interface{}) error

func (*Client) OneWay

func (c *Client) OneWay(ctx context.Context, method string, args interface{}) error

func (*Client) WithHashKey

func (c *Client) WithHashKey(ctx context.Context, val string) context.Context

func (*Client) WithSoftStateKey

func (c *Client) WithSoftStateKey(ctx context.Context, val string) context.Context

type ClientOption

type ClientOption struct {
	SelectMode ClientSelectMode
	GroupName  string
}

type ClientOptionFunc

type ClientOptionFunc func(*ClientOption)

func ClientWithGroupName

func ClientWithGroupName(groupName string) ClientOptionFunc

func ClientWithSelectMode

func ClientWithSelectMode(selectMode ClientSelectMode) ClientOptionFunc

type ClientProxy

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

func NewClientProxy

func NewClientProxy(discovery proxy.Discovery, groupName string) *ClientProxy

func (*ClientProxy) Close

func (cp *ClientProxy) Close()

func (*ClientProxy) GetClient

func (cp *ClientProxy) GetClient(ctx context.Context, name string, serviceName string, selectMode ClientSelectMode) (*Client, error)

type ClientSelectMode

type ClientSelectMode uint8
const (
	ClientSelectModeRoundRobin ClientSelectMode = iota
	ClientSelectModeHash
	ClientSelectModeSoftState
)

type Server

type Server struct {
	Ip     string
	Port   uint16
	Server *server.Server
	// contains filtered or unexported fields
}

func NewServer

func NewServer(ip string, port uint16) *Server

func (*Server) Addr

func (s *Server) Addr() (string, uint16)

func (*Server) Close

func (s *Server) Close() error

func (*Server) Run

func (s *Server) Run() error

func (*Server) SetHandler

func (s *Server) SetHandler(handler interface{}) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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