@@ -5,8 +5,11 @@ use prost::Message;
5
5
use sagittarius:: flow_service_client_impl:: SagittariusFlowClient ;
6
6
use serde_json:: from_str;
7
7
use server:: AquilaGRPCServer ;
8
- use std:: { fs:: File , io:: Read , sync:: Arc } ;
9
- use tucana:: shared:: Flows ;
8
+ use std:: { collections:: HashMap , fs:: File , io:: Read , sync:: Arc } ;
9
+ use tucana:: shared:: {
10
+ FlowSetting , Flows , NodeFunction , NodeParameter , NodeValue , Struct , ValidationFlow , Value ,
11
+ node_value, value:: Kind ,
12
+ } ;
10
13
11
14
pub mod authorization;
12
15
pub mod configuration;
@@ -17,6 +20,77 @@ pub mod stream;
17
20
18
21
#[ tokio:: main]
19
22
async fn main ( ) {
23
+ let flow = ValidationFlow {
24
+ flow_id : 1 ,
25
+ project_id : 1 ,
26
+ r#type : String :: from ( "REST" ) ,
27
+ data_types : vec ! [ ] ,
28
+ input_type_identifier : Some ( String :: from ( "HTTP_REQUEST" ) ) ,
29
+ return_type_identifier : Some ( String :: from ( "HTTP_RESPONSE" ) ) ,
30
+ settings : vec ! [
31
+ FlowSetting {
32
+ database_id: 1 ,
33
+ flow_setting_id: String :: from( "HTTP_METHOD" ) ,
34
+ object: Some ( Struct {
35
+ fields: HashMap :: from( [ (
36
+ String :: from( "method" ) ,
37
+ Value {
38
+ kind: Some ( Kind :: StringValue ( String :: from( "GET" ) ) ) ,
39
+ } ,
40
+ ) ] ) ,
41
+ } ) ,
42
+ } ,
43
+ FlowSetting {
44
+ database_id: 1 ,
45
+ flow_setting_id: String :: from( "HTTP_URL" ) ,
46
+ object: Some ( Struct {
47
+ fields: HashMap :: from( [ (
48
+ String :: from( "url" ) ,
49
+ Value {
50
+ kind: Some ( Kind :: StringValue ( String :: from( "/hello-world" ) ) ) ,
51
+ } ,
52
+ ) ] ) ,
53
+ } ) ,
54
+ } ,
55
+ FlowSetting {
56
+ database_id: 1 ,
57
+ flow_setting_id: String :: from( "HTTP_HOST" ) ,
58
+ object: Some ( Struct {
59
+ fields: HashMap :: from( [ (
60
+ String :: from( "host" ) ,
61
+ Value {
62
+ kind: Some ( Kind :: StringValue ( String :: from( "localhost" ) ) ) ,
63
+ } ,
64
+ ) ] ) ,
65
+ } ) ,
66
+ } ,
67
+ ] ,
68
+ starting_node : Some ( NodeFunction {
69
+ database_id : 1 ,
70
+ runtime_function_id : String :: from ( "std::control::break" ) ,
71
+ next_node : None ,
72
+ parameters : vec ! [ NodeParameter {
73
+ database_id: 1 ,
74
+ runtime_parameter_id: String :: from( "value" ) ,
75
+ value: Some ( NodeValue {
76
+ value: Some ( node_value:: Value :: LiteralValue ( Value {
77
+ kind: Some ( Kind :: StructValue ( Struct {
78
+ fields: HashMap :: from( [ (
79
+ String :: from( "hallo" ) ,
80
+ Value {
81
+ kind: Some ( Kind :: StringValue ( String :: from( "welt" ) ) ) ,
82
+ } ,
83
+ ) ] ) ,
84
+ } ) ) ,
85
+ } ) ) ,
86
+ } ) ,
87
+ } ] ,
88
+ } ) ,
89
+ } ;
90
+
91
+ let s = serde_json:: to_string_pretty ( & flow) . unwrap ( ) ;
92
+ println ! ( "{}" , s) ;
93
+
20
94
log:: info!( "Starting Aquila..." ) ;
21
95
22
96
// Configure Logging
@@ -106,6 +180,7 @@ async fn init_flows_from_json(
106
180
for flow in flows. flows {
107
181
let key = get_flow_identifier ( & flow) ;
108
182
let bytes = flow. encode_to_vec ( ) ;
183
+ log:: info!( "Inserting flow with key {}" , & key) ;
109
184
match flow_store_client. put ( key, bytes. into ( ) ) . await {
110
185
Ok ( _) => log:: info!( "Flow updated successfully" ) ,
111
186
Err ( err) => log:: error!( "Failed to update flow. Reason: {:?}" , err) ,
0 commit comments