{"modulePath":"github.com/golang-queue/queue","version":"v0.6.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package core\n\n## Types\n\n```go\ntype QueuedMessage interface {\n\tBytes() []byte\n}\n```\nQueuedMessage 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.\n\n```go\ntype TaskMessage interface {\n\tQueuedMessage\n\tPayload() []byte\n}\n```\nTaskMessage 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.\n\n```go\ntype Worker interface {\n\t// Run starts the worker and processes the given task in the provided context.\n\t// It returns an error if the task cannot be processed.\n\tRun(ctx context.Context, task TaskMessage) error\n\n\t// Shutdown stops the worker and performs any necessary cleanup.\n\t// It returns an error if the shutdown process fails.\n\tShutdown() error\n\n\t// Queue adds a task to the worker's queue.\n\t// It returns an error if the task cannot be added to the queue.\n\tQueue(task TaskMessage) error\n\n\t// Request retrieves a task from the worker's queue.\n\t// It returns the queued message and an error if the retrieval fails.\n\tRequest() (TaskMessage, error)\n}\n```\nWorker 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.\n\n","path":"github.com/golang-queue/queue/core","name":"core","synopsis":"","isRedistributable":true}
