2
0
mirror of https://github.com/hibiken/asynq.git synced 2025-04-22 16:50:18 +08:00

Add comments to proto definitions

This commit is contained in:
Ken Hibino 2021-03-09 06:39:01 -08:00
parent 499d35c0fc
commit e136e26b7e

View File

@ -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"; syntax = "proto3";
package asynq; package asynq;
@ -5,57 +9,110 @@ import "google/protobuf/timestamp.proto";
option go_package = "github.com/hibiken/asynq/internal/proto"; option go_package = "github.com/hibiken/asynq/internal/proto";
// TaskMessage is the internal representation of a task with additional metadata fields. // TaskMessage is the internal representation of a task with additional
// See base.TaskMessage for details of each field. // metadata fields.
message TaskMessage { message TaskMessage {
// Type indicates the kind of the task to be performed.
string type = 1; string type = 1;
// Payload holds data needed to process the task.
bytes payload = 2; bytes payload = 2;
// Unique identifier for the task.
string id = 3; string id = 3;
// Name of the queue to which this task belongs.
string queue = 4; string queue = 4;
// Max number of retries for this task.
int32 retry = 5; int32 retry = 5;
// Number of times this task has been retried so far.
int32 retried = 6; int32 retried = 6;
// Error message from the last failure.
string error_msg = 7; string error_msg = 7;
// Timeout specifies timeout in seconds.
// Use zero to indicate no timeout.
int64 timeout = 8; 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; 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; string unique_key = 10;
}; };
// ServerInfo holds information about a running server. // ServerInfo holds information about a running server.
message ServerInfo { message ServerInfo {
// Host machine the server is running on.
string host = 1; string host = 1;
// PID of the server process.
int32 pid = 2; int32 pid = 2;
// Unique identifier for this server.
string server_id = 3; string server_id = 3;
// Maximum number of concurrency this server will use.
int32 concurrency = 4; 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<string, int32> queues = 5; map<string, int32> queues = 5;
// If set, the server will always consume tasks from a queue with higher
// priority.
bool strict_priority = 6; bool strict_priority = 6;
// Status indicates the status of the server.
string status = 7; string status = 7;
// Time this server was started.
google.protobuf.Timestamp start_time = 8; google.protobuf.Timestamp start_time = 8;
// Number of workers currently processing tasks.
int32 active_worker_count = 9; int32 active_worker_count = 9;
}; };
// WorkerInfo holds information about a running worker. // WorkerInfo holds information about a running worker.
message WorkerInfo { message WorkerInfo {
// Host matchine this worker is running on.
string host = 1; string host = 1;
// PID of the process in which this worker is running.
int32 pid = 2; int32 pid = 2;
// ID of the server in which this worker is running.
string server_id = 3; string server_id = 3;
// ID of the task this worker is processing.
string task_id = 4; string task_id = 4;
// Type of the task this worker is processing.
string task_type = 5; string task_type = 5;
// Payload of the task this worker is processing.
bytes task_payload = 6; bytes task_payload = 6;
// Name of the queue the task the worker is processing belongs.
string queue = 7; string queue = 7;
// Time this worker started processing the task.
google.protobuf.Timestamp start_time = 8; 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; 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 { message SchedulerEntry {
// Identifier of the scheduler entry. // Identifier of the scheduler entry.
string id = 1; string id = 1;
@ -80,7 +137,8 @@ message SchedulerEntry {
google.protobuf.Timestamp prev_enqueue_time = 7; 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 { message SchedulerEnqueueEvent {
// ID of the task that was enqueued. // ID of the task that was enqueued.
string task_id = 1; string task_id = 1;