Skip to content

Commit

Permalink
renaming, removed unused type
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Jan 10, 2024
1 parent c960dc4 commit db01409
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 16 deletions.
4 changes: 2 additions & 2 deletions plugins/example-storage-plugin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use zenoh::{prelude::OwnedKeyExpr, sample::Sample, time::Timestamp, value::Value
use zenoh_backend_traits::{
config::{StorageConfig, VolumeConfig},
Capability, History, Persistence, Storage, StorageInsertionResult, StoredData, Volume,
VolumePlugin,
VolumeInstance,
};
use zenoh_plugin_trait::Plugin;
use zenoh_result::ZResult;
Expand All @@ -31,7 +31,7 @@ zenoh_plugin_trait::declare_plugin!(ExampleBackend);

impl Plugin for ExampleBackend {
type StartArgs = VolumeConfig;
type Instance = VolumePlugin;
type Instance = VolumeInstance;
fn start(_name: &str, _args: &Self::StartArgs) -> ZResult<Self::Instance> {
let volume = ExampleBackend {};
Ok(Box::new(volume))
Expand Down
12 changes: 4 additions & 8 deletions plugins/zenoh-backend-traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,6 @@ pub enum History {
All,
}

/// Signature of the `create_volume` operation to be implemented in the library as an entrypoint.
pub const CREATE_VOLUME_FN_NAME: &[u8] = b"create_volume";
pub type CreateVolume = fn(VolumeConfig) -> ZResult<Box<dyn Volume>>;

///
pub enum StorageInsertionResult {
Outdated,
Expand Down Expand Up @@ -224,9 +220,9 @@ pub trait Volume: Send + Sync {
fn outgoing_data_interceptor(&self) -> Option<Arc<dyn Fn(Sample) -> Sample + Send + Sync>>;
}

pub type VolumePlugin = Box<dyn Volume + 'static>;
pub type VolumeInstance = Box<dyn Volume + 'static>;

impl PluginStructVersion for VolumePlugin {
impl PluginStructVersion for VolumeInstance {
fn struct_version() -> u64 {
1
}
Expand All @@ -235,13 +231,13 @@ impl PluginStructVersion for VolumePlugin {
}
}

impl PluginControl for VolumePlugin {
impl PluginControl for VolumeInstance {
fn plugins_status(&self, _names: &zenoh::prelude::keyexpr) -> Vec<PluginStatusRec> {
Vec::new()
}
}

impl PluginInstance for VolumePlugin {}
impl PluginInstance for VolumeInstance {}

/// Trait to be implemented by a Storage.
#[async_trait]
Expand Down
4 changes: 2 additions & 2 deletions plugins/zenoh-plugin-storage-manager/src/backends_mgt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::sync::Arc;
use zenoh::prelude::r#async::*;
use zenoh::Session;
use zenoh_backend_traits::config::StorageConfig;
use zenoh_backend_traits::{Capability, VolumePlugin};
use zenoh_backend_traits::{Capability, VolumeInstance};
use zenoh_result::ZResult;

pub struct StoreIntercept {
Expand All @@ -30,7 +30,7 @@ pub struct StoreIntercept {
pub(crate) async fn create_and_start_storage(
admin_key: String,
config: StorageConfig,
backend: &VolumePlugin,
backend: &VolumeInstance,
in_interceptor: Option<Arc<dyn Fn(Sample) -> Sample + Send + Sync>>,
out_interceptor: Option<Arc<dyn Fn(Sample) -> Sample + Send + Sync>>,
zenoh: Arc<Session>,
Expand Down
4 changes: 2 additions & 2 deletions plugins/zenoh-plugin-storage-manager/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ use zenoh_backend_traits::config::ConfigDiff;
use zenoh_backend_traits::config::PluginConfig;
use zenoh_backend_traits::config::StorageConfig;
use zenoh_backend_traits::config::VolumeConfig;
use zenoh_backend_traits::VolumePlugin;
use zenoh_backend_traits::VolumeInstance;
use zenoh_core::zlock;
use zenoh_plugin_trait::Plugin;
use zenoh_plugin_trait::PluginControl;
Expand Down Expand Up @@ -77,7 +77,7 @@ impl Plugin for StoragesPlugin {
}
}

type PluginsManager = zenoh_plugin_trait::PluginsManager<VolumeConfig, VolumePlugin>;
type PluginsManager = zenoh_plugin_trait::PluginsManager<VolumeConfig, VolumeInstance>;

struct StorageRuntime(Arc<Mutex<StorageRuntimeInner>>);
struct StorageRuntimeInner {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ pub struct MemoryBackend {

impl Plugin for MemoryBackend {
type StartArgs = VolumeConfig;
type Instance = VolumePlugin;
type Instance = VolumeInstance;

const DEFAULT_NAME: &'static str = MEMORY_BACKEND_NAME;
const PLUGIN_VERSION: &'static str = env!("CARGO_PKG_VERSION");

fn start(_: &str, args: &VolumeConfig) -> ZResult<VolumePlugin> {
fn start(_: &str, args: &VolumeConfig) -> ZResult<VolumeInstance> {
Ok(Box::new(MemoryBackend {
config: args.clone(),
}))
Expand Down

0 comments on commit db01409

Please sign in to comment.