mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
[rust]: Crates start with lib consider as foundation libs
This commit is contained in:
parent
80d1b3072d
commit
2449e9352c
@ -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"
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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)]
|
||||
|
@ -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)]
|
||||
|
@ -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]
|
||||
// ┌─────────┐ ┌─────────┐
|
||||
|
@ -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 {
|
||||
|
@ -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",
|
||||
|
@ -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" }
|
||||
|
@ -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) {
|
||||
|
@ -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)]
|
||||
|
@ -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 {
|
||||
|
@ -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 = []
|
@ -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,
|
||||
|
@ -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" }
|
||||
lib-sqlite = {path = "../lib-sqlite" }
|
@ -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)
|
||||
|
@ -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"
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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();
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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::*;
|
||||
|
@ -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,
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use flowy_ot::core::Delta;
|
||||
use lib_ot::core::Delta;
|
||||
|
||||
const MAX_UNDOS: usize = 20;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::core::extensions::*;
|
||||
use flowy_ot::{
|
||||
use lib_ot::{
|
||||
core::{trim, Attribute, Delta, Interval},
|
||||
errors::{ErrorBuilder, OTError, OTErrorCode},
|
||||
};
|
||||
|
@ -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 {
|
||||
|
@ -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)]
|
||||
|
@ -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 {
|
||||
|
@ -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() }
|
||||
|
@ -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]
|
||||
|
@ -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"] }
|
||||
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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};
|
||||
|
||||
|
@ -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};
|
||||
|
||||
|
@ -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};
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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},
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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 {}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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]
|
||||
|
@ -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};
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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"] }
|
||||
|
@ -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"
|
||||
|
@ -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 {
|
||||
|
@ -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),
|
||||
}
|
||||
|
@ -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> {
|
||||
|
@ -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"}
|
||||
|
@ -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;
|
||||
|
@ -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},
|
||||
|
@ -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;
|
||||
|
@ -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"] }
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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};
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
use flowy_dispatch::prelude::*;
|
||||
use lib_dispatch::prelude::*;
|
||||
|
||||
use crate::{event::UserEvent, handlers::*, services::user::UserSession};
|
||||
use std::sync::Arc;
|
||||
|
@ -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>;
|
||||
|
@ -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,
|
||||
|
@ -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 {}
|
||||
|
||||
|
@ -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};
|
||||
|
@ -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;
|
||||
|
@ -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]
|
||||
|
@ -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"}
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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(
|
||||
|
@ -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)]
|
||||
|
@ -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(
|
||||
|
@ -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)]
|
||||
|
@ -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 {}
|
||||
|
@ -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>;
|
||||
|
@ -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,
|
||||
|
@ -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 {}
|
||||
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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};
|
||||
|
||||
|
@ -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::{
|
||||
|
@ -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,
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "flowy-dispatch"
|
||||
name = "lib-dispatch"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
|
@ -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() }
|
||||
|
@ -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"
|
||||
|
@ -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";
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "flowy-ot"
|
||||
name = "lib-ot"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "flowy-sqlite"
|
||||
name = "lib-sqlite"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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::{
|
||||
|
Loading…
Reference in New Issue
Block a user