pub struct StorageManager { /* private fields */ }Expand description
Manages collections and persistence
Implementations§
Source§impl StorageManager
impl StorageManager
pub fn new<P: AsRef<Path>>(data_dir: P) -> Result<Self>
pub fn create_collection( &self, config: CollectionConfig, ) -> Result<Arc<Collection>>
pub fn get_collection(&self, name: &str) -> Option<Arc<Collection>>
pub fn delete_collection(&self, name: &str) -> Result<bool>
pub fn list_collections(&self) -> Vec<String>
pub fn collection_exists(&self, name: &str) -> bool
Sourcepub fn create_alias(
&self,
alias_name: &str,
collection_name: &str,
) -> Result<bool>
pub fn create_alias( &self, alias_name: &str, collection_name: &str, ) -> Result<bool>
Create an alias for a collection
Sourcepub fn delete_alias(&self, alias_name: &str) -> Result<bool>
pub fn delete_alias(&self, alias_name: &str) -> Result<bool>
Delete an alias
Sourcepub fn list_aliases(&self) -> Vec<(String, String)>
pub fn list_aliases(&self) -> Vec<(String, String)>
List all aliases
Sourcepub fn list_collection_aliases(&self, collection_name: &str) -> Vec<String>
pub fn list_collection_aliases(&self, collection_name: &str) -> Vec<String>
List aliases for a specific collection
pub fn data_dir(&self) -> &Path
Sourcepub fn last_save_time(&self) -> u64
pub fn last_save_time(&self) -> u64
Get last save time
Sourcepub fn is_bgsave_in_progress(&self) -> bool
pub fn is_bgsave_in_progress(&self) -> bool
Check if background save is in progress
Sourcepub fn create_collection_snapshot(
&self,
collection_name: &str,
) -> Result<SnapshotDescription>
pub fn create_collection_snapshot( &self, collection_name: &str, ) -> Result<SnapshotDescription>
Create a snapshot for a collection
Sourcepub fn list_collection_snapshots(
&self,
collection_name: &str,
) -> Result<Vec<SnapshotDescription>>
pub fn list_collection_snapshots( &self, collection_name: &str, ) -> Result<Vec<SnapshotDescription>>
List snapshots for a collection
Sourcepub fn delete_collection_snapshot(
&self,
collection_name: &str,
snapshot_name: &str,
) -> Result<bool>
pub fn delete_collection_snapshot( &self, collection_name: &str, snapshot_name: &str, ) -> Result<bool>
Delete a snapshot
Sourcepub fn get_snapshot_path(
&self,
collection_name: &str,
snapshot_name: &str,
) -> Option<PathBuf>
pub fn get_snapshot_path( &self, collection_name: &str, snapshot_name: &str, ) -> Option<PathBuf>
Get snapshot file path for download
Sourcepub fn recover_from_snapshot(
&self,
collection_name: &str,
snapshot_name: &str,
) -> Result<Arc<Collection>>
pub fn recover_from_snapshot( &self, collection_name: &str, snapshot_name: &str, ) -> Result<Arc<Collection>>
Recover collection from a snapshot file
Sourcepub async fn recover_from_url(
&self,
collection_name: &str,
url: &str,
checksum: Option<&str>,
) -> Result<Arc<Collection>>
pub async fn recover_from_url( &self, collection_name: &str, url: &str, checksum: Option<&str>, ) -> Result<Arc<Collection>>
Recover collection from a URL
Sourcepub fn list_all_snapshots(&self) -> Result<Vec<SnapshotDescription>>
pub fn list_all_snapshots(&self) -> Result<Vec<SnapshotDescription>>
List all snapshots
Sourcepub fn upload_and_restore_snapshot(
&self,
collection_name: &str,
data: &[u8],
filename: Option<&str>,
) -> Result<Arc<Collection>>
pub fn upload_and_restore_snapshot( &self, collection_name: &str, data: &[u8], filename: Option<&str>, ) -> Result<Arc<Collection>>
Upload and restore a snapshot from raw bytes
Auto Trait Implementations§
impl Freeze for StorageManager
impl !RefUnwindSafe for StorageManager
impl Send for StorageManager
impl Sync for StorageManager
impl Unpin for StorageManager
impl !UnwindSafe for StorageManager
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> 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