Struct leveldb_rs::DB
[−]
[src]
pub struct DB { /* fields omitted */ }
This struct represents an open instance of the database.
Methods
impl DB
[src]
fn open(path: &Path) -> LevelDBResult<DB>
Open a database at the given path. Returns a Result indicating whether the database could be opened. Note that this function will not create the database at the given location if it does not exist.
fn create(path: &Path) -> LevelDBResult<DB>
Create and returns a database at the given path.
fn open_with_opts(path: &Path, opts: DBOptions) -> LevelDBResult<DB>
Open a database at the given path, using the provided options to control the open behaviour. Returns a Result indicating whether or not the database could be opened.
fn put(&mut self, key: &[u8], val: &[u8]) -> LevelDBResult<()>
Set the database entry for "key" to "value". Returns a result indicating the success or failure of the operation.
fn put_opts(
&mut self,
key: &[u8],
val: &[u8],
opts: DBWriteOptions
) -> LevelDBResult<()>
&mut self,
key: &[u8],
val: &[u8],
opts: DBWriteOptions
) -> LevelDBResult<()>
Set the database entry for "key" to "value". Allows specifying the write options to use for this operaton.
fn delete(&mut self, key: &[u8]) -> LevelDBResult<()>
Remove the database entry (if any) for "key". Returns a result indicating the success of the operation. It is not an error if "key" did not exist in the database.
fn delete_opts(&mut self, key: &[u8], opts: DBWriteOptions) -> LevelDBResult<()>
Remove the database entry (if any) for "key". As delete()
, but allows
specifying the write options to use for this operation.
fn write(&mut self, batch: DBWriteBatch) -> LevelDBResult<()>
Apply the specified updates to the database, as given in the provided DBWriteBatch. Returns a result indicating the success of the operation.
fn write_opts(
&mut self,
batch: DBWriteBatch,
opts: DBWriteOptions
) -> LevelDBResult<()>
&mut self,
batch: DBWriteBatch,
opts: DBWriteOptions
) -> LevelDBResult<()>
Apply the given write batch. As write()
, but allows specifying the
write options to use for this operation.
fn get(&self, key: &[u8]) -> LevelDBResult<Option<Vec<u8>>>
If the database contains an entry for "key", return the associated value - otherwise, return None. This value is wrapped in a Result to indicate if an error occurred.
fn get_opts(
&self,
key: &[u8],
opts: DBReadOptions
) -> LevelDBResult<Option<Vec<u8>>>
&self,
key: &[u8],
opts: DBReadOptions
) -> LevelDBResult<Option<Vec<u8>>>
Get the value for a given key. As get()
, but allows specifying the
options to use when reading.
fn iter(&mut self) -> LevelDBResult<DBIterator>
Return an iterator over the database.
fn snapshot(&self) -> DBSnapshot
Return a snapshot of the database.
Trait Implementations
impl Clone for DB
[src]
fn clone(&self) -> DB
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more