pub enum ReservationOptions<'a> {
New,
Borrowed,
Hold(&'a Reservation),
}Expand description
How metadata and allocator reservations should be handled for a transaction.
A transaction consumes space in two different ways:
- The transaction will consume space in the journal and eventually in an LSM tree (the “metadata” cost of the transaction).
- The transaction might also include additional allocations or deallocations. These may come directly from the global allocator, or they might come from a Reservation object, depending on the context. (See specific enum cases for details.)
The basic decision tree for which variant to use is as follows:
- Is there an existing reservation which the transaction should draw from?
- YES: Use
ReservationOptions::Hold - NO: Is the transaction allocating or deallocating extents for internal filesystem metadata
(e.g. LSM tree compaction, journal/superblock growth, or graveyard tombstoning in the
root/root-parent stores) or expected to be space-neutral or space-saving?
- YES: Use
ReservationOptions::Borrowed- NO: UseReservationOptions::New
- YES: Use
Variants§
New
A new reservation is created to accommodate the metadata of a maximally-sized transaction, and the transaction’s metadata is paid for from this reservation. Allocations and deallocations within the transaction will go directly to the global allocator (and therefore might fail if there’s insufficient space).
This should be the default case for most transactions which permit failure when there’s no space left in the global allocator.
Borrowed
Metadata space is borrowed directly from the global reservation held by the ObjectManager.
For system stores (root_parent_store and root_store), extent allocations and
deallocations in the transaction also draw from and return space to the global metadata
reservation (e.g. journal and super-block growth/shrink, LSM tree compaction, and graveyard
tombstoning of layer files).
For child stores, extent allocations are not permitted, and extent deallocations are returned to the global allocator pool. This must only be used for child-store transactions that will either not affect net space usage after compaction (e.g. setting attributes on an object) or will reduce space (e.g. unlinking a file or deleting a range of extents).
When this is used appropriately, it is guaranteed that transactions will not fail due to lack of space (barring any bugs resulting in a deficit in the global reservation).
Hold(&'a Reservation)
Use the specified reservation for the transaction’s metadata (placing a hold on it) as well as any allocations or deallocations in the transaction.
Trait Implementations§
Source§impl<'a> Clone for ReservationOptions<'a>
impl<'a> Clone for ReservationOptions<'a>
impl<'a> Copy for ReservationOptions<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ReservationOptions<'a>
impl<'a> !UnwindSafe for ReservationOptions<'a>
impl<'a> Freeze for ReservationOptions<'a>
impl<'a> Send for ReservationOptions<'a>
impl<'a> Sync for ReservationOptions<'a>
impl<'a> Unpin for ReservationOptions<'a>
impl<'a> UnsafeUnpin for ReservationOptions<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
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> ⓘ
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> ⓘ
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