[−][src]Struct lmdb::RwTransaction
An LMDB read-write transaction.
Methods
impl<'env> RwTransaction<'env>
[src]
pub unsafe fn create_db(
&self,
name: Option<&str>,
flags: DatabaseFlags
) -> Result<Database>
[src]
&self,
name: Option<&str>,
flags: DatabaseFlags
) -> Result<Database>
Opens a database in the provided transaction, creating it if necessary.
If name
is None
, then the default database will be opened, otherwise
a named database will be opened. The database handle will be private to
the transaction until the transaction is successfully committed. If the
transaction is aborted the returned database handle should no longer be
used.
Prefer using Environment::create_db
.
Safety
This function (as well as Environment::open_db
,
Environment::create_db
, and Database::open
) must not be called
from multiple concurrent transactions in the same environment. A
transaction which uses this function must finish (either commit or
abort) before any other transaction may use this function.
pub fn open_rw_cursor<'txn>(
&'txn mut self,
db: Database
) -> Result<RwCursor<'txn>>
[src]
&'txn mut self,
db: Database
) -> Result<RwCursor<'txn>>
Opens a new read-write cursor on the given database and transaction.
pub fn put<K, D>(
&mut self,
database: Database,
key: &K,
data: &D,
flags: WriteFlags
) -> Result<()> where
K: AsRef<[u8]>,
D: AsRef<[u8]>,
[src]
&mut self,
database: Database,
key: &K,
data: &D,
flags: WriteFlags
) -> Result<()> where
K: AsRef<[u8]>,
D: AsRef<[u8]>,
Stores an item into a database.
This function stores key/data pairs in the database. The default
behavior is to enter the new key/data pair, replacing any previously
existing key if duplicates are disallowed, or adding a duplicate data
item if duplicates are allowed (DatabaseFlags::DUP_SORT
).
pub fn reserve<'txn, K>(
&'txn mut self,
database: Database,
key: &K,
len: size_t,
flags: WriteFlags
) -> Result<&'txn mut [u8]> where
K: AsRef<[u8]>,
[src]
&'txn mut self,
database: Database,
key: &K,
len: size_t,
flags: WriteFlags
) -> Result<&'txn mut [u8]> where
K: AsRef<[u8]>,
Returns a buffer which can be used to write a value into the item at the given key and with the given length. The buffer must be completely filled by the caller.
pub fn del<K>(
&mut self,
database: Database,
key: &K,
data: Option<&[u8]>
) -> Result<()> where
K: AsRef<[u8]>,
[src]
&mut self,
database: Database,
key: &K,
data: Option<&[u8]>
) -> Result<()> where
K: AsRef<[u8]>,
Deletes an item from a database.
This function removes key/data pairs from the database. If the database
does not support sorted duplicate data items (DatabaseFlags::DUP_SORT
)
the data parameter is ignored. If the database supports sorted
duplicates and the data parameter is None
, all of the duplicate data
items for the key will be deleted. Otherwise, if the data parameter is
Some
only the matching data item will be deleted. This function will
return Error::NotFound
if the specified key/data pair is not in the
database.
pub fn clear_db(&mut self, db: Database) -> Result<()>
[src]
Empties the given database. All items will be removed.
pub unsafe fn drop_db(&mut self, db: Database) -> Result<()>
[src]
Drops the database from the environment.
Safety
This method is unsafe in the same ways as Environment::close_db
, and
should be used accordingly.
pub fn begin_nested_txn<'txn>(&'txn mut self) -> Result<RwTransaction<'txn>>
[src]
Begins a new nested transaction inside of this transaction.
Trait Implementations
impl<'env> Transaction for RwTransaction<'env>
[src]
fn txn(&self) -> *mut MDB_txn
[src]
fn commit(self) -> Result<()>
[src]
Commits the transaction. Read more
fn abort(self)
[src]
Aborts the transaction. Read more
unsafe fn open_db(&self, name: Option<&str>) -> Result<Database>
[src]
Opens a database in the transaction. Read more
fn get<'txn, K>(&'txn self, database: Database, key: &K) -> Result<&'txn [u8]> where
K: AsRef<[u8]>,
[src]
K: AsRef<[u8]>,
Gets an item from a database. Read more
fn open_ro_cursor<'txn>(&'txn self, db: Database) -> Result<RoCursor<'txn>>
[src]
Open a new read-only cursor on the given database.
fn db_flags(&self, db: Database) -> Result<DatabaseFlags>
[src]
Gets the option flags for the given database in the transaction.
fn stat(&self, db: Database) -> Result<Stat>
[src]
Retrieves database statistics.
impl<'env> Drop for RwTransaction<'env>
[src]
impl<'env> Debug for RwTransaction<'env>
[src]
Auto Trait Implementations
impl<'env> !Send for RwTransaction<'env>
impl<'env> !Sync for RwTransaction<'env>
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,