Struct rkv::Manager

source ·
pub struct Manager<E> { /* private fields */ }
Expand description

A process is only permitted to have one open handle to each Rkv environment. This manager exists to enforce that constraint: don’t open environments directly.

By default, path canonicalization is enabled for identifying RKV instances. This is true by default, because it helps enforce the constraints guaranteed by this manager. However, path canonicalization might crash in some fringe circumstances, so the no-canonicalize-path feature offers the possibility of disabling it. See: https://bugzilla.mozilla.org/show_bug.cgi?id=1531887

When path canonicalization is disabled, you must ensure an RKV environment is always created or retrieved with the same path.

Implementations§

source§

impl<'e, E> Manager<E>where E: BackendEnvironment<'e>,

source

pub fn get<'p, P>( &self, path: P ) -> Result<Option<Arc<RwLock<Rkv<E>>>>, StoreError>where P: Into<&'p Path>,

Return the open env at path, returning None if it has not already been opened.

source

pub fn get_or_create<'p, F, P>( &mut self, path: P, f: F ) -> Result<Arc<RwLock<Rkv<E>>>, StoreError>where F: FnOnce(&Path) -> Result<Rkv<E>, StoreError>, P: Into<&'p Path>,

Return the open env at path, or create it by calling f.

source

pub fn get_or_create_with_capacity<'p, F, P>( &mut self, path: P, capacity: c_uint, f: F ) -> Result<Arc<RwLock<Rkv<E>>>, StoreError>where F: FnOnce(&Path, c_uint) -> Result<Rkv<E>, StoreError>, P: Into<&'p Path>,

Return the open env at path with capacity, or create it by calling f.

source

pub fn get_or_create_from_builder<'p, F, P, B>( &mut self, path: P, builder: B, f: F ) -> Result<Arc<RwLock<Rkv<E>>>, StoreError>where F: FnOnce(&Path, B) -> Result<Rkv<E>, StoreError>, P: Into<&'p Path>, B: BackendEnvironmentBuilder<'e, Environment = E>,

Return a new Rkv environment from the builder, or create it by calling f.

source

pub fn try_close<'p, P>( &mut self, path: P, options: CloseOptions ) -> Result<(), CloseError>where P: Into<&'p Path>,

Tries to close the specified environment. Returns an error when other users of this environment still exist.

source§

impl Manager<SafeModeEnvironment>

Auto Trait Implementations§

§

impl<E> RefUnwindSafe for Manager<E>

§

impl<E> Send for Manager<E>where E: Send + Sync,

§

impl<E> Sync for Manager<E>where E: Send + Sync,

§

impl<E> Unpin for Manager<E>

§

impl<E> UnwindSafe for Manager<E>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.