runtimehook

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package runtimehook provides a tiny internal hook registry used to avoid import cycles between the public queue package and internal bridge/test helpers introduced during API flattening.

Index

Constants

This section is empty.

Variables

View Source
var DriverResource func(any) any

DriverResource resolves an optional module's resource capability without public SDK types.

Functions

This section is empty.

Types

type BuildQueueFromDescriptorFunc added in v0.3.0

type BuildQueueFromDescriptorFunc func(cfg any, observer any, descriptor Descriptor, opts []any) (any, error)

BuildQueueFromDescriptorFunc constructs a queue while preserving explicit capabilities.

var BuildQueueFromDescriptor BuildQueueFromDescriptorFunc

BuildQueueFromDescriptor is installed by the root package to avoid an import cycle.

type BuildQueueFromDriverFunc

type BuildQueueFromDriverFunc func(cfg any, observer any, backend any, workerFactory WorkerFactory, opts []any) (any, error)

BuildQueueFromDriver builds a high-level *queue.Queue from a private driver backend representation provided by internal/driverbridge.

var BuildQueueFromDriver BuildQueueFromDriverFunc

type Descriptor added in v0.3.0

type Descriptor struct {
	TranslateJobError func(error) error
	PanicJobError     func(any) error
	Backend           any
	WorkerFactory     WorkerFactory
	WorkflowMode      WorkflowMode
	NewCoordinator    func(*WorkflowBinding) (NativeCoordinator, error)
	NewLifecycle      func(*WorkflowBinding) (DriverLifecycle, error)
	ValidateSettings  func(Settings) error
}

Descriptor carries declared capabilities separately from adapted interfaces. New drivers must supply an explicit mode; only the legacy bridge defaults it. Construction callbacks roll back their own allocations on error. The supplying module retains cleanup ownership of the backend if queue construction fails.

type DriverLifecycle added in v0.3.0

type DriverLifecycle interface {
	// Binding identifies the same resource as ordinary delivery and coordination.
	Binding() *WorkflowBinding
	// SetWorkers records the desired remote worker capacity or a deferred conflict.
	SetWorkers(int)
	// ConfigurationError returns a deferred fluent configuration failure.
	ConfigurationError() error
	// Done returns a nonnil terminal-result notification channel.
	Done() <-chan struct{}
	// Err returns the stable fatal result after Done closes.
	Err() error
	// ShutdownTimeout returns the resource's positive aggregate shutdown budget.
	ShutdownTimeout() time.Duration
}

DriverLifecycle preserves resource-wide worker configuration and fatal results. Done closes when the driver has a terminal runtime result; caller cancellation remains separate so a timed-out shutdown can be joined again.

type ExtractRuntimeFromQueueFunc

type ExtractRuntimeFromQueueFunc func(q any) (any, error)

ExtractRuntimeFromQueue exposes the internal runtime from *queue.Queue for test-only bridges (not public API use).

var ExtractRuntimeFromQueue ExtractRuntimeFromQueueFunc

type NativeCoordinator added in v0.3.0

type NativeCoordinator interface {
	workflow.Engine
	// Binding returns the exact identity supplied during construction.
	Binding() *WorkflowBinding
}

NativeCoordinator binds native coordination to the root-selected job runtime.

type Settings added in v0.3.0

type Settings struct {
	ResourceID              string
	ResourceIDSupplied      bool
	Store                   workflow.Store
	StoreSupplied           bool
	Clock                   func() time.Time
	ClockSupplied           bool
	Middlewares             []workflow.Middleware
	MiddlewareSupplied      bool
	ObserverSupplied        bool
	Workers                 int
	WorkersSupplied         bool
	HandlerContextDecorator func(context.Context) context.Context
	DecoratorSupplied       bool
	LegacyDirectEnvelope    bool
	LegacyEnvelopeSupplied  bool
}

Settings retains typed effective options and explicit caller provenance. Optional drivers validate these before root registration or worker creation.

type WorkerFactory

type WorkerFactory func(workers int) (any, error)

type WorkflowBinding added in v0.3.0

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

WorkflowBinding identifies the shared executor, lifecycle owner, and driver selected by the root constructor. Its fields cannot be replaced by a driver.

func NewWorkflowBinding added in v0.3.0

func NewWorkflowBinding(runtime any, jobs *workflow.Jobs, driver string) *WorkflowBinding

NewWorkflowBinding creates the identity token validated by root construction.

func (*WorkflowBinding) Driver added in v0.3.0

func (b *WorkflowBinding) Driver() string

Driver returns the driver identity established by root construction.

func (*WorkflowBinding) Jobs added in v0.3.0

func (b *WorkflowBinding) Jobs() *workflow.Jobs

Jobs returns the executor shared with ordinary application deliveries.

func (*WorkflowBinding) Runtime added in v0.3.0

func (b *WorkflowBinding) Runtime() any

Runtime returns the selected physical lifecycle owner.

type WorkflowMode added in v0.3.0

type WorkflowMode string

WorkflowMode selects exactly one coordinator authority for a driver resource.

const (
	// WorkflowBuiltIn retains the established store-backed coordinator.
	WorkflowBuiltIn WorkflowMode = "built-in"
	// WorkflowNative delegates coordination to the driver bound to the same runtime.
	WorkflowNative WorkflowMode = "native"
	// WorkflowUnsupported explicitly disables portable workflows without fallback.
	WorkflowUnsupported WorkflowMode = "unsupported"
)

Jump to

Keyboard shortcuts

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