crawler

package
v0.0.0-...-caa0154 Latest Latest
Warning

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

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

Documentation

Overview

Package crawler is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var CrawlerMaster_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "CrawlerMaster",
	HandlerType: (*CrawlerMasterServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "AddResource",
			Handler:    _CrawlerMaster_AddResource_Handler,
		},
		{
			MethodName: "DeleteResource",
			Handler:    _CrawlerMaster_DeleteResource_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "crawler.proto",
}

CrawlerMaster_ServiceDesc is the grpc.ServiceDesc for CrawlerMaster service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_crawler_proto protoreflect.FileDescriptor

Functions

func RegisterCrawlerMasterGw

func RegisterCrawlerMasterGw(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterCrawlerMasterGw registers the http handlers for service CrawlerMaster to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterCrawlerMasterGwClient

func RegisterCrawlerMasterGwClient(ctx context.Context, mux *runtime.ServeMux, client CrawlerMasterClient) error

RegisterCrawlerMasterGwClient registers the http handlers for service CrawlerMaster to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "CrawlerMasterClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CrawlerMasterClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "CrawlerMasterClient" to call the correct interceptors.

func RegisterCrawlerMasterGwFromEndpoint

func RegisterCrawlerMasterGwFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterCrawlerMasterGwFromEndpoint is same as RegisterCrawlerMasterGw but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterCrawlerMasterGwServer

func RegisterCrawlerMasterGwServer(ctx context.Context, mux *runtime.ServeMux, server CrawlerMasterServer) error

RegisterCrawlerMasterGwServer registers the http handlers for service CrawlerMaster to "mux". UnaryRPC :call CrawlerMasterServer 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 RegisterCrawlerMasterGwFromEndpoint instead.

func RegisterCrawlerMasterHandler

func RegisterCrawlerMasterHandler(s server.Server, hdlr CrawlerMasterHandler, opts ...server.HandlerOption) error

func RegisterCrawlerMasterServer

func RegisterCrawlerMasterServer(s grpc.ServiceRegistrar, srv CrawlerMasterServer)

Types

type CrawlerMasterClient

type CrawlerMasterClient interface {
	AddResource(ctx context.Context, in *ResourceSpec, opts ...grpc.CallOption) (*NodeSpec, error)
	DeleteResource(ctx context.Context, in *ResourceSpec, opts ...grpc.CallOption) (*empty.Empty, error)
}

CrawlerMasterClient is the client API for CrawlerMaster 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 CrawlerMasterHandler

type CrawlerMasterHandler interface {
	AddResource(context.Context, *ResourceSpec, *NodeSpec) error
	DeleteResource(context.Context, *ResourceSpec, *empty.Empty) error
}

type CrawlerMasterServer

type CrawlerMasterServer interface {
	AddResource(context.Context, *ResourceSpec) (*NodeSpec, error)
	DeleteResource(context.Context, *ResourceSpec) (*empty.Empty, error)
	// contains filtered or unexported methods
}

CrawlerMasterServer is the server API for CrawlerMaster service. All implementations must embed UnimplementedCrawlerMasterServer for forward compatibility

type CrawlerMasterService

type CrawlerMasterService interface {
	AddResource(ctx context.Context, in *ResourceSpec, opts ...client.CallOption) (*NodeSpec, error)
	DeleteResource(ctx context.Context, in *ResourceSpec, opts ...client.CallOption) (*empty.Empty, error)
}

func NewCrawlerMasterService

func NewCrawlerMasterService(name string, c client.Client) CrawlerMasterService

type NodeSpec

type NodeSpec struct {
	Id      string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Address string `protobuf:"bytes,2,opt,name=Address,proto3" json:"Address,omitempty"`
	// contains filtered or unexported fields
}

func (*NodeSpec) Descriptor deprecated

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

Deprecated: Use NodeSpec.ProtoReflect.Descriptor instead.

func (*NodeSpec) GetAddress

func (x *NodeSpec) GetAddress() string

func (*NodeSpec) GetId

func (x *NodeSpec) GetId() string

func (*NodeSpec) ProtoMessage

func (*NodeSpec) ProtoMessage()

func (*NodeSpec) ProtoReflect

func (x *NodeSpec) ProtoReflect() protoreflect.Message

func (*NodeSpec) Reset

func (x *NodeSpec) Reset()

func (*NodeSpec) String

func (x *NodeSpec) String() string

type ResourceSpec

type ResourceSpec struct {
	Id           string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Name         string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	AssignedNode string `protobuf:"bytes,3,opt,name=assigned_node,json=assignedNode,proto3" json:"assigned_node,omitempty"`
	CreationTime int64  `protobuf:"varint,4,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty"`
	// contains filtered or unexported fields
}

func (*ResourceSpec) Descriptor deprecated

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

Deprecated: Use ResourceSpec.ProtoReflect.Descriptor instead.

func (*ResourceSpec) GetAssignedNode

func (x *ResourceSpec) GetAssignedNode() string

func (*ResourceSpec) GetCreationTime

func (x *ResourceSpec) GetCreationTime() int64

func (*ResourceSpec) GetId

func (x *ResourceSpec) GetId() string

func (*ResourceSpec) GetName

func (x *ResourceSpec) GetName() string

func (*ResourceSpec) ProtoMessage

func (*ResourceSpec) ProtoMessage()

func (*ResourceSpec) ProtoReflect

func (x *ResourceSpec) ProtoReflect() protoreflect.Message

func (*ResourceSpec) Reset

func (x *ResourceSpec) Reset()

func (*ResourceSpec) String

func (x *ResourceSpec) String() string

type UnimplementedCrawlerMasterServer

type UnimplementedCrawlerMasterServer struct {
}

UnimplementedCrawlerMasterServer must be embedded to have forward compatible implementations.

func (UnimplementedCrawlerMasterServer) AddResource

func (UnimplementedCrawlerMasterServer) DeleteResource

type UnsafeCrawlerMasterServer

type UnsafeCrawlerMasterServer interface {
	// contains filtered or unexported methods
}

UnsafeCrawlerMasterServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CrawlerMasterServer will result in compilation errors.

Jump to

Keyboard shortcuts

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