Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

[rust]: Crates start with lib consider as foundation libs

appflowy2449e9352ca8
diff --git a/backend/Cargo.toml b/backend/Cargo.toml
index 669cda1f0f..68271e079b 100644
--- a/backend/Cargo.toml
+++ b/backend/Cargo.toml
@@ -63,8 +63,8 @@ async-stream = "0.3.2"
flowy-user-infra = { path = "../rust-lib/flowy-user-infra" }
flowy-workspace-infra = { path = "../rust-lib/flowy-workspace-infra" }
flowy-document-infra = { path = "../rust-lib/flowy-document-infra" }
-flowy-ws = { path = "../rust-lib/lib-ws" }
-flowy-ot = { path = "../rust-lib/lib-ot" }
+lib-ws = { path = "../rust-lib/lib-ws" }
+lib-ot = { path = "../rust-lib/lib-ot" }
flowy-net = { path = "../rust-lib/flowy-net", features = ["http_server"] }
ormx = { version = "0.7", features = ["postgres"]}
@@ -104,9 +104,9 @@ flowy-sdk = { path = "../rust-lib/flowy-sdk", features = ["http_server"] }
flowy-user = { path = "../rust-lib/flowy-user", features = ["http_server"] }
flowy-document = { path = "../rust-lib/flowy-document", features = ["flowy_test", "http_server"] }
-flowy-ws = { path = "../rust-lib/lib-ws" }
+lib-ws = { path = "../rust-lib/lib-ws" }
flowy-test = { path = "../rust-lib/flowy-test" }
-flowy-infra = { path = "../rust-lib/lib-infra" }
-flowy-ot = { path = "../rust-lib/lib-ot" }
-flowy-sqlite = { path = "../rust-lib/lib-sqlite" }
+lib-infra = { path = "../rust-lib/lib-infra" }
+lib-ot = { path = "../rust-lib/lib-ot" }
+lib-sqlite = { path = "../rust-lib/lib-sqlite" }
futures-util = "0.3.15"
\ No newline at end of file
diff --git a/backend/src/context.rs b/backend/src/context.rs
index 482d97eece..e70abb6cf7 100644
--- a/backend/src/context.rs
+++ b/backend/src/context.rs
@@ -4,7 +4,7 @@ use crate::service::{
};
use actix::Addr;
use actix_web::web::Data;
-use flowy_ws::WsModule;
+use lib_ws::WsModule;
use sqlx::PgPool;
use std::sync::Arc;
diff --git a/backend/src/service/doc/edit/edit_doc.rs b/backend/src/service/doc/edit/edit_doc.rs
index 2a079cfb43..aa0e12606f 100644
--- a/backend/src/service/doc/edit/edit_doc.rs
+++ b/backend/src/service/doc/edit/edit_doc.rs
@@ -11,7 +11,7 @@ use flowy_document_infra::{
protobuf::{Doc, RevId, RevType, Revision, RevisionRange, UpdateDocParams},
};
use flowy_net::errors::{internal_error, ServerError};
-use flowy_ot::core::{Delta, OperationTransformable};
+use lib_ot::core::{Delta, OperationTransformable};
use parking_lot::RwLock;
use protobuf::Message;
use sqlx::PgPool;
diff --git a/backend/src/service/ws/biz_handler.rs b/backend/src/service/ws/biz_handler.rs
index 7a452381fe..45dc6389ec 100644
--- a/backend/src/service/ws/biz_handler.rs
+++ b/backend/src/service/ws/biz_handler.rs
@@ -1,6 +1,6 @@
use crate::service::ws::WsClientData;
-use flowy_ws::WsModule;
+use lib_ws::WsModule;
use std::{collections::HashMap, sync::Arc};
pub trait WsBizHandler: Send + Sync {
@@ -13,15 +13,9 @@ pub struct WsBizHandlers {
}
impl WsBizHandlers {
- pub fn new() -> Self {
- Self {
- inner: HashMap::new(),
- }
- }
+ pub fn new() -> Self { Self { inner: HashMap::new() } }
- pub fn register(&mut self, source: WsModule, handler: BizHandler) {
- self.inner.insert(source, handler);
- }
+ pub fn register(&mut self, source: WsModule, handler: BizHandler) { self.inner.insert(source, handler); }
pub fn get(&self, source: &WsModule) -> Option<BizHandler> {
match self.inner.get(source) {
diff --git a/backend/src/service/ws/entities/message.rs b/backend/src/service/ws/entities/message.rs
index d91910a0a6..0ebc379b8c 100644
--- a/backend/src/service/ws/entities/message.rs
+++ b/backend/src/service/ws/entities/message.rs
@@ -1,7 +1,7 @@
use actix::Message;
use bytes::Bytes;
use flowy_document_infra::entities::ws::WsDocumentData;
-use flowy_ws::{WsMessage, WsModule};
+use lib_ws::{WsMessage, WsModule};
use std::convert::TryInto;
#[derive(Debug, Message, Clone)]
diff --git a/backend/src/service/ws/ws_client.rs b/backend/src/service/ws/ws_client.rs
index 1e2d6ae430..d793a7bfd5 100644
--- a/backend/src/service/ws/ws_client.rs
+++ b/backend/src/service/ws/ws_client.rs
@@ -14,7 +14,7 @@ use actix::*;
use actix_web::web::Data;
use actix_web_actors::{ws, ws::Message::Text};
use bytes::Bytes;
-use flowy_ws::WsMessage;
+use lib_ws::WsMessage;
use std::{convert::TryFrom, sync::Arc, time::Instant};
#[derive(Debug)]
diff --git a/backend/tests/document/edit.rs b/backend/tests/document/edit.rs
index 90de20d492..7483f4ee0c 100644
--- a/backend/tests/document/edit.rs
+++ b/backend/tests/document/edit.rs
@@ -1,6 +1,6 @@
use crate::document::helper::{DocScript, DocumentTest};
use flowy_document_infra::core::{Document, FlowyDoc};
-use flowy_ot::core::{Attribute, Interval};
+use lib_ot::core::{Attribute, Interval};
#[rustfmt::skip]
// ┌─────────┐ ┌─────────┐
diff --git a/backend/tests/document/helper.rs b/backend/tests/document/helper.rs
index 3d478b2609..be88f732b9 100644
--- a/backend/tests/document/helper.rs
+++ b/backend/tests/document/helper.rs
@@ -11,7 +11,7 @@ use tokio::time::{sleep, Duration};
// use crate::helper::*;
use crate::util::helper::{spawn_server, TestServer};
use flowy_document_infra::{entities::doc::DocIdentifier, protobuf::UpdateDocParams};
-use flowy_ot::core::{Attribute, Delta, Interval};
+use lib_ot::core::{Attribute, Delta, Interval};
use parking_lot::RwLock;
pub struct DocumentTest {
diff --git a/rust-lib/Cargo.toml b/rust-lib/Cargo.toml
index 0f9e831d11..21f1e6864d 100644
--- a/rust-lib/Cargo.toml
+++ b/rust-lib/Cargo.toml
@@ -1,6 +1,6 @@
[workspace]
members = [
- "lib-dispatch",
+ "lib-dispatch",
"flowy-sdk",
"dart-ffi",
"flowy-log",
@@ -14,10 +14,10 @@ members = [
"lib-infra",
"flowy-workspace",
"flowy-workspace-infra",
- "dart-notify",
+ "dart-notify",
"flowy-document",
"flowy-document-infra",
- "lib-ot",
+ "lib-ot",
"flowy-net",
"lib-ws",
"flowy-backend-api",
diff --git a/rust-lib/dart-ffi/Cargo.toml b/rust-lib/dart-ffi/Cargo.toml
index adeaedf8b3..81715e8c35 100644
--- a/rust-lib/dart-ffi/Cargo.toml
+++ b/rust-lib/dart-ffi/Cargo.toml
@@ -24,7 +24,7 @@ serde_json = {version = "1.0"}
bytes = { version = "1.0" }
parking_lot = "0.11"
-flowy-dispatch = {path = "../lib-dispatch" }
+lib-dispatch = {path = "../lib-dispatch" }
flowy-sdk = {path = "../flowy-sdk"}
flowy-derive = {path = "../flowy-derive"}
flowy-dart-notify = {path = "../dart-notify" }
diff --git a/rust-lib/dart-ffi/src/lib.rs b/rust-lib/dart-ffi/src/lib.rs
index f2c6cd65fe..1c43b83073 100644
--- a/rust-lib/dart-ffi/src/lib.rs
+++ b/rust-lib/dart-ffi/src/lib.rs
@@ -7,9 +7,9 @@ use crate::{
c::{extend_front_four_bytes_into_bytes, forget_rust},
model::{FFIRequest, FFIResponse},
};
-use flowy_dispatch::prelude::*;
use flowy_sdk::*;
use lazy_static::lazy_static;
+use lib_dispatch::prelude::*;
use parking_lot::RwLock;
use std::{ffi::CStr, os::raw::c_char, sync::Arc};
@@ -69,8 +69,8 @@ pub extern "C" fn set_stream_port(port: i64) -> i32 {
#[no_mangle]
pub extern "C" fn link_me_please() {}
-use flowy_dispatch::prelude::ToBytes;
use flowy_net::config::ServerConfig;
+use lib_dispatch::prelude::ToBytes;
#[inline(always)]
async fn post_to_flutter(response: EventResponse, port: i64) {
diff --git a/rust-lib/dart-ffi/src/model/ffi_request.rs b/rust-lib/dart-ffi/src/model/ffi_request.rs
index 8d3f85720d..45685ba76d 100644
--- a/rust-lib/dart-ffi/src/model/ffi_request.rs
+++ b/rust-lib/dart-ffi/src/model/ffi_request.rs
@@ -1,6 +1,6 @@
use bytes::Bytes;
use flowy_derive::ProtoBuf;
-use flowy_dispatch::prelude::ModuleRequest;
+use lib_dispatch::prelude::ModuleRequest;
use std::convert::TryFrom;
#[derive(Default, ProtoBuf)]
diff --git a/rust-lib/dart-ffi/src/model/ffi_response.rs b/rust-lib/dart-ffi/src/model/ffi_response.rs
index 687d166ba9..06e81d8b9e 100644
--- a/rust-lib/dart-ffi/src/model/ffi_response.rs
+++ b/rust-lib/dart-ffi/src/model/ffi_response.rs
@@ -1,5 +1,5 @@
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
-use flowy_dispatch::prelude::{EventResponse, Payload, StatusCode};
+use lib_dispatch::prelude::{EventResponse, Payload, StatusCode};
#[derive(ProtoBuf_Enum, Clone, Copy)]
pub enum FFIStatusCode {
diff --git a/rust-lib/dart-notify/Cargo.toml b/rust-lib/dart-notify/Cargo.toml
index c3caa3b830..516765ca40 100644
--- a/rust-lib/dart-notify/Cargo.toml
+++ b/rust-lib/dart-notify/Cargo.toml
@@ -13,7 +13,7 @@ log = "0.4.14"
bytes = { version = "1.0" }
flowy-derive = {path = "../flowy-derive"}
-flowy-dispatch = {path = "../lib-dispatch" }
+lib-dispatch = {path = "../lib-dispatch" }
[features]
dart = []
\ No newline at end of file
diff --git a/rust-lib/dart-notify/src/lib.rs b/rust-lib/dart-notify/src/lib.rs
index d1bc22e145..0715fe1b10 100644
--- a/rust-lib/dart-notify/src/lib.rs
+++ b/rust-lib/dart-notify/src/lib.rs
@@ -5,7 +5,7 @@ pub mod entities;
mod protobuf;
use crate::{dart::DartStreamSender, entities::SubscribeObject};
-use flowy_dispatch::prelude::ToBytes;
+use lib_dispatch::prelude::ToBytes;
pub struct DartNotifyBuilder {
id: String,
diff --git a/rust-lib/flowy-database/Cargo.toml b/rust-lib/flowy-database/Cargo.toml
index 0bcfaef842..0045ecca91 100644
--- a/rust-lib/flowy-database/Cargo.toml
+++ b/rust-lib/flowy-database/Cargo.toml
@@ -9,4 +9,4 @@ edition = "2018"
diesel = {version = "1.4.8", features = ["sqlite"]}
diesel_derives = {version = "1.4.1", features = ["sqlite"]}
diesel_migrations = {version = "1.4.0", features = ["sqlite"]}
-flowy-sqlite = {path = "../lib-sqlite" }
\ No newline at end of file
+lib-sqlite = {path = "../lib-sqlite" }
\ No newline at end of file
diff --git a/rust-lib/flowy-database/src/lib.rs b/rust-lib/flowy-database/src/lib.rs
index d645ecebc0..4d50552f55 100644
--- a/rust-lib/flowy-database/src/lib.rs
+++ b/rust-lib/flowy-database/src/lib.rs
@@ -14,11 +14,11 @@ pub use diesel_derives::*;
#[macro_use]
extern crate diesel_migrations;
-pub use flowy_sqlite::{ConnectionPool, DBConnection, Database};
+pub use lib_sqlite::{ConnectionPool, DBConnection, Database};
pub type Error = diesel::result::Error;
use diesel_migrations::*;
-use flowy_sqlite::PoolConfig;
+use lib_sqlite::PoolConfig;
use std::{fmt::Debug, io, path::Path};
pub mod prelude {
@@ -42,7 +42,7 @@ pub fn init(storage_path: &str) -> Result<Database, io::Error> {
fn as_io_error<E>(e: E) -> io::Error
where
- E: Into<flowy_sqlite::Error> + Debug,
+ E: Into<lib_sqlite::Error> + Debug,
{
let msg = format!("{:?}", e);
io::Error::new(io::ErrorKind::NotConnected, msg)
diff --git a/rust-lib/flowy-document-infra/Cargo.toml b/rust-lib/flowy-document-infra/Cargo.toml
index 3fd0a9f5db..4e3bca95f7 100644
--- a/rust-lib/flowy-document-infra/Cargo.toml
+++ b/rust-lib/flowy-document-infra/Cargo.toml
@@ -6,7 +6,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-flowy-ot = { path = "../lib-ot" }
+lib-ot = { path = "../lib-ot" }
flowy-derive = { path = "../flowy-derive" }
protobuf = {version = "2.18.0"}
bytes = "1.0"
diff --git a/rust-lib/flowy-document-infra/src/core/document.rs b/rust-lib/flowy-document-infra/src/core/document.rs
index fbc99c015f..ad63773e02 100644
--- a/rust-lib/flowy-document-infra/src/core/document.rs
+++ b/rust-lib/flowy-document-infra/src/core/document.rs
@@ -6,7 +6,7 @@ use crate::{
errors::DocumentError,
user_default::doc_initial_delta,
};
-use flowy_ot::core::*;
+use lib_ot::core::*;
use tokio::sync::mpsc;
pub trait CustomDocument {
diff --git a/rust-lib/flowy-document-infra/src/core/extensions/delete/default_delete.rs b/rust-lib/flowy-document-infra/src/core/extensions/delete/default_delete.rs
index 2afe1b268a..47674b906d 100644
--- a/rust-lib/flowy-document-infra/src/core/extensions/delete/default_delete.rs
+++ b/rust-lib/flowy-document-infra/src/core/extensions/delete/default_delete.rs
@@ -1,5 +1,5 @@
use crate::core::extensions::DeleteExt;
-use flowy_ot::core::{Delta, DeltaBuilder, Interval};
+use lib_ot::core::{Delta, DeltaBuilder, Interval};
pub struct DefaultDelete {}
impl DeleteExt for DefaultDelete {
diff --git a/rust-lib/flowy-document-infra/src/core/extensions/delete/preserve_line_format_merge.rs b/rust-lib/flowy-document-infra/src/core/extensions/delete/preserve_line_format_merge.rs
index b5a1a7f5d1..cfabbd89e7 100644
--- a/rust-lib/flowy-document-infra/src/core/extensions/delete/preserve_line_format_merge.rs
+++ b/rust-lib/flowy-document-infra/src/core/extensions/delete/preserve_line_format_merge.rs
@@ -1,5 +1,5 @@
use crate::{core::extensions::DeleteExt, util::is_newline};
-use flowy_ot::core::{plain_attributes, CharMetric, Delta, DeltaBuilder, DeltaIter, Interval, NEW_LINE};
+use lib_ot::core::{plain_attributes, CharMetric, Delta, DeltaBuilder, DeltaIter, Interval, NEW_LINE};
pub struct PreserveLineFormatOnMerge {}
impl DeleteExt for PreserveLineFormatOnMerge {
diff --git a/rust-lib/flowy-document-infra/src/core/extensions/format/helper.rs b/rust-lib/flowy-document-infra/src/core/extensions/format/helper.rs
index b99901cabb..c4cac2efaa 100644
--- a/rust-lib/flowy-document-infra/src/core/extensions/format/helper.rs
+++ b/rust-lib/flowy-document-infra/src/core/extensions/format/helper.rs
@@ -1,5 +1,5 @@
use crate::util::find_newline;
-use flowy_ot::core::{plain_attributes, Attribute, AttributeScope, Delta, Operation};
+use lib_ot::core::{plain_attributes, Attribute, AttributeScope, Delta, Operation};
pub(crate) fn line_break(op: &Operation, attribute: &Attribute, scope: AttributeScope) -> Delta {
let mut new_delta = Delta::new();
diff --git a/rust-lib/flowy-document-infra/src/core/extensions/format/resolve_block_format.rs b/rust-lib/flowy-document-infra/src/core/extensions/format/resolve_block_format.rs
index 316fed1cfb..18c353fd77 100644
--- a/rust-lib/flowy-document-infra/src/core/extensions/format/resolve_block_format.rs
+++ b/rust-lib/flowy-document-infra/src/core/extensions/format/resolve_block_format.rs
@@ -2,7 +2,7 @@ use crate::{
core::extensions::{format::helper::line_break, FormatExt},
util::find_newline,
};
-use flowy_ot::core::{plain_attributes, Attribute, AttributeScope, Delta, DeltaBuilder, DeltaIter, Interval};
+use lib_ot::core::{plain_attributes, Attribute, AttributeScope, Delta, DeltaBuilder, DeltaIter, Interval};
pub struct ResolveBlockFormat {}
impl FormatExt for ResolveBlockFormat {
diff --git a/rust-lib/flowy-document-infra/src/core/extensions/format/resolve_inline_format.rs b/rust-lib/flowy-document-infra/src/core/extensions/format/resolve_inline_format.rs
index 957a4b2504..3bb03467cf 100644
--- a/rust-lib/flowy-document-infra/src/core/extensions/format/resolve_inline_format.rs
+++ b/rust-lib/flowy-document-infra/src/core/extensions/format/resolve_inline_format.rs
@@ -2,7 +2,7 @@ use crate::{
core::extensions::{format::helper::line_break, FormatExt},
util::find_newline,
};
-use flowy_ot::core::{Attribute, AttributeScope, Delta, DeltaBuilder, DeltaIter, Interval};
+use lib_ot::core::{Attribute, AttributeScope, Delta, DeltaBuilder, DeltaIter, Interval};
pub struct ResolveInlineFormat {}
impl FormatExt for ResolveInlineFormat {
diff --git a/rust-lib/flowy-document-infra/src/core/extensions/insert/auto_exit_block.rs b/rust-lib/flowy-document-infra/src/core/extensions/insert/auto_exit_block.rs
index 6573585bcc..d2d331635c 100644
--- a/rust-lib/flowy-document-infra/src/core/extensions/insert/auto_exit_block.rs
+++ b/rust-lib/flowy-document-infra/src/core/extensions/insert/auto_exit_block.rs
@@ -1,5 +1,5 @@
use crate::{core::extensions::InsertExt, util::is_newline};
-use flowy_ot::core::{attributes_except_header, is_empty_line_at_index, AttributeKey, Delta, DeltaBuilder, DeltaIter};
+use lib_ot::core::{attributes_except_header, is_empty_line_at_index, AttributeKey, Delta, DeltaBuilder, DeltaIter};
pub struct AutoExitBlock {}
diff --git a/rust-lib/flowy-document-infra/src/core/extensions/insert/auto_format.rs b/rust-lib/flowy-document-infra/src/core/extensions/insert/auto_format.rs
index 1aa2fcf61d..fe814f27ee 100644
--- a/rust-lib/flowy-document-infra/src/core/extensions/insert/auto_format.rs
+++ b/rust-lib/flowy-document-infra/src/core/extensions/insert/auto_format.rs
@@ -1,5 +1,5 @@
use crate::{core::extensions::InsertExt, util::is_whitespace};
-use flowy_ot::core::{count_utf16_code_units, plain_attributes, Attribute, Attributes, Delta, DeltaBuilder, DeltaIter};
+use lib_ot::core::{count_utf16_code_units, plain_attributes, Attribute, Attributes, Delta, DeltaBuilder, DeltaIter};
use std::cmp::min;
use url::Url;
diff --git a/rust-lib/flowy-document-infra/src/core/extensions/insert/default_insert.rs b/rust-lib/flowy-document-infra/src/core/extensions/insert/default_insert.rs
index 0d0d732a2c..5fd207e383 100644
--- a/rust-lib/flowy-document-infra/src/core/extensions/insert/default_insert.rs
+++ b/rust-lib/flowy-document-infra/src/core/extensions/insert/default_insert.rs
@@ -1,5 +1,5 @@
use crate::core::extensions::InsertExt;
-use flowy_ot::core::{AttributeKey, Attributes, Delta, DeltaBuilder, DeltaIter, NEW_LINE};
+use lib_ot::core::{AttributeKey, Attributes, Delta, DeltaBuilder, DeltaIter, NEW_LINE};
pub struct DefaultInsertAttribute {}
impl InsertExt for DefaultInsertAttribute {
diff --git a/rust-lib/flowy-document-infra/src/core/extensions/insert/mod.rs b/rust-lib/flowy-document-infra/src/core/extensions/insert/mod.rs
index 88e57dde4f..b70105e6bf 100644
--- a/rust-lib/flowy-document-infra/src/core/extensions/insert/mod.rs
+++ b/rust-lib/flowy-document-infra/src/core/extensions/insert/mod.rs
@@ -2,7 +2,7 @@ use crate::core::extensions::InsertExt;
pub use auto_exit_block::*;
pub use auto_format::*;
pub use default_insert::*;
-use flowy_ot::core::Delta;
+use lib_ot::core::Delta;
pub use preserve_block_format::*;
pub use preserve_inline_format::*;
pub use reset_format_on_new_line::*;
diff --git a/rust-lib/flowy-document-infra/src/core/extensions/insert/preserve_block_format.rs b/rust-lib/flowy-document-infra/src/core/extensions/insert/preserve_block_format.rs
index f6dafbdd08..321dc4e032 100644
--- a/rust-lib/flowy-document-infra/src/core/extensions/insert/preserve_block_format.rs
+++ b/rust-lib/flowy-document-infra/src/core/extensions/insert/preserve_block_format.rs
@@ -1,5 +1,5 @@
use crate::{core::extensions::InsertExt, util::is_newline};
-use flowy_ot::core::{
+use lib_ot::core::{
attributes_except_header,
plain_attributes,
Attribute,
diff --git a/rust-lib/flowy-document-infra/src/core/extensions/insert/preserve_inline_format.rs b/rust-lib/flowy-document-infra/src/core/extensions/insert/preserve_inline_format.rs
index 8d7b4124d4..f786726ab6 100644
--- a/rust-lib/flowy-document-infra/src/core/extensions/insert/preserve_inline_format.rs
+++ b/rust-lib/flowy-document-infra/src/core/extensions/insert/preserve_inline_format.rs
@@ -2,7 +2,7 @@ use crate::{
core::extensions::InsertExt,
util::{contain_newline, is_newline},
};
-use flowy_ot::core::{plain_attributes, AttributeKey, Delta, DeltaBuilder, DeltaIter, OpNewline, NEW_LINE};
+use lib_ot::core::{plain_attributes, AttributeKey, Delta, DeltaBuilder, DeltaIter, OpNewline, NEW_LINE};
pub struct PreserveInlineFormat {}
impl InsertExt for PreserveInlineFormat {
diff --git a/rust-lib/flowy-document-infra/src/core/extensions/insert/reset_format_on_new_line.rs b/rust-lib/flowy-document-infra/src/core/extensions/insert/reset_format_on_new_line.rs
index 24a86dc770..0e1699a814 100644
--- a/rust-lib/flowy-document-infra/src/core/extensions/insert/reset_format_on_new_line.rs
+++ b/rust-lib/flowy-document-infra/src/core/extensions/insert/reset_format_on_new_line.rs
@@ -1,5 +1,5 @@
use crate::{core::extensions::InsertExt, util::is_newline};
-use flowy_ot::core::{AttributeKey, Attributes, CharMetric, Delta, DeltaBuilder, DeltaIter, NEW_LINE};
+use lib_ot::core::{AttributeKey, Attributes, CharMetric, Delta, DeltaBuilder, DeltaIter, NEW_LINE};
pub struct ResetLineFormatOnNewLine {}
impl InsertExt for ResetLineFormatOnNewLine {
diff --git a/rust-lib/flowy-document-infra/src/core/extensions/mod.rs b/rust-lib/flowy-document-infra/src/core/extensions/mod.rs
index a6c5be1986..584dee2d68 100644
--- a/rust-lib/flowy-document-infra/src/core/extensions/mod.rs
+++ b/rust-lib/flowy-document-infra/src/core/extensions/mod.rs
@@ -2,7 +2,7 @@ pub use delete::*;
pub use format::*;
pub use insert::*;
-use flowy_ot::core::{Attribute, Delta, Interval};
+use lib_ot::core::{Attribute, Delta, Interval};
mod delete;
mod format;
diff --git a/rust-lib/flowy-document-infra/src/core/history.rs b/rust-lib/flowy-document-infra/src/core/history.rs
index 6e0d374770..472c574436 100644
--- a/rust-lib/flowy-document-infra/src/core/history.rs
+++ b/rust-lib/flowy-document-infra/src/core/history.rs
@@ -1,4 +1,4 @@
-use flowy_ot::core::Delta;
+use lib_ot::core::Delta;
const MAX_UNDOS: usize = 20;
diff --git a/rust-lib/flowy-document-infra/src/core/view.rs b/rust-lib/flowy-document-infra/src/core/view.rs
index 4a1b0fed1b..984b461169 100644
--- a/rust-lib/flowy-document-infra/src/core/view.rs
+++ b/rust-lib/flowy-document-infra/src/core/view.rs
@@ -1,5 +1,5 @@
use crate::core::extensions::*;
-use flowy_ot::{
+use lib_ot::{
core::{trim, Attribute, Delta, Interval},
errors::{ErrorBuilder, OTError, OTErrorCode},
};
diff --git a/rust-lib/flowy-document-infra/src/entities/doc/doc.rs b/rust-lib/flowy-document-infra/src/entities/doc/doc.rs
index e077222ddd..3502f81768 100644
--- a/rust-lib/flowy-document-infra/src/entities/doc/doc.rs
+++ b/rust-lib/flowy-document-infra/src/entities/doc/doc.rs
@@ -1,5 +1,5 @@
use flowy_derive::ProtoBuf;
-use flowy_ot::{core::Delta, errors::OTError};
+use lib_ot::{core::Delta, errors::OTError};
#[derive(ProtoBuf, Default, Debug, Clone)]
pub struct CreateDocParams {
diff --git a/rust-lib/flowy-document-infra/src/entities/doc/revision.rs b/rust-lib/flowy-document-infra/src/entities/doc/revision.rs
index c347b57f4e..9b576e4502 100644
--- a/rust-lib/flowy-document-infra/src/entities/doc/revision.rs
+++ b/rust-lib/flowy-document-infra/src/entities/doc/revision.rs
@@ -1,6 +1,6 @@
use crate::{entities::doc::Doc, util::md5};
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
-use flowy_ot::core::Delta;
+use lib_ot::core::Delta;
use std::{fmt::Formatter, ops::RangeInclusive};
#[derive(Debug, ProtoBuf_Enum, Clone, Eq, PartialEq)]
diff --git a/rust-lib/flowy-document-infra/src/errors.rs b/rust-lib/flowy-document-infra/src/errors.rs
index 4c60302e9f..0a82f1741e 100644
--- a/rust-lib/flowy-document-infra/src/errors.rs
+++ b/rust-lib/flowy-document-infra/src/errors.rs
@@ -54,10 +54,8 @@ pub enum ErrorCode {
InternalError = 1000,
}
-impl std::convert::From<flowy_ot::errors::OTError> for DocumentError {
- fn from(error: flowy_ot::errors::OTError) -> Self {
- DocumentError::new(ErrorCode::InternalError, "").context(error)
- }
+impl std::convert::From<lib_ot::errors::OTError> for DocumentError {
+ fn from(error: lib_ot::errors::OTError) -> Self { DocumentError::new(ErrorCode::InternalError, "").context(error) }
}
impl std::convert::From<protobuf::ProtobufError> for DocumentError {
diff --git a/rust-lib/flowy-document-infra/src/user_default.rs b/rust-lib/flowy-document-infra/src/user_default.rs
index 9e9d73b688..e96c78860b 100644
--- a/rust-lib/flowy-document-infra/src/user_default.rs
+++ b/rust-lib/flowy-document-infra/src/user_default.rs
@@ -1,4 +1,4 @@
-use flowy_ot::core::{Delta, DeltaBuilder};
+use lib_ot::core::{Delta, DeltaBuilder};
#[inline]
pub fn doc_initial_delta() -> Delta { DeltaBuilder::new().insert("\n").build() }
diff --git a/rust-lib/flowy-document-infra/src/util.rs b/rust-lib/flowy-document-infra/src/util.rs
index 9336832175..eac139a767 100644
--- a/rust-lib/flowy-document-infra/src/util.rs
+++ b/rust-lib/flowy-document-infra/src/util.rs
@@ -1,4 +1,4 @@
-use flowy_ot::core::{NEW_LINE, WHITESPACE};
+use lib_ot::core::{NEW_LINE, WHITESPACE};
use std::sync::atomic::{AtomicI64, Ordering::SeqCst};
#[inline]
diff --git a/rust-lib/flowy-document/Cargo.toml b/rust-lib/flowy-document/Cargo.toml
index 92e4223542..a41d5be2ee 100644
--- a/rust-lib/flowy-document/Cargo.toml
+++ b/rust-lib/flowy-document/Cargo.toml
@@ -9,13 +9,13 @@ edition = "2018"
[dependencies]
flowy-document-infra = { path = "../flowy-document-infra" }
derive_more = {version = "0.99", features = ["display"]}
-flowy-dispatch = { path = "../lib-dispatch" }
+lib-dispatch = { path = "../lib-dispatch" }
flowy-derive = { path = "../flowy-derive" }
flowy-database = { path = "../flowy-database" }
-flowy-infra = { path = "../lib-infra" }
+lib-infra = { path = "../lib-infra" }
flowy-dart-notify = { path = "../dart-notify" }
-flowy-ot = { path = "../lib-ot" }
-flowy-ws = { path = "../lib-ws" }
+lib-ot = { path = "../lib-ot" }
+lib-ws = { path = "../lib-ws" }
flowy-net = { path = "../flowy-net", features = ["flowy_request"] }
diff --git a/rust-lib/flowy-document/src/errors.rs b/rust-lib/flowy-document/src/errors.rs
index 1465f87586..e81683e39b 100644
--- a/rust-lib/flowy-document/src/errors.rs
+++ b/rust-lib/flowy-document/src/errors.rs
@@ -1,8 +1,8 @@
use bytes::Bytes;
use derive_more::Display;
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};
-use flowy_dispatch::prelude::{EventResponse, ResponseBuilder};
use flowy_net::errors::ServerError;
+use lib_dispatch::prelude::{EventResponse, ResponseBuilder};
use std::{convert::TryInto, fmt};
pub type DocResult<T> = std::result::Result<T, DocError>;
@@ -43,9 +43,9 @@ impl DocError {
pub fn is_record_not_found(&self) -> bool { self.code == ErrorCode::DocNotfound }
+ static_doc_error!(ws, ErrorCode::WsConnectError);
static_doc_error!(internal, ErrorCode::InternalError);
static_doc_error!(unauthorized, ErrorCode::UserUnauthorized);
- static_doc_error!(ws, ErrorCode::WsConnectError);
static_doc_error!(record_not_found, ErrorCode::DocNotfound);
static_doc_error!(duplicate_rev, ErrorCode::DuplicateRevision);
}
@@ -69,7 +69,7 @@ pub enum ErrorCode {
DuplicateRevision = 2,
#[display(fmt = "UserUnauthorized")]
- UserUnauthorized = 999,
+ UserUnauthorized = 10,
#[display(fmt = "InternalError")]
InternalError = 1000,
@@ -88,8 +88,8 @@ impl std::convert::From<flowy_database::Error> for DocError {
}
}
-impl std::convert::From<flowy_ot::errors::OTError> for DocError {
- fn from(error: flowy_ot::errors::OTError) -> Self { DocError::internal().context(error) }
+impl std::convert::From<lib_ot::errors::OTError> for DocError {
+ fn from(error: lib_ot::errors::OTError) -> Self { DocError::internal().context(error) }
}
impl std::convert::From<flowy_document_infra::errors::DocumentError> for DocError {
@@ -108,14 +108,6 @@ impl std::convert::From<protobuf::ProtobufError> for DocError {
fn from(e: protobuf::ProtobufError) -> Self { DocError::internal().context(e) }
}
-// impl std::convert::From<::r2d2::Error> for DocError {
-// fn from(error: r2d2::Error) -> Self {
-// ErrorBuilder::new(ErrorCode::InternalError).error(error).build() } }
-
-// impl std::convert::From<flowy_sqlite::Error> for DocError {
-// fn from(error: flowy_sqlite::Error) -> Self {
-// ErrorBuilder::new(ErrorCode::InternalError).error(error).build() } }
-
impl std::convert::From<flowy_net::errors::ServerError> for DocError {
fn from(error: ServerError) -> Self {
let code = server_error_to_doc_error(error.code);
@@ -134,7 +126,7 @@ fn server_error_to_doc_error(code: ServerErrorCode) -> ErrorCode {
}
}
-impl flowy_dispatch::Error for DocError {
+impl lib_dispatch::Error for DocError {
fn as_response(&self) -> EventResponse {
let bytes: Bytes = self.clone().try_into().unwrap();
ResponseBuilder::Err().data(bytes).build()
diff --git a/rust-lib/flowy-document/src/services/doc/doc_controller.rs b/rust-lib/flowy-document/src/services/doc/doc_controller.rs
index e597853ae8..165abc5346 100644
--- a/rust-lib/flowy-document/src/services/doc/doc_controller.rs
+++ b/rust-lib/flowy-document/src/services/doc/doc_controller.rs
@@ -14,7 +14,7 @@ use crate::{
use bytes::Bytes;
use flowy_database::ConnectionPool;
use flowy_document_infra::entities::doc::{Doc, DocDelta, DocIdentifier};
-use flowy_infra::future::{wrap_future, FnFuture, ResultFuture};
+use lib_infra::future::{wrap_future, FnFuture, ResultFuture};
use std::sync::Arc;
use tokio::time::{interval, Duration};
diff --git a/rust-lib/flowy-document/src/services/doc/edit/doc_actor.rs b/rust-lib/flowy-document/src/services/doc/edit/doc_actor.rs
index e267f522e2..1ce354afe1 100644
--- a/rust-lib/flowy-document/src/services/doc/edit/doc_actor.rs
+++ b/rust-lib/flowy-document/src/services/doc/edit/doc_actor.rs
@@ -5,8 +5,8 @@ use flowy_document_infra::{
entities::doc::{RevId, Revision},
errors::DocumentError,
};
-use flowy_ot::core::{Attribute, Delta, Interval, OperationTransformable};
use futures::stream::StreamExt;
+use lib_ot::core::{Attribute, Delta, Interval, OperationTransformable};
use std::{convert::TryFrom, sync::Arc};
use tokio::sync::{mpsc, oneshot, RwLock};
diff --git a/rust-lib/flowy-document/src/services/doc/edit/edit_doc.rs b/rust-lib/flowy-document/src/services/doc/edit/edit_doc.rs
index f067f821cf..e1f0a47a7b 100644
--- a/rust-lib/flowy-document/src/services/doc/edit/edit_doc.rs
+++ b/rust-lib/flowy-document/src/services/doc/edit/edit_doc.rs
@@ -16,9 +16,9 @@ use flowy_document_infra::{
},
errors::DocumentResult,
};
-use flowy_infra::retry::{ExponentialBackoff, Retry};
-use flowy_ot::core::{Attribute, Delta, Interval};
-use flowy_ws::WsState;
+use lib_infra::retry::{ExponentialBackoff, Retry};
+use lib_ot::core::{Attribute, Delta, Interval};
+use lib_ws::WsState;
use std::{convert::TryFrom, sync::Arc};
use tokio::sync::{mpsc, mpsc::UnboundedSender, oneshot};
diff --git a/rust-lib/flowy-document/src/services/doc/edit/model.rs b/rust-lib/flowy-document/src/services/doc/edit/model.rs
index 5f002fa078..62bbb76da4 100644
--- a/rust-lib/flowy-document/src/services/doc/edit/model.rs
+++ b/rust-lib/flowy-document/src/services/doc/edit/model.rs
@@ -1,7 +1,7 @@
use crate::{errors::DocError, services::ws::DocumentWebSocket};
use flowy_document_infra::entities::doc::{NewDocUser, RevId};
-use flowy_infra::retry::Action;
use futures::future::BoxFuture;
+use lib_infra::retry::Action;
use std::{future, sync::Arc};
pub(crate) struct OpenDocAction {
diff --git a/rust-lib/flowy-document/src/services/doc/revision/manager.rs b/rust-lib/flowy-document/src/services/doc/revision/manager.rs
index 790b11cccf..03794f4dba 100644
--- a/rust-lib/flowy-document/src/services/doc/revision/manager.rs
+++ b/rust-lib/flowy-document/src/services/doc/revision/manager.rs
@@ -7,8 +7,8 @@ use flowy_document_infra::{
entities::doc::{Doc, RevId, RevType, Revision, RevisionRange},
util::RevIdCounter,
};
-use flowy_infra::future::ResultFuture;
-use flowy_ot::core::{Delta, OperationTransformable};
+use lib_infra::future::ResultFuture;
+use lib_ot::core::{Delta, OperationTransformable};
use std::sync::Arc;
use tokio::sync::mpsc;
diff --git a/rust-lib/flowy-document/src/services/doc/revision/model.rs b/rust-lib/flowy-document/src/services/doc/revision/model.rs
index 9b64c6e534..dd32d64005 100644
--- a/rust-lib/flowy-document/src/services/doc/revision/model.rs
+++ b/rust-lib/flowy-document/src/services/doc/revision/model.rs
@@ -4,7 +4,7 @@ use crate::{
};
use flowy_database::ConnectionPool;
use flowy_document_infra::entities::doc::{Revision, RevisionRange};
-use flowy_infra::future::ResultFuture;
+use lib_infra::future::ResultFuture;
use std::sync::Arc;
use tokio::sync::broadcast;
diff --git a/rust-lib/flowy-document/src/services/doc/revision/persistence.rs b/rust-lib/flowy-document/src/services/doc/revision/persistence.rs
index 47b2662523..1fb997fd35 100644
--- a/rust-lib/flowy-document/src/services/doc/revision/persistence.rs
+++ b/rust-lib/flowy-document/src/services/doc/revision/persistence.rs
@@ -7,9 +7,9 @@ use async_stream::stream;
use dashmap::DashMap;
use flowy_database::{ConnectionPool, SqliteConnection};
use flowy_document_infra::entities::doc::{revision_from_doc, Doc, RevId, RevType, Revision, RevisionRange};
-use flowy_infra::future::ResultFuture;
-use flowy_ot::core::{Delta, Operation, OperationTransformable};
use futures::stream::StreamExt;
+use lib_infra::future::ResultFuture;
+use lib_ot::core::{Delta, Operation, OperationTransformable};
use std::{collections::VecDeque, sync::Arc, time::Duration};
use tokio::{
sync::{broadcast, mpsc, RwLock},
diff --git a/rust-lib/flowy-document/src/services/server/mod.rs b/rust-lib/flowy-document/src/services/server/mod.rs
index e4cee182b5..3705fef28d 100644
--- a/rust-lib/flowy-document/src/services/server/mod.rs
+++ b/rust-lib/flowy-document/src/services/server/mod.rs
@@ -6,8 +6,8 @@ pub use server_api::*;
// TODO: ignore mock files in production
use crate::errors::DocError;
use flowy_document_infra::entities::doc::{CreateDocParams, Doc, DocIdentifier, UpdateDocParams};
-use flowy_infra::future::ResultFuture;
use flowy_net::config::ServerConfig;
+use lib_infra::future::ResultFuture;
pub use server_api_mock::*;
use std::sync::Arc;
diff --git a/rust-lib/flowy-document/src/services/server/server_api.rs b/rust-lib/flowy-document/src/services/server/server_api.rs
index 7bc023b0e2..6d1a6e4b4e 100644
--- a/rust-lib/flowy-document/src/services/server/server_api.rs
+++ b/rust-lib/flowy-document/src/services/server/server_api.rs
@@ -1,7 +1,7 @@
use crate::{errors::DocError, services::server::DocumentServerAPI};
use flowy_document_infra::entities::doc::{CreateDocParams, Doc, DocIdentifier, UpdateDocParams};
-use flowy_infra::future::ResultFuture;
use flowy_net::{config::*, request::HttpRequestBuilder};
+use lib_infra::future::ResultFuture;
pub struct DocServer {
config: ServerConfig,
diff --git a/rust-lib/flowy-document/src/services/server/server_api_mock.rs b/rust-lib/flowy-document/src/services/server/server_api_mock.rs
index 29cc85e577..f78d3d4f40 100644
--- a/rust-lib/flowy-document/src/services/server/server_api_mock.rs
+++ b/rust-lib/flowy-document/src/services/server/server_api_mock.rs
@@ -3,7 +3,7 @@ use flowy_document_infra::{
entities::doc::{CreateDocParams, Doc, DocIdentifier, UpdateDocParams},
user_default::doc_initial_string,
};
-use flowy_infra::future::ResultFuture;
+use lib_infra::future::ResultFuture;
pub struct DocServerMock {}
diff --git a/rust-lib/flowy-document/src/services/ws/ws_manager.rs b/rust-lib/flowy-document/src/services/ws/ws_manager.rs
index 61a3a81027..7dd1c5f90c 100644
--- a/rust-lib/flowy-document/src/services/ws/ws_manager.rs
+++ b/rust-lib/flowy-document/src/services/ws/ws_manager.rs
@@ -2,7 +2,7 @@ use crate::errors::DocError;
use bytes::Bytes;
use dashmap::DashMap;
use flowy_document_infra::entities::ws::WsDocumentData;
-use flowy_ws::WsState;
+use lib_ws::WsState;
use std::{convert::TryInto, sync::Arc};
pub(crate) trait WsDocumentHandler: Send + Sync {
diff --git a/rust-lib/flowy-document/tests/editor/attribute_test.rs b/rust-lib/flowy-document/tests/editor/attribute_test.rs
index d3c96d722d..b817e1f646 100644
--- a/rust-lib/flowy-document/tests/editor/attribute_test.rs
+++ b/rust-lib/flowy-document/tests/editor/attribute_test.rs
@@ -1,7 +1,7 @@
#![cfg_attr(rustfmt, rustfmt::skip)]
use crate::editor::{TestBuilder, TestOp::*};
use flowy_document_infra::core::{FlowyDoc, PlainDoc};
-use flowy_ot::core::{Delta, Interval, OperationTransformable, NEW_LINE, WHITESPACE, FlowyStr};
+use lib_ot::core::{Delta, Interval, OperationTransformable, NEW_LINE, WHITESPACE, FlowyStr};
use unicode_segmentation::UnicodeSegmentation;
#[test]
diff --git a/rust-lib/flowy-document/tests/editor/mod.rs b/rust-lib/flowy-document/tests/editor/mod.rs
index 6dcac75a74..e78fe6db33 100644
--- a/rust-lib/flowy-document/tests/editor/mod.rs
+++ b/rust-lib/flowy-document/tests/editor/mod.rs
@@ -5,7 +5,7 @@ mod undo_redo_test;
use derive_more::Display;
use flowy_document_infra::core::{CustomDocument, Document};
-use flowy_ot::core::*;
+use lib_ot::core::*;
use rand::{prelude::*, Rng as WrappedRng};
use std::{sync::Once, time::Duration};
diff --git a/rust-lib/flowy-document/tests/editor/op_test.rs b/rust-lib/flowy-document/tests/editor/op_test.rs
index 9acfdc1c0f..b4e54fde73 100644
--- a/rust-lib/flowy-document/tests/editor/op_test.rs
+++ b/rust-lib/flowy-document/tests/editor/op_test.rs
@@ -1,6 +1,6 @@
use crate::editor::{Rng, TestBuilder, TestOp::*};
use flowy_document_infra::core::{FlowyDoc, PlainDoc};
-use flowy_ot::core::*;
+use lib_ot::core::*;
#[test]
fn attributes_insert_text() {
diff --git a/rust-lib/flowy-document/tests/editor/serde_test.rs b/rust-lib/flowy-document/tests/editor/serde_test.rs
index cc3bfd1654..e89b4d8117 100644
--- a/rust-lib/flowy-document/tests/editor/serde_test.rs
+++ b/rust-lib/flowy-document/tests/editor/serde_test.rs
@@ -1,5 +1,5 @@
use flowy_document_infra::core::{Document, PlainDoc};
-use flowy_ot::core::*;
+use lib_ot::core::*;
#[test]
fn operation_insert_serialize_test() {
diff --git a/rust-lib/flowy-document/tests/editor/undo_redo_test.rs b/rust-lib/flowy-document/tests/editor/undo_redo_test.rs
index 8b5a8ed04b..355121fc2e 100644
--- a/rust-lib/flowy-document/tests/editor/undo_redo_test.rs
+++ b/rust-lib/flowy-document/tests/editor/undo_redo_test.rs
@@ -1,6 +1,6 @@
use crate::editor::{TestBuilder, TestOp::*};
use flowy_document_infra::core::{FlowyDoc, PlainDoc, RECORD_THRESHOLD};
-use flowy_ot::core::{Interval, NEW_LINE, WHITESPACE};
+use lib_ot::core::{Interval, NEW_LINE, WHITESPACE};
#[test]
fn history_insert_undo() {
diff --git a/rust-lib/flowy-net/Cargo.toml b/rust-lib/flowy-net/Cargo.toml
index 6de7bfe2b9..94f828e0cb 100644
--- a/rust-lib/flowy-net/Cargo.toml
+++ b/rust-lib/flowy-net/Cargo.toml
@@ -22,7 +22,7 @@ tokio = { version = "1", features = ["full"] }
actix-web = {version = "4.0.0-beta.8", optional = true}
derive_more = {version = "0.99", features = ["display"]}
flowy-derive = { path = "../flowy-derive" }
-flowy-infra = { path = "../lib-infra" }
+lib-infra = { path = "../lib-infra" }
anyhow = "1.0"
thiserror = "1.0.24"
uuid = { version = "0.8", features = ["v4"] }
diff --git a/rust-lib/flowy-sdk/Cargo.toml b/rust-lib/flowy-sdk/Cargo.toml
index 48a0579924..a6b9f2f795 100644
--- a/rust-lib/flowy-sdk/Cargo.toml
+++ b/rust-lib/flowy-sdk/Cargo.toml
@@ -6,15 +6,15 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
-flowy-dispatch = { path = "../lib-dispatch" }
+lib-dispatch = { path = "../lib-dispatch" }
flowy-log = { path = "../flowy-log" }
flowy-user = { path = "../flowy-user" }
-flowy-infra = { path = "../lib-infra" }
+lib-infra = { path = "../lib-infra" }
flowy-workspace = { path = "../flowy-workspace", default-features = false }
flowy-database = { path = "../flowy-database" }
flowy-document = { path = "../flowy-document" }
flowy-document-infra = { path = "../flowy-document-infra" }
-flowy-ws = { path = "../lib-ws" }
+lib-ws = { path = "../lib-ws" }
flowy-net = { path = "../flowy-net" }
tracing = { version = "0.1" }
log = "0.4.14"
diff --git a/rust-lib/flowy-sdk/src/deps_resolve/document_deps.rs b/rust-lib/flowy-sdk/src/deps_resolve/document_deps.rs
index 5c3a16ce48..608a6b7ccb 100644
--- a/rust-lib/flowy-sdk/src/deps_resolve/document_deps.rs
+++ b/rust-lib/flowy-sdk/src/deps_resolve/document_deps.rs
@@ -10,7 +10,7 @@ use flowy_user::{
errors::{ErrorCode, UserError},
services::user::UserSession,
};
-use flowy_ws::{WsMessage, WsMessageHandler, WsModule};
+use lib_ws::{WsMessage, WsMessageHandler, WsModule};
use std::{convert::TryInto, path::Path, sync::Arc};
pub struct DocumentDepsResolver {
diff --git a/rust-lib/flowy-sdk/src/lib.rs b/rust-lib/flowy-sdk/src/lib.rs
index 93f2493877..faa99e5416 100644
--- a/rust-lib/flowy-sdk/src/lib.rs
+++ b/rust-lib/flowy-sdk/src/lib.rs
@@ -3,11 +3,11 @@ mod deps_resolve;
pub mod module;
use crate::deps_resolve::WorkspaceDepsResolver;
-use flowy_dispatch::prelude::*;
use flowy_document::module::FlowyDocument;
use flowy_net::config::ServerConfig;
use flowy_user::services::user::{UserSession, UserSessionBuilder, UserStatus};
use flowy_workspace::{errors::WorkspaceError, prelude::WorkspaceController};
+use lib_dispatch::prelude::*;
use module::mk_modules;
pub use module::*;
use std::sync::{
@@ -141,7 +141,7 @@ async fn _listen_user_status(
}
fn init_kv(root: &str) {
- match flowy_infra::kv::KV::init(root) {
+ match lib_infra::kv::KV::init(root) {
Ok(_) => {},
Err(e) => tracing::error!("Init kv store failedL: {}", e),
}
diff --git a/rust-lib/flowy-sdk/src/module.rs b/rust-lib/flowy-sdk/src/module.rs
index 1f18696cbd..47f1e47d2b 100644
--- a/rust-lib/flowy-sdk/src/module.rs
+++ b/rust-lib/flowy-sdk/src/module.rs
@@ -1,9 +1,9 @@
use crate::deps_resolve::DocumentDepsResolver;
-use flowy_dispatch::prelude::Module;
use flowy_document::module::FlowyDocument;
use flowy_net::config::ServerConfig;
use flowy_user::services::user::UserSession;
use flowy_workspace::prelude::WorkspaceController;
+use lib_dispatch::prelude::Module;
use std::sync::Arc;
pub fn mk_modules(workspace_controller: Arc<WorkspaceController>, user_session: Arc<UserSession>) -> Vec<Module> {
diff --git a/rust-lib/flowy-test/Cargo.toml b/rust-lib/flowy-test/Cargo.toml
index d0c8c62ce4..3506c6c02b 100644
--- a/rust-lib/flowy-test/Cargo.toml
+++ b/rust-lib/flowy-test/Cargo.toml
@@ -7,10 +7,10 @@ edition = "2018"
[dependencies]
flowy-sdk = { path = "../flowy-sdk"}
-flowy-dispatch = { path = "../lib-dispatch" }
+lib-dispatch = { path = "../lib-dispatch" }
flowy-user = { path = "../flowy-user"}
flowy-workspace = { path = "../flowy-workspace", default-features = false}
-flowy-infra = { path = "../lib-infra" }
+lib-infra = { path = "../lib-infra" }
flowy-document = { path = "../flowy-document"}
flowy-document-infra = { path = "../flowy-document-infra"}
flowy-net = { path = "../flowy-net"}
diff --git a/rust-lib/flowy-test/src/builder.rs b/rust-lib/flowy-test/src/builder.rs
index 7903c69d69..aa8f2e4b59 100644
--- a/rust-lib/flowy-test/src/builder.rs
+++ b/rust-lib/flowy-test/src/builder.rs
@@ -1,12 +1,12 @@
-use flowy_dispatch::prelude::{EventDispatch, EventResponse, FromBytes, ModuleRequest, StatusCode, ToBytes};
use flowy_user::entities::UserProfile;
+use lib_dispatch::prelude::{EventDispatch, EventResponse, FromBytes, ModuleRequest, StatusCode, ToBytes};
use std::{
fmt::{Debug, Display},
hash::Hash,
};
use crate::FlowyTestSDK;
-use flowy_dispatch::prelude::*;
+use lib_dispatch::prelude::*;
use flowy_sdk::*;
use flowy_user::errors::UserError;
diff --git a/rust-lib/flowy-test/src/helper.rs b/rust-lib/flowy-test/src/helper.rs
index 2fdbc780b9..596e26b9ca 100644
--- a/rust-lib/flowy-test/src/helper.rs
+++ b/rust-lib/flowy-test/src/helper.rs
@@ -1,6 +1,6 @@
use bytes::Bytes;
-use flowy_dispatch::prelude::{EventDispatch, ModuleRequest, ToBytes};
-use flowy_infra::{kv::KV, uuid};
+use lib_dispatch::prelude::{EventDispatch, ModuleRequest, ToBytes};
+use lib_infra::{kv::KV, uuid};
use flowy_user::{
entities::{SignInRequest, SignUpRequest, UserProfile},
diff --git a/rust-lib/flowy-test/src/lib.rs b/rust-lib/flowy-test/src/lib.rs
index d738ad0f8e..8941ca316d 100644
--- a/rust-lib/flowy-test/src/lib.rs
+++ b/rust-lib/flowy-test/src/lib.rs
@@ -3,14 +3,14 @@ mod helper;
pub mod workspace;
use crate::helper::*;
-use flowy_infra::uuid;
use flowy_net::config::ServerConfig;
use flowy_sdk::{FlowySDK, FlowySDKConfig};
use flowy_user::entities::UserProfile;
+use lib_infra::uuid;
pub mod prelude {
pub use crate::{builder::*, helper::*, *};
- pub use flowy_dispatch::prelude::*;
+ pub use lib_dispatch::prelude::*;
}
pub type FlowyTestSDK = FlowySDK;
diff --git a/rust-lib/flowy-user/Cargo.toml b/rust-lib/flowy-user/Cargo.toml
index 0526ad5be9..663fa37c84 100644
--- a/rust-lib/flowy-user/Cargo.toml
+++ b/rust-lib/flowy-user/Cargo.toml
@@ -9,13 +9,13 @@ edition = "2018"
flowy-user-infra = { path = "../flowy-user-infra" }
flowy-backend-api = { path = "../flowy-backend-api" }
derive_more = {version = "0.99", features = ["display"]}
-flowy-dispatch = { path = "../lib-dispatch" }
+lib-dispatch = { path = "../lib-dispatch" }
flowy-derive = { path = "../flowy-derive" }
flowy-database = { path = "../flowy-database" }
-flowy-sqlite = { path = "../lib-sqlite" }
-flowy-infra = { path = "../lib-infra" }
+lib-sqlite = { path = "../lib-sqlite" }
+lib-infra = { path = "../lib-infra" }
flowy-net = { path = "../flowy-net", features = ["flowy_request"] }
-flowy-ws = { path = "../lib-ws" }
+lib-ws = { path = "../lib-ws" }
flowy-dart-notify = { path = "../dart-notify" }
tracing = { version = "0.1", features = ["log"] }
diff --git a/rust-lib/flowy-user/src/errors.rs b/rust-lib/flowy-user/src/errors.rs
index ba818b46ae..315803881e 100644
--- a/rust-lib/flowy-user/src/errors.rs
+++ b/rust-lib/flowy-user/src/errors.rs
@@ -1,8 +1,8 @@
use bytes::Bytes;
use flowy_derive::ProtoBuf;
-use flowy_dispatch::prelude::{EventResponse, ResponseBuilder};
pub use flowy_user_infra::errors::ErrorCode;
+use lib_dispatch::prelude::{EventResponse, ResponseBuilder};
use std::{convert::TryInto, fmt, fmt::Debug};
#[derive(Debug, Default, Clone, ProtoBuf)]
@@ -77,19 +77,19 @@ impl std::convert::From<::r2d2::Error> for UserError {
fn from(error: r2d2::Error) -> Self { UserError::internal().context(error) }
}
-impl std::convert::From<flowy_ws::errors::WsError> for UserError {
- fn from(error: flowy_ws::errors::WsError) -> Self {
+impl std::convert::From<lib_ws::errors::WsError> for UserError {
+ fn from(error: lib_ws::errors::WsError) -> Self {
match error.code {
- flowy_ws::errors::ErrorCode::InternalError => UserError::internal().context(error.msg),
+ lib_ws::errors::ErrorCode::InternalError => UserError::internal().context(error.msg),
_ => UserError::internal().context(error),
}
}
}
// use diesel::result::{Error, DatabaseErrorKind};
-// use flowy_sqlite::ErrorKind;
-impl std::convert::From<flowy_sqlite::Error> for UserError {
- fn from(error: flowy_sqlite::Error) -> Self { UserError::internal().context(error) }
+// use lib_sqlite::ErrorKind;
+impl std::convert::From<lib_sqlite::Error> for UserError {
+ fn from(error: lib_sqlite::Error) -> Self { UserError::internal().context(error) }
}
impl std::convert::From<flowy_net::errors::ServerError> for UserError {
@@ -119,7 +119,7 @@ fn server_error_to_user_error(error: flowy_net::errors::ServerError) -> (ErrorCo
}
}
-impl flowy_dispatch::Error for UserError {
+impl lib_dispatch::Error for UserError {
fn as_response(&self) -> EventResponse {
let bytes: Bytes = self.clone().try_into().unwrap();
ResponseBuilder::Err().data(bytes).build()
diff --git a/rust-lib/flowy-user/src/handlers/auth_handler.rs b/rust-lib/flowy-user/src/handlers/auth_handler.rs
index 403640ea4e..1fdcb67f96 100644
--- a/rust-lib/flowy-user/src/handlers/auth_handler.rs
+++ b/rust-lib/flowy-user/src/handlers/auth_handler.rs
@@ -1,5 +1,5 @@
use crate::{entities::*, errors::UserError, services::user::UserSession};
-use flowy_dispatch::prelude::*;
+use lib_dispatch::prelude::*;
use std::{convert::TryInto, sync::Arc};
// tracing instrument 👉🏻 https://docs.rs/tracing/0.1.26/tracing/attr.instrument.html
diff --git a/rust-lib/flowy-user/src/handlers/user_handler.rs b/rust-lib/flowy-user/src/handlers/user_handler.rs
index a1a74c5395..d50da32293 100644
--- a/rust-lib/flowy-user/src/handlers/user_handler.rs
+++ b/rust-lib/flowy-user/src/handlers/user_handler.rs
@@ -1,5 +1,5 @@
use crate::{entities::*, errors::UserError, services::user::UserSession};
-use flowy_dispatch::prelude::*;
+use lib_dispatch::prelude::*;
use std::{convert::TryInto, sync::Arc};
diff --git a/rust-lib/flowy-user/src/module.rs b/rust-lib/flowy-user/src/module.rs
index bb2aa6a51e..0660602068 100644
--- a/rust-lib/flowy-user/src/module.rs
+++ b/rust-lib/flowy-user/src/module.rs
@@ -1,4 +1,4 @@
-use flowy_dispatch::prelude::*;
+use lib_dispatch::prelude::*;
use crate::{event::UserEvent, handlers::*, services::user::UserSession};
use std::sync::Arc;
diff --git a/rust-lib/flowy-user/src/services/server/mod.rs b/rust-lib/flowy-user/src/services/server/mod.rs
index 1eafc6cc47..4f45b2efb1 100644
--- a/rust-lib/flowy-user/src/services/server/mod.rs
+++ b/rust-lib/flowy-user/src/services/server/mod.rs
@@ -9,8 +9,8 @@ use crate::{
entities::{SignInParams, SignInResponse, SignUpParams, SignUpResponse, UpdateUserParams, UserProfile},
errors::UserError,
};
-use flowy_infra::future::ResultFuture;
use flowy_net::config::ServerConfig;
+use lib_infra::future::ResultFuture;
pub trait UserServerAPI {
fn sign_up(&self, params: SignUpParams) -> ResultFuture<SignUpResponse, UserError>;
diff --git a/rust-lib/flowy-user/src/services/server/server_api.rs b/rust-lib/flowy-user/src/services/server/server_api.rs
index 07c6004e52..d08d3e00b8 100644
--- a/rust-lib/flowy-user/src/services/server/server_api.rs
+++ b/rust-lib/flowy-user/src/services/server/server_api.rs
@@ -4,8 +4,8 @@ use crate::{
services::server::UserServerAPI,
};
use flowy_backend_api::user_request::*;
-use flowy_infra::future::ResultFuture;
use flowy_net::config::*;
+use lib_infra::future::ResultFuture;
pub struct UserServer {
config: ServerConfig,
diff --git a/rust-lib/flowy-user/src/services/server/server_api_mock.rs b/rust-lib/flowy-user/src/services/server/server_api_mock.rs
index ac73f3a370..53f18f366a 100644
--- a/rust-lib/flowy-user/src/services/server/server_api_mock.rs
+++ b/rust-lib/flowy-user/src/services/server/server_api_mock.rs
@@ -4,7 +4,7 @@ use crate::{
};
use crate::services::server::UserServerAPI;
-use flowy_infra::{future::ResultFuture, uuid};
+use lib_infra::{future::ResultFuture, uuid};
pub struct UserServerMock {}
diff --git a/rust-lib/flowy-user/src/services/user/database.rs b/rust-lib/flowy-user/src/services/user/database.rs
index 354b5afe13..c5d6352b08 100644
--- a/rust-lib/flowy-user/src/services/user/database.rs
+++ b/rust-lib/flowy-user/src/services/user/database.rs
@@ -1,7 +1,7 @@
use crate::errors::UserError;
use flowy_database::{DBConnection, Database};
-use flowy_sqlite::ConnectionPool;
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};
diff --git a/rust-lib/flowy-user/src/services/user/user_session.rs b/rust-lib/flowy-user/src/services/user/user_session.rs
index 5dc13abf09..54e8161927 100644
--- a/rust-lib/flowy-user/src/services/user/user_session.rs
+++ b/rust-lib/flowy-user/src/services/user/user_session.rs
@@ -16,10 +16,10 @@ use flowy_database::{
ExpressionMethods,
UserDatabaseConnection,
};
-use flowy_infra::kv::KV;
use flowy_net::config::ServerConfig;
-use flowy_sqlite::ConnectionPool;
-use flowy_ws::{WsController, WsMessageHandler, WsState};
+use lib_infra::kv::KV;
+use lib_sqlite::ConnectionPool;
+use lib_ws::{WsController, WsMessageHandler, WsState};
use parking_lot::RwLock;
use serde::{Deserialize, Serialize};
use std::sync::Arc;
diff --git a/rust-lib/flowy-user/tests/event/user_profile_test.rs b/rust-lib/flowy-user/tests/event/user_profile_test.rs
index 3b7bdef947..8ef97e6fe6 100644
--- a/rust-lib/flowy-user/tests/event/user_profile_test.rs
+++ b/rust-lib/flowy-user/tests/event/user_profile_test.rs
@@ -1,7 +1,7 @@
use crate::helper::*;
-use flowy_infra::uuid;
use flowy_test::{builder::UserTest, FlowyTest};
use flowy_user::{errors::ErrorCode, event::UserEvent::*, prelude::*};
+use lib_infra::uuid;
use serial_test::*;
#[tokio::test]
diff --git a/rust-lib/flowy-workspace/Cargo.toml b/rust-lib/flowy-workspace/Cargo.toml
index f958c76909..59450d3bd9 100644
--- a/rust-lib/flowy-workspace/Cargo.toml
+++ b/rust-lib/flowy-workspace/Cargo.toml
@@ -9,13 +9,13 @@ edition = "2018"
flowy-workspace-infra = { path = "../flowy-workspace-infra" }
flowy-document-infra = { path = "../flowy-document-infra" }
flowy-document = { path = "../flowy-document" }
-flowy-dispatch = { path = "../lib-dispatch" }
+lib-dispatch = { path = "../lib-dispatch" }
flowy-derive = { path = "../flowy-derive" }
flowy-database = { path = "../flowy-database" }
-flowy-sqlite = { path = "../lib-sqlite" }
-flowy-infra = { path = "../lib-infra" }
+lib-sqlite = { path = "../lib-sqlite" }
+lib-infra = { path = "../lib-infra" }
flowy-dart-notify = { path = "../dart-notify" }
-flowy-ot = { path = "../lib-ot" }
+lib-ot = { path = "../lib-ot" }
flowy-net = { path = "../flowy-net", features = ["flowy_request"] }
flowy-backend-api = { path = "../flowy-backend-api"}
diff --git a/rust-lib/flowy-workspace/src/errors.rs b/rust-lib/flowy-workspace/src/errors.rs
index 754ddca5c4..a048059cee 100644
--- a/rust-lib/flowy-workspace/src/errors.rs
+++ b/rust-lib/flowy-workspace/src/errors.rs
@@ -1,10 +1,10 @@
use bytes::Bytes;
use flowy_derive::ProtoBuf;
-use flowy_dispatch::prelude::{EventResponse, ResponseBuilder};
use flowy_document::errors::DocError;
use flowy_net::errors::ErrorCode as ServerErrorCode;
pub use flowy_workspace_infra::errors::ErrorCode;
+use lib_dispatch::prelude::{EventResponse, ResponseBuilder};
use std::{convert::TryInto, fmt, fmt::Debug};
pub type WorkspaceResult<T> = std::result::Result<T, WorkspaceError>;
@@ -86,7 +86,7 @@ impl std::convert::From<flowy_database::Error> for WorkspaceError {
fn from(error: flowy_database::Error) -> Self { WorkspaceError::internal().context(error) }
}
-impl flowy_dispatch::Error for WorkspaceError {
+impl lib_dispatch::Error for WorkspaceError {
fn as_response(&self) -> EventResponse {
let bytes: Bytes = self.clone().try_into().unwrap();
ResponseBuilder::Err().data(bytes).build()
diff --git a/rust-lib/flowy-workspace/src/handlers/app_handler.rs b/rust-lib/flowy-workspace/src/handlers/app_handler.rs
index 1f1e7d8864..38799288db 100644
--- a/rust-lib/flowy-workspace/src/handlers/app_handler.rs
+++ b/rust-lib/flowy-workspace/src/handlers/app_handler.rs
@@ -14,7 +14,7 @@ use crate::{
errors::WorkspaceError,
services::{AppController, TrashCan, ViewController},
};
-use flowy_dispatch::prelude::{data_result, Data, DataResult, Unit};
+use lib_dispatch::prelude::{data_result, Data, DataResult, Unit};
use std::{convert::TryInto, sync::Arc};
pub(crate) async fn create_app_handler(
diff --git a/rust-lib/flowy-workspace/src/handlers/trash_handler.rs b/rust-lib/flowy-workspace/src/handlers/trash_handler.rs
index 774bdc011c..dff81964e8 100644
--- a/rust-lib/flowy-workspace/src/handlers/trash_handler.rs
+++ b/rust-lib/flowy-workspace/src/handlers/trash_handler.rs
@@ -3,7 +3,7 @@ use crate::{
errors::WorkspaceError,
services::TrashCan,
};
-use flowy_dispatch::prelude::{data_result, Data, DataResult, Unit};
+use lib_dispatch::prelude::{data_result, Data, DataResult, Unit};
use std::sync::Arc;
#[tracing::instrument(skip(controller), err)]
diff --git a/rust-lib/flowy-workspace/src/handlers/view_handler.rs b/rust-lib/flowy-workspace/src/handlers/view_handler.rs
index 1bfeea3f3d..81487aaa2d 100644
--- a/rust-lib/flowy-workspace/src/handlers/view_handler.rs
+++ b/rust-lib/flowy-workspace/src/handlers/view_handler.rs
@@ -15,9 +15,9 @@ use crate::{
errors::WorkspaceError,
services::{TrashCan, ViewController},
};
-use flowy_dispatch::prelude::{data_result, Data, DataResult, Unit};
use flowy_document_infra::entities::doc::DocDelta;
use flowy_workspace_infra::entities::share::{ExportData, ExportParams, ExportRequest};
+use lib_dispatch::prelude::{data_result, Data, DataResult, Unit};
use std::{convert::TryInto, sync::Arc};
pub(crate) async fn create_view_handler(
diff --git a/rust-lib/flowy-workspace/src/handlers/workspace_handler.rs b/rust-lib/flowy-workspace/src/handlers/workspace_handler.rs
index badd50b63e..4060a2ec16 100644
--- a/rust-lib/flowy-workspace/src/handlers/workspace_handler.rs
+++ b/rust-lib/flowy-workspace/src/handlers/workspace_handler.rs
@@ -1,7 +1,7 @@
use crate::{errors::WorkspaceError, services::WorkspaceController};
-use flowy_dispatch::prelude::{data_result, Data, DataResult, Unit};
use flowy_workspace_infra::entities::{app::RepeatedApp, workspace::*};
+use lib_dispatch::prelude::{data_result, Data, DataResult, Unit};
use std::{convert::TryInto, sync::Arc};
#[tracing::instrument(skip(data, controller), err)]
diff --git a/rust-lib/flowy-workspace/src/module.rs b/rust-lib/flowy-workspace/src/module.rs
index 08f24cc482..3098eb494f 100644
--- a/rust-lib/flowy-workspace/src/module.rs
+++ b/rust-lib/flowy-workspace/src/module.rs
@@ -5,10 +5,10 @@ use crate::{
services::{server::construct_workspace_server, AppController, TrashCan, ViewController, WorkspaceController},
};
use flowy_database::DBConnection;
-use flowy_dispatch::prelude::*;
use flowy_document::module::FlowyDocument;
use flowy_net::config::ServerConfig;
-use flowy_sqlite::ConnectionPool;
+use lib_dispatch::prelude::*;
+use lib_sqlite::ConnectionPool;
use std::sync::Arc;
pub trait WorkspaceDeps: WorkspaceUser + WorkspaceDatabase {}
diff --git a/rust-lib/flowy-workspace/src/services/server/mod.rs b/rust-lib/flowy-workspace/src/services/server/mod.rs
index 43452b93c5..0d966fae63 100644
--- a/rust-lib/flowy-workspace/src/services/server/mod.rs
+++ b/rust-lib/flowy-workspace/src/services/server/mod.rs
@@ -14,8 +14,8 @@ use crate::{
},
errors::WorkspaceError,
};
-use flowy_infra::future::ResultFuture;
use flowy_net::config::ServerConfig;
+use lib_infra::future::ResultFuture;
use std::sync::Arc;
pub(crate) type Server = Arc<dyn WorkspaceServerAPI + Send + Sync>;
diff --git a/rust-lib/flowy-workspace/src/services/server/server_api.rs b/rust-lib/flowy-workspace/src/services/server/server_api.rs
index 4e34319dd6..295c63a296 100644
--- a/rust-lib/flowy-workspace/src/services/server/server_api.rs
+++ b/rust-lib/flowy-workspace/src/services/server/server_api.rs
@@ -10,9 +10,9 @@ use crate::{
services::server::WorkspaceServerAPI,
};
use flowy_backend_api::{middleware::*, workspace_request::*};
-use flowy_infra::future::ResultFuture;
use flowy_net::config::ServerConfig;
use flowy_workspace_infra::errors::ErrorCode;
+use lib_infra::future::ResultFuture;
pub struct WorkspaceServer {
config: ServerConfig,
diff --git a/rust-lib/flowy-workspace/src/services/server/server_api_mock.rs b/rust-lib/flowy-workspace/src/services/server/server_api_mock.rs
index a804b73f62..7a3093472f 100644
--- a/rust-lib/flowy-workspace/src/services/server/server_api_mock.rs
+++ b/rust-lib/flowy-workspace/src/services/server/server_api_mock.rs
@@ -8,7 +8,7 @@ use crate::{
errors::WorkspaceError,
services::server::WorkspaceServerAPI,
};
-use flowy_infra::{future::ResultFuture, timestamp, uuid};
+use lib_infra::{future::ResultFuture, timestamp, uuid};
pub struct WorkspaceServerMock {}
diff --git a/rust-lib/flowy-workspace/src/services/view_controller.rs b/rust-lib/flowy-workspace/src/services/view_controller.rs
index 53996b5702..51382c6213 100644
--- a/rust-lib/flowy-workspace/src/services/view_controller.rs
+++ b/rust-lib/flowy-workspace/src/services/view_controller.rs
@@ -15,8 +15,8 @@ use crate::{
sql_tables::view::{ViewTable, ViewTableChangeset, ViewTableSql},
};
use flowy_document::module::FlowyDocument;
-use flowy_infra::kv::KV;
use flowy_workspace_infra::entities::share::{ExportData, ExportParams};
+use lib_infra::kv::KV;
const LATEST_VIEW_ID: &str = "latest_view_id";
diff --git a/rust-lib/flowy-workspace/src/services/workspace_controller.rs b/rust-lib/flowy-workspace/src/services/workspace_controller.rs
index 83373aab3c..1cfc3f1c25 100644
--- a/rust-lib/flowy-workspace/src/services/workspace_controller.rs
+++ b/rust-lib/flowy-workspace/src/services/workspace_controller.rs
@@ -8,12 +8,12 @@ use crate::{
use chrono::Utc;
use flowy_database::SqliteConnection;
use flowy_document_infra::{entities::doc::DocDelta, user_default::initial_read_me};
-use flowy_infra::kv::KV;
use flowy_workspace_infra::{
entities::{app::RepeatedApp, view::View, workspace::*},
user_default,
};
use lazy_static::lazy_static;
+use lib_infra::kv::KV;
use parking_lot::RwLock;
use std::{collections::HashMap, sync::Arc};
diff --git a/rust-lib/flowy-workspace/src/sql_tables/view/view_table.rs b/rust-lib/flowy-workspace/src/sql_tables/view/view_table.rs
index 088d1889a4..9957d0c9f8 100644
--- a/rust-lib/flowy-workspace/src/sql_tables/view/view_table.rs
+++ b/rust-lib/flowy-workspace/src/sql_tables/view/view_table.rs
@@ -1,7 +1,7 @@
use diesel::sql_types::Integer;
use flowy_database::schema::view_table;
-use flowy_infra::timestamp;
+use lib_infra::timestamp;
use crate::{
entities::{
diff --git a/rust-lib/flowy-workspace/src/util.rs b/rust-lib/flowy-workspace/src/util.rs
index e1cfbf3bc7..d1efb8bd9a 100644
--- a/rust-lib/flowy-workspace/src/util.rs
+++ b/rust-lib/flowy-workspace/src/util.rs
@@ -1,5 +1,5 @@
use crate::{module::WorkspaceUser, services::server::Server};
-use flowy_infra::retry::Action;
+use lib_infra::retry::Action;
use pin_project::pin_project;
use std::{
future::Future,
diff --git a/rust-lib/lib-dispatch/Cargo.toml b/rust-lib/lib-dispatch/Cargo.toml
index b38e1fe3bc..b681ee15df 100644
--- a/rust-lib/lib-dispatch/Cargo.toml
+++ b/rust-lib/lib-dispatch/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "flowy-dispatch"
+name = "lib-dispatch"
version = "0.1.0"
edition = "2018"
diff --git a/rust-lib/lib-dispatch/tests/api/module.rs b/rust-lib/lib-dispatch/tests/api/module.rs
index 4b9e8d06be..ad997c2c3c 100644
--- a/rust-lib/lib-dispatch/tests/api/module.rs
+++ b/rust-lib/lib-dispatch/tests/api/module.rs
@@ -1,4 +1,4 @@
-use flowy_dispatch::prelude::*;
+use lib_dispatch::prelude::*;
use std::sync::Arc;
pub async fn hello() -> String { "say hello".to_string() }
diff --git a/rust-lib/lib-infra/Cargo.toml b/rust-lib/lib-infra/Cargo.toml
index f9db9d6994..0113d25fa4 100644
--- a/rust-lib/lib-infra/Cargo.toml
+++ b/rust-lib/lib-infra/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "flowy-infra"
+name = "lib-infra"
version = "0.1.0"
edition = "2018"
@@ -11,7 +11,7 @@ diesel = {version = "1.4.8", features = ["sqlite"]}
diesel_derives = {version = "1.4.1", features = ["sqlite"]}
diesel_migrations = {version = "1.4.0", features = ["sqlite"]}
flowy-derive = { path = "../flowy-derive"}
-flowy-sqlite = { path = "../lib-sqlite" }
+lib-sqlite = { path = "../lib-sqlite" }
lazy_static = "1.4.0"
protobuf = {version = "2.18.0"}
log = "0.4.14"
diff --git a/rust-lib/lib-infra/src/kv/kv.rs b/rust-lib/lib-infra/src/kv/kv.rs
index 3d4fbb8a0e..59f60f66c1 100644
--- a/rust-lib/lib-infra/src/kv/kv.rs
+++ b/rust-lib/lib-infra/src/kv/kv.rs
@@ -2,8 +2,8 @@ use crate::kv::schema::{kv_table, kv_table::dsl, KV_SQL};
use ::diesel::{query_dsl::*, ExpressionMethods};
use diesel::{Connection, SqliteConnection};
use flowy_derive::ProtoBuf;
-use flowy_sqlite::{DBConnection, Database, PoolConfig};
use lazy_static::lazy_static;
+use lib_sqlite::{DBConnection, Database, PoolConfig};
use std::{collections::HashMap, path::Path, sync::RwLock};
const DB_NAME: &str = "kv.db";
diff --git a/rust-lib/lib-ot/Cargo.toml b/rust-lib/lib-ot/Cargo.toml
index 4aa217b322..2fa2437165 100644
--- a/rust-lib/lib-ot/Cargo.toml
+++ b/rust-lib/lib-ot/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "flowy-ot"
+name = "lib-ot"
version = "0.1.0"
edition = "2018"
diff --git a/rust-lib/lib-sqlite/Cargo.toml b/rust-lib/lib-sqlite/Cargo.toml
index 13672634dc..c2ff3db7c8 100644
--- a/rust-lib/lib-sqlite/Cargo.toml
+++ b/rust-lib/lib-sqlite/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "flowy-sqlite"
+name = "lib-sqlite"
version = "0.1.0"
edition = "2018"
diff --git a/rust-lib/lib-ws/Cargo.toml b/rust-lib/lib-ws/Cargo.toml
index 695495fe98..6553edf0a7 100644
--- a/rust-lib/lib-ws/Cargo.toml
+++ b/rust-lib/lib-ws/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "flowy-ws"
+name = "lib-ws"
version = "0.1.0"
edition = "2018"
@@ -8,7 +8,7 @@ edition = "2018"
[dependencies]
flowy-derive = { path = "../flowy-derive" }
flowy-net = { path = "../flowy-net" }
-flowy-infra = { path = "../lib-infra" }
+lib-infra = { path = "../lib-infra" }
tokio-tungstenite = "0.15"
futures-util = "0.3.17"
diff --git a/rust-lib/lib-ws/src/ws.rs b/rust-lib/lib-ws/src/ws.rs
index ae92aa2001..ce6226550c 100644
--- a/rust-lib/lib-ws/src/ws.rs
+++ b/rust-lib/lib-ws/src/ws.rs
@@ -6,10 +6,10 @@ use crate::{
};
use bytes::Bytes;
use dashmap::DashMap;
-use flowy_infra::retry::{Action, FixedInterval, Retry};
use flowy_net::errors::ServerError;
use futures_channel::mpsc::{UnboundedReceiver, UnboundedSender};
use futures_core::{ready, Stream};
+use lib_infra::retry::{Action, FixedInterval, Retry};
use parking_lot::RwLock;
use pin_project::pin_project;
use std::{