pub struct AllocatedRanges { /* private fields */ }Expand description
AllocatedRanges tracks the logical ranges of a file which are pre-allocated using allocate, in other words, the ranges of the file with overwrite extents. It’s used by PagedObjectHandle to split writes to CoW ranges and writes to overwrite ranges into separate batches so they can have different transaction options.
Implementations§
Source§impl AllocatedRanges
impl AllocatedRanges
pub fn empty() -> Self
pub fn new(ranges_to_apply: &[Range<u64>]) -> Self
pub fn clear(&mut self)
pub fn is_empty(&self) -> bool
Sourcepub fn overlap<'a>(&'a self, query_range: Range<u64>) -> RangeOverlapIter<'a>
pub fn overlap<'a>(&'a self, query_range: Range<u64>) -> RangeOverlapIter<'a>
Find the overlapping overwrite ranges in the given range for this file, so writes can be split between them appropriately. Ranges with RangeType::Overwrite should be written to with multi_overwrite and RangeType::Cow should use multi_write.
Sourcepub fn apply_range(&mut self, new_range: Range<u64>)
pub fn apply_range(&mut self, new_range: Range<u64>)
Apply range takes a single, valid file range and inserts it into the list of ranges it’s storing. This list of ranges, so it’s easy to insert and search, is kept sorted and merged, so that the list has no overlapping ranges.
pub fn apply_range_to(ranges: &mut Vec<Range<u64>>, new_range: Range<u64>)
Sourcepub fn truncate(&mut self, cutoff: u64) -> bool
pub fn truncate(&mut self, cutoff: u64) -> bool
For when a file is truncated. Drop any ranges past the cutoff point. If a range covers the cutoff point, it is modified to end at the cutoff.
Additionally, this returns true if there were previously tracked ranges but they were all completely removed by this truncate call. In this case, metadata for a file will need to be updated since there are no longer any overwrite ranges.
Trait Implementations§
Source§impl Debug for AllocatedRanges
impl Debug for AllocatedRanges
Source§impl Default for AllocatedRanges
impl Default for AllocatedRanges
Source§fn default() -> AllocatedRanges
fn default() -> AllocatedRanges
impl Eq for AllocatedRanges
Source§impl PartialEq for AllocatedRanges
impl PartialEq for AllocatedRanges
Source§fn eq(&self, other: &AllocatedRanges) -> bool
fn eq(&self, other: &AllocatedRanges) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for AllocatedRanges
Auto Trait Implementations§
impl Freeze for AllocatedRanges
impl RefUnwindSafe for AllocatedRanges
impl Send for AllocatedRanges
impl Sync for AllocatedRanges
impl Unpin for AllocatedRanges
impl UnsafeUnpin for AllocatedRanges
impl UnwindSafe for AllocatedRanges
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<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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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