Documentation
¶
Overview ¶
Package scheduleclient provides functionalities to interact with a scheduling service, such as creating and managing scheduled tasks.
Index ¶
- Variables
- type ScheduleClient
- func (c *ScheduleClient) DeleteScheduledTask(ctx context.Context, handler client.ScheduleHandle) error
- func (c *ScheduleClient) PauseScheduledTask(ctx context.Context, handler client.ScheduleHandle, ...) error
- func (c *ScheduleClient) ResumeScheduledTask(ctx context.Context, handler client.ScheduleHandle, ...) error
- func (sc *ScheduleClient) ScheduleTask(ctx context.Context, task *Task) (*client.ScheduleHandle, error)
- func (c *ScheduleClient) UpdateScheduledTask(ctx context.Context, handler client.ScheduleHandle, ...) error
- type ScheduleOption
- type Task
Constants ¶
This section is empty.
Variables ¶
var ( ErrClientNotSet = errors.New("client not set") ErrLoggerNotSet = errors.New("logger not set") ErrTaskIdNotSet = errors.New("task id not set") ErrTaskSpecNotSet = errors.New("task spec not set") ErrTaskActionNotSet = errors.New("task action not set") ErrScheduleClientNotSet = errors.New("schedule client not set") )
Functions ¶
This section is empty.
Types ¶
type ScheduleClient ¶
type ScheduleClient struct { Logger *zap.Logger // Logger for logging messages. ScheduleClient client.ScheduleClient // Specific client for scheduling-related operations. // contains filtered or unexported fields }
ScheduleClient is a struct that encapsulates clients and logger necessary for scheduling tasks. It includes the Temporal client, a logger, and a specific schedule client for task scheduling.
func NewScheduleClient ¶
func NewScheduleClient(opts ...ScheduleOption) (*ScheduleClient, error)
NewScheduleClient creates a new instance of ScheduleClient with the provided options. It applies each option to modify the ScheduleClient and validates it before returning. Returns an error if the validation fails.
func (*ScheduleClient) DeleteScheduledTask ¶
func (c *ScheduleClient) DeleteScheduledTask( ctx context.Context, handler client.ScheduleHandle) error
DeleteScheduledTask deletes an existing scheduled task. It takes a context and the task's handler as arguments.
func (*ScheduleClient) PauseScheduledTask ¶
func (c *ScheduleClient) PauseScheduledTask( ctx context.Context, handler client.ScheduleHandle, options *client.SchedulePauseOptions) error
PauseScheduledTask pauses an existing scheduled task. It takes a context, the task's handler, and pause options as arguments.
func (*ScheduleClient) ResumeScheduledTask ¶
func (c *ScheduleClient) ResumeScheduledTask( ctx context.Context, handler client.ScheduleHandle, options *client.ScheduleUnpauseOptions) error
ResumeScheduledTask resumes a paused scheduled task. It takes a context, the task's handler, and unpause options as arguments.
func (*ScheduleClient) ScheduleTask ¶
func (sc *ScheduleClient) ScheduleTask(ctx context.Context, task *Task) (*client.ScheduleHandle, error)
ScheduleTask schedules a new task using the provided context and task details. It returns a handle to the scheduled task and any error encountered.
func (*ScheduleClient) UpdateScheduledTask ¶
func (c *ScheduleClient) UpdateScheduledTask( ctx context.Context, handler client.ScheduleHandle, options *client.ScheduleUpdateOptions) error
UpdateScheduledTask updates an existing scheduled task using the provided options. It takes a context, the task's handler, and update options as arguments.
type ScheduleOption ¶
type ScheduleOption func(*ScheduleClient)
func WithClient ¶
func WithClient(client *client.Client) ScheduleOption
func WithLogger ¶
func WithLogger(logger *zap.Logger) ScheduleOption
func WithScheduleClient ¶
func WithScheduleClient(scheduleClient client.ScheduleClient) ScheduleOption
type Task ¶
type Task struct { Id string `json:"id"` // Unique identifier for the task. Spec *client.ScheduleSpec `json:"spec"` // Specification of the scheduling. Action *client.ScheduleWorkflowAction `json:"action"` // Action to be executed by the task. }
Task represents a schedulable task with an ID, specification, and action.