mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
refactor: File upload (#5542)
* chore: rename service * refactor: upload * chore: save upload meta data * chore: add sql test * chore: uploader * chore: fix upload * chore: cache file and remove after finish * chore: retry upload * chore: pause when netowork unreachable * chore: add event test * chore: add test * chore: clippy * chore: update client-api commit id * chore: fix flutter test
This commit is contained in:
@ -5,7 +5,7 @@ use tracing_subscriber::util::SubscriberInitExt;
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
mod af_cloud_test;
|
||||
mod supabase_test;
|
||||
// mod supabase_test;
|
||||
|
||||
pub fn setup_log() {
|
||||
static START: Once = Once::new();
|
||||
|
@ -1,4 +1,3 @@
|
||||
use flowy_storage::ObjectStorageService;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
@ -16,10 +15,8 @@ use flowy_server::supabase::api::{
|
||||
SupabaseFolderServiceImpl, SupabaseServerServiceImpl, SupabaseUserServiceImpl,
|
||||
};
|
||||
use flowy_server::supabase::define::{USER_DEVICE_ID, USER_EMAIL, USER_UUID};
|
||||
use flowy_server::supabase::file_storage::core::SupabaseFileStorage;
|
||||
use flowy_server::{AppFlowyEncryption, EncryptionImpl};
|
||||
use flowy_server_pub::supabase_config::SupabaseConfiguration;
|
||||
use flowy_storage::{FileStoragePlan, StorageObject};
|
||||
use flowy_user_pub::cloud::UserCloudService;
|
||||
use lib_infra::future::FutureResult;
|
||||
|
||||
@ -63,7 +60,7 @@ pub fn folder_service() -> Arc<dyn FolderCloudService> {
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn file_storage_service() -> Arc<dyn ObjectStorageService> {
|
||||
pub fn file_storage_service() -> Arc<dyn ObjectStorageCloudService> {
|
||||
let encryption_impl: Arc<dyn AppFlowyEncryption> = Arc::new(EncryptionImpl::new(None));
|
||||
let config = SupabaseConfiguration::from_env().unwrap();
|
||||
Arc::new(
|
||||
@ -163,19 +160,3 @@ pub fn third_party_sign_up_param(uuid: String) -> HashMap<String, String> {
|
||||
}
|
||||
|
||||
pub struct TestFileStoragePlan;
|
||||
|
||||
impl FileStoragePlan for TestFileStoragePlan {
|
||||
fn storage_size(&self) -> FutureResult<u64, FlowyError> {
|
||||
// 1 GB
|
||||
FutureResult::new(async { Ok(1024 * 1024 * 1024) })
|
||||
}
|
||||
|
||||
fn maximum_file_size(&self) -> FutureResult<u64, FlowyError> {
|
||||
// 5 MB
|
||||
FutureResult::new(async { Ok(5 * 1024 * 1024) })
|
||||
}
|
||||
|
||||
fn check_upload_object(&self, _object: &StorageObject) -> FutureResult<(), FlowyError> {
|
||||
FutureResult::new(async { Ok(()) })
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user