firkin_vminitd_client/
lib.rs1#![forbid(unsafe_code)]
2#![warn(missing_docs)]
3pub use guest_ops::{ApplyOciLayer, FilesystemUsage, FilesystemUsageStats, Fstrim, RemovePath};
5pub mod pb {
7 #![allow(missing_docs, clippy::all, clippy::pedantic)]
8 tonic::include_proto!("com.apple.containerization.sandbox.v3");
9}
10pub mod bundle;
11pub(crate) mod guest_ops;
12#[allow(unused_imports, ambiguous_glob_reexports)]
13pub use bundle::*;
14pub mod connect;
15#[allow(unused_imports, ambiguous_glob_reexports)]
16pub use connect::*;
17pub mod copy;
18#[allow(unused_imports, ambiguous_glob_reexports)]
19pub use copy::*;
20pub mod error;
21#[allow(unused_imports, ambiguous_glob_reexports)]
22pub use error::*;
23pub mod network;
24#[allow(unused_imports, ambiguous_glob_reexports)]
25pub use network::*;
26pub mod process;
27#[allow(unused_imports, ambiguous_glob_reexports)]
28pub use process::*;
29pub mod proxy;
30#[allow(unused_imports, ambiguous_glob_reexports)]
31pub use proxy::*;
32pub mod rosetta;
33#[allow(unused_imports, ambiguous_glob_reexports)]
34pub use rosetta::*;
35pub mod stats;
36#[allow(unused_imports, ambiguous_glob_reexports)]
37pub use stats::*;
38bitflags::bitflags! {
39 #[doc = " Categories of container statistics to request from vminitd."]
40 #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] pub struct StatCategory : u32 {
41 #[doc = " Process pid statistics."] const PROCESS = 1 << 0; #[doc =
42 " Memory usage statistics."] const MEMORY = 1 << 1; #[doc = " CPU usage statistics."]
43 const CPU = 1 << 2; #[doc = " Block I/O statistics."] const BLOCK_IO = 1 << 3; #[doc
44 = " Network interface statistics."] const NETWORK = 1 << 4; #[doc =
45 " Memory event counters."] const MEMORY_EVENTS = 1 << 5; }
46}
47impl StatCategory {
48 pub(crate) fn wants(self, category: Self) -> bool {
49 self.is_empty() || self.contains(category)
50 }
51 pub(crate) fn proto_categories(self) -> Vec<i32> {
52 let mut categories = Vec::new();
53 if self.contains(Self::PROCESS) {
54 categories.push(pb::StatCategory::Process as i32);
55 }
56 if self.contains(Self::MEMORY) {
57 categories.push(pb::StatCategory::Memory as i32);
58 }
59 if self.contains(Self::CPU) {
60 categories.push(pb::StatCategory::Cpu as i32);
61 }
62 if self.contains(Self::BLOCK_IO) {
63 categories.push(pb::StatCategory::BlockIo as i32);
64 }
65 if self.contains(Self::NETWORK) {
66 categories.push(pb::StatCategory::Network as i32);
67 }
68 if self.contains(Self::MEMORY_EVENTS) {
69 categories.push(pb::StatCategory::MemoryEvents as i32);
70 }
71 categories
72 }
73}