pub struct State {
pub oci_version: String,
pub id: String,
pub status: ContainerStatus,
pub pid: Option<i32>,
pub bundle: PathBuf,
pub annotations: Option<HashMap<String, String>>,
pub created: Option<DateTime<Utc>>,
pub creator: Option<u32>,
pub use_systemd: bool,
pub clean_up_intel_rdt_subdirectory: Option<bool>,
}Expand description
Stores the state information of the container
Fields§
§oci_version: String§id: String§status: ContainerStatus§pid: Option<i32>§bundle: PathBuf§annotations: Option<HashMap<String, String>>§created: Option<DateTime<Utc>>§creator: Option<u32>§use_systemd: bool§clean_up_intel_rdt_subdirectory: Option<bool>Implementations§
Source§impl State
impl State
pub fn new( container_id: &str, status: ContainerStatus, pid: Option<i32>, bundle: PathBuf, ) -> Self
pub fn save(&self, container_root: &Path) -> Result<(), StateError>
pub fn load(container_root: &Path) -> Result<Self, StateError>
Sourcepub fn file_path(container_root: &Path) -> PathBuf
pub fn file_path(container_root: &Path) -> PathBuf
Returns the path to the state JSON file for the provided container_root.
let container_root = Path::new("/var/run/containers/container");
let state_file = State::file_path(&container_root);
assert_eq!(state_file.to_str(), Some("/var/run/containers/container/state.json"));Trait Implementations§
Source§impl<'de> Deserialize<'de> for State
impl<'de> Deserialize<'de> for State
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for State
impl RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl UnsafeUnpin for State
impl UnwindSafe for State
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more