Skip to main content

Namespace

Struct Namespace 

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

Durable finite namespace records for one expression tree.

Implementations§

Source§

impl Namespace

Source

pub fn new(tree_id: TreeId, root_dir: DirId) -> Self

Create a namespace with one root directory record.

Source

pub fn tree_id(&self) -> &TreeId

The namespace tree id.

Source

pub fn root_dir(&self) -> &DirId

Root directory identity.

Source

pub fn acquire_writer(&mut self) -> Result<WriterLane, NamespaceError>

Acquire the single serialized writer lane.

Source

pub fn release_writer(&mut self, lane: WriterLane) -> Result<(), NamespaceError>

Release a previously acquired writer lane.

Source

pub fn reservation_count(&self) -> usize

Number of durable name reservations.

Source

pub fn counter_count(&self) -> usize

Number of generated-name counters.

Source

pub fn dir(&self, id: &DirId) -> Option<&DirRecord>

Read a directory by id without allocating namespace state.

Source

pub fn cell(&self, id: &CellId) -> Option<&CellRecord>

Read a cell by id without allocating namespace state.

Source

pub fn child( &self, parent: &DirId, name: &NamespaceName, ) -> Option<NamespaceEntry>

Read a named child without allocating namespace state.

Source

pub fn children( &self, parent: &DirId, ) -> Result<Vec<(NamespaceName, NamespaceEntry)>, NamespaceError>

Lists a directory’s named children in deterministic name order.

Source

pub fn reserve_name( &mut self, lane: WriterLane, parent: &DirId, name: NamespaceName, ) -> Result<NamespaceName, NamespaceError>

Reserve an explicit child name before creating the durable node.

Source

pub fn reserve_generated_name( &mut self, lane: WriterLane, parent: &DirId, kind: GeneratedNameKind, ) -> Result<NamespaceName, NamespaceError>

Reserve a generated child name before creating the durable node.

Source

pub fn create_cell( &mut self, lane: WriterLane, request: CellCreate, ) -> Result<(), NamespaceError>

Create a durable cell from a prior reservation.

Source

pub fn create_dir( &mut self, lane: WriterLane, id: DirId, parent: &DirId, name: NamespaceName, policy_patch: CodecPolicyPatch, ) -> Result<(), NamespaceError>

Create a durable child directory from a prior reservation.

Source

pub fn move_cell( &mut self, lane: WriterLane, id: &CellId, new_parent: &DirId, new_name: NamespaceName, ) -> Result<(), NamespaceError>

Rename or move a cell while preserving immutable cell identity.

Source

pub fn move_dir( &mut self, lane: WriterLane, id: &DirId, new_parent: &DirId, new_name: NamespaceName, ) -> Result<(), NamespaceError>

Rename or move a directory while preserving immutable directory identity.

Source

pub fn set_cell_policy( &mut self, lane: WriterLane, id: &CellId, policy_patch: CodecPolicyPatch, ) -> Result<(), NamespaceError>

Replaces a cell’s local codec-policy patch.

Source

pub fn set_dir_policy( &mut self, lane: WriterLane, id: &DirId, policy_patch: CodecPolicyPatch, ) -> Result<(), NamespaceError>

Replaces a directory’s local codec-policy patch.

Source

pub fn delete_cell( &mut self, lane: WriterLane, id: &CellId, ) -> Result<CellRecord, NamespaceError>

Deletes one cell while preserving its generated-name reservation history.

Source

pub fn delete_dir( &mut self, lane: WriterLane, id: &DirId, ) -> Result<DirRecord, NamespaceError>

Deletes one empty non-root directory.

Source

pub fn effective_dir_policy( &self, id: &DirId, ) -> Result<EffectiveCodecPolicy, NamespaceError>

Resolve the inherited policy for a directory.

Source

pub fn effective_cell_policy( &self, id: &CellId, ) -> Result<EffectiveCodecPolicy, NamespaceError>

Resolve the inherited policy for a cell, applying the cell patch last.

Source§

impl Namespace

Source

pub fn codec_patch(codec: impl Into<String>) -> CodecPolicyPatch

Convenience policy patch for tests and callers that need only a codec.

Trait Implementations§

Source§

impl Debug for Namespace

Source§

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

Formats the value using the given formatter. Read more

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