diff --git a/internal/proto/asynq.proto b/internal/proto/asynq.proto index 199c9a1..788f43d 100644 --- a/internal/proto/asynq.proto +++ b/internal/proto/asynq.proto @@ -1,3 +1,7 @@ +// Copyright 2020 Kentaro Hibino. All rights reserved. +// Use of this source code is governed by a MIT license +// that can be found in the LICENSE file. + syntax = "proto3"; package asynq; @@ -5,57 +9,110 @@ import "google/protobuf/timestamp.proto"; option go_package = "github.com/hibiken/asynq/internal/proto"; -// TaskMessage is the internal representation of a task with additional metadata fields. -// See base.TaskMessage for details of each field. +// TaskMessage is the internal representation of a task with additional +// metadata fields. message TaskMessage { + // Type indicates the kind of the task to be performed. string type = 1; + // Payload holds data needed to process the task. bytes payload = 2; + // Unique identifier for the task. string id = 3; + // Name of the queue to which this task belongs. string queue = 4; + // Max number of retries for this task. int32 retry = 5; + // Number of times this task has been retried so far. int32 retried = 6; + // Error message from the last failure. string error_msg = 7; + // Timeout specifies timeout in seconds. + // Use zero to indicate no timeout. int64 timeout = 8; + // Deadline specifies the deadline for the task in Unix time, + // the number of seconds elapsed since January 1, 1970 UTC. + // Use zero to indicate no deadline. int64 deadline = 9; + // UniqueKey holds the redis key used for uniqueness lock for this task. + // Empty string indicates that no uniqueness lock was used. string unique_key = 10; }; // ServerInfo holds information about a running server. message ServerInfo { + // Host machine the server is running on. string host = 1; + + // PID of the server process. int32 pid = 2; + + // Unique identifier for this server. string server_id = 3; + + // Maximum number of concurrency this server will use. int32 concurrency = 4; + + // List of queue names with their priorities. + // The server will consume tasks from the queues and prioritize + // queues with higher priority numbers. map queues = 5; + + // If set, the server will always consume tasks from a queue with higher + // priority. bool strict_priority = 6; + + // Status indicates the status of the server. string status = 7; + + // Time this server was started. google.protobuf.Timestamp start_time = 8; + + // Number of workers currently processing tasks. int32 active_worker_count = 9; }; // WorkerInfo holds information about a running worker. message WorkerInfo { + // Host matchine this worker is running on. string host = 1; + + // PID of the process in which this worker is running. int32 pid = 2; + + // ID of the server in which this worker is running. string server_id = 3; + + // ID of the task this worker is processing. string task_id = 4; + + // Type of the task this worker is processing. string task_type = 5; + + // Payload of the task this worker is processing. bytes task_payload = 6; + + // Name of the queue the task the worker is processing belongs. string queue = 7; + + // Time this worker started processing the task. google.protobuf.Timestamp start_time = 8; + + // Deadline by which the worker needs to complete processing + // the task. If worker exceeds the deadline, the task will fail. google.protobuf.Timestamp deadline = 9; }; -// SchedulerEntry holds information about a periodic task registered with a scheduler. +// SchedulerEntry holds information about a periodic task registered +// with a scheduler. message SchedulerEntry { // Identifier of the scheduler entry. string id = 1; @@ -80,7 +137,8 @@ message SchedulerEntry { google.protobuf.Timestamp prev_enqueue_time = 7; }; -// SchedulerEnqueueEvent holds information about an enqueue event by a scheduler. +// SchedulerEnqueueEvent holds information about an enqueue event +// by a scheduler. message SchedulerEnqueueEvent { // ID of the task that was enqueued. string task_id = 1;