controller

package
v0.3.0-20260710175603-... Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func IsInvalidRequest(err error) bool

IsInvalidRequest returns true if any error in the error chain is ErrInvalidRequest.

func IsRequestNotFound

func IsRequestNotFound(err error) bool

IsRequestNotFound returns true if any error in the chain is a *RequestNotFoundError.

func IsUnrecognizedQueue

func IsUnrecognizedQueue(err error) bool

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, requestLogStore storage.RequestLogStore, registry consumer.TopicRegistry) *CancelController

NewCancelController creates a new instance of the gateway cancel controller. The controller writes a RequestStatusCancelling log entry through requestLogStore and publishes cancel requests to the topic registered under topickey.TopicKeyCancel.

func (*CancelController) Cancel

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 *pb.LandRequest) (resp *pb.LandResponse, retErr error)

Land handles the land request and returns a response

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

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

Status returns the current reconciled status of a request identified by its sqid.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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