pb

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	TegenariaService_SetStatus_FullMethodName = "/pb.TegenariaService/SetStatus"
	TegenariaService_GetStatus_FullMethodName = "/pb.TegenariaService/GetStatus"
)

Variables

View Source
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.

View Source
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.

View Source
var File_service_proto protoreflect.FileDescriptor
View Source
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) Enum

func (x ResponseStatus) Enum() *ResponseStatus

func (ResponseStatus) EnumDescriptor deprecated

func (ResponseStatus) EnumDescriptor() ([]byte, []int)

Deprecated: Use ResponseStatus.Descriptor instead.

func (ResponseStatus) Number

func (ResponseStatus) String

func (x ResponseStatus) String() string

func (ResponseStatus) Type

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.

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) Enum

func (x TegenariaStatus) Enum() *TegenariaStatus

func (TegenariaStatus) EnumDescriptor deprecated

func (TegenariaStatus) EnumDescriptor() ([]byte, []int)

Deprecated: Use TegenariaStatus.Descriptor instead.

func (TegenariaStatus) Number

func (TegenariaStatus) String

func (x TegenariaStatus) String() string

func (TegenariaStatus) Type

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) SetStatus

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.

Jump to

Keyboard shortcuts

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