|
| 1 | +// @file vine.proto |
| 2 | +// @brief Defines the gRPC services and messages for communication between Mountain (host) and Cocoon (sidecar). |
| 3 | + |
| 4 | +syntax = "proto3"; |
| 5 | + |
| 6 | +package vine_ipc; |
| 7 | + |
| 8 | +// Service running on the Mountain host, listening for requests from Cocoon. |
| 9 | +service MountainService { |
| 10 | + // A generic request-response method for Cocoon to call a function on Mountain. |
| 11 | + rpc ProcessCocoonRequest(GenericRequest) returns (GenericResponse); |
| 12 | + // A generic fire-and-forget method for Cocoon to send a notification to Mountain. |
| 13 | + rpc SendCocoonNotification(GenericNotification) returns (Empty); |
| 14 | + // A method for Cocoon to request that Mountain cancel a long-running operation. |
| 15 | + rpc CancelOperation(CancelOperationRequest) returns (Empty); |
| 16 | +} |
| 17 | + |
| 18 | +// Service running on the Cocoon sidecar, listening for requests from Mountain. |
| 19 | +service CocoonService { |
| 20 | + // A generic request-response method for Mountain to call a function on Cocoon. |
| 21 | + rpc ProcessMountainRequest(GenericRequest) returns (GenericResponse); |
| 22 | + // A generic fire-and-forget method for Mountain to send a notification to Cocoon. |
| 23 | + rpc SendMountainNotification(GenericNotification) returns (Empty); |
| 24 | + // A method for Mountain to request that Cocoon cancel a long-running operation. |
| 25 | + rpc CancelOperation(CancelOperationRequest) returns (Empty); |
| 26 | +} |
| 27 | + |
| 28 | +// Represents an empty message, typically used for RPCs that don't need to return data. |
| 29 | +message Empty {} |
| 30 | + |
| 31 | +// A generic request message containing a method name and serialized parameters. |
| 32 | +message GenericRequest { |
| 33 | + uint64 request_id = 1; |
| 34 | + string method = 2; |
| 35 | + bytes params = 3; // Parameters are expected to be a JSON-serialized byte array. |
| 36 | +} |
| 37 | + |
| 38 | +// A generic response message containing the result or an error. |
| 39 | +message GenericResponse { |
| 40 | + uint64 request_id = 1; |
| 41 | + bytes result = 2; // The successful result, JSON-serialized. |
| 42 | + optional RpcError error = 3; |
| 43 | +} |
| 44 | + |
| 45 | +// A generic notification message, which is fire-and-forget and does not have an ID. |
| 46 | +message GenericNotification { |
| 47 | + string method = 1; |
| 48 | + bytes params = 2; // Parameters are expected to be a JSON-serialized byte array. |
| 49 | +} |
| 50 | + |
| 51 | +// A structured error payload, compliant with JSON-RPC error objects. |
| 52 | +message RpcError { |
| 53 | + int32 code = 1; |
| 54 | + string message = 2; |
| 55 | + bytes data = 3; // Optional, additional error data, JSON-serialized. |
| 56 | +} |
| 57 | + |
| 58 | +// A message to cancel a specific, ongoing operation. |
| 59 | +message CancelOperationRequest { |
| 60 | + uint64 request_id_to_cancel = 1; |
| 61 | +} |
| 62 | + |
| 63 | +// A generic data payload, currently unused but available for future extensions. |
| 64 | +message RpcDataPayload { |
| 65 | + bytes data = 1; |
| 66 | +} |
0 commit comments