pub struct MasonChamber {
pub bee_id: BeeId,
pub memory_budget: u64,
pub memory_used: AtomicU64,
pub scratch_dir: PathBuf,
pub task_timeout: Duration,
}Expand description
A sealed execution chamber with hard memory budget and scratch isolation.
Fields§
§bee_id: BeeIdThe bee that owns this chamber.
memory_budget: u64Hard memory limit in bytes.
memory_used: AtomicU64Current memory usage in bytes.
scratch_dir: PathBufIsolated scratch directory for this bee.
task_timeout: DurationMaximum execution time per task.
Implementations§
Source§impl MasonChamber
impl MasonChamber
Sourcepub fn new(
bee_id: BeeId,
memory_budget: u64,
scratch_dir: PathBuf,
task_timeout: Duration,
) -> Self
pub fn new( bee_id: BeeId, memory_budget: u64, scratch_dir: PathBuf, task_timeout: Duration, ) -> Self
Create a new chamber with the given budget and scratch directory.
Sourcepub fn request_memory(&self, bytes: u64) -> Result<()>
pub fn request_memory(&self, bytes: u64) -> Result<()>
Request a memory allocation. Returns an error if the budget would be exceeded.
Sourcepub fn release_memory(&self, bytes: u64)
pub fn release_memory(&self, bytes: u64)
Release a previously allocated memory amount.
Sourcepub fn utilisation(&self) -> f64
pub fn utilisation(&self) -> f64
Return current memory utilisation as a fraction (0.0 to 1.0).
Auto Trait Implementations§
impl !Freeze for MasonChamber
impl RefUnwindSafe for MasonChamber
impl Send for MasonChamber
impl Sync for MasonChamber
impl Unpin for MasonChamber
impl UnsafeUnpin for MasonChamber
impl UnwindSafe for MasonChamber
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> 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