Struct sanakirja::Env[][src]

pub struct Env { /* fields omitted */ }

An environment, which may be either a memory-mapped file, or memory allocated with std::alloc.

Implementations

impl Env[src]

pub fn mut_txn_begin<E: Borrow<Self>>(env: E) -> Result<MutTxn<E, ()>, Error>[src]

Start a mutable transaction. Mutable transactions that go out of scope are automatically aborted.

impl Env[src]

pub unsafe fn new_nolock<P: AsRef<Path>>(
    path: P,
    length: u64,
    n_roots: usize
) -> Result<Self, Error>
[src]

Same as new, but does not create any lock on the file system.

The database is very likely to get corrupted if an environment is opened from multiple processes, or more than once by the same process, if at least one of these instances can start a mutable transaction.

The n_roots argument is ignored if the database already exists, and is used to initialise the first n_roots pages of the file else.

impl Env[src]

pub fn new<P: AsRef<Path>>(
    path: P,
    length: u64,
    n_roots: usize
) -> Result<Env, Error>
[src]

Initialize an environment. If length is not a multiple of 4096, it is rounded to the next multiple of the page size (4096 bytes).

The n_roots parameter is the maximum number of versions that can be alive at the same time, before mut_txn_begin must wait for old readers to stop.

If n_roots is 1, mutable transactions exclude all readers.

pub fn new_anon(length: u64, n_roots: usize) -> Result<Env, Error>[src]

Create a new anonymous database, backed by memory. The length is the total size in bytes of the database.

impl Env[src]

pub fn txn_begin<E: Borrow<Self>>(env: E) -> Result<Txn<E>, Error>[src]

Start a read-only transaction.

Trait Implementations

impl Send for Env[src]

impl Sync for Env[src]

Auto Trait Implementations

impl !RefUnwindSafe for Env

impl Unpin for Env

impl UnwindSafe for Env

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.