Documentation ¶
Overview ¶
Package pb is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterTegenariaServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterTegenariaServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TegenariaServiceClient) error
- func RegisterTegenariaServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterTegenariaServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TegenariaServiceServer) error
- func RegisterTegenariaServiceServer(s grpc.ServiceRegistrar, srv TegenariaServiceServer)
- type ResponseMessage
- func (*ResponseMessage) Descriptor() ([]byte, []int)deprecated
- func (x *ResponseMessage) GetCode() int32
- func (x *ResponseMessage) GetData() *structpb.Struct
- func (x *ResponseMessage) GetMsg() string
- func (*ResponseMessage) ProtoMessage()
- func (x *ResponseMessage) ProtoReflect() protoreflect.Message
- func (x *ResponseMessage) Reset()
- func (x *ResponseMessage) String() string
- type ResponseStatus
- func (ResponseStatus) Descriptor() protoreflect.EnumDescriptor
- func (x ResponseStatus) Enum() *ResponseStatus
- func (ResponseStatus) EnumDescriptor() ([]byte, []int)deprecated
- func (x ResponseStatus) Number() protoreflect.EnumNumber
- func (x ResponseStatus) String() string
- func (ResponseStatus) Type() protoreflect.EnumType
- type StatusContorlRequest
- func (*StatusContorlRequest) Descriptor() ([]byte, []int)deprecated
- func (x *StatusContorlRequest) GetSpiderName() string
- func (x *StatusContorlRequest) GetStatus() TegenariaStatus
- func (*StatusContorlRequest) ProtoMessage()
- func (x *StatusContorlRequest) ProtoReflect() protoreflect.Message
- func (x *StatusContorlRequest) Reset()
- func (x *StatusContorlRequest) String() string
- type TegenariaServiceClient
- type TegenariaServiceServer
- type TegenariaStatus
- func (TegenariaStatus) Descriptor() protoreflect.EnumDescriptor
- func (x TegenariaStatus) Enum() *TegenariaStatus
- func (TegenariaStatus) EnumDescriptor() ([]byte, []int)deprecated
- func (x TegenariaStatus) Number() protoreflect.EnumNumber
- func (x TegenariaStatus) String() string
- func (TegenariaStatus) Type() protoreflect.EnumType
- type TegenariaStatusMessage
- func (*TegenariaStatusMessage) Descriptor() ([]byte, []int)deprecated
- func (x *TegenariaStatusMessage) GetDuration() float64
- func (x *TegenariaStatusMessage) GetMetrics() map[string]uint64
- func (x *TegenariaStatusMessage) GetSpiderName() string
- func (x *TegenariaStatusMessage) GetStartAt() string
- func (x *TegenariaStatusMessage) GetStatus() string
- func (x *TegenariaStatusMessage) GetStopAt() string
- func (*TegenariaStatusMessage) ProtoMessage()
- func (x *TegenariaStatusMessage) ProtoReflect() protoreflect.Message
- func (x *TegenariaStatusMessage) Reset()
- func (x *TegenariaStatusMessage) String() string
- type UnimplementedTegenariaServiceServer
- type UnsafeTegenariaServiceServer
Constants ¶
const ( TegenariaService_SetStatus_FullMethodName = "/pb.TegenariaService/SetStatus" TegenariaService_GetStatus_FullMethodName = "/pb.TegenariaService/GetStatus" )
Variables ¶
var ( ResponseStatus_name = map[int32]string{ 0: "UNKNOWN", 1000: "OK", 5000: "UNKNOWN_ERROR", 50001: "NOT_FOUND_SPIDER", } ResponseStatus_value = map[string]int32{ "UNKNOWN": 0, "OK": 1000, "UNKNOWN_ERROR": 5000, "NOT_FOUND_SPIDER": 50001, } )
Enum value maps for ResponseStatus.
var ( TegenariaStatus_name = map[int32]string{ 0: "ON_START", 1: "ON_STOP", 2: "ON_PAUSE", } TegenariaStatus_value = map[string]int32{ "ON_START": 0, "ON_STOP": 1, "ON_PAUSE": 2, } )
Enum value maps for TegenariaStatus.
var File_service_proto protoreflect.FileDescriptor
var TegenariaService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "pb.TegenariaService", HandlerType: (*TegenariaServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "SetStatus", Handler: _TegenariaService_SetStatus_Handler, }, { MethodName: "GetStatus", Handler: _TegenariaService_GetStatus_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "service.proto", }
TegenariaService_ServiceDesc is the grpc.ServiceDesc for TegenariaService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterTegenariaServiceHandler ¶
func RegisterTegenariaServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterTegenariaServiceHandler registers the http handlers for service TegenariaService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterTegenariaServiceHandlerClient ¶
func RegisterTegenariaServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TegenariaServiceClient) error
RegisterTegenariaServiceHandlerClient registers the http handlers for service TegenariaService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TegenariaServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TegenariaServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "TegenariaServiceClient" to call the correct interceptors.
func RegisterTegenariaServiceHandlerFromEndpoint ¶
func RegisterTegenariaServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterTegenariaServiceHandlerFromEndpoint is same as RegisterTegenariaServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterTegenariaServiceHandlerServer ¶
func RegisterTegenariaServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TegenariaServiceServer) error
RegisterTegenariaServiceHandlerServer registers the http handlers for service TegenariaService to "mux". UnaryRPC :call TegenariaServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterTegenariaServiceHandlerFromEndpoint instead.
func RegisterTegenariaServiceServer ¶
func RegisterTegenariaServiceServer(s grpc.ServiceRegistrar, srv TegenariaServiceServer)
Types ¶
type ResponseMessage ¶
type ResponseMessage struct { // @gotags: json:"code" Code int32 `protobuf:"varint,1,opt,name=Code,json=code,proto3" json:"code"` // @gotags: json:"msg" Msg string `protobuf:"bytes,2,opt,name=Msg,json=msg,proto3" json:"msg"` // @gotags: json:"data" Data *structpb.Struct `protobuf:"bytes,3,opt,name=Data,json=data,proto3" json:"data"` // contains filtered or unexported fields }
func (*ResponseMessage) Descriptor
deprecated
func (*ResponseMessage) Descriptor() ([]byte, []int)
Deprecated: Use ResponseMessage.ProtoReflect.Descriptor instead.
func (*ResponseMessage) GetCode ¶
func (x *ResponseMessage) GetCode() int32
func (*ResponseMessage) GetData ¶
func (x *ResponseMessage) GetData() *structpb.Struct
func (*ResponseMessage) GetMsg ¶
func (x *ResponseMessage) GetMsg() string
func (*ResponseMessage) ProtoMessage ¶
func (*ResponseMessage) ProtoMessage()
func (*ResponseMessage) ProtoReflect ¶
func (x *ResponseMessage) ProtoReflect() protoreflect.Message
func (*ResponseMessage) Reset ¶
func (x *ResponseMessage) Reset()
func (*ResponseMessage) String ¶
func (x *ResponseMessage) String() string
type ResponseStatus ¶
type ResponseStatus int32
const ( ResponseStatus_UNKNOWN ResponseStatus = 0 ResponseStatus_OK ResponseStatus = 1000 ResponseStatus_UNKNOWN_ERROR ResponseStatus = 5000 ResponseStatus_NOT_FOUND_SPIDER ResponseStatus = 50001 )
func (ResponseStatus) Descriptor ¶
func (ResponseStatus) Descriptor() protoreflect.EnumDescriptor
func (ResponseStatus) Enum ¶
func (x ResponseStatus) Enum() *ResponseStatus
func (ResponseStatus) EnumDescriptor
deprecated
func (ResponseStatus) EnumDescriptor() ([]byte, []int)
Deprecated: Use ResponseStatus.Descriptor instead.
func (ResponseStatus) Number ¶
func (x ResponseStatus) Number() protoreflect.EnumNumber
func (ResponseStatus) String ¶
func (x ResponseStatus) String() string
func (ResponseStatus) Type ¶
func (ResponseStatus) Type() protoreflect.EnumType
type StatusContorlRequest ¶
type StatusContorlRequest struct { // @inject_tag: json:"status" Status TegenariaStatus `protobuf:"varint,1,opt,name=Status,json=status,proto3,enum=pb.TegenariaStatus" json:"status"` // @inject_tag: json:"spider_name" SpiderName string `protobuf:"bytes,2,opt,name=SpiderName,json=spider_name,proto3" json:"spider_name"` // contains filtered or unexported fields }
func (*StatusContorlRequest) Descriptor
deprecated
func (*StatusContorlRequest) Descriptor() ([]byte, []int)
Deprecated: Use StatusContorlRequest.ProtoReflect.Descriptor instead.
func (*StatusContorlRequest) GetSpiderName ¶
func (x *StatusContorlRequest) GetSpiderName() string
func (*StatusContorlRequest) GetStatus ¶
func (x *StatusContorlRequest) GetStatus() TegenariaStatus
func (*StatusContorlRequest) ProtoMessage ¶
func (*StatusContorlRequest) ProtoMessage()
func (*StatusContorlRequest) ProtoReflect ¶
func (x *StatusContorlRequest) ProtoReflect() protoreflect.Message
func (*StatusContorlRequest) Reset ¶
func (x *StatusContorlRequest) Reset()
func (*StatusContorlRequest) String ¶
func (x *StatusContorlRequest) String() string
type TegenariaServiceClient ¶
type TegenariaServiceClient interface { SetStatus(ctx context.Context, in *StatusContorlRequest, opts ...grpc.CallOption) (*ResponseMessage, error) GetStatus(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ResponseMessage, error) }
TegenariaServiceClient is the client API for TegenariaService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewTegenariaServiceClient ¶
func NewTegenariaServiceClient(cc grpc.ClientConnInterface) TegenariaServiceClient
type TegenariaServiceServer ¶
type TegenariaServiceServer interface { SetStatus(context.Context, *StatusContorlRequest) (*ResponseMessage, error) GetStatus(context.Context, *emptypb.Empty) (*ResponseMessage, error) // contains filtered or unexported methods }
TegenariaServiceServer is the server API for TegenariaService service. All implementations must embed UnimplementedTegenariaServiceServer for forward compatibility
type TegenariaStatus ¶
type TegenariaStatus int32
const ( TegenariaStatus_ON_START TegenariaStatus = 0 TegenariaStatus_ON_STOP TegenariaStatus = 1 TegenariaStatus_ON_PAUSE TegenariaStatus = 2 )
func (TegenariaStatus) Descriptor ¶
func (TegenariaStatus) Descriptor() protoreflect.EnumDescriptor
func (TegenariaStatus) Enum ¶
func (x TegenariaStatus) Enum() *TegenariaStatus
func (TegenariaStatus) EnumDescriptor
deprecated
func (TegenariaStatus) EnumDescriptor() ([]byte, []int)
Deprecated: Use TegenariaStatus.Descriptor instead.
func (TegenariaStatus) Number ¶
func (x TegenariaStatus) Number() protoreflect.EnumNumber
func (TegenariaStatus) String ¶
func (x TegenariaStatus) String() string
func (TegenariaStatus) Type ¶
func (TegenariaStatus) Type() protoreflect.EnumType
type TegenariaStatusMessage ¶
type TegenariaStatusMessage struct { // @inject_tag: json:"status" Status string `protobuf:"bytes,1,opt,name=Status,proto3" json:"status"` // @inject_tag: json:"start_at" StartAt string `protobuf:"bytes,2,opt,name=StartAt,proto3" json:"start_at"` // @inject_tag: json:"stop_at" StopAt string `protobuf:"bytes,3,opt,name=StopAt,proto3" json:"stop_at"` // @inject_tag: json:"duration" Duration float64 `protobuf:"fixed64,4,opt,name=Duration,proto3" json:"duration"` // @inject_tag: json:"metrics" Metrics map[string]uint64 `` /* 146-byte string literal not displayed */ // @inject_tag: json:"spider_name" SpiderName string `protobuf:"bytes,6,opt,name=SpiderName,proto3" json:"spider_name"` // contains filtered or unexported fields }
func (*TegenariaStatusMessage) Descriptor
deprecated
func (*TegenariaStatusMessage) Descriptor() ([]byte, []int)
Deprecated: Use TegenariaStatusMessage.ProtoReflect.Descriptor instead.
func (*TegenariaStatusMessage) GetDuration ¶
func (x *TegenariaStatusMessage) GetDuration() float64
func (*TegenariaStatusMessage) GetMetrics ¶
func (x *TegenariaStatusMessage) GetMetrics() map[string]uint64
func (*TegenariaStatusMessage) GetSpiderName ¶
func (x *TegenariaStatusMessage) GetSpiderName() string
func (*TegenariaStatusMessage) GetStartAt ¶
func (x *TegenariaStatusMessage) GetStartAt() string
func (*TegenariaStatusMessage) GetStatus ¶
func (x *TegenariaStatusMessage) GetStatus() string
func (*TegenariaStatusMessage) GetStopAt ¶
func (x *TegenariaStatusMessage) GetStopAt() string
func (*TegenariaStatusMessage) ProtoMessage ¶
func (*TegenariaStatusMessage) ProtoMessage()
func (*TegenariaStatusMessage) ProtoReflect ¶
func (x *TegenariaStatusMessage) ProtoReflect() protoreflect.Message
func (*TegenariaStatusMessage) Reset ¶
func (x *TegenariaStatusMessage) Reset()
func (*TegenariaStatusMessage) String ¶
func (x *TegenariaStatusMessage) String() string
type UnimplementedTegenariaServiceServer ¶
type UnimplementedTegenariaServiceServer struct { }
UnimplementedTegenariaServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedTegenariaServiceServer) GetStatus ¶
func (UnimplementedTegenariaServiceServer) GetStatus(context.Context, *emptypb.Empty) (*ResponseMessage, error)
func (UnimplementedTegenariaServiceServer) SetStatus ¶
func (UnimplementedTegenariaServiceServer) SetStatus(context.Context, *StatusContorlRequest) (*ResponseMessage, error)
type UnsafeTegenariaServiceServer ¶
type UnsafeTegenariaServiceServer interface {
// contains filtered or unexported methods
}
UnsafeTegenariaServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to TegenariaServiceServer will result in compilation errors.