controller

package
v0.3.0-20261008172002-... Latest Latest
Warning

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

Go to latest
Published: Oct 8, 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 a request fails validation.

Functions

func IsInvalidRequest

func IsInvalidRequest(err error) bool

IsInvalidRequest reports whether err contains an invalid request classification.

func IsListConsistency

func IsListConsistency(err error) bool

IsListConsistency reports whether err represents inconsistent listing records.

func IsProjectStatusConsistency

func IsProjectStatusConsistency(err error) bool

IsProjectStatusConsistency reports whether err represents inconsistent persisted state.

func IsProjectStatusNotFound

func IsProjectStatusNotFound(err error) bool

IsProjectStatusNotFound reports whether err represents an unknown validation request.

func IsRequestHistoryNotFound

func IsRequestHistoryNotFound(err error) bool

IsRequestHistoryNotFound reports whether err contains a retained-history absence.

Types

type GetProjectStatusByURIController

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

GetProjectStatusByURIController reads the durable validation projections.

func NewGetProjectStatusByURIController

func NewGetProjectStatusByURIController(logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory) *GetProjectStatusByURIController

NewGetProjectStatusByURIController creates a controller for validation-status lookups.

func (*GetProjectStatusByURIController) GetProjectStatusByURI

GetProjectStatusByURI returns the selected request summary and its repository validation fact, if recorded.

type IngestController

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

IngestController handles ingest business logic for stovepipe: it admits a queue's newly observed commit into the validation pipeline.

It resolves the queue's head commit URI via the SourceControl extension, dedups on the (queue, URI) pair, persists the Request and its initial log entry via storage, and publishes the request ID onto the process stage. Ingestion is idempotent: a re-reported head resolves to the already-minted request and republishes it only while it remains accepted.

func NewIngestController

func NewIngestController(
	logger *zap.SugaredLogger,
	scope tally.Scope,
	counters counter.Factory,
	sourceControl sourcecontrol.Factory,
	stores storage.Factory,
	materializer requestlog.Materializer,
	registry consumer.TopicRegistry,
	configuredQueues []string,
) *IngestController

NewIngestController creates a new instance of the stovepipe ingest controller. It publishes accepted requests to the topic registered under messagequeue.TopicKeyProcess in the registry.

func (*IngestController) Ingest

func (c *IngestController) Ingest(ctx context.Context, req entity.IngestRequest) (result entity.IngestResult, retErr error)

Ingest admits a queue's newly observed commit into the validation pipeline and returns the request ID validating it.

It is idempotent and runs to completion on every call, each step tolerant of having already run: it resolves (or claims) the (queue, URI) mapping, ensures the Request row and accepted log entry exist, and publishes the request to the process stage. A retry after a partial failure — for example the URI mapping committed but the request write failed — completes the missing steps instead of returning a dangling reference. The (queue, URI) mapping is the dedup gate, so concurrent ingests of the same head converge on one request.

type ListConsistencyError

type ListConsistencyError struct {
	// Queue is the selected queue.
	Queue string
	// RequestID identifies the mapped request; empty when the mapping lacks an ID.
	RequestID string
	// Reason describes the inconsistency in the mapping or summary.
	Reason string
	// Err is the underlying summary-read failure, if any.
	Err error
}

ListConsistencyError indicates an invalid acceptance mapping, a missing summary, or disagreement between the two. It represents an infrastructure failure, not a user lookup miss.

func (*ListConsistencyError) Error

func (e *ListConsistencyError) Error() string

func (*ListConsistencyError) Unwrap

func (e *ListConsistencyError) Unwrap() error

Unwrap preserves the underlying summary-read failure, when present.

type ListController

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

ListController handles queue-scoped acceptance-time listing.

func NewListController

func NewListController(logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory, configuredQueues []string) ListController

NewListController creates a controller restricted to the supplied configured queues.

type PingController

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

PingController handles ping business logic for the stovepipe

func NewPingController

func NewPingController(logger *zap.Logger, scope tally.Scope) *PingController

NewPingController creates a new instance of the stovepipe ping controller

func (*PingController) Ping

func (c *PingController) Ping(ctx context.Context, req *pb.PingRequest) (resp *pb.PingResponse, retErr error)

Ping handles the ping request and returns a response

type ProjectStatusConsistencyError

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

ProjectStatusConsistencyError indicates that persisted records disagree about a request.

func (*ProjectStatusConsistencyError) Error

type ProjectStatusNotFoundError

type ProjectStatusNotFoundError struct {
	// Queue is the queue in the selector.
	Queue string
	// ChangeURI is the commit URI in the selector.
	ChangeURI string
}

ProjectStatusNotFoundError indicates that no validation request matches a lookup selector.

func (*ProjectStatusNotFoundError) Error

type RequestHistoryByIDNotFoundError

type RequestHistoryByIDNotFoundError struct {
	// RequestID is the selected request identifier.
	RequestID string
}

RequestHistoryByIDNotFoundError indicates that no retained history exists for a request ID.

func (*RequestHistoryByIDNotFoundError) Error

Error implements error.

type RequestHistoryByURINotFoundError

type RequestHistoryByURINotFoundError struct {
	// URI is the selected commit URI.
	URI string
}

RequestHistoryByURINotFoundError indicates that no retained history exists for a URI.

func (*RequestHistoryByURINotFoundError) Error

Error implements error.

type RequestHistoryController

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

RequestHistoryController handles retained request-history lookups.

func NewRequestHistoryController

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

NewRequestHistoryController creates a request-history controller.

Directories

Path Synopsis
Package build holds the build-stage queue controller.
Package build holds the build-stage queue controller.
Package buildsignal holds the buildsignal-stage queue controller.
Package buildsignal holds the buildsignal-stage queue controller.
Package dlq contains controllers that consume messages from a pipeline stage's dead-letter topic and reconcile the affected request into a terminal state.
Package dlq contains controllers that consume messages from a pipeline stage's dead-letter topic and reconcile the affected request into a terminal state.
Package process holds the process-stage queue controller.
Package process holds the process-stage queue controller.
Package record holds the record-stage queue controller.
Package record holds the record-stage queue controller.

Jump to

Keyboard shortcuts

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