pub struct PersistentStorage { /* private fields */ }Expand description
RocksDB-based persistent storage
Implementations§
Source§impl PersistentStorage
impl PersistentStorage
Sourcepub fn open(path: impl AsRef<Path>) -> Result<PersistentStorage, StorageError>
pub fn open(path: impl AsRef<Path>) -> Result<PersistentStorage, StorageError>
Open or create a new persistent storage
Sourcepub fn get_node(
&self,
tenant: &str,
node_id: u64,
) -> Result<Option<Node>, StorageError>
pub fn get_node( &self, tenant: &str, node_id: u64, ) -> Result<Option<Node>, StorageError>
Get a node
Sourcepub fn get_edge(
&self,
tenant: &str,
edge_id: u64,
) -> Result<Option<Edge>, StorageError>
pub fn get_edge( &self, tenant: &str, edge_id: u64, ) -> Result<Option<Edge>, StorageError>
Get an edge
Sourcepub fn delete_node(
&self,
tenant: &str,
node_id: u64,
) -> Result<(), StorageError>
pub fn delete_node( &self, tenant: &str, node_id: u64, ) -> Result<(), StorageError>
Delete a node
Sourcepub fn delete_edge(
&self,
tenant: &str,
edge_id: u64,
) -> Result<(), StorageError>
pub fn delete_edge( &self, tenant: &str, edge_id: u64, ) -> Result<(), StorageError>
Delete an edge
Sourcepub fn create_snapshot(
&self,
) -> SnapshotWithThreadMode<'_, DBCommon<SingleThreaded, DBWithThreadModeInner>>
pub fn create_snapshot( &self, ) -> SnapshotWithThreadMode<'_, DBCommon<SingleThreaded, DBWithThreadModeInner>>
Create a snapshot
Sourcepub fn flush(&self) -> Result<(), StorageError>
pub fn flush(&self) -> Result<(), StorageError>
Flush all data to disk
Sourcepub fn scan_nodes(&self, tenant: &str) -> Result<Vec<Node>, StorageError>
pub fn scan_nodes(&self, tenant: &str) -> Result<Vec<Node>, StorageError>
Get all nodes for a tenant (for recovery)
Sourcepub fn scan_edges(&self, tenant: &str) -> Result<Vec<Edge>, StorageError>
pub fn scan_edges(&self, tenant: &str) -> Result<Vec<Edge>, StorageError>
Get all edges for a tenant (for recovery)
Sourcepub fn list_persisted_tenants(&self) -> Result<Vec<String>, StorageError>
pub fn list_persisted_tenants(&self) -> Result<Vec<String>, StorageError>
List all tenants that have persisted data
Auto Trait Implementations§
impl Freeze for PersistentStorage
impl RefUnwindSafe for PersistentStorage
impl Send for PersistentStorage
impl Sync for PersistentStorage
impl Unpin for PersistentStorage
impl UnsafeUnpin for PersistentStorage
impl UnwindSafe for PersistentStorage
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more