taskid

package
v0.52.2 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskImplementationID

type TaskImplementationID[TaskResult any] interface {
	UntypedTaskImplementationID
	// Ref returns the typed reference associated with this implementation ID.
	Ref() 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.

func ReinterpretTaskImplementationID

func ReinterpretTaskImplementationID[T any](id UntypedTaskImplementationID) TaskImplementationID[T]

ReinterpretTaskImplementationID casts UntypedImplementationID to TaskImplementationID[T]. Use this with caution.

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
}

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) 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.

func ReinterpretTaskReference

func ReinterpretTaskReference[T any](ref UntypedTaskReference) TaskReference[T]

ReinterpretTaskReference casts UntypedTaskReference to TaskReference[T]. Use this with caution.

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
	// GetTaskImplementationHash returns the implementation-specific hash part of the ID.
	GetTaskImplementationHash() 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 {
	// 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