Documentation
¶
Index ¶
- Constants
- func BeginCompletion(ctx context.Context, rdb *common.RedisClient, meta types.TaskMetadata, ...) (context.Context, context.CancelFunc, error)
- func CompletionContext(ctx context.Context, policy types.TaskCompletionConfig) (context.Context, context.CancelFunc, error)
- func CompletionError(err error) error
- func CompletionExpired(ctx context.Context, rdb *common.RedisClient, meta types.TaskMetadata) (bool, error)
- func ContainerIsRunning(containers repository.ContainerRepository, containerID string) (bool, error)
- func ForgetDeletedTask(ctx context.Context, rdb *common.RedisClient, meta types.TaskMetadata) error
- func FunctionPhaseLabelsFromStub(stub *types.StubWithRelated, stubConfig types.StubConfigV1, ...) map[string]string
- func FunctionPhaseLabelsFromTask(task *types.TaskWithRelated) map[string]string
- func GetTaskResultPath(taskId string) string
- func KeepFinalizationAlive(ctx context.Context, taskID string, refresh func(context.Context) error) (context.Context, func(), error)
- func RenewTaskLiveness(ctx context.Context, rdb *common.RedisClient, meta types.TaskMetadata, ...) error
- func SerializeHttpPayload(ctx echo.Context) (*types.TaskPayload, error)
- type Dispatcher
- func (d *Dispatcher) Claim(ctx context.Context, workspaceName, stubId, taskId, containerId string) error
- func (d *Dispatcher) Complete(ctx context.Context, workspaceName, stubId, taskId string) error
- func (d *Dispatcher) Register(executor string, ...)
- func (d *Dispatcher) Release(ctx context.Context, workspaceName, stubId, taskId string) error
- func (d *Dispatcher) Retrieve(ctx context.Context, workspaceName, stubId, taskId string) (types.TaskInterface, error)
- func (d *Dispatcher) RetryTask(ctx context.Context, task types.TaskInterface) error
- func (d *Dispatcher) Send(ctx context.Context, executor string, authInfo *auth.AuthInfo, stubId string, ...) (types.TaskInterface, error)
- func (d *Dispatcher) SendAndExecute(ctx context.Context, executor string, authInfo *auth.AuthInfo, stubId string, ...) (types.TaskInterface, error)
- func (d *Dispatcher) StoreTaskResult(ctx context.Context, workspace *types.Workspace, taskId string, result []byte) error
- type PhaseMetrics
- func (m *PhaseMetrics) Labels(ctx context.Context, workspaceName, taskId string, fallback map[string]string) map[string]string
- func (m *PhaseMetrics) Mark(ctx context.Context, workspaceName, taskId, phase string, at time.Time) error
- func (m *PhaseMetrics) RecordSince(ctx context.Context, workspaceName, taskId, metricPhase, sincePhase string, ...)
- func (m *PhaseMetrics) StoreLabels(ctx context.Context, workspaceName, taskId string, labels map[string]string) error
- func (m *PhaseMetrics) Timestamp(ctx context.Context, workspaceName, taskId, phase string) (time.Time, bool, error)
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 ¶
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 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 ¶
type PhaseMetrics ¶
type PhaseMetrics struct {
// contains filtered or unexported fields
}
func NewPhaseMetrics ¶
func NewPhaseMetrics(rdb *common.RedisClient) *PhaseMetrics
func (*PhaseMetrics) RecordSince ¶
func (*PhaseMetrics) StoreLabels ¶
Click to show internal directories.
Click to hide internal directories.