Skip to main content

Namespace

Struct Namespace 

Source
pub struct Namespace<E: Engine> {
    pub id: u64,
    /* private fields */
}
Expand description

Namespace handle for tenant data isolation (u64 numerical identifier) 命名空间句柄对象(纯数字编号 u64 隔离)

Fields§

§id: u64

Implementations§

Source§

impl<E: Engine> Namespace<E>

Source

pub const fn id(&self) -> u64

Numerical namespace ID 命名空间数字 ID

Source

pub fn wedb(&self) -> WeDb<E>

Get underlying WeDb reference 获取所属 WeDb 实例句柄

Source

pub fn batch(&self) -> DbBatch<E>

Create a batch write handle 创建批量写入句柄

Source

pub fn batch_with_capacity(&self, capacity: usize) -> DbBatch<E>

Create a batch write handle with pre-allocated capacity 创建具有预分配容量槽位的批量写入句柄

Source

pub fn iter(&self, begin: u64) -> Dbs<'_, E>

Stream iterate all existing databases in this namespace starting from begin ID 纯流式迭代当前命名空间下实际存在的数据库索引(支持从指定起始 begin ID 开始遍历)

Source§

impl<E: Engine> Namespace<E>
where Error: From<E::Error>,

Source

pub fn db(&self, id: impl IntoOptId) -> Result<Db<E>>

Open existing database in current namespace by numerical ID, or allocate a new auto-increment database if None is passed. 打开当前命名空间下指定编号的数据库;若传入 None,则自动分配下一个递增自增 ID 并持久化至 Catalog 目录。

Source

pub fn rm(&self) -> Result<u64>

Delete current namespace cascadingly (clears all databases, data, metadata, and auto-increment ID counter in this namespace; deregisters from the catalog so it will no longer appear when iterating) 级联删除当前命名空间(清除该命名空间下的所有数据库、业务数据、元数据与发号器,并从 Catalog 目录中注销,迭代时不复现)

Trait Implementations§

Source§

impl<E: Engine> Clone for Namespace<E>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<E> !RefUnwindSafe for Namespace<E>

§

impl<E> !UnwindSafe for Namespace<E>

§

impl<E> Freeze for Namespace<E>
where Arc<WeDbInner<E>>: Freeze,

§

impl<E> Send for Namespace<E>
where Arc<WeDbInner<E>>: Send,

§

impl<E> Sync for Namespace<E>
where Arc<WeDbInner<E>>: Sync,

§

impl<E> Unpin for Namespace<E>
where Arc<WeDbInner<E>>: Unpin,

§

impl<E> UnsafeUnpin for Namespace<E>
where Arc<WeDbInner<E>>: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.