pub struct Database {
pub path: String,
pub rocksdb: DB,
pub options: Options,
/* private fields */
}
Expand description
Database instance.
Fields§
§path: String
§rocksdb: DB
§options: Options
Implementations§
Source§impl Database
impl Database
Sourcepub fn open_with_options(
path: impl AsRef<Path>,
options: Options,
) -> Result<Database>
pub fn open_with_options( path: impl AsRef<Path>, options: Options, ) -> Result<Database>
Open database with specific options.
pub fn save_meta( &self, key: impl AsRef<[u8]>, meta: &KeyMeta, delete_if_empty: bool, ) -> Result<()>
pub fn get_meta(&self, key: impl AsRef<[u8]>) -> Result<Option<KeyMeta>>
pub fn get_or_create_meta( &self, key: impl AsRef<[u8]>, key_type: KeyType, ) -> Result<KeyMeta>
pub fn for_each_key<F>(&self, f: F) -> Result<usize>
pub fn for_each_key_with_limit<F>(&self, limit: usize, f: F) -> Result<usize>
pub fn for_each_key_with_prefix<F>(&self, prefix: &str, f: F) -> Result<usize>
pub fn keys(&self) -> Result<Vec<(String, KeyMeta)>>
pub fn keys_with_prefix(&self, prefix: &str) -> Result<Vec<(String, KeyMeta)>>
pub fn for_each_data<F>( &self, key: &str, prefix: Option<&str>, f: F, ) -> Result<u64>
pub fn get_count(&self, key: impl AsRef<[u8]>) -> Result<u64>
pub fn delete_all(&self, key: &str) -> Result<u64>
pub fn map_count(&self, key: impl AsRef<[u8]>) -> Result<u64>
pub fn map_get( &self, key: impl AsRef<[u8]>, field: impl AsRef<[u8]>, ) -> Result<Option<Vec<u8>>>
pub fn map_put( &self, key: impl AsRef<[u8]>, field: impl AsRef<[u8]>, value: impl AsRef<[u8]>, ) -> Result<()>
pub fn map_delete( &self, key: impl AsRef<[u8]>, field: impl AsRef<[u8]>, ) -> Result<bool>
pub fn map_for_each<F>(&self, key: &str, f: F) -> Result<u64>
pub fn map_items(&self, key: &str) -> Result<Vec<(String, Box<[u8]>)>>
pub fn map_for_each_with_prefix<F>( &self, key: &str, prefix: &str, f: F, ) -> Result<u64>
pub fn map_items_with_prefix( &self, key: &str, prefix: &str, ) -> Result<Vec<(String, Box<[u8]>)>>
pub fn set_count(&self, key: &str) -> Result<u64>
pub fn set_add(&self, key: &str, value: &[u8]) -> Result<bool>
pub fn set_is_member(&self, key: &str, value: &[u8]) -> Result<bool>
pub fn set_delete(&self, key: &str, value: &[u8]) -> Result<bool>
pub fn set_for_each<F>(&self, key: &str, f: F) -> Result<u64>
pub fn set_items(&self, key: &str) -> Result<Vec<Box<[u8]>>>
pub fn list_count(&self, key: &str) -> Result<u64>
pub fn list_left_push(&self, key: &str, value: &[u8]) -> Result<u64>
pub fn list_right_push(&self, key: &str, value: &[u8]) -> Result<u64>
pub fn list_left_pop(&self, key: &str) -> Result<Option<Box<[u8]>>>
pub fn list_right_pop(&self, key: &str) -> Result<Option<Box<[u8]>>>
pub fn list_for_each<F>(&self, key: &str, f: F) -> Result<u64>
pub fn list_items(&self, key: &str) -> Result<Vec<Box<[u8]>>>
pub fn sorted_list_count(&self, key: &str) -> Result<u64>
pub fn sorted_list_add( &self, key: &str, score: &[u8], value: &[u8], ) -> Result<u64>
pub fn sorted_list_left_pop( &self, key: &str, max_score: Option<&[u8]>, ) -> Result<Option<ScoreVal>>
pub fn sorted_list_right_pop( &self, key: &str, min_score: Option<&[u8]>, ) -> Result<Option<ScoreVal>>
pub fn sorted_list_for_each<F>(&self, key: &str, f: F) -> Result<u64>
pub fn sorted_list_items(&self, key: &str) -> Result<VecScoreVal>
pub fn sorted_set_count(&self, key: &str) -> Result<u64>
pub fn sorted_set_for_each<F>(&self, key: &str, f: F) -> Result<u64>
pub fn sorted_set_items(&self, key: &str) -> Result<VecScoreVal>
pub fn sorted_set_add( &self, key: &str, score: &[u8], value: &[u8], ) -> Result<u64>
pub fn sorted_set_is_member(&self, key: &str, value: &[u8]) -> Result<bool>
pub fn sorted_set_delete(&self, key: &str, value: &[u8]) -> Result<bool>
pub fn sorted_set_left( &self, key: &str, max_score: Option<&[u8]>, limit: usize, ) -> Result<VecScoreVal>
pub fn sorted_set_right( &self, key: &str, min_score: Option<&[u8]>, limit: usize, ) -> Result<VecScoreVal>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Database
impl !RefUnwindSafe for Database
impl Unpin for Database
impl UnwindSafe for Database
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more