remote

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

README

Rpc

功能

  • 远程调用相关

Grpc

  • 编译
  • protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative rp_service.proto

小测

  • 13k/qps

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GrpcClient

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

func (*GrpcClient) InvokeAllRemoteRpc

func (s *GrpcClient) InvokeAllRemoteRpc(addr []string, bytes []byte)

func (*GrpcClient) InvokeRemoteRpc

func (s *GrpcClient) InvokeRemoteRpc(addr string, rpcInfo *protof.RpcInfo) []byte

type GrpcServer

type GrpcServer struct {
	protof.RpcServiceServer
	// contains filtered or unexported fields
}

func (*GrpcServer) CallbackResult

func (s *GrpcServer) CallbackResult(f func(in *protof.RpcInfo) []byte)

func (*GrpcServer) InvokeRemoteFunc

func (s *GrpcServer) InvokeRemoteFunc(ctx context.Context, in *protof.RpcInfo) (*protof.RpcInfo, error)

InvokeRemoteFunc 此处由Grpc客户端调用

func (*GrpcServer) ListenAddr

func (s *GrpcServer) ListenAddr(addr string)

type RpcClient

type RpcClient interface {
	// InvokeAllRemoteRpc  只发送,不确认返回.
	InvokeAllRemoteRpc([]string, []byte)
	// InvokeRemoteRpc  Invoke remote method
	InvokeRemoteRpc(addr string, rpcInfo *protof.RpcInfo) []byte
}

RpcClient 远程调用接口,你可以随意实现自己的远程调用!

type RpcServer

type RpcServer interface {
	// CallbackResult 注册函数获取结果
	CallbackResult(func(in *protof.RpcInfo) []byte)
	// ListenAddr 监听地址
	ListenAddr(addr string)
}

Jump to

Keyboard shortcuts

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