grpc_util

package
v0.0.0-...-11651c4 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2018 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package grpc_util is a generated protocol buffer package.

It is generated from these files:

rpc_metadata.proto

It has these top-level messages:

RpcMetadata

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BizAuthfunc

func BizAuthfunc(ctx context.Context) (context.Context, error)

func BizStreamRecoveryHandler

func BizStreamRecoveryHandler(stream grpc.ServerStream, p interface{}) (err error)

func BizUnaryRecoveryHandler

func BizUnaryRecoveryHandler(ctx context.Context, p interface{}) (err error)

func BizUnaryRecoveryHandler2

func BizUnaryRecoveryHandler2(ctx context.Context, p interface{}) (err error)

func NewMessageByName

func NewMessageByName(mname string) (proto.Message, error)

func NewRPCClientByServiceDiscovery

func NewRPCClientByServiceDiscovery(discovery *service_discovery.ServiceDiscoveryClientConfig) (c *grpc.ClientConn, err error)

func RpcErrorFromMD

func RpcErrorFromMD(md metadata.MD) (rpcErr *mtproto.TLRpcError)

Server To Client

func RpcErrorToMD

func RpcErrorToMD(md *mtproto.TLRpcError) (metadata.MD, error)

func RpcMetadataToOutgoing

func RpcMetadataToOutgoing(ctx context.Context, md *RpcMetadata) (context.Context, error)

Types

type RPCClient

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

func NewRPCClient

func NewRPCClient(discovery *service_discovery.ServiceDiscoveryClientConfig) (c *RPCClient, err error)

func (*RPCClient) GetClientConn

func (c *RPCClient) GetClientConn() *grpc.ClientConn

func (*RPCClient) Invoke

func (c *RPCClient) Invoke(rpcMetaData *RpcMetadata, object mtproto.TLObject) (mtproto.TLObject, error)

通用grpc转发器

type RPCServer

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

func (*RPCServer) Serve

func (s *RPCServer) Serve(regFunc RegisterRPCServerFunc)

func (*RPCServer) Stop

func (s *RPCServer) Stop()

type RegisterRPCServerFunc

type RegisterRPCServerFunc func(s *grpc.Server)

type func RegisterRPCServerHandler(s *grpc.Server)

type RpcMetadata

type RpcMetadata struct {
	ServerId        int32  `protobuf:"varint,1,opt,name=server_id,json=serverId" json:"server_id,omitempty"`
	NetlibSessionId int64  `protobuf:"varint,2,opt,name=netlib_session_id,json=netlibSessionId" json:"netlib_session_id,omitempty"`
	ClientAddr      string `protobuf:"bytes,3,opt,name=client_addr,json=clientAddr" json:"client_addr,omitempty"`
	AuthId          int64  `protobuf:"varint,4,opt,name=auth_id,json=authId" json:"auth_id,omitempty"`
	SessionId       int64  `protobuf:"varint,5,opt,name=session_id,json=sessionId" json:"session_id,omitempty"`
	TraceId         int64  `protobuf:"varint,6,opt,name=trace_id,json=traceId" json:"trace_id,omitempty"`
	SpanId          int64  `protobuf:"varint,7,opt,name=span_id,json=spanId" json:"span_id,omitempty"`
	ReceiveTime     int64  `protobuf:"varint,8,opt,name=receive_time,json=receiveTime" json:"receive_time,omitempty"`
	From            string `protobuf:"bytes,9,opt,name=from" json:"from,omitempty"`
	To              string `protobuf:"bytes,10,opt,name=to" json:"to,omitempty"`
	// 用户ID
	UserId      int32 `protobuf:"varint,11,opt,name=user_id,json=userId" json:"user_id,omitempty"`
	ClientMsgId int64 `protobuf:"varint,12,opt,name=client_msg_id,json=clientMsgId" json:"client_msg_id,omitempty"`
	// mtproto
	Layer int32 `protobuf:"varint,13,opt,name=layer" json:"layer,omitempty"`
	// extend
	Extend *google_protobuf.Any `protobuf:"bytes,15,opt,name=extend" json:"extend,omitempty"`
}

func RpcMetadataFromIncoming

func RpcMetadataFromIncoming(ctx context.Context) *RpcMetadata

func RpcMetadataFromMD

func RpcMetadataFromMD(md metadata.MD) (*RpcMetadata, error)

func (*RpcMetadata) Descriptor

func (*RpcMetadata) Descriptor() ([]byte, []int)

func (*RpcMetadata) GetAuthId

func (m *RpcMetadata) GetAuthId() int64

func (*RpcMetadata) GetClientAddr

func (m *RpcMetadata) GetClientAddr() string

func (*RpcMetadata) GetClientMsgId

func (m *RpcMetadata) GetClientMsgId() int64

func (*RpcMetadata) GetExtend

func (m *RpcMetadata) GetExtend() *google_protobuf.Any

func (*RpcMetadata) GetFrom

func (m *RpcMetadata) GetFrom() string

func (*RpcMetadata) GetLayer

func (m *RpcMetadata) GetLayer() int32

func (*RpcMetadata) GetNetlibSessionId

func (m *RpcMetadata) GetNetlibSessionId() int64

func (*RpcMetadata) GetReceiveTime

func (m *RpcMetadata) GetReceiveTime() int64

func (*RpcMetadata) GetServerId

func (m *RpcMetadata) GetServerId() int32

func (*RpcMetadata) GetSessionId

func (m *RpcMetadata) GetSessionId() int64

func (*RpcMetadata) GetSpanId

func (m *RpcMetadata) GetSpanId() int64

func (*RpcMetadata) GetTo

func (m *RpcMetadata) GetTo() string

func (*RpcMetadata) GetTraceId

func (m *RpcMetadata) GetTraceId() int64

func (*RpcMetadata) GetUserId

func (m *RpcMetadata) GetUserId() int32

func (*RpcMetadata) ProtoMessage

func (*RpcMetadata) ProtoMessage()

func (*RpcMetadata) Reset

func (m *RpcMetadata) Reset()

func (*RpcMetadata) String

func (m *RpcMetadata) String() string

Directories

Path Synopsis
middleware
examples/zproto
Package zproto is a generated protocol buffer package.
Package zproto is a generated protocol buffer package.
recovery2
helper recovery, RecoveryHandlerFunc spit UnaryRecoveryHandlerFunc and StreamRecoveryHandlerFunc
helper recovery, RecoveryHandlerFunc spit UnaryRecoveryHandlerFunc and StreamRecoveryHandlerFunc
examples/proto
Package proto is a generated protocol buffer package.
Package proto is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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