[−][src]Struct sanakirja::Env
Environment, required to start any transactions. Thread-safe, but opening the same database several times in the same process is not cross-platform.
Implementations
impl<T> Env<T>
[src]
impl<T> Env<T>
[src]
pub fn file_size<P: AsRef<Path>>(path: P) -> Result<u64, Error>
[src]
std::fs::File size of the database path, if it exists.
pub fn set_flush_limit(&mut self, flush: u64)
[src]
Set the maximum number of dirty pages before triggering a
flush. The default is 4096 pages. Some operating systems might
have other acceptable values. For example, Linux defines the
"dirty ratio" as the number of memory pages that have been
written to (so-called "dirty pages") divided by number of
pages in available memory. This can be checked for instance
using the command systctl -a | grep dirty
.
pub fn flush_limit(&self) -> u64
[src]
Get the maximum number of dirty pages before triggering a flush.
pub unsafe fn new_nolock<P: AsRef<Path>>(
path: P,
length: u64
) -> Result<Self, Error>
[src]
path: P,
length: u64
) -> Result<Self, Error>
Same as new
, but does not take a lock on the file
system.
This method is provided because waiting for a lock on the file system may block the whole process, whereas.
However, the database is very likely to get corrupted if open more than once at the same time, even within the same process.
Therefore, do not use this method without another locking mechanism in place to avoid that situation.
impl Env<Shared>
[src]
pub fn new_shared<P: AsRef<Path>>(
path: P,
length: u64
) -> Result<Env<Shared>, Error>
[src]
path: P,
length: u64
) -> Result<Env<Shared>, Error>
Initialize an environment. length
must be a strictly
positive multiple of 4096. The same file can only be open in
one process or thread at the same time, and this is enforced
by a locked file.
pub fn try_new_shared<P: AsRef<Path>>(
path: P,
length: u64
) -> Result<Env<Shared>, Error>
[src]
path: P,
length: u64
) -> Result<Env<Shared>, Error>
Initialize an environment. length
must be a strictly
positive multiple of 4096. Returns an error if the database is
locked by another process or thread.
impl Env<Exclusive>
[src]
pub fn new<P: AsRef<Path>>(
path: P,
length: u64
) -> Result<Env<Exclusive>, Error>
[src]
path: P,
length: u64
) -> Result<Env<Exclusive>, Error>
Initialize an environment. length
must be a strictly
positive multiple of 4096. The same file can only be open in
one process or thread at the same time, and this is enforced
by a locked file.
pub fn try_new<P: AsRef<Path>>(
path: P,
length: u64
) -> Result<Env<Exclusive>, Error>
[src]
path: P,
length: u64
) -> Result<Env<Exclusive>, Error>
Initialize an environment. length
must be a strictly
positive multiple of 4096. Returns an error if the database is
locked by another process or thread.
pub fn new_anon(length: u64) -> Result<Env<Exclusive>, Error>
[src]
Create a new anonymous database, backed by memory. The length is the total size in bytes of the database.
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<L> Env<L>
[src]
pub unsafe fn close(&mut self)
[src]
Close this repository, releasing the locks. It is undefined
behaviour to use the environment afterwards. This method can
be used for instance to release the locks before allocating a
new environment (note that std::mem::replace
followed by
Drop::drop
of the previous value would not release the locks
in the correct order).
The safe alternative to this method is to use an Option<Env>
instead of an Env
.
impl<L> Env<L>
[src]
pub fn txn_begin<E: Borrow<Self>>(env: E) -> Result<Txn<L, E>, Error>
[src]
Start a read-only transaction.
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for Env<T>
[src]
impl<T> Unpin for Env<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Env<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,