Struct Environment

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

Represents LMDB Environment. Should be opened using EnvBuilder

Implementations§

Source§

impl Environment

Source

pub fn new() -> EnvBuilder

Source

pub fn reader_check(&self) -> MdbResult<c_int>

Check for stale entries in the reader lock table.

Returns the number of stale slots that were cleared.

Source

pub fn stat(&self) -> MdbResult<MDB_stat>

Retrieve environment statistics

Source

pub fn info(&self) -> MdbResult<MDB_envinfo>

Source

pub fn sync(&self, force: bool) -> MdbResult<()>

Sync environment to disk

Source

pub fn set_mapsize(&self, map_size: usize) -> MdbResult<()>

Sets map size. This can be called after open if no transactions are active in this process.

Source

pub fn set_flags(&mut self, flags: EnvFlags, turn_on: bool) -> MdbResult<()>

This one sets only flags which are available for change even after opening, see also get_flags and get_all_flags

Source

pub fn get_flags(&self) -> MdbResult<EnvFlags>

Get flags of environment, which could be changed after it was opened use get_all_flags if you need also creation time flags

Source

pub fn get_all_flags(&self) -> MdbResult<EnvCreateFlags>

Get all flags of environment, including which were specified on creation See also get_flags if you’re interested only in modifiable flags

Source

pub fn get_maxreaders(&self) -> MdbResult<c_uint>

Source

pub fn get_maxkeysize(&self) -> c_int

Source

pub fn copy_to_fd(&self, fd: mdb_filehandle_t) -> MdbResult<()>

Creates a backup copy in specified file descriptor

Source

pub fn get_fd(&self) -> MdbResult<mdb_filehandle_t>

Gets file descriptor of this environment

Source

pub fn copy_to_path<P: AsRef<Path>>(&self, path: P) -> MdbResult<()>

Creates a backup copy in specified path

Source

pub fn new_transaction(&self) -> MdbResult<Transaction<'_>>

Creates a new read-write transaction

Use get_reader to get much faster lock-free alternative

Source

pub fn get_reader(&self) -> MdbResult<ReadonlyTransaction<'_>>

Creates a readonly transaction

Source

pub fn get_db(&self, db_name: &str, flags: DbFlags) -> MdbResult<DbHandle>

Opens existing DB

Source

pub fn create_db(&self, db_name: &str, flags: DbFlags) -> MdbResult<DbHandle>

Opens or creates a DB

Source

pub fn get_default_db(&self, flags: DbFlags) -> MdbResult<DbHandle>

Opens default DB with specified flags

Trait Implementations§

Source§

impl Clone for Environment

Source§

fn clone(&self) -> Environment

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Environment

Source§

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

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

impl Send for Environment

Source§

impl Sync for Environment

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