taskid

package
v0.59.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFanInOption added in v0.59.0

func ApplyFanInOption(c *DependencyConfig, opt FanInOption)

ApplyFanInOption applies a FanInOption to a DependencyConfig.

func ApplyReferenceOption added in v0.59.0

func ApplyReferenceOption(c *DependencyConfig, opt ReferenceOption)

ApplyReferenceOption applies a ReferenceOption to a DependencyConfig.

Types

type DependencyConfig added in v0.59.0

type DependencyConfig struct {
	// Cardinality specifies whether the dependency is a 1:1 reference or a 1:N fan-in reference.
	Cardinality EdgeCardinality
	// Scope specifies the task search and binding scope for resolving the dependency.
	Scope DependencyScope
}

DependencyConfig holds edge attribute configuration values applied by dependency options.

func NewDefaultFanInConfig added in v0.59.0

func NewDefaultFanInConfig() DependencyConfig

NewDefaultFanInConfig returns a DependencyConfig initialized for a standard fan-in data dependency.

func NewDefaultPointToPointConfig added in v0.59.0

func NewDefaultPointToPointConfig() DependencyConfig

NewDefaultPointToPointConfig returns a DependencyConfig initialized for a standard point-to-point data dependency.

type DependencyDescriptor added in v0.59.0

type DependencyDescriptor interface {
	// DescriptorCardinality returns whether this dependency is point-to-point or fan-in.
	DescriptorCardinality() EdgeCardinality
	// DescriptorScope returns the effective dependency resolution scope.
	DescriptorScope() DependencyScope
	// ResultType returns the reflection Type for the expected result type of this dependency.
	ResultType() reflect.Type
}

DependencyDescriptor is the base interface that all dependency descriptors must implement. It has 0 internal package dependencies and consists only of standard Go types and taskid enums.

type DependencyScope added in v0.59.0

type DependencyScope int

DependencyScope represents the search and binding scope for dependencies.

const (
	// ScopeUnspecified indicates that no dependency scope was explicitly specified.
	ScopeUnspecified DependencyScope = iota

	// ScopeActiveGraph binds only to tasks already included in the active graph (lazy).
	// It never pulls upstream tasks into the graph by itself.
	ScopeActiveGraph

	// ScopeActiveFeatures pulls in producer tasks only if all of their upstream dependencies
	// merge into tasks that are already in the active graph.
	ScopeActiveFeatures

	// ScopeAll searches all available tasks and eagerly pulls them into the graph.
	ScopeAll
)

type EdgeCardinality added in v0.59.0

type EdgeCardinality int

EdgeCardinality represents the multiplicity of the dependency.

const (
	// CardinalityPointToPoint represents a 1:1 dependency targeting a specific single task.
	CardinalityPointToPoint EdgeCardinality = iota

	// CardinalityFanIn represents a 1:N aggregation dependency targeting all tasks matching a tag.
	CardinalityFanIn
)

type FanInDescriptor added in v0.59.0

type FanInDescriptor interface {
	DependencyDescriptor
	// Tag returns the tag identifier to match against producer tasks.
	Tag() string
}

FanInDescriptor is an interface for 1:N aggregation dependencies targeting tasks matching a tag.

type FanInOption added in v0.59.0

type FanInOption interface {
	// contains filtered or unexported methods
}

FanInOption is an option that can be applied to a fan-in tag reference.

type PointToPointDescriptor added in v0.59.0

type PointToPointDescriptor interface {
	DependencyDescriptor
	// ReferenceID returns the target task's reference ID without any implementation hash.
	ReferenceID() string
}

PointToPointDescriptor is an interface for 1:1 dependencies targeting a single task by reference ID.

type ReferenceOption added in v0.59.0

type ReferenceOption interface {
	// contains filtered or unexported methods
}

ReferenceOption is an option that can be applied to a point-to-point task reference.

type TaskEdge added in v0.59.0

type TaskEdge struct {
	// SourceRefID is the reference ID of the upstream producer task.
	SourceRefID string
	// SourceImplID is the implementation ID of the upstream producer task.
	SourceImplID string
	// TargetImplID is the implementation ID of the downstream consumer task.
	TargetImplID string
	// Cardinality indicates whether this edge originated from a point-to-point or fan-in dependency.
	Cardinality EdgeCardinality
	// Tag is the tag identifier if this edge originated from a fan-in dependency.
	Tag string
	// Priority specifies the precedence weight of this edge during graph resolution and cycle pruning.
	Priority int
	// OutputType is the string representation of the data type transported over this edge.
	OutputType string
}

TaskEdge represents a concrete directed edge in the resolved task DAG.

type TaskImplementationID

type TaskImplementationID[TaskResult any] interface {
	UntypedTaskImplementationID
	// Ref returns the typed reference associated with this implementation ID.
	Ref(opts ...ReferenceOption) TaskReference[TaskResult]
}

TaskImplementationID defines a typed implementation ID for a task that produces a specific result type. The type parameter ensures that implementations maintain type safety with their references.

func NewDefaultImplementationID

func NewDefaultImplementationID[TaskResult any](id string) TaskImplementationID[TaskResult]

NewDefaultImplementationID creates a new TaskImplementationID with the "default" implementation hash. This is a convenience function for creating standard task implementations. The ID cannot contain '#' as the function will append "#default" to create the full implementation ID. Typically used when there is only one common implementation of a task reference.

func NewImplementationID

func NewImplementationID[TaskResult any](baseReference TaskReference[TaskResult], implementationHash string) TaskImplementationID[TaskResult]

NewImplementationID creates a new TaskImplementationID with a custom implementation hash. This function is used when multiple different implementations of the same task reference are needed. The implementation hash distinguishes between different implementations that produce the same type of result. For example, a log parser task could have different implementations for different log formats, but all implementations would share the same TaskReference.

type TaskReference

type TaskReference[TaskResult any] interface {
	UntypedTaskReference
	// GetZeroValue returns a zero value of the TaskResult type.
	// This is used to maintain type safety by ensuring TaskReference[A] and TaskReference[B]
	// are considered different types when A and B are different.
	GetZeroValue() TaskResult
	// Ref returns a new TaskReference with the specified dependency options applied.
	Ref(opts ...ReferenceOption) TaskReference[TaskResult]
}

TaskReference defines a typed reference to a task that produces a specific result type. The type parameter ensures that dependencies between tasks maintain type safety.

func NewTaskReference

func NewTaskReference[TaskResult any](id string, opts ...ReferenceOption) TaskReference[TaskResult]

NewTaskReference creates a new TaskReference with the specified ID. This function is used to create references to tasks that can be used in dependencies. The ID cannot contain '#' as it would be confused with an implementation hash. Typically used to define the interface of a task that other tasks can depend on.

type UntypedTaskImplementationID

type UntypedTaskImplementationID interface {
	// String returns the full string representation of the task implementation ID (ReferenceID#ImplementationHash).
	String() string
	// ReferenceIDString returns only the reference ID portion without the implementation hash.
	ReferenceIDString() string
	// GetUntypedReference returns the reference ID associated with this implementation ID.
	GetUntypedReference() UntypedTaskReference
}

UntypedTaskImplementationID defines the interface for task implementation IDs without type information. This allows the task system to handle task IDs generically when exact types are not needed.

type UntypedTaskReference

type UntypedTaskReference interface {
	PointToPointDescriptor
	// String returns the string representation of the reference ID.
	String() string
	// ReferenceIDString returns the reference ID portion without any implementation hash.
	ReferenceIDString() string
	// contains filtered or unexported methods
}

UntypedTaskReference defines the interface for task references without type information. This allows the task system to handle references generically when exact types are not needed.

Jump to

Keyboard shortcuts

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