task

package
v0.0.0-...-0186d81 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FunctionPhaseContainerRequestReady = types.FunctionLifecycleCheckpointContainerRequestReady
	FunctionPhaseStartTask             = types.FunctionLifecycleCheckpointStartTask
	FunctionPhaseGetArgs               = types.FunctionLifecycleCheckpointGetArgs
	FunctionPhaseSetResult             = types.FunctionLifecycleCheckpointSetResult
)

Variables

This section is empty.

Functions

func BeginCompletion

func BeginCompletion(ctx context.Context, rdb *common.RedisClient, meta types.TaskMetadata, budget time.Duration) (context.Context, context.CancelFunc, error)

BeginCompletion fixes the execution's deadline across replays and gateway restarts.

func CompletionContext

func CompletionContext(ctx context.Context, policy types.TaskCompletionConfig) (context.Context, context.CancelFunc, error)

CompletionContext lets an accepted completion outlive its client, within policy.

func CompletionError

func CompletionError(err error) error

CompletionError distinguishes permanent rejection from retryable persistence errors.

func CompletionExpired

func CompletionExpired(ctx context.Context, rdb *common.RedisClient, meta types.TaskMetadata) (bool, error)

func ContainerIsRunning

func ContainerIsRunning(containers repository.ContainerRepository, containerID string) (bool, error)

ContainerIsRunning distinguishes a stopped container from a repository outage. A lost gateway heartbeat alone must not cause another execution of user code.

func ForgetDeletedTask

func ForgetDeletedTask(ctx context.Context, rdb *common.RedisClient, meta types.TaskMetadata) error

ForgetDeletedTask clears orphaned recovery state only for its current owner.

func FunctionPhaseLabelsFromStub

func FunctionPhaseLabelsFromStub(stub *types.StubWithRelated, stubConfig types.StubConfigV1, status types.TaskStatus) map[string]string

func FunctionPhaseLabelsFromTask

func FunctionPhaseLabelsFromTask(task *types.TaskWithRelated) map[string]string

func GetTaskResultPath

func GetTaskResultPath(taskId string) string

func KeepFinalizationAlive

func KeepFinalizationAlive(ctx context.Context, taskID string, refresh func(context.Context) error) (context.Context, func(), error)

KeepFinalizationAlive renews leases until stopped. Its stop function joins the renewer.

func RenewTaskLiveness

func RenewTaskLiveness(ctx context.Context, rdb *common.RedisClient, meta types.TaskMetadata, heartbeat, running, index string) error

RenewTaskLiveness atomically verifies ownership and caps leases at the completion deadline.

func SerializeHttpPayload

func SerializeHttpPayload(ctx echo.Context) (*types.TaskPayload, error)

Types

type Dispatcher

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

func NewDispatcher

func NewDispatcher(ctx context.Context, taskRepo repository.TaskRepository) (*Dispatcher, error)

func (*Dispatcher) Claim

func (d *Dispatcher) Claim(ctx context.Context, workspaceName, stubId, taskId, containerId string) error

func (*Dispatcher) Complete

func (d *Dispatcher) Complete(ctx context.Context, workspaceName, stubId, taskId string) error

func (*Dispatcher) Register

func (d *Dispatcher) Register(executor string, taskFactory func(ctx context.Context, message types.TaskMessage) (types.TaskInterface, error))

func (*Dispatcher) Release

func (d *Dispatcher) Release(ctx context.Context, workspaceName, stubId, taskId string) error

func (*Dispatcher) Retrieve

func (d *Dispatcher) Retrieve(ctx context.Context, workspaceName, stubId, taskId string) (types.TaskInterface, error)

func (*Dispatcher) RetryTask

func (d *Dispatcher) RetryTask(ctx context.Context, task types.TaskInterface) error

func (*Dispatcher) Send

func (d *Dispatcher) Send(ctx context.Context, executor string, authInfo *auth.AuthInfo, stubId string, payload *types.TaskPayload, policy types.TaskPolicy) (types.TaskInterface, error)

func (*Dispatcher) SendAndExecute

func (d *Dispatcher) SendAndExecute(ctx context.Context, executor string, authInfo *auth.AuthInfo, stubId string, payload *types.TaskPayload, policy types.TaskPolicy, options ...interface{}) (types.TaskInterface, error)

func (*Dispatcher) StoreTaskResult

func (d *Dispatcher) StoreTaskResult(ctx context.Context, workspace *types.Workspace, taskId string, result []byte) error

type PhaseMetrics

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

func NewPhaseMetrics

func NewPhaseMetrics(rdb *common.RedisClient) *PhaseMetrics

func (*PhaseMetrics) Labels

func (m *PhaseMetrics) Labels(ctx context.Context, workspaceName, taskId string, fallback map[string]string) map[string]string

func (*PhaseMetrics) Mark

func (m *PhaseMetrics) Mark(ctx context.Context, workspaceName, taskId, phase string, at time.Time) error

func (*PhaseMetrics) RecordSince

func (m *PhaseMetrics) RecordSince(ctx context.Context, workspaceName, taskId, metricPhase, sincePhase string, end time.Time, labels map[string]string)

func (*PhaseMetrics) StoreLabels

func (m *PhaseMetrics) StoreLabels(ctx context.Context, workspaceName, taskId string, labels map[string]string) error

func (*PhaseMetrics) Timestamp

func (m *PhaseMetrics) Timestamp(ctx context.Context, workspaceName, taskId, phase string) (time.Time, bool, error)

Jump to

Keyboard shortcuts

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