From 564ca3cce7a9108bfea09b8b6a3d77cdae29b821 Mon Sep 17 00:00:00 2001 From: raphael-goetz Date: Fri, 3 Jan 2025 18:50:39 +0100 Subject: [PATCH 1/9] feat: adjusted build configuration --- build/rust/build.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/build/rust/build.rs b/build/rust/build.rs index 3d9f519..08c90ab 100644 --- a/build/rust/build.rs +++ b/build/rust/build.rs @@ -2,17 +2,21 @@ use std::fs::create_dir; use std::io::Result; fn main() -> Result<()> { - let proto = &[ - "definitions.proto", + // aquila + "action.proto", + "action_execute.proto", + // sagittarius + "action.proto", + "datatype.proto", + "flow.proto", "flow_definition.proto", "node.proto", - "flow.proto", - "action.proto", - "transfer.proto", "ping.proto", - "action_execute.proto", - "event.proto" + // shared + "datatype_definition.proto", + "runtime_function_definition.proto", + "translations.proto", ]; let inclusions = &[ @@ -41,4 +45,4 @@ fn main() -> Result<()> { .expect("Cannot compile internal protos"); Ok(()) -} \ No newline at end of file +} From f80c1e12d2b5a34819d514bc95ce078c5490382c Mon Sep 17 00:00:00 2001 From: raphael-goetz Date: Fri, 3 Jan 2025 18:50:58 +0100 Subject: [PATCH 2/9] fix: removed unused/unwanted proto files --- proto/aquila/event.proto | 13 ------------- proto/aquila/transfer.proto | 33 --------------------------------- 2 files changed, 46 deletions(-) delete mode 100644 proto/aquila/event.proto delete mode 100644 proto/aquila/transfer.proto diff --git a/proto/aquila/event.proto b/proto/aquila/event.proto deleted file mode 100644 index 917150c..0000000 --- a/proto/aquila/event.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; - -option ruby_package = "Tucana::Aquila"; - -package aquila; - -// Event that gets admitted by an action -message Event { - // Id of Event type - string event_type = 1; - // Payload (JSON) of event params - string payload = 2; -} \ No newline at end of file diff --git a/proto/aquila/transfer.proto b/proto/aquila/transfer.proto deleted file mode 100644 index afd8a94..0000000 --- a/proto/aquila/transfer.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; - -import "definitions.proto"; - -option ruby_package = "Tucana::Aquila"; - -package aquila; - -message InformationRequest { - string identifier = 1; - repeated shared.RuntimeFunctionDefinition function_definition = 2; - repeated shared.RuntimeParameterDefinition parameter_definition = 3; -} - -message InformationResponse { - bool success = 1; -} - -message ActionExecuteRequest { - string execution_identifier = 1; - string function_identifier = 2; - repeated string parameters = 3; -} - -message ActionExecuteResponse { - string execution_identifier = 1; - repeated string result = 2; -} - -service ActionTransferService { - rpc Transfer (stream InformationRequest) returns (InformationResponse); - rpc Execute (stream ActionExecuteRequest) returns (stream ActionExecuteResponse); -} \ No newline at end of file From 156647daa72980bf96b88b28a2e0b93b5df6df0d Mon Sep 17 00:00:00 2001 From: raphael-goetz Date: Fri, 3 Jan 2025 18:51:11 +0100 Subject: [PATCH 3/9] feat: added action proto for aquila --- proto/aquila/action.proto | 65 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 proto/aquila/action.proto diff --git a/proto/aquila/action.proto b/proto/aquila/action.proto new file mode 100644 index 0000000..eb5b7bd --- /dev/null +++ b/proto/aquila/action.proto @@ -0,0 +1,65 @@ +syntax = "proto3"; + +import "runtime_function_definition.proto"; + +option ruby_package = "Tucana::Aquila"; + +package aquila; + +// Event that gets admitted by an action +message Event { + // Id of Event type + string event_type = 1; + // Payload (JSON) of event params + string payload = 2; +} + +// Action flow/event configuration +message Configuration { + // Action identifier + string identifier = 1; + // Configuration + repeated shared.RuntimeFunctionDefinition function_definition = 2; +} + +// Request to execute a request a flow +message ExecutionRequest { + // Execution identifier of execution + string execution_identifier = 1; + // Function identifier of flow to execute + string function_identifier = 2; + // Parameters of flow required to execute + repeated string parameters = 3; +} + +// Result from executed flows by an action +message ExecutionResult { + // Identifier of flow to execute + string execution_identifier = 1; + // Result of executed flow + repeated string result = 2; +} + +message TransferRequest { + oneof data { + // Configuration of action that will be send to sagittarius + // + // Expected behavior: + // Aquila will abort if the first request is not a configuration + Configuration configuration = 1; + // Event that got admitted + Event event = 2; + // Result of execution that was triggered by a execution request + ExecutionResult result = 3; + } +} + +message TransferResponse { + // Execution request + ExecutionRequest execution = 1; +} + +service ActionTransferService { + // This behavior achieves a bi-directional stream so that both services aren't required to be a server & client on their own + rpc Transfer (stream TransferRequest) returns (stream TransferResponse); +} \ No newline at end of file From 2a23d74b489e83d7eab27931ef1c0699e71a8bfa Mon Sep 17 00:00:00 2001 From: raphael-goetz Date: Fri, 3 Jan 2025 18:51:17 +0100 Subject: [PATCH 4/9] feat: small changes --- proto/sagittarius/action.proto | 3 +-- proto/sagittarius/node.proto | 2 +- proto/shared/definitions.proto | 13 ----------- .../shared/runtime_function_definition.proto | 22 +++++++++++++++++++ proto/shared/translations.proto | 3 +++ 5 files changed, 27 insertions(+), 16 deletions(-) delete mode 100644 proto/shared/definitions.proto create mode 100644 proto/shared/runtime_function_definition.proto diff --git a/proto/sagittarius/action.proto b/proto/sagittarius/action.proto index 81b801a..fa1e819 100644 --- a/proto/sagittarius/action.proto +++ b/proto/sagittarius/action.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -import "definitions.proto"; +import "runtime_function_definition.proto"; option ruby_package = "Tucana::Sagittarius"; @@ -8,7 +8,6 @@ package sagittarius; message ActionLogonRequest { string identifier = 1; repeated shared.RuntimeFunctionDefinition function_definition = 2; - repeated shared.RuntimeParameterDefinition parameter_definition = 3; } message ActionLogonResponse {} diff --git a/proto/sagittarius/node.proto b/proto/sagittarius/node.proto index a3024f9..994275d 100644 --- a/proto/sagittarius/node.proto +++ b/proto/sagittarius/node.proto @@ -4,7 +4,7 @@ option ruby_package = "Tucana::Sagittarius"; package sagittarius; -import "definitions.proto"; +import "runtime_function_definition.proto"; message Node { shared.RuntimeFunctionDefinition definition = 1; diff --git a/proto/shared/definitions.proto b/proto/shared/definitions.proto deleted file mode 100644 index c056c1f..0000000 --- a/proto/shared/definitions.proto +++ /dev/null @@ -1,13 +0,0 @@ -syntax = "proto3"; - -option ruby_package = "Tucana::Shared"; - -package shared; - -message RuntimeFunctionDefinition { - string id = 1; -} - -message RuntimeParameterDefinition { - string name = 1; -} \ No newline at end of file diff --git a/proto/shared/runtime_function_definition.proto b/proto/shared/runtime_function_definition.proto new file mode 100644 index 0000000..7ee62b8 --- /dev/null +++ b/proto/shared/runtime_function_definition.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +import "datatype_definition.proto"; + +option ruby_package = "Tucana::Shared"; + +package shared; + +message RuntimeFunctionDefinition { + string runtime_id = 1; + optional RuntimeParameterDefinitions runtime_parameter_definitions = 2; + optional DataType return_type = 3; +} + +message RuntimeParameterDefinitions { + repeated RuntimeFunctionDefinition parameters = 1; +} + +message RuntimeParameterDefinition { + DataType type = 1; + string name = 2; +} \ No newline at end of file diff --git a/proto/shared/translations.proto b/proto/shared/translations.proto index 973f43f..70d53d6 100644 --- a/proto/shared/translations.proto +++ b/proto/shared/translations.proto @@ -4,7 +4,10 @@ option ruby_package = "Tucana::Shared"; package shared; +// Translation to translate flows, description etc... message Translation { + // Language code (e.g. de_DE) string code = 1; + // Translated content string content = 2; } From 4dae205271c9f6b996386409a9054b9e0b6e2517 Mon Sep 17 00:00:00 2001 From: raphael-goetz Date: Fri, 3 Jan 2025 19:09:19 +0100 Subject: [PATCH 5/9] docs: added setup & project structure --- README.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..ad70031 --- /dev/null +++ b/README.md @@ -0,0 +1,63 @@ +# Tucana + +This repository is responsible for all gRPC definitions that we use. + +## Setup + +See the setup guide for the following languages. Support for other languages is not planed! + +### Rust + +See: [Crate](https://crates.io/crates/tucana) + +```toml +[dependencies] +tucana = { version = "" } +``` + +To enable additional features:: + +```toml +[dependencies] +tucana = { version = "", features = ["sagittarius", "aquila"] } +``` + +### Ruby + +See: [Gem](https://rubygems.org/gems/tucana) + +```ruby +gem 'tucana', '' +``` + +Don't forget to initialize the required feature: +```ruby +# For Sagittarius +Tucana.load_protocol(:sagittarius) + +# For Aquila +Tucana.load_protocol(:aquila) +``` + +## Project Structure + +The project is organized with services functioning as servers. Each protocol in the Sagittarius folder corresponds to +services that Sagittarius must implement as a server. + +```ascii-tree +. +├── aquila +│ ├── action - Action service (emits events, manages configs, and handles executions) +│ └── execution - Execution service (handles internal execution calls) +├── sagittarius +│ ├── action - Action service (manages logon/logoff requests for action configurations) +│ ├── datatype - DataType service +│ ├── flow - Flow service (handles flow updates) +│ ├── flow_definition - Defines types for flows +│ ├── node - Defines types for nodes +│ └── ping - Ping service (performs life checks) +└── shared + ├── datatype_definition - Defines types for data types + ├── runtime_function_definition - Defines types for runtime functions + └── translations - Contains translations with country codes and translated messages +``` \ No newline at end of file From 4271620e13c36d7b3755c8b005ba91a8fc4bb769 Mon Sep 17 00:00:00 2001 From: raphael-goetz Date: Fri, 3 Jan 2025 19:24:37 +0100 Subject: [PATCH 6/9] feat: added runtime token --- proto/sagittarius/flow.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/sagittarius/flow.proto b/proto/sagittarius/flow.proto index 9723833..42b942e 100644 --- a/proto/sagittarius/flow.proto +++ b/proto/sagittarius/flow.proto @@ -19,6 +19,7 @@ message Flows { //Aquila sends a request to initialise stream to Sagittarius message FlowLogonRequest { + string runtime_token = 1; } //Sagittarius sends flow to be updated From 1a4dc422780bc32786dcc8287ae8bc1c0a403096 Mon Sep 17 00:00:00 2001 From: raphael-goetz Date: Fri, 3 Jan 2025 19:26:41 +0100 Subject: [PATCH 7/9] drop: removed runtime token --- proto/sagittarius/flow.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/proto/sagittarius/flow.proto b/proto/sagittarius/flow.proto index 42b942e..9723833 100644 --- a/proto/sagittarius/flow.proto +++ b/proto/sagittarius/flow.proto @@ -19,7 +19,6 @@ message Flows { //Aquila sends a request to initialise stream to Sagittarius message FlowLogonRequest { - string runtime_token = 1; } //Sagittarius sends flow to be updated From aff7355fec646e831117b37fd436cd95121312a5 Mon Sep 17 00:00:00 2001 From: raphael-goetz Date: Sat, 4 Jan 2025 12:32:44 +0100 Subject: [PATCH 8/9] fix: renamed duplicate action file to fix duplicate file name error --- build/rust/build.rs | 2 +- proto/aquila/{action.proto => action_communication.proto} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename proto/aquila/{action.proto => action_communication.proto} (100%) diff --git a/build/rust/build.rs b/build/rust/build.rs index 08c90ab..c3ee6c4 100644 --- a/build/rust/build.rs +++ b/build/rust/build.rs @@ -4,7 +4,7 @@ use std::io::Result; fn main() -> Result<()> { let proto = &[ // aquila - "action.proto", + "action_communication.proto", "action_execute.proto", // sagittarius "action.proto", diff --git a/proto/aquila/action.proto b/proto/aquila/action_communication.proto similarity index 100% rename from proto/aquila/action.proto rename to proto/aquila/action_communication.proto From 27671f759c5c8716a096ac1ba075a4202c77f682 Mon Sep 17 00:00:00 2001 From: raphael-goetz Date: Sun, 5 Jan 2025 20:14:03 +0100 Subject: [PATCH 9/9] feat: requested changes --- build/rust/build.rs | 1 + proto/aquila/action_communication.proto | 27 ++++++++++++++++++------ proto/shared/event.proto | 28 +++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 proto/shared/event.proto diff --git a/build/rust/build.rs b/build/rust/build.rs index c3ee6c4..5c709ff 100644 --- a/build/rust/build.rs +++ b/build/rust/build.rs @@ -17,6 +17,7 @@ fn main() -> Result<()> { "datatype_definition.proto", "runtime_function_definition.proto", "translations.proto", + "event.proto" ]; let inclusions = &[ diff --git a/proto/aquila/action_communication.proto b/proto/aquila/action_communication.proto index eb5b7bd..2a6b1b9 100644 --- a/proto/aquila/action_communication.proto +++ b/proto/aquila/action_communication.proto @@ -1,6 +1,10 @@ syntax = "proto3"; +import "google/protobuf/struct.proto"; import "runtime_function_definition.proto"; +import "datatype_definition.proto"; +import "translations.proto"; +import "event.proto"; option ruby_package = "Tucana::Aquila"; @@ -11,15 +15,26 @@ message Event { // Id of Event type string event_type = 1; // Payload (JSON) of event params - string payload = 2; + google.protobuf.Value payload = 2; } // Action flow/event configuration message Configuration { // Action identifier string identifier = 1; - // Configuration - repeated shared.RuntimeFunctionDefinition function_definition = 2; + // Flow Configuration + repeated shared.RuntimeFunctionDefinition function_definitions = 2; + // Event Configuration + repeated shared.EventType event_types = 3; + // Application Configuration + repeated ActionConfiguration action_configurations = 4; +} + +message ActionConfiguration { + repeated shared.Translation name = 1; + repeated shared.Translation description = 2; + shared.DataType type = 3; + optional google.protobuf.Value default_value = 4; } // Request to execute a request a flow @@ -28,8 +43,8 @@ message ExecutionRequest { string execution_identifier = 1; // Function identifier of flow to execute string function_identifier = 2; - // Parameters of flow required to execute - repeated string parameters = 3; + // Parameters (JSON) of flow required to execute + google.protobuf.Struct parameters = 3; } // Result from executed flows by an action @@ -37,7 +52,7 @@ message ExecutionResult { // Identifier of flow to execute string execution_identifier = 1; // Result of executed flow - repeated string result = 2; + google.protobuf.Value result = 2; } message TransferRequest { diff --git a/proto/shared/event.proto b/proto/shared/event.proto new file mode 100644 index 0000000..e0f8cdc --- /dev/null +++ b/proto/shared/event.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; + +import "google/protobuf/struct.proto"; +import "translations.proto"; +import "datatype_definition.proto"; + +option ruby_package = "Tucana::Shared"; + +package shared; + +message EventDefinitionSettings { + repeated Translation name = 1; + bool unique = 2; + repeated Translation description = 3; + DataType type = 4; + optional google.protobuf.Value default_value = 5; +} + +message EventDefinition { + repeated EventDefinitionSettings settings = 1; + DataType input_type = 2; + bool editable = 3; +} + +message EventType { + repeated Translation name = 1; + EventDefinition definition = 2; +}