srpc

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Overview

@Title @Description @Author Wangwengang 2023/12/10 18:54 @Update Wangwengang 2023/12/10 18:54

@Title @Description @Author Wangwengang 2023/12/11 23:34 @Update Wangwengang 2023/12/11 23:34

@Title @Description @Author Wangwengang 2023/12/12 23:12 @Update Wangwengang 2023/12/12 23:12

@Title @Description @Author Wangwengang 2023/12/12 00:08 @Update Wangwengang 2023/12/12 00:08

@Title @Description @Author Wangwengang 2023/12/12 21:43 @Update Wangwengang 2023/12/12 21:43

Index

Constants

This section is empty.

Variables

Functions

func AddRegistryPlugin

func AddRegistryPlugin(s *server.Server, rpc sconfig.RPC, service sconfig.RpcService)

func CreateServiceDiscovery

func CreateServiceDiscovery(regAddr []string, regType string, basePath string) (client.ServiceDiscovery, error)

func TODO

func TODO()

Types

type OptionSRPCClients

type OptionSRPCClients func(s *RPCXClients)

func WithFailMode

func WithFailMode(failMode client.FailMode) OptionSRPCClients

自由设置FailMode, 不设置将使用默认方法

func WithOption

func WithOption(option client.Option) OptionSRPCClients

自由设置Option, 不设置将使用默认方法

func WithSelectMode

func WithSelectMode(selectMode client.SelectMode) OptionSRPCClients

自由设置SelectMode, 不设置将使用默认方法

type RPCXClients

type RPCXClients struct {
	FailMode   client.FailMode
	SelectMode client.SelectMode
	Option     client.Option
	// contains filtered or unexported fields
}

func NewSRPCClients

func NewSRPCClients(config *sconfig.RPC, opts ...OptionSRPCClients) *RPCXClients

func (*RPCXClients) GetReq

func (s *RPCXClients) GetReq(servicePath string, serviceMethod string) *protocol.Message

func (*RPCXClients) GetXClient

func (s *RPCXClients) GetXClient(servicePath string) (xc client.XClient, err error)

func (*RPCXClients) Oneshot added in v0.1.5

func (s *RPCXClients) Oneshot(ctx context.Context, servicePath string, serviceMethod string, args interface{}) (err error)

func (*RPCXClients) RPC

func (s *RPCXClients) RPC(ctx context.Context, servicePath string, serviceMethod string, payload []byte, serializeType protocol.SerializeType, oneway bool) (meta map[string]string, resp []byte, err error)

func (*RPCXClients) RPC2

func (s *RPCXClients) RPC2(ctx context.Context, servicePath string, serviceMethod string, args interface{}, reply interface{}) (err error)

func (*RPCXClients) RPCJson

func (s *RPCXClients) RPCJson(ctx context.Context, servicePath string, serviceMethod string, payload []byte) (meta map[string]string, resp []byte, err error)

func (*RPCXClients) RPCProtobuf

func (s *RPCXClients) RPCProtobuf(ctx context.Context, servicePath string, serviceMethod string, payload []byte) (meta map[string]string, resp []byte, err error)

type SRPC

type SRPC interface {
	GetReq(servicePath string, serviceMethod string) *protocol.Message
	RPC(ctx context.Context, servicePath string, serviceMethod string, payload []byte, serializeType protocol.SerializeType, oneway bool) (meta map[string]string, resp []byte, err error)
	RPC2(ctx context.Context, servicePath string, serviceMethod string, args interface{}, reply interface{}) (err error)
	Oneshot(ctx context.Context, servicePath string, serviceMethod string, args interface{}) (err error)
	RPCProtobuf(ctx context.Context, servicePath string, serviceMethod string, payload []byte) (meta map[string]string, resp []byte, err error)
	RPCJson(ctx context.Context, servicePath string, serviceMethod string, payload []byte) (meta map[string]string, resp []byte, err error)
	GetXClient(servicePath string) (xc client.XClient, err error)
}

type SRPCServer

type SRPCServer interface {
	RegisterName(name string, rcvr interface{}, metadata string) error
	Serve(network, address string) (err error)
}

Jump to

Keyboard shortcuts

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