controller

package
v0.3.0-20260722193008-... Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 23 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 IsInternalConsistency

func IsInternalConsistency(err error) bool

IsInternalConsistency returns true if any error in the chain is an *InternalConsistencyError.

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 IsTooManyChangeRequests

func IsTooManyChangeRequests(err error) bool

IsTooManyChangeRequests returns true if any error in the chain is a *TooManyChangeRequestsError.

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, 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

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 InternalConsistencyError

type InternalConsistencyError struct {
	Message string
}

InternalConsistencyError indicates that gateway-owned read models disagree.

func (*InternalConsistencyError) Error

func (e *InternalConsistencyError) Error() string

Error implements the error interface.

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 ListController

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

ListController handles bounded queue receipt-history queries.

func NewListController

func NewListController(logger *zap.SugaredLogger, scope tally.Scope, requestQueueSummaryStore storage.RequestQueueSummaryStore, queueConfigs queueconfig.Store) *ListController

NewListController creates a gateway list controller.

func (*ListController) List

func (c *ListController) List(ctx context.Context, req entity.ListRequest) (result entity.ListResult, retErr error)

List returns one page of requests received for a queue in the supplied half-open time range.

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 RequestHistoryController

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

RequestHistoryController handles retained request-log history lookups.

func NewRequestHistoryController

func NewRequestHistoryController(logger *zap.SugaredLogger, scope tally.Scope, requestLogStore storage.RequestLogStore, requestURIStore storage.RequestURIStore) *RequestHistoryController

NewRequestHistoryController creates a gateway request-history controller.

func (*RequestHistoryController) GetRequestHistoryByChangeURI

func (c *RequestHistoryController) GetRequestHistoryByChangeURI(ctx context.Context, req entity.GetRequestHistoryByChangeURIRequest) (result []entity.RequestHistory, retErr error)

GetRequestHistoryByChangeURI returns retained histories for an exact pinned change URI.

func (*RequestHistoryController) GetRequestHistoryByID

func (c *RequestHistoryController) GetRequestHistoryByID(ctx context.Context, req entity.GetRequestHistoryByIDRequest) (logs []entity.RequestLog, retErr error)

GetRequestHistoryByID returns every retained request-log event for one sqid.

type RequestNotFoundError

type RequestNotFoundError struct {
	Sqid      string
	ChangeURI string
}

RequestNotFoundError indicates that no request exists for the selected sqid or change URI.

func (*RequestNotFoundError) Error

func (e *RequestNotFoundError) Error() string

Error implements the error interface.

type RequestSummaryController

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

RequestSummaryController handles materialized request-summary lookups for the gateway.

func NewRequestSummaryController

func NewRequestSummaryController(logger *zap.SugaredLogger, scope tally.Scope, requestSummaryStore storage.RequestSummaryStore, requestURIStore storage.RequestURIStore) *RequestSummaryController

NewRequestSummaryController creates a gateway request-summary controller.

func (*RequestSummaryController) GetRequestSummaryByChangeURI

func (c *RequestSummaryController) GetRequestSummaryByChangeURI(ctx context.Context, req entity.GetRequestSummaryByChangeURIRequest) (summaries []entity.RequestSummary, retErr error)

GetRequestSummaryByChangeURI returns current materialized views for an exact pinned change URI.

func (*RequestSummaryController) GetRequestSummaryByID

func (c *RequestSummaryController) GetRequestSummaryByID(ctx context.Context, req entity.GetRequestSummaryByIDRequest) (summary entity.RequestSummary, retErr error)

GetRequestSummaryByID returns the current materialized view of one request.

type TooManyChangeRequestsError

type TooManyChangeRequestsError struct {
	ChangeURI string
	Limit     int
}

TooManyChangeRequestsError indicates that a change URI exceeded the API result limit.

func (*TooManyChangeRequestsError) Error

Error implements the error interface.

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