feat(core): add shared platform skeleton
This commit is contained in:
parent
1fdfc4e5fc
commit
cf26a1f319
|
|
@ -105,6 +105,33 @@ version = "1.0.102"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
|
||||
|
||||
[[package]]
|
||||
name = "app_feeder_distributor"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"dotenv",
|
||||
"plc_platform_core",
|
||||
"tokio",
|
||||
"tower-http",
|
||||
"tracing",
|
||||
"tray-icon",
|
||||
"webbrowser",
|
||||
"winit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "app_operation_system"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"axum",
|
||||
"dotenv",
|
||||
"plc_platform_core",
|
||||
"tokio",
|
||||
"tower-http",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arc-swap"
|
||||
version = "1.8.2"
|
||||
|
|
@ -1265,34 +1292,6 @@ dependencies = [
|
|||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gateway_rs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-opcua",
|
||||
"async-stream",
|
||||
"axum",
|
||||
"chrono",
|
||||
"dotenv",
|
||||
"fs2",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"sqlx",
|
||||
"time",
|
||||
"tokio",
|
||||
"tower-http",
|
||||
"tracing",
|
||||
"tracing-appender",
|
||||
"tracing-subscriber",
|
||||
"tray-icon",
|
||||
"uuid",
|
||||
"validator",
|
||||
"webbrowser",
|
||||
"winit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gdk"
|
||||
version = "0.18.2"
|
||||
|
|
@ -2715,6 +2714,31 @@ version = "0.2.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6"
|
||||
|
||||
[[package]]
|
||||
name = "plc_platform_core"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-opcua",
|
||||
"async-stream",
|
||||
"axum",
|
||||
"chrono",
|
||||
"dotenv",
|
||||
"fs2",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"sqlx",
|
||||
"time",
|
||||
"tokio",
|
||||
"tower-http",
|
||||
"tracing",
|
||||
"tracing-appender",
|
||||
"tracing-subscriber",
|
||||
"uuid",
|
||||
"validator",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.17.16"
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
fn main() {}
|
||||
|
|
@ -0,0 +1 @@
|
|||
fn main() {}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
use crate::platform_context::PlatformContext;
|
||||
|
||||
pub fn bootstrap_platform() -> PlatformContext {
|
||||
PlatformContext::new("bootstrap")
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
pub mod bootstrap;
|
||||
pub mod platform_context;
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct PlatformContext {
|
||||
pub config_name: Arc<str>,
|
||||
}
|
||||
|
||||
impl PlatformContext {
|
||||
pub fn new(config_name: impl Into<Arc<str>>) -> Self {
|
||||
Self {
|
||||
config_name: config_name.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
use plc_platform_core::bootstrap::bootstrap_platform;
|
||||
use plc_platform_core::platform_context::PlatformContext;
|
||||
|
||||
#[test]
|
||||
fn platform_context_type_is_public() {
|
||||
let context = bootstrap_platform();
|
||||
assert_eq!(context.config_name.as_ref(), "bootstrap");
|
||||
|
||||
fn assert_send_sync_clone<T: Send + Sync + Clone>() {}
|
||||
assert_send_sync_clone::<PlatformContext>();
|
||||
}
|
||||
Loading…
Reference in New Issue