Trait transact::database::DatabaseReader [−][src]
pub trait DatabaseReader { fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, DatabaseError>; fn index_get(
&self,
index: &str,
key: &[u8]
) -> Result<Option<Vec<u8>>, DatabaseError>; fn cursor(&self) -> Result<DatabaseCursor<'_>, DatabaseError>; fn index_cursor(
&self,
index: &str
) -> Result<DatabaseCursor<'_>, DatabaseError>; fn count(&self) -> Result<usize, DatabaseError>; fn index_count(&self, index: &str) -> Result<usize, DatabaseError>; }
Expand description
A DatabaseReader provides read access to a database instance.
Required methods
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, DatabaseError>
[src]
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, DatabaseError>
[src]Returns the bytes stored at the given key, if found.
fn index_get(
&self,
index: &str,
key: &[u8]
) -> Result<Option<Vec<u8>>, DatabaseError>
[src]
fn index_get(
&self,
index: &str,
key: &[u8]
) -> Result<Option<Vec<u8>>, DatabaseError>
[src]Returns the bytes stored at the given key on a specified index, if found.
fn cursor(&self) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]
fn cursor(&self) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]Returns a cursor against the main database. The cursor iterates over the entries in the natural key order.
fn index_cursor(&self, index: &str) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]
fn index_cursor(&self, index: &str) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]Returns a cursor against the given index. The cursor iterates over the entries in the index’s natural key order.
fn count(&self) -> Result<usize, DatabaseError>
[src]
fn count(&self) -> Result<usize, DatabaseError>
[src]Returns the number of entries in the main database.
fn index_count(&self, index: &str) -> Result<usize, DatabaseError>
[src]
fn index_count(&self, index: &str) -> Result<usize, DatabaseError>
[src]Returns the number of entries in the given index.
Implementors
impl<'a> DatabaseReader for BTreeReader<'a>
[src]
impl<'a> DatabaseReader for BTreeReader<'a>
[src]fn cursor(&self) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]
fn cursor(&self) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]Returns a cursor against the main database. The cursor iterates over the entries in the natural key order.
fn index_cursor(&self, index: &str) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]
fn index_cursor(&self, index: &str) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]Returns a cursor against the given index. The cursor iterates over the entries in the index’s natural key order.
fn count(&self) -> Result<usize, DatabaseError>
[src]
fn count(&self) -> Result<usize, DatabaseError>
[src]Returns the number of entries in the main database.
fn index_count(&self, index: &str) -> Result<usize, DatabaseError>
[src]
fn index_count(&self, index: &str) -> Result<usize, DatabaseError>
[src]Returns the number of entries in the given index.
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, DatabaseError>
[src]
fn index_get(
&self,
index: &str,
key: &[u8]
) -> Result<Option<Vec<u8>>, DatabaseError>
[src]
&self,
index: &str,
key: &[u8]
) -> Result<Option<Vec<u8>>, DatabaseError>
impl<'a> DatabaseReader for BTreeWriter<'a>
[src]
impl<'a> DatabaseReader for BTreeWriter<'a>
[src]fn cursor(&self) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]
fn cursor(&self) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]Returns a cursor against the main database. The cursor iterates over the entries in the natural key order.
fn index_cursor(&self, index: &str) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]
fn index_cursor(&self, index: &str) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]Returns a cursor against the given index. The cursor iterates over the entries in the index’s natural key order.
fn count(&self) -> Result<usize, DatabaseError>
[src]
fn count(&self) -> Result<usize, DatabaseError>
[src]Returns the number of entries in the main database.
fn index_count(&self, index: &str) -> Result<usize, DatabaseError>
[src]
fn index_count(&self, index: &str) -> Result<usize, DatabaseError>
[src]Returns the number of entries in the given index
fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, DatabaseError>
[src]
fn index_get(
&self,
index: &str,
key: &[u8]
) -> Result<Option<Vec<u8>>, DatabaseError>
[src]
&self,
index: &str,
key: &[u8]
) -> Result<Option<Vec<u8>>, DatabaseError>
impl<'a> DatabaseReader for LmdbDatabaseReader<'a>
[src]
impl<'a> DatabaseReader for LmdbDatabaseReader<'a>
[src]fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, DatabaseError>
[src]
fn index_get(
&self,
index: &str,
key: &[u8]
) -> Result<Option<Vec<u8>>, DatabaseError>
[src]
&self,
index: &str,
key: &[u8]
) -> Result<Option<Vec<u8>>, DatabaseError>
fn cursor(&self) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]
fn index_cursor(&self, index: &str) -> Result<DatabaseCursor<'_>, DatabaseError>
[src]
fn count(&self) -> Result<usize, DatabaseError>
[src]
fn index_count(&self, index: &str) -> Result<usize, DatabaseError>
[src]
impl<'a> DatabaseReader for LmdbDatabaseWriter<'a>
[src]
impl<'a> DatabaseReader for LmdbDatabaseWriter<'a>
[src]fn get(&self, key: &[u8]) -> Result<Option<Vec<u8>>, DatabaseError>
[src]
fn index_get(
&self,
index: &str,
key: &[u8]
) -> Result<Option<Vec<u8>>, DatabaseError>
[src]
&self,
index: &str,
key: &[u8]
) -> Result<Option<Vec<u8>>, DatabaseError>