Skip to content

Commit 7bb0aed

Browse files
Merge pull request #215 from code0-tech/#212-new-module-properties
new module properties
2 parents 22e8b2f + c5c220d commit 7bb0aed

6 files changed

Lines changed: 23 additions & 52 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ version = "0.0.0"
77
edition = "2024"
88

99
[workspace.dependencies]
10-
code0-flow = { version = "0.0.32" }
11-
tucana = { version = "0.0.68", features = ["aquila"] }
10+
code0-flow = { version = "0.0.33" }
11+
tucana = { version = "0.0.70", features = ["aquila"] }
1212
serde_json = { version = "1.0.138" }
1313
log = "0.4.27"
1414
env_logger = "0.11.8"

adapter/cron/src/main.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use base::traits::{IdentifiableFlow, LoadConfig, Server};
55
use chrono::{DateTime, Datelike, Timelike, Utc};
66
use cron::Schedule;
77
use std::str::FromStr;
8+
use tucana::shared::ValidationFlow;
89
use tucana::shared::value::Kind;
9-
use tucana::shared::{RuntimeFeature, Translation, ValidationFlow};
1010

1111
#[derive(Default)]
1212
struct Cron {}
@@ -25,18 +25,7 @@ async fn main() {
2525
let server = Cron::default();
2626
let runner = ServerRunner::new(server).await.unwrap();
2727

28-
let featues = vec![RuntimeFeature {
29-
name: vec![Translation {
30-
code: "en-US".to_string(),
31-
content: "Cron Adapter".to_string(),
32-
}],
33-
description: vec![Translation {
34-
code: "en-US".to_string(),
35-
content: "A Cron-Adapter is a time-based scheduler that runs commands or scripts automatically at specified times or intervals.".to_string(),
36-
}],
37-
}];
38-
39-
runner.serve(featues, vec![]).await.unwrap();
28+
runner.serve(vec![]).await.unwrap();
4029
}
4130

4231
struct Time {

adapter/rest/src/main.rs

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ use std::sync::Arc;
1717
use tokio::net::TcpListener;
1818
use tonic::async_trait;
1919
use tucana::shared::{
20-
AdapterConfiguration, RuntimeFeature, Struct, Translation, ValidationFlow, Value,
21-
helper::value::ToValue, value::Kind,
20+
AdapterStatusConfiguration, Struct, ValidationFlow, Value, helper::value::ToValue, value::Kind,
2221
};
2322

2423
use crate::response::{error_to_http_response, value_to_http_response};
@@ -43,26 +42,16 @@ async fn main() {
4342
let addr = runner.get_server_config().port;
4443
let host = runner.get_server_config().host.clone();
4544

46-
let featues = vec![RuntimeFeature {
47-
name: vec![Translation {
48-
code: "en-US".to_string(),
49-
content: "Rest Adapter".to_string(),
50-
}],
51-
description: vec![Translation {
52-
code: "en-US".to_string(),
53-
content: "A Rest-Adapter is a server that exposes resources through HTTP URLs (endpoints). Clients use methods like GET, POST, PUT, and DELETE to retrieve or modify data, typically exchanged as JSON.".to_string(),
54-
}],
55-
}];
56-
57-
let configs = vec![AdapterConfiguration {
58-
data: Some(tucana::shared::adapter_configuration::Data::Endpoint(
59-
format!(
45+
let configs = vec![AdapterStatusConfiguration {
46+
flow_type_identifiers: vec![String::from("REST")],
47+
data: Some(
48+
tucana::shared::adapter_status_configuration::Data::Endpoint(format!(
6049
r"{}:{}/${{project_slug}}/${{flow_setting_identifier}}",
6150
host, addr
62-
),
63-
)),
51+
)),
52+
),
6453
}];
65-
match runner.serve(featues, configs).await {
54+
match runner.serve(configs).await {
6655
Ok(_) => (),
6756
Err(err) => panic!("Failed to start server runner: {:?}", err),
6857
};

crates/base/src/client/mod.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@ use tucana::{
1111
RuntimeStatusUpdateRequest, runtime_status_service_client::RuntimeStatusServiceClient,
1212
runtime_status_update_request::Status,
1313
},
14-
shared::{AdapterConfiguration, AdapterRuntimeStatus, RuntimeFeature},
14+
shared::{AdapterRuntimeStatus, AdapterStatusConfiguration},
1515
};
1616

1717
pub struct DracoRuntimeStatusService {
1818
channel: Channel,
1919
identifier: String,
20-
features: Vec<RuntimeFeature>,
21-
configs: Vec<AdapterConfiguration>,
20+
configs: Vec<AdapterStatusConfiguration>,
2221
aquila_token: String,
2322
}
2423

@@ -74,24 +73,21 @@ impl DracoRuntimeStatusService {
7473
aquila_url: String,
7574
aquila_token: String,
7675
identifier: String,
77-
features: Vec<RuntimeFeature>,
78-
configs: Vec<AdapterConfiguration>,
76+
configs: Vec<AdapterStatusConfiguration>,
7977
) -> Self {
8078
let channel = create_channel_with_retry("Aquila", aquila_url).await;
81-
Self::new(channel, identifier, features, configs, aquila_token)
79+
Self::new(channel, identifier, configs, aquila_token)
8280
}
8381

8482
pub fn new(
8583
channel: Channel,
8684
identifier: String,
87-
features: Vec<RuntimeFeature>,
88-
configs: Vec<AdapterConfiguration>,
85+
configs: Vec<AdapterStatusConfiguration>,
8986
aquila_token: String,
9087
) -> Self {
9188
DracoRuntimeStatusService {
9289
channel,
9390
identifier,
94-
features,
9591
configs,
9692
aquila_token,
9793
}
@@ -121,7 +117,6 @@ impl DracoRuntimeStatusService {
121117
status: status.into(),
122118
timestamp: timestamp as i64,
123119
identifier: self.identifier.clone(),
124-
features: self.features.clone(),
125120
configurations: self.configs.clone(),
126121
})),
127122
},

crates/base/src/runner.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use std::{sync::Arc, time::Duration};
99
use tokio::{signal, task::JoinHandle, time::sleep};
1010
use tonic::transport::Server;
1111
use tonic_health::pb::health_server::HealthServer;
12-
use tucana::shared::{AdapterConfiguration, RuntimeFeature};
12+
use tucana::shared::AdapterStatusConfiguration;
1313

1414
/// Context passed to adapter server implementations containing all shared resources
1515
pub struct ServerContext<C: LoadConfig> {
@@ -58,8 +58,7 @@ impl<C: LoadConfig> ServerRunner<C> {
5858

5959
pub async fn serve(
6060
self,
61-
runtime_feature: Vec<RuntimeFeature>,
62-
runtime_config: Vec<AdapterConfiguration>,
61+
runtime_config: Vec<AdapterStatusConfiguration>,
6362
) -> anyhow::Result<()> {
6463
let config = self.context.adapter_config.clone();
6564
let mut runtime_status_service: Option<Arc<DracoRuntimeStatusService>> = None;
@@ -72,7 +71,6 @@ impl<C: LoadConfig> ServerRunner<C> {
7271
config.aquila_url.clone(),
7372
config.aquila_token.clone(),
7473
config.draco_variant.clone(),
75-
runtime_feature,
7674
runtime_config,
7775
)
7876
.await,

0 commit comments

Comments
 (0)