pub struct BackupService { /* private fields */ }Expand description
Backup service for managing workspace backups
Implementations§
Source§impl BackupService
impl BackupService
Sourcepub fn new(
db: Pool<Sqlite>,
local_backup_dir: Option<String>,
core_bridge: Arc<CoreBridge>,
workspace_service: Arc<WorkspaceService>,
) -> Self
pub fn new( db: Pool<Sqlite>, local_backup_dir: Option<String>, core_bridge: Arc<CoreBridge>, workspace_service: Arc<WorkspaceService>, ) -> Self
Create a new backup service
Sourcepub async fn backup_workspace(
&self,
workspace_id: Uuid,
user_id: Uuid,
storage_backend: StorageBackend,
format: Option<String>,
commit_id: Option<Uuid>,
) -> Result<WorkspaceBackup>
pub async fn backup_workspace( &self, workspace_id: Uuid, user_id: Uuid, storage_backend: StorageBackend, format: Option<String>, commit_id: Option<Uuid>, ) -> Result<WorkspaceBackup>
Create a backup of a workspace
Exports the workspace to the specified storage backend.
Supports local filesystem, Azure Blob Storage, and Google Cloud Storage.
For cloud storage, use backup_workspace_with_config to provide credentials.
§Errors
Returns an error if the workspace cannot be read or the storage backend fails.
Sourcepub async fn backup_workspace_with_config(
&self,
workspace_id: Uuid,
user_id: Uuid,
storage_backend: StorageBackend,
format: Option<String>,
commit_id: Option<Uuid>,
storage_config: Option<Value>,
) -> Result<WorkspaceBackup>
pub async fn backup_workspace_with_config( &self, workspace_id: Uuid, user_id: Uuid, storage_backend: StorageBackend, format: Option<String>, commit_id: Option<Uuid>, storage_config: Option<Value>, ) -> Result<WorkspaceBackup>
Create a backup of a workspace with storage configuration
Exports the workspace to the specified storage backend.
For Azure, storage_config should include:
account_name: Azure storage account name (required)container_name: Container name (defaults to “mockforge-backups”)account_keyorsas_token: Credentials (optional, usesDefaultAzureCredentialif not provided)
For GCS, storage_config should include:
bucket_name: GCS bucket name (defaults to “mockforge-backups”)
For local storage, storage_config is ignored.
§Errors
Returns an error if the workspace cannot be read, serialization fails, or the storage backend upload fails.
Sourcepub async fn restore_workspace(
&self,
backup_id: Uuid,
target_workspace_id: Option<Uuid>,
_user_id: Uuid,
) -> Result<Uuid>
pub async fn restore_workspace( &self, backup_id: Uuid, target_workspace_id: Option<Uuid>, _user_id: Uuid, ) -> Result<Uuid>
Restore a workspace from a backup
§Errors
Returns an error if the backup is not found, data deserialization fails, or the workspace cannot be restored.
Sourcepub async fn list_backups(
&self,
workspace_id: Uuid,
limit: Option<i32>,
) -> Result<Vec<WorkspaceBackup>>
pub async fn list_backups( &self, workspace_id: Uuid, limit: Option<i32>, ) -> Result<Vec<WorkspaceBackup>>
Sourcepub async fn get_backup(&self, backup_id: Uuid) -> Result<WorkspaceBackup>
pub async fn get_backup(&self, backup_id: Uuid) -> Result<WorkspaceBackup>
Auto Trait Implementations§
impl Freeze for BackupService
impl !RefUnwindSafe for BackupService
impl Send for BackupService
impl Sync for BackupService
impl Unpin for BackupService
impl UnsafeUnpin for BackupService
impl !UnwindSafe for BackupService
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
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>
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>
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