feat(storage): add a guide on storage
This commit is contained in:
@@ -11,7 +11,6 @@ pub mod dedup_service;
|
||||
pub mod drives_consistency_service;
|
||||
pub mod encrypted_blob_backend;
|
||||
pub mod entry_backend;
|
||||
pub mod swappable_blob_backend;
|
||||
pub mod exif_service;
|
||||
pub mod face_geometry;
|
||||
pub mod face_indexing_service;
|
||||
@@ -47,6 +46,7 @@ pub mod search_index;
|
||||
pub mod share_unlock_cookie;
|
||||
pub mod smtp_email_sender;
|
||||
pub mod storage_migration_service;
|
||||
pub mod swappable_blob_backend;
|
||||
pub mod thumbnail_service;
|
||||
#[cfg(test)]
|
||||
mod thumbnail_service_test;
|
||||
|
||||
@@ -421,10 +421,7 @@ impl BlobStorageBackend for S3BlobBackend {
|
||||
Ok(StorageHealthStatus {
|
||||
connected: false,
|
||||
backend_type: "s3".to_string(),
|
||||
message: format!(
|
||||
"S3 bucket '{}' is not accessible: {detail}",
|
||||
self.bucket
|
||||
),
|
||||
message: format!("S3 bucket '{}' is not accessible: {detail}", self.bucket),
|
||||
available_bytes: None,
|
||||
})
|
||||
}
|
||||
@@ -595,7 +592,10 @@ where
|
||||
}
|
||||
SdkError::TimeoutError(_) => "timeout".to_string(),
|
||||
SdkError::ResponseError(r) => {
|
||||
format!("malformed response (HTTP {}): {r:?}", r.raw().status().as_u16())
|
||||
format!(
|
||||
"malformed response (HTTP {}): {r:?}",
|
||||
r.raw().status().as_u16()
|
||||
)
|
||||
}
|
||||
SdkError::ConstructionFailure(c) => format!("request construction failed: {c:?}"),
|
||||
_ => format!("unknown SDK error: {err:?}"),
|
||||
|
||||
@@ -119,9 +119,8 @@ pub struct StorageMigrationService {
|
||||
/// restart. Shared with `CoreServices.blob_backend_hot_swap` —
|
||||
/// same instance the coerced `blob_backend: Arc<dyn ...>`
|
||||
/// delegates through.
|
||||
blob_backend_hot_swap: Arc<
|
||||
crate::infrastructure::services::swappable_blob_backend::SwappableBlobBackend,
|
||||
>,
|
||||
blob_backend_hot_swap:
|
||||
Arc<crate::infrastructure::services::swappable_blob_backend::SwappableBlobBackend>,
|
||||
}
|
||||
|
||||
impl StorageMigrationService {
|
||||
@@ -700,8 +699,9 @@ impl StorageMigrationService {
|
||||
// 4. Drop read-only. In this order (after swap) so no write
|
||||
// slips through against the OLD backend between "readonly
|
||||
// off" and "backend swapped".
|
||||
let readonly_persisted =
|
||||
persist_migration_readonly(self.pool.as_ref(), false).await.is_ok();
|
||||
let readonly_persisted = persist_migration_readonly(self.pool.as_ref(), false)
|
||||
.await
|
||||
.is_ok();
|
||||
self.migration_readonly.store(false, Ordering::Relaxed);
|
||||
|
||||
if !readonly_persisted {
|
||||
|
||||
@@ -126,11 +126,7 @@ impl BlobStorageBackend for SwappableBlobBackend {
|
||||
Box::pin(async move { inner.put_blob(&hash, &source_path).await })
|
||||
}
|
||||
|
||||
fn put_blob_from_bytes(
|
||||
&self,
|
||||
hash: &str,
|
||||
data: Bytes,
|
||||
) -> BoxFut<'_, Result<u64, DomainError>> {
|
||||
fn put_blob_from_bytes(&self, hash: &str, data: Bytes) -> BoxFut<'_, Result<u64, DomainError>> {
|
||||
let inner = self.current();
|
||||
let hash = hash.to_owned();
|
||||
Box::pin(async move { inner.put_blob_from_bytes(&hash, data).await })
|
||||
@@ -222,4 +218,3 @@ impl BlobStorageBackend for SwappableBlobBackend {
|
||||
Box::pin(async move { inner.list_blob_hashes(cursor, limit).await })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user