Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ services that Sagittarius must implement as a server.
├── sagittarius
│ ├── action - Action service (manages logon/logoff requests for action configurations)
│ ├── datatype - DataType service
│ ├── flow - Flow service & Flow types (handles flow updates)
│ ├── flow - Flow service (handles flow updates)
│ ├── flow_definition - Defines a definition for a Flow
│ ├── ping - Ping service (performs life checks)
│ └── runtime_function - Service for updating the runtime functions
└── shared
├── datatype - Defines types for data types
├── event - Defines types for events
├── flow - Defines types for flows
├── runtime_function_definition - Defines types for runtime functions
├── struct - Defines types for json representations
├── test_execution - Defines types test execution
Expand Down
3 changes: 3 additions & 0 deletions build/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fn main() -> Result<()> {
"sagittarius.runtime_function.proto",
// shared
"shared.datatype.proto",
"shared.flow.proto",
"shared.runtime_function.proto",
"shared.translation.proto",
"shared.struct.proto",
Expand Down Expand Up @@ -42,6 +43,7 @@ fn main() -> Result<()> {
.build_server(true)
.build_client(true)
.type_attribute("kind", serde_attribute)
.type_attribute("value", serde_attribute)
.type_attribute("NullValue", serde_attribute)
.type_attribute("Value", serde_attribute)
.type_attribute("ListValue", serde_attribute)
Expand All @@ -51,6 +53,7 @@ fn main() -> Result<()> {
.type_attribute("DataType", serde_attribute)
.type_attribute("RuntimeParameterDefinition", serde_attribute)
.type_attribute("RuntimeFunctionDefinition", serde_attribute)
.type_attribute("FlowSettingDefinition", serde_attribute)
.type_attribute("FlowSetting", serde_attribute)
.type_attribute("NodeParameterDefinition", serde_attribute)
.type_attribute("NodeFunctionDefinition", serde_attribute)
Expand Down
28 changes: 18 additions & 10 deletions build/rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
#[cfg(feature = "sagittarius")]
pub mod sagittarius {
include!("generated/sagittarius.rs");
include!("generated/shared.rs");

#[cfg(test)]
pub mod tests {
use crate::sagittarius::Flow;
use crate::shared::Flow;
use serde_json;

#[test]
fn test_serialize() {
let flow = Flow {
flow_id: 0,
data_types: vec![],
input_type: None,
r#type: "no".to_string(),
settings: vec![],
starting_node: None,
};

let str_flow = serde_json::to_string(&flow).expect("Serialization failed");
let json_flow: serde_json::Value = serde_json::from_str(&str_flow).expect("Failed to parse JSON");
let json_flow: serde_json::Value =
serde_json::from_str(&str_flow).expect("Failed to parse JSON");

let expected_json: serde_json::Value = serde_json::json!({
"flow_id": 0,
"type": "no",
"settings": [],
"starting_node": null
});
"flow_id": 0,
"type": "no",
"input_type": null,
"data_types": [],
"settings": [],
"starting_node": null
});

assert_eq!(json_flow, expected_json);
}
Expand All @@ -34,6 +39,8 @@ pub mod sagittarius {
let json_data = r#"{
"flow_id": 0,
"type": "no",
"input_type": null,
"data_types": [],
"settings": [],
"starting_node": null
}"#;
Expand All @@ -45,13 +52,14 @@ pub mod sagittarius {
flow_id: 0,
r#type: "no".to_string(),
settings: vec![],
data_types: vec![],
input_type: None,
starting_node: None,
};

assert_eq!(deserialized.unwrap(), expected_flow);
}
}

}

#[cfg(feature = "aquila")]
Expand All @@ -62,4 +70,4 @@ pub mod aquila {
#[cfg(feature = "shared")]
pub mod shared {
include!("generated/shared.rs");
}
}
45 changes: 3 additions & 42 deletions proto/sagittarius/sagittarius.flow.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,7 @@ option ruby_package = "Tucana::Sagittarius";

package sagittarius;

import "shared.struct.proto";

message Flow {
// Database ID -> req. for Aquila to identify in FlowStore
int64 flow_id = 1;
string type = 2;
repeated FlowSetting settings = 3;
NodeFunction starting_node = 4;
}

message FlowSetting {
string definition = 1;
shared.Struct object = 2;
}

message NodeFunction {
NodeFunctionDefinition definition = 1;
repeated NodeParameter parameters = 2;
optional NodeFunction next_node = 3;
}

message NodeParameter {
NodeParameterDefinition definition = 1;
shared.Struct object = 2;
NodeFunction sub_node = 3;
}

message NodeParameterDefinition {
string parameter_id = 1;
string runtime_parameter_id = 2;
}

message NodeFunctionDefinition {
string function_id = 1;
string runtime_function_id = 2;
}

message Flows {
repeated Flow flows = 1;
}
import "shared.flow.proto";

//Aquila sends a request to initialise stream to Sagittarius
message FlowLogonRequest {
Expand All @@ -53,11 +14,11 @@ message FlowLogonRequest {
message FlowResponse {
oneof data {
// Updates a single flow
Flow updated_flow = 1;
shared.Flow updated_flow = 1;
// Deletes a single flow
int64 deleted_flow_id = 2;
// Replaces all flows in Aquila (only on startup and for releases)
Flows flows = 3;
shared.Flows flows = 3;
}
}

Expand Down
3 changes: 2 additions & 1 deletion proto/sagittarius/sagittarius.flow_definition.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package sagittarius;
import "shared.translation.proto";
import "shared.datatype.proto";
import "shared.struct.proto";
import "shared.flow.proto";

message FlowType {
FlowDefinition definition = 1;
Expand All @@ -25,4 +26,4 @@ message FlowDefinition {
repeated FlowDefinitionSetting settings = 1;
shared.DataType input_type = 2;
bool editable = 3;
}
}
56 changes: 56 additions & 0 deletions proto/shared/shared.flow.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
syntax = "proto3";

option ruby_package = "Tucana::Shared";

package shared;

import "shared.struct.proto";
import "shared.datatype.proto";

message Flow {
// Database ID -> req. for Aquila to identify in FlowStore
int64 flow_id = 1;
string type = 2;
repeated shared.DataType data_types = 3;
optional shared.DataType input_type = 4;
repeated FlowSetting settings = 5;
NodeFunction starting_node = 6;
}

message FlowSetting {
FlowSettingDefinition definition = 1;
shared.Struct object = 2;
}

message FlowSettingDefinition {
string id = 1;
string key = 2;
}

message NodeFunction {
NodeFunctionDefinition definition = 1;
repeated NodeParameter parameters = 2;
optional NodeFunction next_node = 3;
}

message NodeParameter {
NodeParameterDefinition definition = 1;
oneof value {
shared.Value literal_value = 2;
NodeFunction function_value = 3;
}
}

message NodeParameterDefinition {
string parameter_id = 1;
string runtime_parameter_id = 2;
}

message NodeFunctionDefinition {
string function_id = 1;
string runtime_function_id = 2;
}

message Flows {
repeated Flow flows = 1;
}