callback

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 callback is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_callback_callback_proto protoreflect.FileDescriptor

Functions

func RegisterCallbackHandler

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

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

func RegisterCallbackHandlerClient

func RegisterCallbackHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CallbackClient) error

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

func RegisterCallbackHandlerFromEndpoint

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

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

func RegisterCallbackHandlerServer

func RegisterCallbackHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CallbackServer) error

RegisterCallbackHandlerServer registers the http handlers for service Callback to "mux". UnaryRPC :call CallbackServer 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 RegisterCallbackHandlerFromEndpoint instead.

func RegisterCallbackServer

func RegisterCallbackServer(s *grpc.Server, srv CallbackServer)

Types

type CallbackClient

type CallbackClient interface {
	// Callback 事件通知
	Callback(ctx context.Context, in *CallbackRequest, opts ...grpc.CallOption) (*CallbackResponse, error)
}

CallbackClient is the client API for Callback service.

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

func NewCallbackClient

func NewCallbackClient(cc grpc.ClientConnInterface) CallbackClient

type CallbackRequest

type CallbackRequest struct {

	// payload 回调内容
	//
	// Types that are assignable to Payload:
	//	*CallbackRequest_Job
	//	*CallbackRequest_Task
	Payload isCallbackRequest_Payload `protobuf_oneof:"payload"`
	// status 状态
	Status job.Status `protobuf:"varint,11,opt,name=status,proto3,enum=job.Status" json:"status,omitempty"`
	// contains filtered or unexported fields
}

CallbackRequest 回调请求

func (*CallbackRequest) Descriptor deprecated

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

Deprecated: Use CallbackRequest.ProtoReflect.Descriptor instead.

func (*CallbackRequest) GetJob

func (x *CallbackRequest) GetJob() *job.Job

func (*CallbackRequest) GetPayload

func (m *CallbackRequest) GetPayload() isCallbackRequest_Payload

func (*CallbackRequest) GetStatus

func (x *CallbackRequest) GetStatus() job.Status

func (*CallbackRequest) GetTask

func (x *CallbackRequest) GetTask() *job.Task

func (*CallbackRequest) ProtoMessage

func (*CallbackRequest) ProtoMessage()

func (*CallbackRequest) ProtoReflect

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

func (*CallbackRequest) Reset

func (x *CallbackRequest) Reset()

func (*CallbackRequest) String

func (x *CallbackRequest) String() string

func (*CallbackRequest) Validate

func (m *CallbackRequest) Validate() error

Validate checks the field values on CallbackRequest with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type CallbackRequestValidationError

type CallbackRequestValidationError struct {
	// contains filtered or unexported fields
}

CallbackRequestValidationError is the validation error returned by CallbackRequest.Validate if the designated constraints aren't met.

func (CallbackRequestValidationError) Cause

Cause function returns cause value.

func (CallbackRequestValidationError) Error

Error satisfies the builtin error interface

func (CallbackRequestValidationError) ErrorName

func (e CallbackRequestValidationError) ErrorName() string

ErrorName returns error name.

func (CallbackRequestValidationError) Field

Field function returns field value.

func (CallbackRequestValidationError) Key

Key function returns key value.

func (CallbackRequestValidationError) Reason

Reason function returns reason value.

type CallbackRequest_Job

type CallbackRequest_Job struct {
	// job job类型回调
	Job *job.Job `protobuf:"bytes,1,opt,name=job,proto3,oneof"`
}

type CallbackRequest_Task

type CallbackRequest_Task struct {
	// task task类型回调
	Task *job.Task `protobuf:"bytes,2,opt,name=task,proto3,oneof"`
}

type CallbackResponse

type CallbackResponse struct {
	// contains filtered or unexported fields
}

CallbackResponse 响应

func (*CallbackResponse) Descriptor deprecated

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

Deprecated: Use CallbackResponse.ProtoReflect.Descriptor instead.

func (*CallbackResponse) ProtoMessage

func (*CallbackResponse) ProtoMessage()

func (*CallbackResponse) ProtoReflect

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

func (*CallbackResponse) Reset

func (x *CallbackResponse) Reset()

func (*CallbackResponse) String

func (x *CallbackResponse) String() string

func (*CallbackResponse) Validate

func (m *CallbackResponse) Validate() error

Validate checks the field values on CallbackResponse with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.

type CallbackResponseValidationError

type CallbackResponseValidationError struct {
	// contains filtered or unexported fields
}

CallbackResponseValidationError is the validation error returned by CallbackResponse.Validate if the designated constraints aren't met.

func (CallbackResponseValidationError) Cause

Cause function returns cause value.

func (CallbackResponseValidationError) Error

Error satisfies the builtin error interface

func (CallbackResponseValidationError) ErrorName

ErrorName returns error name.

func (CallbackResponseValidationError) Field

Field function returns field value.

func (CallbackResponseValidationError) Key

Key function returns key value.

func (CallbackResponseValidationError) Reason

Reason function returns reason value.

type CallbackServer

type CallbackServer interface {
	// Callback 事件通知
	Callback(context.Context, *CallbackRequest) (*CallbackResponse, error)
}

CallbackServer is the server API for Callback service.

type UnimplementedCallbackServer

type UnimplementedCallbackServer struct {
}

UnimplementedCallbackServer can be embedded to have forward compatible implementations.

func (*UnimplementedCallbackServer) Callback

Jump to

Keyboard shortcuts

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