42 lines
1.5 KiB
Go
42 lines
1.5 KiB
Go
|
|
// Code generated by ndpgen. DO NOT EDIT.
|
||
|
|
//
|
||
|
|
// This file provides stub implementations for non-WASM platforms.
|
||
|
|
// It allows Go plugins to compile and run tests outside of WASM,
|
||
|
|
// but the actual functionality is only available in WASM builds.
|
||
|
|
//
|
||
|
|
//go:build !wasip1
|
||
|
|
|
||
|
|
package taskworker
|
||
|
|
|
||
|
|
// TaskExecuteRequest is the request provided when a task is ready to execute.
|
||
|
|
type TaskExecuteRequest struct {
|
||
|
|
// QueueName is the name of the queue this task belongs to.
|
||
|
|
QueueName string `json:"queueName"`
|
||
|
|
// TaskID is the unique identifier for this task.
|
||
|
|
TaskID string `json:"taskId"`
|
||
|
|
// Payload is the opaque data provided when the task was enqueued.
|
||
|
|
Payload []byte `json:"payload"`
|
||
|
|
// Attempt is the current attempt number (1-based: first attempt = 1).
|
||
|
|
Attempt int32 `json:"attempt"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// TaskWorker is the marker interface for taskworker plugins.
|
||
|
|
// Implement one or more of the provider interfaces below.
|
||
|
|
// TaskWorker provides task execution handling.
|
||
|
|
// This capability allows plugins to receive callbacks when their queued tasks
|
||
|
|
// are ready to execute. Plugins that use the taskqueue host service must
|
||
|
|
// implement this capability.
|
||
|
|
type TaskWorker interface{}
|
||
|
|
|
||
|
|
// TaskExecuteProvider provides the OnTaskExecute function.
|
||
|
|
type TaskExecuteProvider interface {
|
||
|
|
OnTaskExecute(TaskExecuteRequest) (string, error)
|
||
|
|
}
|
||
|
|
|
||
|
|
// NotImplementedCode is the standard return code for unimplemented functions.
|
||
|
|
const NotImplementedCode int32 = -2
|
||
|
|
|
||
|
|
// Register is a no-op on non-WASM platforms.
|
||
|
|
// This stub allows code to compile outside of WASM.
|
||
|
|
func Register(_ TaskWorker) {}
|