Documentation ¶
Overview ¶
Package worker is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterWorkerHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterWorkerHandlerClient(ctx context.Context, mux *runtime.ServeMux, client WorkerClient) error
- func RegisterWorkerHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterWorkerHandlerServer(ctx context.Context, mux *runtime.ServeMux, server WorkerServer) error
- func RegisterWorkerServer(s *grpc.Server, srv WorkerServer)
- type UnimplementedWorkerServer
- type WorkerClient
- type WorkerServer
Constants ¶
This section is empty.
Variables ¶
var File_worker_worker_proto protoreflect.FileDescriptor
Functions ¶
func RegisterWorkerHandler ¶
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 ¶
func (*UnimplementedWorkerServer) Schedule(context.Context, *scheduler.ScheduleRequest) (*scheduler.ScheduleResponse, error)
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.