chore: remove unuse crates

This commit is contained in:
appflowy
2022-03-19 16:23:34 +08:00
parent 27628cc78e
commit b1d87d95cf
26 changed files with 71 additions and 191 deletions

View File

@ -84,17 +84,6 @@ dependencies = [
"syn",
]
[[package]]
name = "async-trait"
version = "0.1.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "061a7acccaa286c011ddc30970520b98fa40e00c9d644633fb26b5fc63a265e3"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "atomic"
version = "0.5.1"
@ -464,20 +453,6 @@ dependencies = [
"itertools",
]
[[package]]
name = "crossbeam"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845"
dependencies = [
"cfg-if",
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-epoch",
"crossbeam-queue",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.2"
@ -512,16 +487,6 @@ dependencies = [
"scopeguard",
]
[[package]]
name = "crossbeam-queue"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b979d76c9fcb84dffc80a73f7290da0f83e4c95773494674cb44b76d13a7a110"
dependencies = [
"cfg-if",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.6"
@ -858,9 +823,6 @@ name = "flowy-block"
version = "0.1.0"
dependencies = [
"async-stream",
"async-trait",
"bytecount",
"byteorder",
"bytes",
"chrono",
"color-eyre",
@ -884,8 +846,6 @@ dependencies = [
"lib-ot",
"lib-ws",
"log",
"parking_lot",
"pin-project",
"protobuf",
"rand 0.7.3",
"serde",
@ -986,14 +946,8 @@ dependencies = [
name = "flowy-folder"
version = "0.1.0"
dependencies = [
"bincode",
"bytes",
"chrono",
"crossbeam",
"crossbeam-utils",
"dart-notify",
"dashmap",
"derive_more",
"diesel",
"diesel_derives",
"flowy-block",
@ -1006,19 +960,16 @@ dependencies = [
"flowy-sync",
"flowy-test",
"futures",
"futures-core",
"lazy_static",
"lib-dispatch",
"lib-infra",
"lib-ot",
"lib-sqlite",
"log",
"parking_lot",
"pin-project",
"protobuf",
"serde",
"serde_json",
"serial_test",
"strum",
"strum_macros",
"tokio",
@ -1067,8 +1018,6 @@ dependencies = [
"lib-dispatch",
"lib-infra",
"lib-ot",
"lib-sqlite",
"parking_lot",
"protobuf",
"rayon",
"rust_decimal",
@ -1171,7 +1120,6 @@ name = "flowy-sync"
version = "0.1.0"
dependencies = [
"async-stream",
"async-trait",
"bytes",
"dashmap",
"diesel",
@ -1183,10 +1131,7 @@ dependencies = [
"lib-infra",
"lib-ot",
"lib-ws",
"parking_lot",
"protobuf",
"serde",
"serde_json",
"strum",
"strum_macros",
"tokio",
@ -1229,8 +1174,6 @@ version = "0.1.0"
dependencies = [
"bytes",
"dart-notify",
"dashmap",
"derive_more",
"diesel",
"diesel_derives",
"flowy-database",
@ -1239,24 +1182,17 @@ dependencies = [
"flowy-test",
"flowy-user-data-model",
"futures",
"futures-core",
"lazy_static",
"lib-dispatch",
"lib-infra",
"lib-sqlite",
"log",
"once_cell",
"parking_lot",
"pin-project",
"protobuf",
"r2d2",
"serde",
"serde_json",
"serial_test",
"strum",
"strum_macros",
"thread-id",
"thread_local",
"tokio",
"tracing",
]

View File

@ -18,4 +18,15 @@ members = [
]
[profile.dev]
opt-level = 0
#https://doc.rust-lang.org/rustc/codegen-options/index.html#debug-assertions
split-debuginfo = "unpacked"
[profile.release]
opt-level = 3
## debuginfoit makes ./target much bigger, which again harms caching. Depending on your preferred workflow,
## you might consider disabling debuginfo unconditionally, this brings some benefits for local builds as well.
#strip = "debuginfo"
## For from-scratch builds, incremental adds an extra dependency-tracking overhead. It also significantly increases
## the amount of IO and the size of ./target, which make caching less effective.
incremental = false

View File

@ -13,7 +13,6 @@ lib-ot = { path = "../../../shared-lib/lib-ot" }
lib-ws = { path = "../../../shared-lib/lib-ws" }
lib-infra = { path = "../../../shared-lib/lib-infra" }
derive_more = {version = "0.99", features = ["display"]}
lib-dispatch = { path = "../lib-dispatch" }
flowy-database = { path = "../flowy-database" }
flowy-sync = { path = "../flowy-sync" }
@ -31,22 +30,18 @@ bytes = { version = "1.1" }
strum = "0.21"
strum_macros = "0.21"
dashmap = "4.0"
parking_lot = "0.11"
bytecount = "0.6.0"
url = "2.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = {version = "1.0"}
chrono = "0.4.19"
futures-util = "0.3.15"
byteorder = {version = "1.3.4"}
async-stream = "0.3.2"
async-trait = "0.1.52"
futures = "0.3.15"
pin-project = "1.0.0"
[dev-dependencies]
flowy-test = { path = "../flowy-test" }
flowy-block = { path = "../flowy-block", features = ["flowy_unit_test"]}
derive_more = {version = "0.99", features = ["display"]}
color-eyre = { version = "0.5", default-features = false }
criterion = "0.3"

View File

@ -4,7 +4,6 @@ mod op_test;
mod serde_test;
mod undo_redo_test;
use derive_more::Display;
use flowy_collaboration::client_document::{ClientDocument, InitialDocumentText};
use lib_ot::{
core::*,

View File

@ -17,7 +17,6 @@ flowy-database = { path = "../flowy-database" }
flowy-error = { path = "../flowy-error", features = ["db", "http_server"]}
dart-notify = { path = "../dart-notify" }
lib-dispatch = { path = "../lib-dispatch" }
lib-sqlite = { path = "../lib-sqlite" }
flowy-sync = { path = "../flowy-sync" }
parking_lot = "0.11"
@ -25,9 +24,6 @@ protobuf = {version = "2.18.0"}
log = "0.4.14"
diesel = {version = "1.4.8", features = ["sqlite"]}
diesel_derives = {version = "1.4.1", features = ["sqlite"]}
#diesel = { git = "https://github.com/diesel-rs/diesel.git", branch = "master", features = ["sqlite"] }
#diesel_derives = { git = "https://github.com/diesel-rs/diesel.git", branch = "master",features = ["sqlite"] }
futures-core = { version = "0.3", default-features = false }
futures = "0.3.15"
pin-project = "1.0.0"
strum = "0.21"
@ -35,17 +31,10 @@ strum_macros = "0.21"
tokio = { version = "1", features = ["rt"] }
lazy_static = "1.4.0"
serde = { version = "1.0", features = ["derive"] }
derive_more = {version = "0.99", features = ["display"]}
bincode = { version = "1.3"}
tracing = { version = "0.1", features = ["log"] }
bytes = { version = "1.0" }
crossbeam = "0.8"
crossbeam-utils = "0.8"
chrono = "0.4"
dashmap = "4.0"
[dev-dependencies]
serial_test = "0.5.1"
serde_json = "1.0"
flowy-folder = { path = "../flowy-folder", features = ["flowy_unit_test"]}
flowy-test = { path = "../flowy-test" }

View File

@ -9,14 +9,12 @@ use crate::{
manager::FolderManager,
services::{app::event_handler::*, trash::event_handler::*, view::event_handler::*, workspace::event_handler::*},
};
use flowy_database::DBConnection;
use flowy_database::{ConnectionPool, DBConnection};
use flowy_derive::{Flowy_Event, ProtoBuf_Enum};
use strum_macros::Display;
use lib_dispatch::prelude::*;
use lib_infra::future::FutureResult;
use lib_sqlite::ConnectionPool;
use std::sync::Arc;
use strum_macros::Display;
pub trait WorkspaceDeps: WorkspaceUser + WorkspaceDatabase {}

View File

@ -9,8 +9,6 @@ use crate::{
},
};
use bytes::Bytes;
use chrono::Utc;
use flowy_collaboration::client_document::default::{initial_quill_delta_string, initial_read_me};
use flowy_collaboration::{client_folder::FolderPad, entities::ws_data::ServerRevisionWSData};
@ -202,8 +200,7 @@ impl DefaultFolderBuilder {
view_controller: Arc<ViewController>,
) -> FlowyResult<()> {
log::debug!("Create user default workspace");
let time = Utc::now();
let workspace = user_default::create_default_workspace(time);
let workspace = user_default::create_default_workspace();
set_current_workspace(&workspace.id);
for app in workspace.apps.iter() {
for (index, view) in app.belongings.iter().enumerate() {

View File

@ -9,6 +9,7 @@ use crate::{
};
use flowy_collaboration::client_folder::initial_folder_delta;
use flowy_collaboration::{client_folder::FolderPad, entities::revision::Revision};
use flowy_database::ConnectionPool;
use flowy_error::{FlowyError, FlowyResult};
use flowy_folder_data_model::entities::{
app::App,
@ -18,7 +19,6 @@ use flowy_folder_data_model::entities::{
};
use flowy_sync::disk::{RevisionRecord, RevisionState};
use flowy_sync::mk_revision_disk_cache;
use lib_sqlite::ConnectionPool;
use std::sync::Arc;
use tokio::sync::RwLock;
pub use version_1::{app_sql::*, trash_sql::*, v1_impl::V1Transaction, view_sql::*, workspace_sql::*};

View File

@ -1,18 +1,14 @@
use crate::entities::{
app::{App, ColorStyle, UpdateAppParams},
app::{App, UpdateAppParams},
trash::{Trash, TrashType},
view::RepeatedView,
};
use diesel::sql_types::Binary;
use crate::{errors::FlowyError, services::persistence::version_1::workspace_sql::WorkspaceTable};
use flowy_database::{
prelude::*,
schema::{app_table, app_table::dsl},
SqliteConnection,
};
use serde::{Deserialize, Serialize, __private::TryFrom};
use std::convert::TryInto;
use crate::{errors::FlowyError, services::persistence::version_1::workspace_sql::WorkspaceTable};
pub struct AppTableSql();
impl AppTableSql {
@ -86,7 +82,7 @@ pub(crate) struct AppTable {
pub workspace_id: String, // equal to #[belongs_to(Workspace, foreign_key = "workspace_id")].
pub name: String,
pub desc: String,
pub color_style: ColorStyleCol,
pub color_style: Vec<u8>,
pub last_view_id: Option<String>,
pub modified_time: i64,
pub create_time: i64,
@ -101,7 +97,7 @@ impl AppTable {
workspace_id: app.workspace_id,
name: app.name,
desc: app.desc,
color_style: ColorStyleCol::default(),
color_style: Default::default(),
last_view_id: None,
modified_time: app.modified_time,
create_time: app.create_time,
@ -123,38 +119,6 @@ impl std::convert::From<AppTable> for Trash {
}
}
#[derive(Clone, PartialEq, Serialize, Deserialize, Debug, Default, FromSqlRow, AsExpression)]
#[sql_type = "Binary"]
pub(crate) struct ColorStyleCol {
pub(crate) theme_color: String,
}
impl std::convert::From<ColorStyle> for ColorStyleCol {
fn from(s: ColorStyle) -> Self {
Self {
theme_color: s.theme_color,
}
}
}
impl std::convert::TryInto<Vec<u8>> for &ColorStyleCol {
type Error = String;
fn try_into(self) -> Result<Vec<u8>, Self::Error> {
bincode::serialize(self).map_err(|e| format!("{:?}", e))
}
}
impl std::convert::TryFrom<&[u8]> for ColorStyleCol {
type Error = String;
fn try_from(value: &[u8]) -> Result<Self, Self::Error> {
bincode::deserialize(value).map_err(|e| format!("{:?}", e))
}
}
impl_sql_binary_expression!(ColorStyleCol);
#[derive(AsChangeset, Identifiable, Default, Debug)]
#[table_name = "app_table"]
pub struct AppChangeset {

View File

@ -6,6 +6,7 @@ use crate::services::persistence::{
},
FolderPersistenceTransaction, TrashTableSql,
};
use flowy_database::DBConnection;
use flowy_error::FlowyResult;
use flowy_folder_data_model::entities::{
app::App,
@ -13,7 +14,6 @@ use flowy_folder_data_model::entities::{
view::View,
workspace::Workspace,
};
use lib_sqlite::DBConnection;
pub struct V1Transaction<'a>(pub &'a DBConnection);

View File

@ -8,7 +8,6 @@ edition = "2021"
[dependencies]
lib-dispatch = { path = "../lib-dispatch" }
dart-notify = { path = "../dart-notify" }
lib-sqlite = { path = "../lib-sqlite" }
flowy-sync = { path = "../flowy-sync" }
flowy-error = { path = "../flowy-error", features = ["db"]}
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
@ -32,7 +31,6 @@ diesel = {version = "1.4.8", features = ["sqlite"]}
dashmap = "4.0"
tokio = {version = "1", features = ["sync"]}
rayon = "1.5"
parking_lot = "0.11"
serde = { version = "1.0", features = ["derive"] }
serde_json = {version = "1.0"}

View File

@ -4,13 +4,13 @@ use bytes::Bytes;
use dashmap::DashMap;
use flowy_collaboration::client_grid::{make_block_meta_delta, make_grid_delta};
use flowy_collaboration::entities::revision::{RepeatedRevision, Revision};
use flowy_database::ConnectionPool;
use flowy_error::{FlowyError, FlowyResult};
use flowy_grid_data_model::entities::{BuildGridContext, GridMeta};
use flowy_sync::disk::{SQLiteGridBlockMetaRevisionPersistence, SQLiteGridRevisionPersistence};
use flowy_sync::{RevisionManager, RevisionPersistence, RevisionWebSocket};
use lib_sqlite::ConnectionPool;
use parking_lot::RwLock;
use std::sync::Arc;
use tokio::sync::RwLock;
pub trait GridUser: Send + Sync {
fn user_id(&self) -> Result<String, FlowyError>;
@ -137,8 +137,8 @@ impl GridManager {
}
#[allow(dead_code)]
fn get_kv_persistence(&self) -> FlowyResult<Arc<GridKVPersistence>> {
let read_guard = self.kv_persistence.read();
async fn get_kv_persistence(&self) -> FlowyResult<Arc<GridKVPersistence>> {
let read_guard = self.kv_persistence.read().await;
if read_guard.is_some() {
return Ok(read_guard.clone().unwrap());
}
@ -146,7 +146,7 @@ impl GridManager {
let pool = self.grid_user.db_pool()?;
let kv_persistence = Arc::new(GridKVPersistence::new(pool));
*self.kv_persistence.write() = Some(kv_persistence.clone());
*self.kv_persistence.write().await = Some(kv_persistence.clone());
Ok(kv_persistence)
}
}

View File

@ -4,9 +4,9 @@ use diesel::SqliteConnection;
use flowy_database::{
prelude::*,
schema::{kv_table, kv_table::dsl},
ConnectionPool,
};
use flowy_error::{FlowyError, FlowyResult};
use lib_sqlite::ConnectionPool;
use std::sync::Arc;
#[derive(PartialEq, Clone, Debug, Queryable, Identifiable, Insertable, Associations)]

View File

@ -14,19 +14,15 @@ flowy-database = { path = "../flowy-database" }
flowy-error = { path = "../flowy-error", features = ["collaboration", "ot", "http_server", "serde", "db"] }
diesel = {version = "1.4.8", features = ["sqlite"]}
diesel_derives = {version = "1.4.1", features = ["sqlite"]}
protobuf = {version = "2.18.0"}
tracing = { version = "0.1", features = ["log"] }
tokio = {version = "1", features = ["sync"]}
bytes = { version = "1.1" }
strum = "0.21"
strum_macros = "0.21"
dashmap = "4.0"
parking_lot = "0.11"
serde = { version = "1.0", features = ["derive"] }
serde_json = {version = "1.0"}
futures-util = "0.3.15"
async-stream = "0.3.2"
async-trait = "0.1.52"
[features]
flowy_unit_test = ["lib-ot/flowy_unit_test"]

View File

@ -8,14 +8,12 @@ edition = "2018"
[dependencies]
flowy-user-data-model = { path = "../../../shared-lib/flowy-user-data-model" }
flowy-derive = { path = "../../../shared-lib/flowy-derive" }
lib-infra = { path = "../../../shared-lib/lib-infra" }
derive_more = {version = "0.99", features = ["display"]}
flowy-database = { path = "../flowy-database" }
flowy-error = { path = "../flowy-error", features = ["db", "http_server"] }
lib-infra = { path = "../../../shared-lib/lib-infra" }
dart-notify = { path = "../dart-notify" }
lib-dispatch = { path = "../lib-dispatch" }
flowy-error = { path = "../flowy-error", features = ["db", "http_server"] }
lib-sqlite = { path = "../lib-sqlite" }
tracing = { version = "0.1", features = ["log"] }
bytes = "1.0"
@ -26,22 +24,16 @@ protobuf = {version = "2.18.0"}
lazy_static = "1.4.0"
diesel = {version = "1.4.8", features = ["sqlite"]}
diesel_derives = {version = "1.4.1", features = ["sqlite"]}
thread_local = "1.1.3"
thread-id = "3.3.0"
once_cell = "1.7.2"
parking_lot = "0.11"
strum = "0.21"
strum_macros = "0.21"
tokio = { version = "1", features = ["rt"] }
pin-project = "1.0.0"
futures-core = { version = "0.3", default-features = false }
r2d2 = "0.8.9"
dashmap = "4.0"
[dev-dependencies]
flowy-test = { path = "../flowy-test" }
futures = "0.3.15"
serial_test = "0.5.1"
[features]
http_server = []

View File

@ -9,7 +9,7 @@ pub mod services;
extern crate flowy_database;
pub mod errors {
pub use flowy_error::{internal_error, ErrorCode, FlowyError};
pub use flowy_error::*;
}
pub mod entities {

View File

@ -1,8 +1,8 @@
use flowy_database::ConnectionPool;
use flowy_database::{schema::user_table, DBConnection, Database};
use flowy_error::FlowyError;
use flowy_error::{ErrorCode, FlowyError};
use flowy_user_data_model::entities::{SignInResponse, SignUpResponse, UpdateUserParams, UserProfile};
use lazy_static::lazy_static;
use lib_sqlite::ConnectionPool;
use once_cell::sync::Lazy;
use parking_lot::{Mutex, RwLock};
use std::{collections::HashMap, sync::Arc, time::Duration};
@ -24,7 +24,7 @@ impl UserDB {
fn open_user_db(&self, user_id: &str) -> Result<(), FlowyError> {
if user_id.is_empty() {
return Err(FlowyError::internal().context("user id is empty"));
return Err(ErrorCode::UserIdIsEmpty.into());
}
tracing::info!("open user db {}", user_id);

View File

@ -7,6 +7,7 @@ use crate::{
notifier::UserNotifier,
},
};
use flowy_database::ConnectionPool;
use flowy_database::{
kv::KV,
query_dsl::*,
@ -16,7 +17,6 @@ use flowy_database::{
use flowy_user_data_model::entities::{
SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserParams, UserProfile,
};
use lib_sqlite::ConnectionPool;
use parking_lot::RwLock;
use serde::{Deserialize, Serialize};
use std::sync::Arc;

View File

@ -3,7 +3,7 @@ use flowy_test::{event_builder::UserModuleEventBuilder, FlowySDKTest};
use flowy_user::{errors::ErrorCode, event_map::UserEvent::*};
use flowy_user_data_model::entities::{UpdateUserPayload, UserProfile};
use lib_infra::uuid;
use serial_test::*;
// use serial_test::*;
#[tokio::test]
async fn user_profile_get_failed() {
@ -17,7 +17,6 @@ async fn user_profile_get_failed() {
}
#[tokio::test]
#[serial]
async fn user_profile_get() {
let test = FlowySDKTest::default();
let user_profile = test.init_user().await;
@ -29,7 +28,6 @@ async fn user_profile_get() {
}
#[tokio::test]
#[serial]
async fn user_update_with_name() {
let sdk = FlowySDKTest::default();
let user = sdk.init_user().await;
@ -50,7 +48,6 @@ async fn user_update_with_name() {
}
#[tokio::test]
#[serial]
async fn user_update_with_email() {
let sdk = FlowySDKTest::default();
let user = sdk.init_user().await;
@ -70,7 +67,6 @@ async fn user_update_with_email() {
}
#[tokio::test]
#[serial]
async fn user_update_with_password() {
let sdk = FlowySDKTest::default();
let user = sdk.init_user().await;
@ -85,7 +81,6 @@ async fn user_update_with_password() {
}
#[tokio::test]
#[serial]
async fn user_update_with_invalid_email() {
let test = FlowySDKTest::default();
let user = test.init_user().await;
@ -104,7 +99,6 @@ async fn user_update_with_invalid_email() {
}
#[tokio::test]
#[serial]
async fn user_update_with_invalid_password() {
let test = FlowySDKTest::default();
let user = test.init_user().await;
@ -120,7 +114,6 @@ async fn user_update_with_invalid_password() {
}
#[tokio::test]
#[serial]
async fn user_update_with_invalid_name() {
let test = FlowySDKTest::default();
let user = test.init_user().await;