Skip to main content

AllocatedRanges

Struct AllocatedRanges 

Source
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

Source

pub fn empty() -> Self

Source

pub fn new(ranges_to_apply: &[Range<u64>]) -> Self

Source

pub fn clear(&mut self)

Source

pub fn is_empty(&self) -> bool

Source

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.

Source

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.

Source

pub fn apply_range_to(ranges: &mut Vec<Range<u64>>, new_range: Range<u64>)

Source

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

Source§

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

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

impl Default for AllocatedRanges

Source§

fn default() -> AllocatedRanges

Returns the “default value” for a type. Read more
Source§

impl Eq for AllocatedRanges

Source§

impl PartialEq for AllocatedRanges

Source§

fn eq(&self, other: &AllocatedRanges) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for AllocatedRanges

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<F, N> FidlIntoNative<Box<N>> for F
where F: FidlIntoNative<N>,

§

fn fidl_into_native(self) -> Box<N>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V