worker

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package worker is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_worker_worker_proto protoreflect.FileDescriptor

Functions

func RegisterWorkerHandler

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

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

func RegisterWorkerHandlerClient

func RegisterWorkerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkerClient) error

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

func RegisterWorkerHandlerFromEndpoint

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

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

func RegisterWorkerHandlerServer

func RegisterWorkerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WorkerServer) error

RegisterWorkerHandlerServer registers the http handlers for service Worker to "mux". UnaryRPC :call WorkerServer 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 RegisterWorkerHandlerFromEndpoint instead.

func RegisterWorkerServer

func RegisterWorkerServer(s *grpc.Server, srv WorkerServer)

Types

type UnimplementedWorkerServer

type UnimplementedWorkerServer struct {
}

UnimplementedWorkerServer can be embedded to have forward compatible implementations.

func (*UnimplementedWorkerServer) Schedule

type WorkerClient

type WorkerClient interface {
	// Schedule 调度任务,该请求由调度器发往worker
	Schedule(ctx context.Context, in *scheduler.ScheduleRequest, opts ...grpc.CallOption) (*scheduler.ScheduleResponse, error)
}

WorkerClient is the client API for Worker service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewWorkerClient

func NewWorkerClient(cc grpc.ClientConnInterface) WorkerClient

type WorkerServer

type WorkerServer interface {
	// Schedule 调度任务,该请求由调度器发往worker
	Schedule(context.Context, *scheduler.ScheduleRequest) (*scheduler.ScheduleResponse, error)
}

WorkerServer is the server API for Worker service.

Jump to

Keyboard shortcuts

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