controller

package
v0.3.0-20260813021757-... Latest Latest
Warning

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

Go to latest
Published: Aug 13, 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 interface {
	Cancel(ctx context.Context, req entity.CancelRequest) error
}

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, stores storage.Factory, materializer *requestcore.Materializer, 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.

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 interface {
	Land(ctx context.Context, req entity.LandRequest) (entity.LandResult, error)
}

LandController handles land business logic for the gateway

func NewLandController

func NewLandController(logger *zap.SugaredLogger, scope tally.Scope, counters counter.Factory, stores storage.Factory, materializer *requestcore.Materializer, 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.

type ListController

type ListController interface {
	List(ctx context.Context, req entity.ListRequest) (entity.ListResult, error)
}

ListController handles bounded queue receipt-history queries.

func NewListController

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

NewListController creates a gateway list controller.

type PingController

type PingController interface {
	Ping(ctx context.Context, req *pb.PingRequest) (*pb.PingResponse, error)
}

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

type RequestHistoryController

type RequestHistoryController interface {
	GetRequestHistoryByID(ctx context.Context, req entity.GetRequestHistoryByIDRequest) ([]entity.RequestLog, error)
	GetRequestHistoryByChangeURI(ctx context.Context, req entity.GetRequestHistoryByChangeURIRequest) ([]entity.RequestHistory, error)
}

RequestHistoryController handles retained request-log history lookups.

func NewRequestHistoryController

func NewRequestHistoryController(logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory) RequestHistoryController

NewRequestHistoryController creates a gateway request-history controller.

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 interface {
	GetRequestSummaryByID(ctx context.Context, req entity.GetRequestSummaryByIDRequest) (entity.RequestSummary, error)
	GetRequestSummaryByChangeURI(ctx context.Context, req entity.GetRequestSummaryByChangeURIRequest) ([]entity.RequestSummary, error)
}

RequestSummaryController handles materialized request-summary lookups for the gateway.

func NewRequestSummaryController

func NewRequestSummaryController(logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory) RequestSummaryController

NewRequestSummaryController creates a gateway request-summary controller.

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