Documentation
¶
Index ¶
- Variables
- func ChickRequest(req *HugoRequest) error
- func ChickResponse(out *HugoResponse) error
- func StreamInterceptorChain(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor
- func UnaryInterceptorChain(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
- type Bar
- type Config
- type HugoRequest
- func (*HugoRequest) Descriptor() ([]byte, []int)deprecated
- func (x *HugoRequest) GetInterfaceName() string
- func (x *HugoRequest) GetMethodName() string
- func (x *HugoRequest) GetParamTypes() []string
- func (x *HugoRequest) GetParameters() []string
- func (x *HugoRequest) GetRequestId() string
- func (*HugoRequest) ProtoMessage()
- func (x *HugoRequest) ProtoReflect() protoreflect.Message
- func (x *HugoRequest) Reset()
- func (x *HugoRequest) String() string
- type HugoResponse
- func (*HugoResponse) Descriptor() ([]byte, []int)deprecated
- func (x *HugoResponse) GetCode() int32
- func (x *HugoResponse) GetData() string
- func (x *HugoResponse) GetMessage() string
- func (x *HugoResponse) GetRequestId() string
- func (*HugoResponse) ProtoMessage()
- func (x *HugoResponse) ProtoReflect() protoreflect.Message
- func (x *HugoResponse) Reset()
- func (x *HugoResponse) String() string
- type Server
Constants ¶
This section is empty.
Variables ¶
var File_jupiter_proto_hugotransmission_proto protoreflect.FileDescriptor
Functions ¶
func StreamInterceptorChain ¶
func StreamInterceptorChain(interceptors ...grpc.StreamServerInterceptor) grpc.StreamServerInterceptor
StreamInterceptorChain returns stream interceptors chain. 流拦截器链
func UnaryInterceptorChain ¶
func UnaryInterceptorChain(interceptors ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
UnaryInterceptorChain returns interceptors chain. 一元拦截器链
Types ¶
type Bar ¶
type Bar struct {
// contains filtered or unexported fields
}
func (*Bar) Descriptor
deprecated
func (*Bar) ProtoMessage ¶
func (*Bar) ProtoMessage()
func (*Bar) ProtoReflect ¶
func (x *Bar) ProtoReflect() protoreflect.Message
type Config ¶
type Config struct { Name string `properties:"brian.rpc.server.name"` Host string `properties:"brian.rpc.server.host"` Port int `properties:"brian.rpc.server.port"` // Network network type, tcp4 by default Network string `properties:"brian.rpc.server.Network"` // DisableTrace disbale Trace Interceptor, false by default //禁用跟踪器默认为true DisableTrace bool `properties:"brian.rpc.server.DisableTrace"` // DisableMetric disable Metric Interceptor, false by default //禁用监听器默认为true DisableMetric bool `properties:"brian.rpc.server.DisableMetric"` // SlowQueryThresholdInMilli, request will be colored if cost over this threshold value SlowQueryThresholdInMilli int64 `properties:"brian.rpc.server.timeout"` Weight float64 `properties:"brian.rpc.server.registry.weight"` // contains filtered or unexported fields }
*
* * Copyright (C) @2020 hugo network Co. Ltd * @description * @updateRemark * @author hugo * @updateUser * @createDate 2020/8/4 3:17 下午 * @updateDate 2020/8/4 3:17 下午 * @version 1.0
* TODO 日志需要单独处理 Grpc 的配置结构体
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig represents default config User should construct config base on DefaultConfig grpc默认的配置 用户不做调整则使用默认的配置
type HugoRequest ¶
type HugoRequest struct { //请求id RequestId string `protobuf:"bytes,1,opt,name=requestId,proto3" json:"requestId,omitempty"` //接口名称 InterfaceName string `protobuf:"bytes,2,opt,name=interfaceName,proto3" json:"interfaceName,omitempty"` //方法名称 MethodName string `protobuf:"bytes,3,opt,name=methodName,proto3" json:"methodName,omitempty"` //方法参数 repeated 定义类似集合 //map<string, Bar> parameters = 4; //参数类型 repeated 定义类似集合 //repeated string paramTypes =5; //map<string, Bar> paramTypes = 5; //方法参数 repeated 定义类似集合 Parameters []string `protobuf:"bytes,4,rep,name=parameters,proto3" json:"parameters,omitempty"` //参数类型 repeated 定义类似集合 ParamTypes []string `protobuf:"bytes,5,rep,name=paramTypes,proto3" json:"paramTypes,omitempty"` // contains filtered or unexported fields }
设置默认的请求数据传输
func (*HugoRequest) Descriptor
deprecated
func (*HugoRequest) Descriptor() ([]byte, []int)
Deprecated: Use HugoRequest.ProtoReflect.Descriptor instead.
func (*HugoRequest) GetInterfaceName ¶
func (x *HugoRequest) GetInterfaceName() string
func (*HugoRequest) GetMethodName ¶
func (x *HugoRequest) GetMethodName() string
func (*HugoRequest) GetParamTypes ¶
func (x *HugoRequest) GetParamTypes() []string
func (*HugoRequest) GetParameters ¶
func (x *HugoRequest) GetParameters() []string
func (*HugoRequest) GetRequestId ¶
func (x *HugoRequest) GetRequestId() string
func (*HugoRequest) ProtoMessage ¶
func (*HugoRequest) ProtoMessage()
func (*HugoRequest) ProtoReflect ¶
func (x *HugoRequest) ProtoReflect() protoreflect.Message
func (*HugoRequest) Reset ¶
func (x *HugoRequest) Reset()
func (*HugoRequest) String ¶
func (x *HugoRequest) String() string
type HugoResponse ¶
type HugoResponse struct { //请求id RequestId string `protobuf:"bytes,1,opt,name=requestId,proto3" json:"requestId,omitempty"` //返回的结果默认是200,成功 Code int32 `protobuf:"zigzag32,2,opt,name=code,proto3" json:"code,omitempty"` //消息默认是成功 Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` //数据默认是null Data string `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
The response message containing the greetings 设置默认的返回
func (*HugoResponse) Descriptor
deprecated
func (*HugoResponse) Descriptor() ([]byte, []int)
Deprecated: Use HugoResponse.ProtoReflect.Descriptor instead.
func (*HugoResponse) GetCode ¶
func (x *HugoResponse) GetCode() int32
func (*HugoResponse) GetData ¶
func (x *HugoResponse) GetData() string
func (*HugoResponse) GetMessage ¶
func (x *HugoResponse) GetMessage() string
func (*HugoResponse) GetRequestId ¶
func (x *HugoResponse) GetRequestId() string
func (*HugoResponse) ProtoMessage ¶
func (*HugoResponse) ProtoMessage()
func (*HugoResponse) ProtoReflect ¶
func (x *HugoResponse) ProtoReflect() protoreflect.Message
func (*HugoResponse) Reset ¶
func (x *HugoResponse) Reset()
func (*HugoResponse) String ¶
func (x *HugoResponse) String() string
type Server ¶
Server ... grpc 服务的结构体
func (*Server) GracefulStop ¶
GracefulStop implements server.Server interface it will stop grpc server gracefully 优雅的停止服务,服务接口 将优雅的停止grpc服务
func (*Server) Info ¶
func (s *Server) Info(group, cluster string) *server.ServiceInfo
Info returns server info, used by governor and consumer balancer 初始化服务信息
func (*Server) Register ¶
func (s *Server) Register(in interface{}, srv interface{})
写一个服务注册的方法 srv 服务的实现 in 服务的接口