diff --git a/crates/common/src/parser.rs b/crates/common/src/parser.rs deleted file mode 100644 index 63c3675..0000000 --- a/crates/common/src/parser.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2023 LogCraft, SAS. -// SPDX-License-Identifier: MPL-2.0 - -// TODO: Find a better way to manage configuration. -const LGC_KCL_BASE: &str = r#" -import yaml -import file -import logcraft - -project = logcraft.Project _config -_config = yaml.decode(file.read("lgc.yml")) -"#; - -pub struct Plugin { - name: String, - path: Option, - url: Option -} diff --git a/crates/common/src/plugins/manager.rs b/crates/common/src/plugins/manager.rs index 9435752..01ad383 100644 --- a/crates/common/src/plugins/manager.rs +++ b/crates/common/src/plugins/manager.rs @@ -4,7 +4,7 @@ use anyhow::{anyhow, bail, Result}; use async_trait::async_trait; use logcraft_runtime::{ - plugin_component::plugin::Metadata, state::State, Config, Engine, Interfaces, + plugin_component::plugin::Metadata, state::State, Config, Engine, Plugins, DEFAULT_EPOCH_TICK_INTERVAL, }; use serde::{Deserialize, Serialize}; @@ -22,7 +22,7 @@ use crate::plugins::cleanup_plugin; use super::LGC_PLUGINS_PATH; pub struct InstanceData { - interface: Interfaces, + interface: Plugins, pub metadata: Metadata, } @@ -85,10 +85,10 @@ impl PluginManager { ); let (interface, _) = - Interfaces::instantiate_async(&mut store, &component, &self.engine.linker).await?; + Plugins::instantiate_async(&mut store, &component, &self.engine.linker).await?; let metadata = interface - .logcraft_host_plugin() + .logcraft_lgc_plugin() .call_load(&mut store) .await?; @@ -143,19 +143,19 @@ pub trait PluginActions: Send + 'static { #[async_trait] impl PluginActions for InstanceData { async fn load(&self, store: &mut Store) -> Result { - self.interface.logcraft_host_plugin().call_load(store).await + self.interface.logcraft_lgc_plugin().call_load(store).await } async fn settings(&self, store: &mut Store) -> Result { self.interface - .logcraft_host_plugin() + .logcraft_lgc_plugin() .call_settings(store) .await } async fn schema(&self, store: &mut Store) -> Result { self.interface - .logcraft_host_plugin() + .logcraft_lgc_plugin() .call_schema(store) .await } @@ -168,7 +168,7 @@ impl PluginActions for InstanceData { params: &str, ) -> Result> { self.interface - .logcraft_host_plugin() + .logcraft_lgc_plugin() .call_create(store, config, name, params) .await .map_err(|e| { @@ -195,7 +195,7 @@ impl PluginActions for InstanceData { params: &str, ) -> Result> { self.interface - .logcraft_host_plugin() + .logcraft_lgc_plugin() .call_read(store, config, name, params) .await? .map_err(|e| { @@ -215,7 +215,7 @@ impl PluginActions for InstanceData { params: &str, ) -> Result> { self.interface - .logcraft_host_plugin() + .logcraft_lgc_plugin() .call_update(store, config, name, params) .await? .map_err(|e| { @@ -235,7 +235,7 @@ impl PluginActions for InstanceData { params: &str, ) -> Result> { self.interface - .logcraft_host_plugin() + .logcraft_lgc_plugin() .call_delete(store, config, name, params) .await? .map_err(|e| { @@ -249,7 +249,7 @@ impl PluginActions for InstanceData { async fn ping(&self, store: &mut Store, config: &str) -> Result { self.interface - .logcraft_host_plugin() + .logcraft_lgc_plugin() .call_ping(store, config) .await? .map_err(|e| { diff --git a/crates/runtime/src/lib.rs b/crates/runtime/src/lib.rs index f20ed83..eb76cc3 100644 --- a/crates/runtime/src/lib.rs +++ b/crates/runtime/src/lib.rs @@ -16,6 +16,6 @@ wasmtime::component::bindgen!({ }); pub mod plugin_component { - pub use crate::exports::logcraft::host::plugin; - pub use crate::Interfaces; + pub use crate::exports::logcraft::lgc::plugin; + pub use crate::Plugins; } diff --git a/wit/world.wit b/wit/world.wit index 690016a..2f7ff87 100644 --- a/wit/world.wit +++ b/wit/world.wit @@ -1,10 +1,10 @@ // Copyright (c) 2023 LogCraft, SAS. // SPDX-License-Identifier: MPL-2.0 -package logcraft:host; +package logcraft:lgc@0.1.0; /// The logcraft world for the component to target. -world interfaces { +world plugins { // Imports // Exports