Type Alias Reservation

Source
pub type Reservation = ReservationImpl<Arc<dyn ReservationOwner>, dyn ReservationOwner>;

Aliased Type§

struct Reservation { /* private fields */ }

Implementations

Source§

impl<T: Borrow<U> + Clone + Send + Sync, U: ReservationOwner + ?Sized> ReservationImpl<T, U>

Source

pub fn new(owner: T, owner_object_id: Option<u64>, amount: u64) -> Self

Source

pub fn owner_object_id(&self) -> Option<u64>

Source

pub fn amount(&self) -> u64

Returns the total amount of the reservation, not accounting for anything that might be held.

Source

pub fn add(&self, amount: u64)

Adds more to the reservation.

Source

pub fn forget(&self) -> u64

Returns the entire amount of the reservation. The caller is responsible for maintaining consistency, i.e. updating counters, etc, and there can be no sub-reservations (an assert will fire otherwise).

Source

pub fn forget_some(&self, amount: u64)

Takes some of the reservation. The caller is responsible for maintaining consistency, i.e. updating counters, etc. This will assert that the amount being forgotten does not exceed the available reservation amount; the caller should ensure that this is the case.

Source

pub fn reserve(&self, amount: u64) -> Option<ReservationImpl<&Self, Self>>

Reserves exactly amount if possible.

Source

pub fn commit(&self, amount: u64)

Commits a previously reserved amount from this reservation. The caller is responsible for ensuring the amount was reserved.

Source

pub fn give_back(&self, amount: u64)

Returns some of the reservation.

Source

pub fn move_to<V: Borrow<W> + Clone + Send + Sync, W: ReservationOwner + ?Sized>( &self, other: &ReservationImpl<V, W>, amount: u64, )

Moves amount from this reservation to another reservation.

Trait Implementations

Source§

impl<T: Borrow<U>, U: ReservationOwner + ?Sized> Debug for ReservationImpl<T, U>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Borrow<U>, U: ReservationOwner + ?Sized> Drop for ReservationImpl<T, U>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: Borrow<U> + Send + Sync, U: ReservationOwner + ?Sized> ReservationOwner for ReservationImpl<T, U>

Source§

fn release_reservation(&self, owner_object_id: Option<u64>, amount: u64)

Report that bytes are being released from the reservation back to the the |ReservationOwner| where |owner_object_id| is the owner under the root object store associated with the reservation.