Documentation ¶
Overview ¶
Package callback is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterCallbackHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterCallbackHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CallbackClient) error
- func RegisterCallbackHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterCallbackHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CallbackServer) error
- func RegisterCallbackServer(s *grpc.Server, srv CallbackServer)
- type CallbackClient
- type CallbackRequest
- func (*CallbackRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CallbackRequest) GetJob() *job.Job
- func (m *CallbackRequest) GetPayload() isCallbackRequest_Payload
- func (x *CallbackRequest) GetStatus() job.Status
- func (x *CallbackRequest) GetTask() *job.Task
- func (*CallbackRequest) ProtoMessage()
- func (x *CallbackRequest) ProtoReflect() protoreflect.Message
- func (x *CallbackRequest) Reset()
- func (x *CallbackRequest) String() string
- func (m *CallbackRequest) Validate() error
- type CallbackRequestValidationError
- func (e CallbackRequestValidationError) Cause() error
- func (e CallbackRequestValidationError) Error() string
- func (e CallbackRequestValidationError) ErrorName() string
- func (e CallbackRequestValidationError) Field() string
- func (e CallbackRequestValidationError) Key() bool
- func (e CallbackRequestValidationError) Reason() string
- type CallbackRequest_Job
- type CallbackRequest_Task
- type CallbackResponse
- type CallbackResponseValidationError
- func (e CallbackResponseValidationError) Cause() error
- func (e CallbackResponseValidationError) Error() string
- func (e CallbackResponseValidationError) ErrorName() string
- func (e CallbackResponseValidationError) Field() string
- func (e CallbackResponseValidationError) Key() bool
- func (e CallbackResponseValidationError) Reason() string
- type CallbackServer
- type UnimplementedCallbackServer
Constants ¶
This section is empty.
Variables ¶
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 ¶
func (e CallbackRequestValidationError) Cause() error
Cause function returns cause value.
func (CallbackRequestValidationError) Error ¶
func (e CallbackRequestValidationError) Error() string
Error satisfies the builtin error interface
func (CallbackRequestValidationError) ErrorName ¶
func (e CallbackRequestValidationError) ErrorName() string
ErrorName returns error name.
func (CallbackRequestValidationError) Field ¶
func (e CallbackRequestValidationError) Field() string
Field function returns field value.
func (CallbackRequestValidationError) Key ¶
func (e CallbackRequestValidationError) Key() bool
Key function returns key value.
func (CallbackRequestValidationError) Reason ¶
func (e CallbackRequestValidationError) Reason() string
Reason function returns reason value.
type CallbackRequest_Job ¶
type CallbackRequest_Task ¶
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 ¶
func (e CallbackResponseValidationError) Cause() error
Cause function returns cause value.
func (CallbackResponseValidationError) Error ¶
func (e CallbackResponseValidationError) Error() string
Error satisfies the builtin error interface
func (CallbackResponseValidationError) ErrorName ¶
func (e CallbackResponseValidationError) ErrorName() string
ErrorName returns error name.
func (CallbackResponseValidationError) Field ¶
func (e CallbackResponseValidationError) Field() string
Field function returns field value.
func (CallbackResponseValidationError) Key ¶
func (e CallbackResponseValidationError) Key() bool
Key function returns key value.
func (CallbackResponseValidationError) Reason ¶
func (e CallbackResponseValidationError) Reason() string
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 ¶
func (*UnimplementedCallbackServer) Callback(context.Context, *CallbackRequest) (*CallbackResponse, error)