Documentation
¶
Index ¶
- Constants
- func DeregisterClient(name string)
- func DeregisterServer(name string)
- func IsIpPortAddr(addr string) (ip string, port int, ok bool)
- func NewBuilder() container.StandardBuilder
- func RegisterClient(resolver ClientResover)
- func RegisterServer(resolver ServerResolver)
- type BidirectionalStreamClient
- type BidirectionalStreamProcessor
- type BidirectionalStreamRequest
- type Body
- type Client
- type ClientResover
- type ClientStreamChan
- type ClientStreamClient
- type ClientStreamObjects
- type ClientStreamProcessor
- type ClientStreamRequest
- type Config
- type DefaultProcessor
- type Options
- type RequestOption
- func MaxCallRecvMsgSize(size int) RequestOption
- func MaxCallSendMsgSize(size int) RequestOption
- func WithContentType(contentType string) RequestOption
- func WithHeaders(header map[string]string) RequestOption
- func WithMethod(method string) RequestOption
- func WithQuery(query string) RequestOption
- func WithSourceName() RequestOption
- func WithStreamDefaultProcessor() RequestOption
- func WithStreamProcessor(processor any) RequestOption
- func WithWaitForReady(waitForReady bool) RequestOption
- func WithXRequestID(requestID string) RequestOption
- type Server
- type ServerResolver
- type ServerStreamClient
- type ServerStreamProcessor
- type ServerStreamRequest
- type StandardRPC
- type StreamRecvOptions
- type StreamRevcOption
- type StreamType
- type StreamUnmarshaler
Constants ¶
const TypeNode = "rpcs"
Variables ¶
This section is empty.
Functions ¶
func NewBuilder ¶
func NewBuilder() container.StandardBuilder
func RegisterClient ¶ added in v0.3.0
func RegisterClient(resolver ClientResover)
Register 注册配置文件适配器
func RegisterServer ¶ added in v0.3.0
func RegisterServer(resolver ServerResolver)
Register 注册配置文件适配器
Types ¶
type BidirectionalStreamClient ¶ added in v0.7.9
type BidirectionalStreamClient interface { ClientStreamRequest ServerStreamRequest CloseSend() error }
BidirectionalStreamClient is an interface that represents a bidirectional stream client.
type BidirectionalStreamProcessor ¶ added in v0.7.9
type BidirectionalStreamProcessor func(BidirectionalStreamClient) error
BidirectionalStreamProcessor is a callback function that can be used to process a bidirectional stream.
type BidirectionalStreamRequest ¶ added in v0.7.9
type BidirectionalStreamRequest interface { ClientStreamRequest ServerStreamRequest }
StreamRequest is an interface that represents a stream request.
type Body ¶
func NewEmptyBody ¶ added in v0.7.9
func NewEmptyBody() Body
NewEmptyBody returns an empty body object.
type ClientResover ¶ added in v0.3.0
type ClientResover interface { Name() string Resolve(name string, setting config.Config) (Client, error) }
ClientResover 定义配置文件转换方法
type ClientStreamChan ¶ added in v0.7.12
type ClientStreamChan interface {
GetObject() <-chan any
}
ClientStreamChan 客户端流通道接口
type ClientStreamClient ¶ added in v0.7.9
ClientStreamClient is an interface that represents a stream client.
type ClientStreamObjects ¶ added in v0.7.12
type ClientStreamObjects interface {
GetObjects() []any
}
ClientStreamObjects 客户端流对象接口
type ClientStreamProcessor ¶ added in v0.7.9
type ClientStreamProcessor func(ClientStreamClient) (err error)
ClientStreamProcessor is a callback function that can be used to process a stream client.
func BuildDefaultClientStreamProcess ¶ added in v0.7.12
func BuildDefaultClientStreamProcess(input any) (processor ClientStreamProcessor, err error)
BuildDefaultClientStreamProcess 构建默认的客户端流处理器
type ClientStreamRequest ¶ added in v0.7.9
type ClientStreamRequest interface {
Recv(obj any, opts ...StreamRevcOption) (closed bool, err error)
}
ClientStreamRequest is an interface that represents a client stream request.
type DefaultProcessor ¶ added in v0.7.12
type DefaultProcessor struct{}
DefaultProcessor is a default implementation of StreamProcessor.
type Options ¶
type Options struct { Header xtypes.SMap // 请求头 Method string // 请求方法 Query string // 请求参数 WaitForReady bool // 是否等待服务端响应 MaxCallRecvMsgSize int // 最大接收消息体大小,默认4M(maximum message size in bytes the client can receive) MaxCallSendMsgSize int // 最大发送消息体大小,默认4M(maximum message size in bytes the client can send) StreamProcessor any // 是否使用流传输 }
type RequestOption ¶
type RequestOption func(*Options)
func MaxCallRecvMsgSize ¶ added in v0.7.9
func MaxCallRecvMsgSize(size int) RequestOption
MaxCallRecvMsgSize
func MaxCallSendMsgSize ¶ added in v0.7.9
func MaxCallSendMsgSize(size int) RequestOption
MaxCallSendMsgSize
func WithContentType ¶
func WithContentType(contentType string) RequestOption
WithContentType 设置请求内容类型
func WithStreamDefaultProcessor ¶ added in v0.7.12
func WithStreamDefaultProcessor() RequestOption
WithStreamDefaultProcessor 设置使用默认流传输
func WithStreamProcessor ¶ added in v0.7.9
func WithStreamProcessor(processor any) RequestOption
WithStreamProcessor 设置使用流传输
func WithWaitForReady ¶
func WithWaitForReady(waitForReady bool) RequestOption
WithWaitForReady 设置是否等待服务端响应
type Server ¶ added in v0.3.0
type ServerResolver ¶ added in v0.7.1
type ServerResolver interface { Name() string Resolve(name string, router *engine.RouterGroup, cfg config.Config, opts ...engine.Option) (Server, error) }
ServerResover 定义配置文件转换方法
type ServerStreamClient ¶ added in v0.7.9
type ServerStreamClient interface {
Recv(obj any, opts ...StreamRevcOption) (closed bool, err error)
}
ServerStreamClient is an interface that represents a stream server.
type ServerStreamProcessor ¶ added in v0.7.9
type ServerStreamProcessor func(ServerStreamClient) (err error)
ServerStreamProcessor is a callback function that can be used to process a stream server.
type ServerStreamRequest ¶ added in v0.7.9
ServerStreamRequest is an interface that represents a server stream request.
type StandardRPC ¶
type StreamRecvOptions ¶ added in v0.7.9
type StreamRecvOptions struct {
Unmarshal StreamUnmarshaler
}
StreamRecvOptions is a struct that contains options for receiving messages.
type StreamRevcOption ¶ added in v0.7.9
type StreamRevcOption func(*StreamRecvOptions)
StreamRevcOption is a function that sets an option for receiving messages.
func WithStreamUnmarshal ¶ added in v0.7.9
func WithStreamUnmarshal(callback StreamUnmarshaler) StreamRevcOption
WithStreamUnmarshal sets the callback function to unmarshal a received message.
type StreamType ¶ added in v0.7.9
type StreamType int
StreamType is the type of stream.
const ( UnknownStream StreamType = 0 BidirectionalStream StreamType = 1 ClientStream StreamType = 2 ServerStream StreamType = 3 )
type StreamUnmarshaler ¶ added in v0.7.9
StreamUnmarshaler is a callback function that can be used to unmarshal a received message.