From c8dac64763fc006362dd3343603464938136722f Mon Sep 17 00:00:00 2001 From: Fedor Sakharov Date: Wed, 9 Oct 2024 20:24:04 +0200 Subject: [PATCH] adds types and service rpc between gw and worker --- proto/lagrange.proto | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/proto/lagrange.proto b/proto/lagrange.proto index 9111b5c..0cb0138 100644 --- a/proto/lagrange.proto +++ b/proto/lagrange.proto @@ -26,6 +26,49 @@ message TaskType { } } +message MessageEnvelope { + message RoutingKey { + string domain = 1; + uint64 priority = 2; + } + /// Query id is unique for each query and shared between all its tasks + string query_id = 1; + + /// Task id is unique for each task and helps to map replies to tasks + string task_id = 2; + + /// Task id referenced in the DB tasks table + /// TODO: optional? + int32 db_task_id = 3; + + /// Estimate how long it takes this task to finish. + /// This includes may factors like: redis queue current length, workers count, parallel queries count, etc. + /// Ideally assigned by an "intelligent" algorithm. Not important for now though. + /// Might become relevant then we have clients waiting for results, and we can process queries + /// relatively fast. + uint64 rtt = 4; + + /// How much work prover has to do + uint64 gas = 5; + + /// How and where to route the message. + RoutingKey routing_key = 6; + + /// Details of the task to be executed. + TaskType inner = 7; +} + +message DownstreamPayload { + oneof downstream_payload { + MessageEnvelope todo = 1; + } +} + +service WorkersService { + // A bidirectional streaming RPC between GW<->Worker + rpc WorkerToGw(stream ReplyType) returns (stream DownstreamPayload) {} +} + message ReplyType { enum ProofCathegory { PROOF_CATHEGORY_UNSPECIFIED = 0;