Skip to content
Open
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
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ version = "0.0.0"
edition = "2024"

[workspace.dependencies]
code0-flow = { version = "0.0.32" }
tucana = { version = "0.0.68", features = ["aquila"] }
code0-flow = { version = "0.0.33" }
tucana = { version = "0.0.70", features = ["aquila"] }
serde_json = { version = "1.0.138" }
log = "0.4.27"
env_logger = "0.11.8"
Expand Down
15 changes: 2 additions & 13 deletions adapter/cron/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use base::traits::{IdentifiableFlow, LoadConfig, Server};
use chrono::{DateTime, Datelike, Timelike, Utc};
use cron::Schedule;
use std::str::FromStr;
use tucana::shared::ValidationFlow;
use tucana::shared::value::Kind;
use tucana::shared::{RuntimeFeature, Translation, ValidationFlow};

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

let featues = vec![RuntimeFeature {
name: vec![Translation {
code: "en-US".to_string(),
content: "Cron Adapter".to_string(),
}],
description: vec![Translation {
code: "en-US".to_string(),
content: "A Cron-Adapter is a time-based scheduler that runs commands or scripts automatically at specified times or intervals.".to_string(),
}],
}];

runner.serve(featues, vec![]).await.unwrap();
runner.serve(vec![]).await.unwrap();
Comment thread
raphael-goetz marked this conversation as resolved.
}

struct Time {
Expand Down
27 changes: 8 additions & 19 deletions adapter/rest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ use std::sync::Arc;
use tokio::net::TcpListener;
use tonic::async_trait;
use tucana::shared::{
AdapterConfiguration, RuntimeFeature, Struct, Translation, ValidationFlow, Value,
helper::value::ToValue, value::Kind,
AdapterStatusConfiguration, Struct, ValidationFlow, Value, helper::value::ToValue, value::Kind,
};

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

let featues = vec![RuntimeFeature {
name: vec![Translation {
code: "en-US".to_string(),
content: "Rest Adapter".to_string(),
}],
description: vec![Translation {
code: "en-US".to_string(),
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(),
}],
}];

let configs = vec![AdapterConfiguration {
data: Some(tucana::shared::adapter_configuration::Data::Endpoint(
format!(
let configs = vec![AdapterStatusConfiguration {
flow_type_identifiers: vec![String::from("REST")],
data: Some(
tucana::shared::adapter_status_configuration::Data::Endpoint(format!(
r"{}:{}/${{project_slug}}/${{flow_setting_identifier}}",
host, addr
),
)),
)),
),
}];
match runner.serve(featues, configs).await {
match runner.serve(configs).await {
Ok(_) => (),
Err(err) => panic!("Failed to start server runner: {:?}", err),
};
Expand Down
15 changes: 5 additions & 10 deletions crates/base/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ use tucana::{
RuntimeStatusUpdateRequest, runtime_status_service_client::RuntimeStatusServiceClient,
runtime_status_update_request::Status,
},
shared::{AdapterConfiguration, AdapterRuntimeStatus, RuntimeFeature},
shared::{AdapterRuntimeStatus, AdapterStatusConfiguration},
};

pub struct DracoRuntimeStatusService {
channel: Channel,
identifier: String,
features: Vec<RuntimeFeature>,
configs: Vec<AdapterConfiguration>,
configs: Vec<AdapterStatusConfiguration>,
aquila_token: String,
}

Expand Down Expand Up @@ -74,24 +73,21 @@ impl DracoRuntimeStatusService {
aquila_url: String,
aquila_token: String,
identifier: String,
features: Vec<RuntimeFeature>,
configs: Vec<AdapterConfiguration>,
configs: Vec<AdapterStatusConfiguration>,
) -> Self {
let channel = create_channel_with_retry("Aquila", aquila_url).await;
Self::new(channel, identifier, features, configs, aquila_token)
Self::new(channel, identifier, configs, aquila_token)
}

pub fn new(
channel: Channel,
identifier: String,
features: Vec<RuntimeFeature>,
configs: Vec<AdapterConfiguration>,
configs: Vec<AdapterStatusConfiguration>,
aquila_token: String,
) -> Self {
DracoRuntimeStatusService {
channel,
identifier,
features,
configs,
aquila_token,
}
Expand Down Expand Up @@ -121,7 +117,6 @@ impl DracoRuntimeStatusService {
status: status.into(),
timestamp: timestamp as i64,
identifier: self.identifier.clone(),
features: self.features.clone(),
configurations: self.configs.clone(),
})),
},
Expand Down
6 changes: 2 additions & 4 deletions crates/base/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{sync::Arc, time::Duration};
use tokio::{signal, time::sleep};
use tonic::transport::Server;
use tonic_health::pb::health_server::HealthServer;
use tucana::shared::{AdapterConfiguration, RuntimeFeature};
use tucana::shared::AdapterStatusConfiguration;

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

pub async fn serve(
self,
runtime_feature: Vec<RuntimeFeature>,
runtime_config: Vec<AdapterConfiguration>,
runtime_config: Vec<AdapterStatusConfiguration>,
) -> anyhow::Result<()> {
let config = self.context.adapter_config.clone();
let mut runtime_status_service: Option<DracoRuntimeStatusService> = None;
Expand All @@ -71,7 +70,6 @@ impl<C: LoadConfig> ServerRunner<C> {
config.aquila_url.clone(),
config.aquila_token.clone(),
config.draco_variant.clone(),
runtime_feature,
runtime_config,
)
.await,
Expand Down