Struct sanakirja::Env [−][src]
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]
path: P,
length: u64,
n_roots: usize
) -> Result<Self, Error>
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]
path: P,
length: u64,
n_roots: usize
) -> Result<Env, Error>
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
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,