core

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 1 Imported by: 17 modules, 27 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QueuedMessage

type QueuedMessage interface {
	Bytes() []byte
}

QueuedMessage represents an interface for a message that can be queued. It requires the implementation of a Bytes method, which returns the message content as a slice of bytes.

type TaskMessage added in v0.3.0

type TaskMessage interface {
	QueuedMessage
	Payload() []byte
}

TaskMessage represents an interface for a task message that can be queued. It embeds the QueuedMessage interface and adds a method to retrieve the payload of the message.

type Worker

type Worker interface {
	// Run starts the worker and processes the given task in the provided context.
	// It returns an error if the task cannot be processed.
	Run(ctx context.Context, task TaskMessage) error

	// Shutdown stops the worker and performs any necessary cleanup.
	// It returns an error if the shutdown process fails.
	Shutdown() error

	// Queue adds a task to the worker's queue.
	// It returns an error if the task cannot be added to the queue.
	Queue(task TaskMessage) error

	// Request retrieves a task from the worker's queue.
	// It returns the queued message and an error if the retrieval fails.
	Request() (TaskMessage, error)
}

Worker represents an interface for a worker that processes tasks. It provides methods to run tasks, shut down the worker, queue tasks, and request tasks from the queue.

Jump to

Keyboard shortcuts

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