mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 23:04:20 +01:00
agent: move StorageDeviceGeneric from kata-types into agent
Move StorageDeviceGeneric from kata-types into agent, so we can refactor code later. Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
use anyhow::{anyhow, Context, Error, Result};
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::convert::TryFrom;
|
||||
use std::fmt::Formatter;
|
||||
use std::{collections::HashMap, fs, path::PathBuf};
|
||||
|
||||
/// Prefix to mark a volume as Kata special.
|
||||
@@ -429,34 +428,6 @@ impl TryFrom<&NydusExtraOptions> for KataVirtualVolume {
|
||||
}
|
||||
}
|
||||
|
||||
/// An implementation of generic storage device.
|
||||
pub struct StorageDeviceGeneric {
|
||||
path: String,
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for StorageDeviceGeneric {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("StorageState")
|
||||
.field("path", &self.path)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl StorageDeviceGeneric {
|
||||
/// Create a new instance of `StorageStateCommon`.
|
||||
pub fn new(path: String) -> Self {
|
||||
StorageDeviceGeneric { path }
|
||||
}
|
||||
}
|
||||
|
||||
impl StorageDevice for StorageDeviceGeneric {
|
||||
fn path(&self) -> &str {
|
||||
&self.path
|
||||
}
|
||||
|
||||
fn cleanup(&self) {}
|
||||
}
|
||||
|
||||
/// Trait object for storage device.
|
||||
pub trait StorageDevice: Send + Sync {
|
||||
/// Path
|
||||
|
||||
Reference in New Issue
Block a user