Struct KernelSandbox
pub struct KernelSandbox {
policy: SandboxPolicy,
kernel_id: Option<KernelId>,
stats: RwLock<SandboxStats>,
violations: RwLock<Vec<SandboxViolation>>,
start_time: RwLock<Option<Instant>>,
message_count: AtomicU64,
last_rate_check: RwLock<Instant>,
}Expand description
Kernel sandbox for isolation and resource control.
Fields§
§policy: SandboxPolicy§kernel_id: Option<KernelId>§stats: RwLock<SandboxStats>§violations: RwLock<Vec<SandboxViolation>>§start_time: RwLock<Option<Instant>>§message_count: AtomicU64§last_rate_check: RwLock<Instant>Implementations§
§impl KernelSandbox
impl KernelSandbox
pub fn new(policy: SandboxPolicy) -> KernelSandbox
pub fn new(policy: SandboxPolicy) -> KernelSandbox
Create a new kernel sandbox.
pub fn apply_to_kernel(&mut self, kernel_id: KernelId)
pub fn apply_to_kernel(&mut self, kernel_id: KernelId)
Apply sandbox to a kernel.
pub fn check_memory(&self, bytes: u64) -> Result<(), SandboxViolation>
pub fn check_memory(&self, bytes: u64) -> Result<(), SandboxViolation>
Check memory usage against limits.
pub fn check_execution_time(&self) -> Result<(), SandboxViolation>
pub fn check_execution_time(&self) -> Result<(), SandboxViolation>
Check execution time against limits.
pub fn check_k2k(&self, destination: &str) -> Result<(), SandboxViolation>
pub fn check_k2k(&self, destination: &str) -> Result<(), SandboxViolation>
Check K2K destination against policy.
pub fn check_checkpoint(&self) -> Result<(), SandboxViolation>
pub fn check_checkpoint(&self) -> Result<(), SandboxViolation>
Check if checkpointing is allowed.
pub fn check_migration(&self) -> Result<(), SandboxViolation>
pub fn check_migration(&self) -> Result<(), SandboxViolation>
Check if migration is allowed.
pub fn record_message(&self) -> Result<(), SandboxViolation>
pub fn record_message(&self) -> Result<(), SandboxViolation>
Record a message for rate limiting.
pub fn violations(&self) -> Vec<SandboxViolation>
pub fn violations(&self) -> Vec<SandboxViolation>
Get all recorded violations.
pub fn stats(&self) -> SandboxStats
pub fn stats(&self) -> SandboxStats
Get sandbox statistics.
pub fn policy(&self) -> &SandboxPolicy
pub fn policy(&self) -> &SandboxPolicy
Get the policy.
pub fn reset(&self)
pub fn reset(&self)
Reset statistics and violations.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for KernelSandbox
impl RefUnwindSafe for KernelSandbox
impl Send for KernelSandbox
impl Sync for KernelSandbox
impl Unpin for KernelSandbox
impl UnwindSafe for KernelSandbox
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.