rpc

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 11 Imported by: 4

Documentation

Index

Constants

View Source
const (
	BaseServicePath = "/im_service"
)

Variables

This section is empty.

Functions

func NewRoundRobinSelector

func NewRoundRobinSelector() client.Selector

Types

type BaseClient

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

func NewBaseClient

func NewBaseClient(options *ClientOptions) (*BaseClient, error)

func (*BaseClient) Broadcast

func (c *BaseClient) Broadcast(fn string, request, reply interface{}) error

func (*BaseClient) Call

func (c *BaseClient) Call(ctx context.Context, fn string, arg interface{}, reply interface{}) error

func (*BaseClient) Call2

func (c *BaseClient) Call2(fn string, arg interface{}, reply interface{}) error

func (*BaseClient) Close

func (c *BaseClient) Close() error

func (*BaseClient) Run

func (c *BaseClient) Run() error

type BaseServer

type BaseServer struct {
	Srv *server.Server

	Options *ServerOptions
	// contains filtered or unexported fields
}

func NewBaseServer

func NewBaseServer(options *ServerOptions) *BaseServer

func (*BaseServer) GetServerID

func (s *BaseServer) GetServerID() string

func (*BaseServer) Register

func (s *BaseServer) Register(name string, sv interface{})

func (*BaseServer) Run

func (s *BaseServer) Run() error

type Cli

type Cli interface {
	Call(ctx context.Context, fn string, request, reply interface{}) error
	Broadcast(fn string, request, reply interface{}) error
	Run() error
	Close() error
}

type ClientOptions

type ClientOptions struct {
	client.Option

	Addr        string
	Port        int
	Name        string
	EtcdServers []string
	Selector    client.Selector
}

type ExtraContext

type ExtraContext struct {
	context.Context
}

func NewContext

func NewContext() *ExtraContext

func NewContextFrom

func NewContextFrom(c context.Context) *ExtraContext

func (*ExtraContext) GetReqExtra

func (c *ExtraContext) GetReqExtra(k string) (string, bool)

func (*ExtraContext) GetResExtra

func (c *ExtraContext) GetResExtra(k string) (string, bool)

func (*ExtraContext) PutReqExtra

func (c *ExtraContext) PutReqExtra(k string, v string) *ExtraContext

func (*ExtraContext) PutResExtra

func (c *ExtraContext) PutResExtra(k string, v string) *ExtraContext

type RoundRobinSelector

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

RoundRobinSelector selects servers with roundrobin.

func (*RoundRobinSelector) Select

func (s *RoundRobinSelector) Select(ctx context.Context, servicePath, serviceMethod string, args interface{}) string

func (*RoundRobinSelector) SelectNext

func (s *RoundRobinSelector) SelectNext() string

func (*RoundRobinSelector) UpdateServer

func (s *RoundRobinSelector) UpdateServer(servers map[string]string)

type ServerOptions

type ServerOptions struct {
	Name           string
	Network        string
	Addr           string
	Port           int
	MaxRecvMsgSize int
	MaxSendMsgSize int
	EtcdServers    []string
}

Jump to

Keyboard shortcuts

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