Skip to content

Commit 38b899c

Browse files
committed
move payloads to the separate file, add conventions
1 parent b27a82f commit 38b899c

File tree

3 files changed

+78
-20
lines changed

3 files changed

+78
-20
lines changed

api-linter.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
disabled_rules:
1313
- "core::0123::resource-annotation" # We don't require resource annotations on all messages -- https://linter.aip.dev/123/resource-annotation
1414

15+
- included_paths:
16+
- "**/worker/v1/worker_nexus_service_commands.proto"
17+
disabled_rules:
18+
- "core::0134::request-unknown-fields" # Same rationale as `core::0131::request-unknown-fields`, but for Update RPCs -- https://linter.aip.dev/134/request-unknown-fields
19+
1520
- included_paths:
1621
- "**/workflowservice/v1/request_response.proto"
1722
- "**/operatorservice/v1/request_response.proto"

temporal/api/worker/v1/message.proto

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ option csharp_namespace = "Temporalio.Api.Worker.V1";
1111

1212
import "google/protobuf/duration.proto";
1313
import "google/protobuf/timestamp.proto";
14-
import "google/protobuf/field_mask.proto";
1514

1615
import "temporal/api/deployment/v1/message.proto";
1716
import "temporal/api/enums/v1/common.proto";
18-
import "temporal/api/sdk/v1/worker_config.proto";
1917

2018
message WorkerPollerInfo {
2119
// Number of polling RPCs that are currently in flight.
@@ -145,21 +143,3 @@ message PluginInfo {
145143
// The version of the plugin, may be empty.
146144
string version = 2;
147145
}
148-
149-
// Will be send to the worker as a payload of the FetchWorkerConfig command.
150-
message FetchWorkerConfigCommandPayload {
151-
// Worker identifier, should be unique for the namespace.
152-
string worker_instance_key = 1;
153-
}
154-
155-
// Will be send to the worker as a payload of the UpdateWorkerConfig command.
156-
message UpdateWorkerConfigCommandPayload {
157-
// Worker identifier, should be unique for the namespace.
158-
repeated string worker_instance_key = 1;
159-
160-
// The new worker config to be applied.
161-
temporal.api.sdk.v1.WorkerConfig worker_config = 2;
162-
163-
// Controls which fields from `worker_config` will be applied
164-
google.protobuf.FieldMask update_mask = 3;
165-
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
syntax = "proto3";
2+
3+
package temporal.api.worker.v1;
4+
5+
option go_package = "go.temporal.io/api/worker/v1;worker";
6+
option java_package = "io.temporal.api.worker.v1";
7+
option java_multiple_files = true;
8+
option java_outer_classname = "WorkerNexusServiceCommandsProto";
9+
option ruby_package = "Temporalio::Api::Worker::V1";
10+
option csharp_namespace = "Temporalio.Api.Worker.V1";
11+
12+
import "google/protobuf/field_mask.proto";
13+
import "temporal/api/sdk/v1/worker_config.proto";
14+
15+
// (--
16+
/////////////////////////////////////////////////////////////////////
17+
// This file contains:
18+
// - Conventions between server and worker.
19+
// - Definitions for commands and payloads for server-worker communication via Nexus
20+
//
21+
// WORKER COMMANDS AND CONVENTIONS:
22+
//
23+
// Worker commands are used to manage worker configurations, operations, etc.
24+
// Command names should match names defined in the server API.
25+
// Currently supported commands:
26+
// - FetchWorkerConfig
27+
// - UpdateWorkerConfig.
28+
//
29+
// Command names are provided in StartOperationRequest.Operation field.
30+
//
31+
// PAYLOAD CONVENTIONS:
32+
//
33+
// In/out payloads namings follow the same convention as the regular API:
34+
// - CommandNameRequest (input payload)
35+
// - CommandNameResponse (output payload).
36+
// - Empty payload if response is not needed/not expected
37+
//
38+
// COMMUNICATION PROTOCOL:
39+
// - Transport: Nexus messages on dedicated channel
40+
// - Server identifier: "sys-worker-service"
41+
// - Task queue: "temporal-sys/worker-tq/{namespace_name}/{process_key}"
42+
// --)
43+
44+
// Will be send to the worker as a payload of the FetchWorkerConfig command.
45+
message FetchWorkerConfigRequest {
46+
// List of worker identifiers. For now only a single worker instance key is supported.
47+
repeated string worker_instance_key = 1;
48+
}
49+
50+
message FetchWorkerConfigResponse {
51+
message WorkerConfigEntry {
52+
// Worker instance key the config is for.
53+
string worker_instance_key = 1;
54+
55+
temporal.api.sdk.v1.WorkerConfig worker_config = 2;
56+
}
57+
repeated WorkerConfigEntry worker_configs = 1;
58+
}
59+
60+
// Will be send to the worker as a payload of the UpdateWorkerConfig command.
61+
message UpdateWorkerConfigRequest {
62+
// List of worker identifiers.
63+
repeated string worker_instance_key = 1;
64+
65+
// The new worker config to be applied.
66+
temporal.api.sdk.v1.WorkerConfig worker_config = 2;
67+
68+
// Controls which fields from `worker_config` will be applied
69+
google.protobuf.FieldMask update_mask = 3;
70+
}
71+
72+
message UpdateWorkerConfigResponse {
73+
}

0 commit comments

Comments
 (0)