Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidRequest = errs.NewUserError(errors.New("invalid request"))
ErrInvalidRequest is returned when the request fails validation. This error should be mapped to codes.InvalidArgument at the gRPC layer.
Functions ¶
func IsInvalidRequest ¶
IsInvalidRequest returns true if any error in the error chain is ErrInvalidRequest.
func IsRequestNotFound ¶
IsRequestNotFound returns true if any error in the chain is a *RequestNotFoundError.
func IsUnrecognizedQueue ¶
IsUnrecognizedQueue returns true if any error in the chain is an *UnrecognizedQueueError.
Types ¶
type CancelController ¶
type CancelController struct {
// contains filtered or unexported fields
}
CancelController handles cancel business logic for the gateway. It validates the request, records a RequestStatusCancelling log entry (intent-only — cancellation is best-effort and may still race a successful merge), publishes a CancelRequest to the cancel topic, and returns a response. The orchestrator-side cancel controller performs the actual state transitions and emits the terminal RequestStatusCancelled log entry.
func NewCancelController ¶
func NewCancelController(logger *zap.SugaredLogger, scope tally.Scope, store storage.Storage, registry consumer.TopicRegistry) *CancelController
NewCancelController creates a new instance of the gateway cancel controller. The controller writes a RequestStatusCancelling log entry through the shared materializer and publishes cancel requests to the topic registered under topickey.TopicKeyCancel.
func (*CancelController) Cancel ¶
func (c *CancelController) Cancel(ctx context.Context, req entity.CancelRequest) error
Cancel handles a cancel request and returns an empty response. The actual cancellation is performed asynchronously by the orchestrator cancel controller. Cancel is idempotent: the orchestrator treats already-terminal requests as a no-op.
Cancellation is best-effort: a request that has already merged or that races to completion before the cancel propagates may still land. The RequestStatusCancelling entry written here records the user's intent; the terminal outcome is reflected by a later RequestStatusCancelled (orchestrator side) or RequestStatusLanded entry.
type LandController ¶
type LandController struct {
// contains filtered or unexported fields
}
LandController handles land business logic for the gateway
func NewLandController ¶
func NewLandController(logger *zap.SugaredLogger, scope tally.Scope, counter counter.Counter, store storage.Storage, queueConfigs queueconfig.Store, registry consumer.TopicRegistry) *LandController
NewLandController creates a new instance of the gateway land controller. The controller publishes land requests to the topic registered under topickey.TopicKeyStart in the registry.
func (*LandController) Land ¶
func (c *LandController) Land(ctx context.Context, req entity.LandRequest) (result entity.LandResult, retErr error)
Land handles the land request and returns the ID assigned to the accepted request.
type PingController ¶
type PingController struct {
// contains filtered or unexported fields
}
PingController handles ping business logic for the gateway
func NewPingController ¶
func NewPingController(logger *zap.Logger, scope tally.Scope) *PingController
NewPingController creates a new instance of the gateway ping controller
func (*PingController) Ping ¶
func (c *PingController) Ping(ctx context.Context, req *pb.PingRequest) (*pb.PingResponse, error)
Ping handles the ping request and returns a response
type RequestNotFoundError ¶
type RequestNotFoundError struct {
Sqid string
}
RequestNotFoundError indicates that no request log records exist for the requested sqid. Either the sqid is wrong or the request has not been accepted yet.
func (*RequestNotFoundError) Error ¶
func (e *RequestNotFoundError) Error() string
Error implements the error interface.
type StatusController ¶
type StatusController struct {
// contains filtered or unexported fields
}
StatusController handles request status business logic for the gateway.
func NewStatusController ¶
func NewStatusController(logger *zap.SugaredLogger, scope tally.Scope, requestLogStore storage.RequestLogStore) *StatusController
NewStatusController creates a new instance of the gateway status controller.
func (*StatusController) Status ¶
func (c *StatusController) Status(ctx context.Context, req entity.StatusRequest) (StatusResult, error)
Status returns the current reconciled status of a request identified by its sqid.
type StatusResult ¶
type StatusResult = request.CurrentState
StatusResult is the outcome of a status query. It is a type alias for request.CurrentState so that the controller's return type follows the same Result naming convention as LandResult and other controller outputs.
type UnrecognizedQueueError ¶
type UnrecognizedQueueError struct {
Queue string
}
UnrecognizedQueueError indicates the request named a queue that is not present in the queue configuration store.
func (*UnrecognizedQueueError) Error ¶
func (e *UnrecognizedQueueError) Error() string
Error implements the error interface.