Extract protobuf structs from flowy-sync crate (#1425)

* refactor: extract data model from flowy-sync crate

* chore: rename lib-infra features
This commit is contained in:
Nathan.fooo
2022-11-08 21:13:28 +08:00
committed by GitHub
parent 7f6ad504fd
commit 882d5535e6
85 changed files with 270 additions and 344 deletions

View File

@ -8,6 +8,7 @@ edition = "2018"
[dependencies]
folder-rev-model = { path = "../../../shared-lib/folder-rev-model" }
flowy-sync = { path = "../../../shared-lib/flowy-sync" }
flowy-http-model = { path = "../../../shared-lib/flowy-http-model" }
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
lib-ot = { path = "../../../shared-lib/lib-ot" }
lib-infra = { path = "../../../shared-lib/lib-infra" }
@ -41,7 +42,7 @@ flowy-folder = { path = "../flowy-folder", features = ["flowy_unit_test"]}
flowy-test = { path = "../flowy-test" }
[build-dependencies]
lib-infra = { path = "../../../shared-lib/lib-infra", features = ["protobuf_file_gen", "proto_gen"] }
lib-infra = { path = "../../../shared-lib/lib-infra", features = [ "proto_gen"] }
[features]
default = []

View File

@ -18,12 +18,13 @@ use flowy_revision::{
RevisionManager, RevisionPersistence, RevisionPersistenceConfiguration, RevisionWebSocket,
SQLiteRevisionSnapshotPersistence,
};
use flowy_sync::{client_folder::FolderPad, entities::ws_data::ServerRevisionWSData};
use folder_rev_model::user_default;
use lazy_static::lazy_static;
use lib_infra::future::FutureResult;
use crate::services::persistence::rev_sqlite::SQLiteFolderRevisionPersistence;
use flowy_http_model::ws_data::ServerRevisionWSData;
use flowy_sync::client_folder::FolderPad;
use std::{collections::HashMap, convert::TryInto, fmt::Formatter, sync::Arc};
use tokio::sync::RwLock as TokioRwLock;
lazy_static! {

View File

@ -1,18 +1,16 @@
use crate::manager::FolderId;
use bytes::Bytes;
use flowy_database::ConnectionPool;
use flowy_error::{FlowyError, FlowyResult};
use flowy_http_model::revision::Revision;
use flowy_http_model::ws_data::ServerRevisionWSData;
use flowy_revision::{
RevisionCloudService, RevisionManager, RevisionMergeable, RevisionObjectDeserializer, RevisionObjectSerializer,
RevisionWebSocket,
};
use flowy_sync::client_folder::{FolderChangeset, FolderPad};
use flowy_sync::util::make_operations_from_revisions;
use flowy_sync::{
client_folder::{FolderChangeset, FolderPad},
entities::{revision::Revision, ws_data::ServerRevisionWSData},
};
use lib_infra::future::FutureResult;
use flowy_database::ConnectionPool;
use lib_ot::core::EmptyAttributes;
use parking_lot::RwLock;
use std::sync::Arc;

View File

@ -6,15 +6,15 @@ use crate::{
use bytes::Bytes;
use flowy_database::kv::KV;
use flowy_error::{FlowyError, FlowyResult};
use flowy_http_model::revision::Revision;
use flowy_revision::reset::{RevisionResettable, RevisionStructReset};
use flowy_sync::client_folder::make_folder_rev_json_str;
use flowy_sync::client_folder::FolderPad;
use flowy_sync::entities::revision::Revision;
use flowy_sync::server_folder::FolderOperationsBuilder;
use folder_rev_model::{AppRevision, FolderRevision, ViewRevision, WorkspaceRevision};
use crate::services::persistence::rev_sqlite::SQLiteFolderRevisionPersistence;
use flowy_sync::util::md5;
use flowy_http_model::util::md5;
use std::sync::Arc;
const V1_MIGRATION: &str = "FOLDER_V1_MIGRATION";

View File

@ -10,8 +10,9 @@ use crate::{
};
use flowy_database::ConnectionPool;
use flowy_error::{FlowyError, FlowyResult};
use flowy_http_model::revision::Revision;
use flowy_revision::disk::{RevisionDiskCache, RevisionState, SyncRecord};
use flowy_sync::{client_folder::FolderPad, entities::revision::Revision};
use flowy_sync::client_folder::FolderPad;
use folder_rev_model::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision};
use crate::services::persistence::rev_sqlite::SQLiteFolderRevisionPersistence;

View File

@ -7,12 +7,9 @@ use flowy_database::{
ConnectionPool,
};
use flowy_error::{internal_error, FlowyError, FlowyResult};
use flowy_http_model::revision::{Revision, RevisionRange};
use flowy_http_model::util::md5;
use flowy_revision::disk::{RevisionChangeset, RevisionDiskCache, RevisionState, SyncRecord};
use flowy_sync::{
entities::revision::{Revision, RevisionRange},
util::md5,
};
use std::sync::Arc;
pub struct SQLiteFolderRevisionPersistence {

View File

@ -16,7 +16,7 @@ use crate::{
};
use bytes::Bytes;
use flowy_database::kv::KV;
use flowy_sync::entities::document::DocumentIdPB;
use flowy_http_model::document::DocumentIdPB;
use folder_rev_model::{gen_view_id, ViewRevision};
use futures::{FutureExt, StreamExt};
use std::{collections::HashSet, sync::Arc};

View File

@ -2,17 +2,12 @@ use crate::services::FOLDER_SYNC_INTERVAL_IN_MILLIS;
use bytes::Bytes;
use flowy_database::ConnectionPool;
use flowy_error::{FlowyError, FlowyResult};
use flowy_http_model::revision::{Revision, RevisionRange};
use flowy_http_model::ws_data::{ClientRevisionWSData, NewDocumentUser, ServerRevisionWSDataType};
use flowy_revision::*;
use flowy_sync::entities::revision::Revision;
use flowy_sync::client_folder::FolderPad;
use flowy_sync::server_folder::FolderOperations;
use flowy_sync::util::make_operations_from_revisions;
use flowy_sync::{
client_folder::FolderPad,
entities::{
revision::RevisionRange,
ws_data::{ClientRevisionWSData, NewDocumentUser, ServerRevisionWSDataType},
},
};
use lib_infra::future::{BoxResultFuture, FutureResult};
use lib_ot::core::OperationTransform;
use parking_lot::RwLock;

View File

@ -16,9 +16,9 @@ use flowy_folder::entities::{
use flowy_folder::event_map::FolderEvent::*;
use flowy_folder::{errors::ErrorCode, services::folder_editor::FolderEditor};
use flowy_http_model::document::DocumentPayloadPB;
use flowy_revision::disk::RevisionState;
use flowy_revision::REVISION_WRITE_INTERVAL_IN_MILLIS;
use flowy_sync::entities::document::DocumentPayloadPB;
use flowy_test::{event_builder::*, FlowySDKTest};
use std::{sync::Arc, time::Duration};
use tokio::time::sleep;