Help us shape the future of Go! Take the 2026 Go Developer Survey

dataplane

package
v4.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package dataplane adapts stable queue management contracts without acquiring backend-native clients or reimplementing queue semantics. Start with NewControllerDispatcher or the record/status/fleet constructors and explicit tenant resolvers. Resolved providers are borrowed, must honor authenticated tenant scope/context and own their shutdown. Commands preserve partial/unknown acknowledgement distinctions, not exactly-once delivery; readers validate package-management models without starting background work.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidControllerConfiguration reports an incomplete adapter graph.
	ErrInvalidControllerConfiguration = errors.New("dataplane: invalid controller configuration")
	// ErrControllerUnavailable reports a tenant resolver without a controller.
	ErrControllerUnavailable = errors.New("dataplane: controller unavailable")
	// ErrUnsupportedCommand reports a command outside queue management.
	ErrUnsupportedCommand = errors.New("dataplane: unsupported command")
	// ErrCommandNotAcknowledged supports legacy error-only dispatch consumers.
	ErrCommandNotAcknowledged = errors.New("dataplane: command not acknowledged")
)
View Source
var (
	// ErrInvalidFleetConfiguration reports a missing worker-status source.
	ErrInvalidFleetConfiguration = errors.New("dataplane: invalid fleet configuration")
	// ErrInvalidFleetOutput reports malformed or unbounded worker traversal.
	ErrInvalidFleetOutput = errors.New("dataplane: invalid fleet output")
)
View Source
var (
	// ErrInvalidRecordConfiguration reports a missing reader resolver.
	ErrInvalidRecordConfiguration = errors.New("dataplane: invalid record configuration")
	// ErrInvalidRecordRequest reports an invalid tenant scope.
	ErrInvalidRecordRequest = errors.New("dataplane: invalid record request")
	// ErrRecordReaderUnavailable reports a resolver without a tenant reader.
	ErrRecordReaderUnavailable = errors.New("dataplane: record reader unavailable")
	// ErrInvalidRecordOutput reports malformed or over-disclosed adapter output.
	ErrInvalidRecordOutput = errors.New("dataplane: invalid record output")
)
View Source
var (
	// ErrInvalidStatusConfiguration reports a missing status resolver.
	ErrInvalidStatusConfiguration = errors.New("dataplane: invalid status configuration")
	// ErrInvalidStatusRequest reports an invalid tenant scope.
	ErrInvalidStatusRequest = errors.New("dataplane: invalid status request")
	// ErrStatusReaderUnavailable reports a resolver without a tenant reader.
	ErrStatusReaderUnavailable = errors.New("dataplane: status reader unavailable")
	// ErrInvalidStatusOutput reports malformed adapter output.
	ErrInvalidStatusOutput = errors.New("dataplane: invalid status output")
)

Functions

This section is empty.

Types

type ControllerDispatcher

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

ControllerDispatcher translates administrative commands to the stable queue management envelope and preserves honest terminal outcomes.

func NewControllerDispatcher

func NewControllerDispatcher(
	resolver ControllerResolver,
	protocol queue.ProtocolVersion,
	timeout time.Duration,
	now func() time.Time,
) (*ControllerDispatcher, error)

NewControllerDispatcher creates a tenant-scoped management adapter.

func (*ControllerDispatcher) Dispatch

func (d *ControllerDispatcher) Dispatch(
	ctx context.Context,
	command controlplane.Command,
) error

Dispatch supports the existing error-only control boundary. Result-aware callers should use DispatchResult so unknown outcomes are not flattened.

func (*ControllerDispatcher) DispatchResult

func (d *ControllerDispatcher) DispatchResult(
	ctx context.Context,
	command controlplane.Command,
) (control.DispatchOutcome, error)

DispatchResult executes through a tenant-scoped queue Controller.

type ControllerResolver

type ControllerResolver interface {
	// ResolveController returns a borrowed controller for the authenticated
	// tenant scope; resolver errors refuse dispatch and lifecycle remains
	// caller-owned.
	ResolveController(context.Context, string) (queue.Controller, error)
}

ControllerResolver selects a tenant-scoped queue management controller. Tenant routing stays outside backend addressing and queue serialization.

type FleetSource

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

FleetSource converts queue status into control-plane worker snapshots.

func NewFleetSource

func NewFleetSource(source WorkerStatusSource) (*FleetSource, error)

NewFleetSource creates a bounded remote worker snapshot source.

func (*FleetSource) SnapshotTenant

func (s *FleetSource) SnapshotTenant(
	ctx context.Context,
	tenant string,
	now time.Time,
	staleAfter time.Duration,
) (fleet.RegistrySnapshot, error)

SnapshotTenant returns one fail-safe tenant fleet observation.

type RecordReaderResolver

type RecordReaderResolver interface {
	// ResolveRecordReader returns a borrowed scoped reader; callers/providers
	// own its lifecycle and copied output obligations.
	ResolveRecordReader(context.Context, string) (queue.RecordReader, error)
}

RecordReaderResolver selects a tenant-scoped queue record reader.

type RecordSource

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

RecordSource applies tenant routing and validates all queue record output.

func NewRecordSource

func NewRecordSource(resolver RecordReaderResolver) (*RecordSource, error)

NewRecordSource creates a tenant-scoped failure and dead-letter source.

func (*RecordSource) Inspect

func (s *RecordSource) Inspect(
	ctx context.Context,
	tenant string,
	request queue.InspectRequest,
) (queue.JobRecord, error)

Inspect returns one validated record without exceeding requested payload visibility. Adapters may safely return a more-redacted representation.

func (*RecordSource) ListDeadLetters

func (s *RecordSource) ListDeadLetters(
	ctx context.Context,
	tenant string,
	request queue.PageRequest,
) (queue.RecordPage, error)

ListDeadLetters returns one validated page of dead-letter metadata.

func (*RecordSource) ListFailures

func (s *RecordSource) ListFailures(
	ctx context.Context,
	tenant string,
	request queue.PageRequest,
) (queue.RecordPage, error)

ListFailures returns one validated page of failure metadata.

type StatusReaderResolver

type StatusReaderResolver interface {
	// ResolveStatusReader returns a borrowed tenant-scoped reader honoring ctx;
	// the source validates requests and output without closing the reader.
	ResolveStatusReader(context.Context, string) (queue.StatusReader, error)
}

StatusReaderResolver selects a tenant-scoped queue status reader.

type StatusSource

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

StatusSource validates tenant routing, requests, and all adapter output.

func NewStatusSource

func NewStatusSource(resolver StatusReaderResolver) (*StatusSource, error)

NewStatusSource creates a tenant-scoped worker and queue status source.

func (*StatusSource) ListQueues

func (s *StatusSource) ListQueues(
	ctx context.Context,
	tenant string,
	request queue.StatusPageRequest,
) (queue.QueueStatusPage, error)

ListQueues returns one validated queue-status page.

func (*StatusSource) ListWorkers

func (s *StatusSource) ListWorkers(
	ctx context.Context,
	tenant string,
	request queue.StatusPageRequest,
) (queue.WorkerStatusPage, error)

ListWorkers returns one validated worker-status page.

type WorkerStatusSource

type WorkerStatusSource interface {
	// ListWorkers returns a validated bounded tenant page with progressing
	// cursors; FleetSource traverses at most five pages and does not
	// authenticate worker reports.
	ListWorkers(
		context.Context,
		string,
		queue.StatusPageRequest,
	) (queue.WorkerStatusPage, error)
}

WorkerStatusSource reads bounded queue worker status pages.

Jump to

Keyboard shortcuts

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