Skip to main content

CowMap

Struct CowMap 

Source
pub struct CowMap { /* private fields */ }
Expand description

Adaptive cluster map for cluster_id -> location resolution.

Each cluster is either local (written to this file), inherited from the parent (ParentRef), or unallocated.

Implementations§

Source§

impl CowMap

Source

pub fn new_flat(cluster_count: u32) -> Self

Create a new flat-array map with cluster_count entries, all Unallocated.

Source

pub fn new_parent_ref(cluster_count: u32) -> Self

Create a new flat-array map with all entries set to ParentRef.

Source

pub fn lookup(&self, cluster_id: u32) -> CowMapEntry

Look up a cluster by ID.

Source

pub fn update(&mut self, cluster_id: u32, entry: CowMapEntry)

Update a cluster entry.

Source

pub fn serialize(&self) -> Vec<u8>

Serialize the map to bytes.

Wire format (flat_array): format(u8) | cluster_count(u32) | entries[cluster_count] Each entry: tag(u8) | offset(u64) tag 0x00 = Unallocated, tag 0x01 = ParentRef, tag 0x02 = LocalOffset

Source

pub fn deserialize(data: &[u8], format: MapFormat) -> Result<Self, RvfError>

Deserialize a CowMap from bytes.

Source

pub fn local_cluster_count(&self) -> u32

Count of clusters that have local data.

Source

pub fn cluster_count(&self) -> u32

Total number of clusters in the map.

Source

pub fn format(&self) -> MapFormat

Get the map format.

Auto Trait Implementations§

§

impl Freeze for CowMap

§

impl RefUnwindSafe for CowMap

§

impl Send for CowMap

§

impl Sync for CowMap

§

impl Unpin for CowMap

§

impl UnwindSafe for CowMap

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
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, 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.