chore: add read view info event

This commit is contained in:
appflowy 2022-06-14 08:37:44 +08:00
parent f8ec4b3e24
commit ae4cc496fc
23 changed files with 289 additions and 96 deletions

View File

@ -1,3 +1,5 @@
// ignore_for_file: unused_field
import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart';
import 'package:flutter/material.dart';

View File

@ -253,6 +253,40 @@ class FolderEventDuplicateView {
}
}
class FolderEventCloseView {
ViewId request;
FolderEventCloseView(this.request);
Future<Either<Unit, FlowyError>> send() {
final request = FFIRequest.create()
..event = FolderEvent.CloseView.toString()
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(bytes) => left(unit),
(errBytes) => right(FlowyError.fromBuffer(errBytes)),
));
}
}
class FolderEventReadViewInfo {
ViewId request;
FolderEventReadViewInfo(this.request);
Future<Either<ViewInfo, FlowyError>> send() {
final request = FFIRequest.create()
..event = FolderEvent.ReadViewInfo.toString()
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(okBytes) => left(ViewInfo.fromBuffer(okBytes)),
(errBytes) => right(FlowyError.fromBuffer(errBytes)),
));
}
}
class FolderEventCopyLink {
FolderEventCopyLink();
@ -284,23 +318,6 @@ class FolderEventSetLatestView {
}
}
class FolderEventCloseView {
ViewId request;
FolderEventCloseView(this.request);
Future<Either<Unit, FlowyError>> send() {
final request = FFIRequest.create()
..event = FolderEvent.CloseView.toString()
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(bytes) => left(unit),
(errBytes) => right(FlowyError.fromBuffer(errBytes)),
));
}
}
class FolderEventMoveFolderItem {
MoveFolderItemPayload request;
FolderEventMoveFolderItem(this.request);

View File

@ -25,10 +25,11 @@ class FolderEvent extends $pb.ProtobufEnum {
static const FolderEvent UpdateView = FolderEvent._(203, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'UpdateView');
static const FolderEvent DeleteView = FolderEvent._(204, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DeleteView');
static const FolderEvent DuplicateView = FolderEvent._(205, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DuplicateView');
static const FolderEvent CopyLink = FolderEvent._(206, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CopyLink');
static const FolderEvent SetLatestView = FolderEvent._(207, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'SetLatestView');
static const FolderEvent CloseView = FolderEvent._(208, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CloseView');
static const FolderEvent MoveFolderItem = FolderEvent._(209, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'MoveFolderItem');
static const FolderEvent CloseView = FolderEvent._(206, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CloseView');
static const FolderEvent ReadViewInfo = FolderEvent._(207, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ReadViewInfo');
static const FolderEvent CopyLink = FolderEvent._(220, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'CopyLink');
static const FolderEvent SetLatestView = FolderEvent._(221, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'SetLatestView');
static const FolderEvent MoveFolderItem = FolderEvent._(230, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'MoveFolderItem');
static const FolderEvent ReadTrash = FolderEvent._(300, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'ReadTrash');
static const FolderEvent PutbackTrash = FolderEvent._(301, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'PutbackTrash');
static const FolderEvent DeleteTrash = FolderEvent._(302, const $core.bool.fromEnvironment('protobuf.omit_enum_names') ? '' : 'DeleteTrash');
@ -51,9 +52,10 @@ class FolderEvent extends $pb.ProtobufEnum {
UpdateView,
DeleteView,
DuplicateView,
CloseView,
ReadViewInfo,
CopyLink,
SetLatestView,
CloseView,
MoveFolderItem,
ReadTrash,
PutbackTrash,

View File

@ -27,10 +27,11 @@ const FolderEvent$json = const {
const {'1': 'UpdateView', '2': 203},
const {'1': 'DeleteView', '2': 204},
const {'1': 'DuplicateView', '2': 205},
const {'1': 'CopyLink', '2': 206},
const {'1': 'SetLatestView', '2': 207},
const {'1': 'CloseView', '2': 208},
const {'1': 'MoveFolderItem', '2': 209},
const {'1': 'CloseView', '2': 206},
const {'1': 'ReadViewInfo', '2': 207},
const {'1': 'CopyLink', '2': 220},
const {'1': 'SetLatestView', '2': 221},
const {'1': 'MoveFolderItem', '2': 230},
const {'1': 'ReadTrash', '2': 300},
const {'1': 'PutbackTrash', '2': 301},
const {'1': 'DeleteTrash', '2': 302},
@ -40,4 +41,4 @@ const FolderEvent$json = const {
};
/// Descriptor for `FolderEvent`. Decode as a `google.protobuf.EnumDescriptorProto`.
final $typed_data.Uint8List folderEventDescriptor = $convert.base64Decode('CgtGb2xkZXJFdmVudBITCg9DcmVhdGVXb3Jrc3BhY2UQABIUChBSZWFkQ3VyV29ya3NwYWNlEAESEgoOUmVhZFdvcmtzcGFjZXMQAhITCg9EZWxldGVXb3Jrc3BhY2UQAxIRCg1PcGVuV29ya3NwYWNlEAQSFQoRUmVhZFdvcmtzcGFjZUFwcHMQBRINCglDcmVhdGVBcHAQZRINCglEZWxldGVBcHAQZhILCgdSZWFkQXBwEGcSDQoJVXBkYXRlQXBwEGgSDwoKQ3JlYXRlVmlldxDJARINCghSZWFkVmlldxDKARIPCgpVcGRhdGVWaWV3EMsBEg8KCkRlbGV0ZVZpZXcQzAESEgoNRHVwbGljYXRlVmlldxDNARINCghDb3B5TGluaxDOARISCg1TZXRMYXRlc3RWaWV3EM8BEg4KCUNsb3NlVmlldxDQARITCg5Nb3ZlRm9sZGVySXRlbRDRARIOCglSZWFkVHJhc2gQrAISEQoMUHV0YmFja1RyYXNoEK0CEhAKC0RlbGV0ZVRyYXNoEK4CEhQKD1Jlc3RvcmVBbGxUcmFzaBCvAhITCg5EZWxldGVBbGxUcmFzaBCwAg==');
final $typed_data.Uint8List folderEventDescriptor = $convert.base64Decode('CgtGb2xkZXJFdmVudBITCg9DcmVhdGVXb3Jrc3BhY2UQABIUChBSZWFkQ3VyV29ya3NwYWNlEAESEgoOUmVhZFdvcmtzcGFjZXMQAhITCg9EZWxldGVXb3Jrc3BhY2UQAxIRCg1PcGVuV29ya3NwYWNlEAQSFQoRUmVhZFdvcmtzcGFjZUFwcHMQBRINCglDcmVhdGVBcHAQZRINCglEZWxldGVBcHAQZhILCgdSZWFkQXBwEGcSDQoJVXBkYXRlQXBwEGgSDwoKQ3JlYXRlVmlldxDJARINCghSZWFkVmlldxDKARIPCgpVcGRhdGVWaWV3EMsBEg8KCkRlbGV0ZVZpZXcQzAESEgoNRHVwbGljYXRlVmlldxDNARIOCglDbG9zZVZpZXcQzgESEQoMUmVhZFZpZXdJbmZvEM8BEg0KCENvcHlMaW5rENwBEhIKDVNldExhdGVzdFZpZXcQ3QESEwoOTW92ZUZvbGRlckl0ZW0Q5gESDgoJUmVhZFRyYXNoEKwCEhEKDFB1dGJhY2tUcmFzaBCtAhIQCgtEZWxldGVUcmFzaBCuAhIUCg9SZXN0b3JlQWxsVHJhc2gQrwISEwoORGVsZXRlQWxsVHJhc2gQsAI=');

View File

@ -591,12 +591,13 @@ dependencies = [
[[package]]
name = "dashmap"
version = "4.0.2"
version = "5.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c"
checksum = "4c8858831f7781322e539ea39e72449c46b059638250c14344fec8d0aa6e539c"
dependencies = [
"cfg-if",
"num_cpus",
"parking_lot 0.12.1",
]
[[package]]
@ -887,7 +888,7 @@ dependencies = [
"lib-infra",
"lib-ot",
"log",
"parking_lot",
"parking_lot 0.11.2",
"pin-project",
"protobuf",
"serde",
@ -1002,7 +1003,7 @@ dependencies = [
"lib-ws",
"log",
"nanoid",
"parking_lot",
"parking_lot 0.11.2",
"protobuf",
"reqwest",
"serde",
@ -1061,7 +1062,7 @@ dependencies = [
"lib-log",
"lib-ws",
"log",
"parking_lot",
"parking_lot 0.11.2",
"protobuf",
"serde",
"tokio",
@ -1085,7 +1086,7 @@ dependencies = [
"lib-ot",
"log",
"md5",
"parking_lot",
"parking_lot 0.11.2",
"protobuf",
"serde",
"serde_json",
@ -1187,7 +1188,7 @@ dependencies = [
"log",
"nanoid",
"once_cell",
"parking_lot",
"parking_lot 0.11.2",
"protobuf",
"serde",
"serde_json",
@ -1806,7 +1807,7 @@ dependencies = [
"futures-util",
"lib-infra",
"log",
"parking_lot",
"parking_lot 0.11.2",
"paste",
"pin-project",
"protobuf",
@ -1843,9 +1844,9 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
[[package]]
name = "lock_api"
version = "0.4.5"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109"
checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b"
dependencies = [
"scopeguard",
]
@ -2126,7 +2127,17 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
"lock_api",
"parking_lot_core",
"parking_lot_core 0.8.5",
]
[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core 0.9.3",
]
[[package]]
@ -2143,6 +2154,19 @@ dependencies = [
"winapi",
]
[[package]]
name = "parking_lot_core"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
dependencies = [
"cfg-if",
"libc",
"redox_syscall 0.2.10",
"smallvec",
"windows-sys",
]
[[package]]
name = "parse-zoneinfo"
version = "0.3.0"
@ -2526,7 +2550,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "545c5bc2b880973c9c10e4067418407a0ccaa3091781d1671d46eb35107cb26f"
dependencies = [
"log",
"parking_lot",
"parking_lot 0.11.2",
"scheduled-thread-pool",
]
@ -2804,7 +2828,7 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc6f74fd1204073fa02d5d5d68bec8021be4c38690b61264b2fdb48083d0e7d7"
dependencies = [
"parking_lot",
"parking_lot 0.11.2",
]
[[package]]
@ -2947,7 +2971,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0bccbcf40c8938196944a3da0e133e031a33f4d6b72db3bda3cc556e361905d"
dependencies = [
"lazy_static",
"parking_lot",
"parking_lot 0.11.2",
"serial_test_derive",
]
@ -3241,7 +3265,7 @@ dependencies = [
"mio",
"num_cpus",
"once_cell",
"parking_lot",
"parking_lot 0.11.2",
"pin-project-lite",
"signal-hook-registry",
"tokio-macros",
@ -3766,6 +3790,49 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
dependencies = [
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
[[package]]
name = "windows_i686_gnu"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
[[package]]
name = "windows_i686_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
[[package]]
name = "windows_x86_64_gnu"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
[[package]]
name = "windows_x86_64_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"
[[package]]
name = "winreg"
version = "0.7.0"

View File

@ -59,6 +59,7 @@ pub fn create(folder: Arc<FolderManager>) -> Module {
module = module
.event(FolderEvent::CreateView, create_view_handler)
.event(FolderEvent::ReadView, read_view_handler)
.event(FolderEvent::ReadViewInfo, read_view_info_handler)
.event(FolderEvent::UpdateView, update_view_handler)
.event(FolderEvent::DeleteView, delete_view_handler)
.event(FolderEvent::DuplicateView, duplicate_view_handler)
@ -124,17 +125,20 @@ pub enum FolderEvent {
#[event(input = "ViewId")]
DuplicateView = 205,
#[event(input = "ViewId")]
CloseView = 206,
#[event(input = "ViewId", output = "ViewInfo")]
ReadViewInfo = 207,
#[event()]
CopyLink = 206,
CopyLink = 220,
#[event(input = "ViewId")]
SetLatestView = 207,
#[event(input = "ViewId")]
CloseView = 208,
SetLatestView = 221,
#[event(input = "MoveFolderItemPayload")]
MoveFolderItem = 209,
MoveFolderItem = 230,
#[event(output = "RepeatedTrash")]
ReadTrash = 300,

View File

@ -40,10 +40,11 @@ pub enum FolderEvent {
UpdateView = 203,
DeleteView = 204,
DuplicateView = 205,
CopyLink = 206,
SetLatestView = 207,
CloseView = 208,
MoveFolderItem = 209,
CloseView = 206,
ReadViewInfo = 207,
CopyLink = 220,
SetLatestView = 221,
MoveFolderItem = 230,
ReadTrash = 300,
PutbackTrash = 301,
DeleteTrash = 302,
@ -73,10 +74,11 @@ impl ::protobuf::ProtobufEnum for FolderEvent {
203 => ::std::option::Option::Some(FolderEvent::UpdateView),
204 => ::std::option::Option::Some(FolderEvent::DeleteView),
205 => ::std::option::Option::Some(FolderEvent::DuplicateView),
206 => ::std::option::Option::Some(FolderEvent::CopyLink),
207 => ::std::option::Option::Some(FolderEvent::SetLatestView),
208 => ::std::option::Option::Some(FolderEvent::CloseView),
209 => ::std::option::Option::Some(FolderEvent::MoveFolderItem),
206 => ::std::option::Option::Some(FolderEvent::CloseView),
207 => ::std::option::Option::Some(FolderEvent::ReadViewInfo),
220 => ::std::option::Option::Some(FolderEvent::CopyLink),
221 => ::std::option::Option::Some(FolderEvent::SetLatestView),
230 => ::std::option::Option::Some(FolderEvent::MoveFolderItem),
300 => ::std::option::Option::Some(FolderEvent::ReadTrash),
301 => ::std::option::Option::Some(FolderEvent::PutbackTrash),
302 => ::std::option::Option::Some(FolderEvent::DeleteTrash),
@ -103,9 +105,10 @@ impl ::protobuf::ProtobufEnum for FolderEvent {
FolderEvent::UpdateView,
FolderEvent::DeleteView,
FolderEvent::DuplicateView,
FolderEvent::CloseView,
FolderEvent::ReadViewInfo,
FolderEvent::CopyLink,
FolderEvent::SetLatestView,
FolderEvent::CloseView,
FolderEvent::MoveFolderItem,
FolderEvent::ReadTrash,
FolderEvent::PutbackTrash,
@ -140,19 +143,19 @@ impl ::protobuf::reflect::ProtobufValue for FolderEvent {
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x0fevent_map.proto*\xc3\x03\n\x0bFolderEvent\x12\x13\n\x0fCreateWorks\
\n\x0fevent_map.proto*\xd6\x03\n\x0bFolderEvent\x12\x13\n\x0fCreateWorks\
pace\x10\0\x12\x14\n\x10ReadCurWorkspace\x10\x01\x12\x12\n\x0eReadWorksp\
aces\x10\x02\x12\x13\n\x0fDeleteWorkspace\x10\x03\x12\x11\n\rOpenWorkspa\
ce\x10\x04\x12\x15\n\x11ReadWorkspaceApps\x10\x05\x12\r\n\tCreateApp\x10\
e\x12\r\n\tDeleteApp\x10f\x12\x0b\n\x07ReadApp\x10g\x12\r\n\tUpdateApp\
\x10h\x12\x0f\n\nCreateView\x10\xc9\x01\x12\r\n\x08ReadView\x10\xca\x01\
\x12\x0f\n\nUpdateView\x10\xcb\x01\x12\x0f\n\nDeleteView\x10\xcc\x01\x12\
\x12\n\rDuplicateView\x10\xcd\x01\x12\r\n\x08CopyLink\x10\xce\x01\x12\
\x12\n\rSetLatestView\x10\xcf\x01\x12\x0e\n\tCloseView\x10\xd0\x01\x12\
\x13\n\x0eMoveFolderItem\x10\xd1\x01\x12\x0e\n\tReadTrash\x10\xac\x02\
\x12\x11\n\x0cPutbackTrash\x10\xad\x02\x12\x10\n\x0bDeleteTrash\x10\xae\
\x02\x12\x14\n\x0fRestoreAllTrash\x10\xaf\x02\x12\x13\n\x0eDeleteAllTras\
h\x10\xb0\x02b\x06proto3\
\x12\n\rDuplicateView\x10\xcd\x01\x12\x0e\n\tCloseView\x10\xce\x01\x12\
\x11\n\x0cReadViewInfo\x10\xcf\x01\x12\r\n\x08CopyLink\x10\xdc\x01\x12\
\x12\n\rSetLatestView\x10\xdd\x01\x12\x13\n\x0eMoveFolderItem\x10\xe6\
\x01\x12\x0e\n\tReadTrash\x10\xac\x02\x12\x11\n\x0cPutbackTrash\x10\xad\
\x02\x12\x10\n\x0bDeleteTrash\x10\xae\x02\x12\x14\n\x0fRestoreAllTrash\
\x10\xaf\x02\x12\x13\n\x0eDeleteAllTrash\x10\xb0\x02b\x06proto3\
";
static file_descriptor_proto_lazy: ::protobuf::rt::LazyV2<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::LazyV2::INIT;

View File

@ -16,10 +16,11 @@ enum FolderEvent {
UpdateView = 203;
DeleteView = 204;
DuplicateView = 205;
CopyLink = 206;
SetLatestView = 207;
CloseView = 208;
MoveFolderItem = 209;
CloseView = 206;
ReadViewInfo = 207;
CopyLink = 220;
SetLatestView = 221;
MoveFolderItem = 230;
ReadTrash = 300;
PutbackTrash = 301;
DeleteTrash = 302;

View File

@ -9,7 +9,6 @@ use crate::{
};
use flowy_database::ConnectionPool;
use flowy_error::{FlowyError, FlowyResult};
use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision};
use flowy_revision::disk::{RevisionRecord, RevisionState};
use flowy_revision::mk_revision_disk_cache;

View File

@ -10,6 +10,7 @@ use flowy_database::DBConnection;
use flowy_error::FlowyResult;
use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision};
/// V1Transaction is deprecated since version 0.0.2 version
pub struct V1Transaction<'a>(pub &'a DBConnection);
impl<'a> FolderPersistenceTransaction for V1Transaction<'a> {

View File

@ -3,7 +3,6 @@ use crate::services::{
persistence::{AppChangeset, FolderPersistenceTransaction, ViewChangeset, WorkspaceChangeset},
};
use flowy_error::{FlowyError, FlowyResult};
use flowy_folder_data_model::revision::{AppRevision, TrashRevision, ViewRevision, WorkspaceRevision};
use std::sync::Arc;

View File

@ -15,6 +15,7 @@ use crate::{
use bytes::Bytes;
use flowy_database::kv::KV;
use flowy_folder_data_model::entities::view::{gen_view_id, ViewDataType};
use flowy_folder_data_model::entities::{ViewExtData, ViewInfo};
use flowy_folder_data_model::revision::ViewRevision;
use flowy_sync::entities::text_block_info::TextBlockId;
use futures::{FutureExt, StreamExt};
@ -121,6 +122,36 @@ impl ViewController {
Ok(view_rev)
}
#[tracing::instrument(level = "debug", skip(self, view_id), fields(view_id = %view_id.value), err)]
pub(crate) async fn read_view_info(&self, view_id: ViewId) -> Result<ViewInfo, FlowyError> {
let view_info = self
.persistence
.begin_transaction(|transaction| {
let view_rev = transaction.read_view(&view_id.value)?;
let items: Vec<View> = view_rev
.belongings
.into_iter()
.map(|view_rev| view_rev.into())
.collect();
let ext_data = ViewExtData::from(view_rev.ext_data);
let view_info = ViewInfo {
id: view_rev.id,
belong_to_id: view_rev.belong_to_id,
name: view_rev.name,
desc: view_rev.desc,
data_type: view_rev.data_type,
belongings: RepeatedView { items },
ext_data,
};
Ok(view_info)
})
.await?;
Ok(view_info)
}
pub(crate) async fn read_local_views(&self, ids: Vec<String>) -> Result<Vec<ViewRevision>, FlowyError> {
self.persistence
.begin_transaction(|transaction| {

View File

@ -35,13 +35,12 @@ pub(crate) async fn read_view_handler(
}
pub(crate) async fn read_view_info_handler(
_data: Data<ViewId>,
_controller: AppData<Arc<ViewController>>,
data: Data<ViewId>,
controller: AppData<Arc<ViewController>>,
) -> DataResult<ViewInfo, FlowyError> {
// For the moment, app and view can contains lots of views. Reading the view
// belongings using the view_id.
// view.belongings = controller.read_views_belong_to(&view_id.value).await?;
todo!()
let view_id: ViewId = data.into_inner();
let view_info = controller.read_view_info(view_id.clone()).await?;
data_result(view_info)
}
#[tracing::instrument(level = "debug", skip(data, controller), err)]

View File

@ -28,7 +28,7 @@ chrono = "0.4.19"
nanoid = "0.4.0"
bytes = { version = "1.0" }
diesel = {version = "1.4.8", features = ["sqlite"]}
dashmap = "4.0"
dashmap = "5"
tokio = {version = "1", features = ["sync"]}
rayon = "1.5.2"
serde = { version = "1.0", features = ["derive"] }

View File

@ -26,7 +26,7 @@ parking_lot = "0.11"
strum = "0.21"
strum_macros = "0.21"
tracing = { version = "0.1", features = ["log"] }
dashmap = {version = "4.0"}
dashmap = "5"
async-stream = "0.3.2"
futures-util = "0.3.15"
http-flowy = { git = "https://github.com/AppFlowy-IO/AppFlowy-Server", features = ["with_reqwest"] }

View File

@ -19,7 +19,7 @@ tokio = {version = "1", features = ["sync"]}
bytes = { version = "1.1" }
strum = "0.21"
strum_macros = "0.21"
dashmap = "4.0"
dashmap = "5"
serde = { version = "1.0", features = ["derive"] }
futures-util = "0.3.15"
async-stream = "0.3.2"

View File

@ -29,7 +29,7 @@ tracing = { version = "0.1", features = ["log"] }
bytes = { version = "1.1" }
strum = "0.21"
strum_macros = "0.21"
dashmap = "4.0"
dashmap = "5"
url = "2.2"
serde = { version = "1.0", features = ["derive"] }
serde_json = {version = "1.0"}

View File

@ -24,7 +24,7 @@ dyn-clone = "1.0"
derivative = "2.2.0"
serde_json = {version = "1.0"}
serde = { version = "1.0", features = ["derive"] }
dashmap = "4.0"
dashmap = "5"
#optional crate
bincode = { version = "1.3", optional = true}

89
shared-lib/Cargo.lock generated
View File

@ -262,12 +262,13 @@ dependencies = [
[[package]]
name = "dashmap"
version = "4.0.2"
version = "5.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e77a43b28d0668df09411cb0bc9a8c2adc40f9a048afe863e05fd43251e8e39c"
checksum = "4c8858831f7781322e539ea39e72449c46b059638250c14344fec8d0aa6e539c"
dependencies = [
"cfg-if",
"num_cpus",
"parking_lot 0.12.1",
]
[[package]]
@ -476,7 +477,7 @@ dependencies = [
"lib-ot",
"log",
"md5",
"parking_lot",
"parking_lot 0.11.2",
"protobuf",
"serde",
"serde_json",
@ -881,7 +882,7 @@ dependencies = [
"futures-util",
"lib-infra",
"log",
"parking_lot",
"parking_lot 0.11.2",
"paste",
"pin-project",
"protobuf",
@ -901,9 +902,9 @@ checksum = "fbe5e23404da5b4f555ef85ebed98fb4083e55a00c317800bc2a50ede9f3d219"
[[package]]
name = "lock_api"
version = "0.4.5"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109"
checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b"
dependencies = [
"scopeguard",
]
@ -1002,9 +1003,9 @@ dependencies = [
[[package]]
name = "num_cpus"
version = "1.13.0"
version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1"
dependencies = [
"hermit-abi",
"libc",
@ -1046,7 +1047,17 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
dependencies = [
"instant",
"lock_api",
"parking_lot_core",
"parking_lot_core 0.8.5",
]
[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core 0.9.3",
]
[[package]]
@ -1063,6 +1074,19 @@ dependencies = [
"winapi",
]
[[package]]
name = "parking_lot_core"
version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-sys",
]
[[package]]
name = "parse-zoneinfo"
version = "0.3.0"
@ -1624,7 +1648,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0bccbcf40c8938196944a3da0e133e031a33f4d6b72db3bda3cc556e361905d"
dependencies = [
"lazy_static",
"parking_lot",
"parking_lot 0.11.2",
"serial_test_derive",
]
@ -1858,7 +1882,7 @@ dependencies = [
"mio",
"num_cpus",
"once_cell",
"parking_lot",
"parking_lot 0.11.2",
"pin-project-lite",
"signal-hook-registry",
"tokio-macros",
@ -2178,3 +2202,46 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2"
dependencies = [
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47"
[[package]]
name = "windows_i686_gnu"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6"
[[package]]
name = "windows_i686_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024"
[[package]]
name = "windows_x86_64_gnu"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1"
[[package]]
name = "windows_x86_64_msvc"
version = "0.36.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680"

View File

@ -19,7 +19,7 @@ quote = "1.0"
proc-macro2 = "1.0"
flowy-ast = { path = "../flowy-ast" }
lazy_static = {version = "1.4.0"}
dashmap = "4.0"
dashmap = "5"
lib-infra = { path = "../lib-infra", features = ["proto_gen"]}
serde_json = "1.0"
walkdir = "2.3.1"

View File

@ -25,7 +25,7 @@ strum = "0.21"
strum_macros = "0.21"
chrono = "0.4.19"
parking_lot = "0.11"
dashmap = "4.0"
dashmap = "5"
futures = "0.3.15"
async-stream = "0.3.2"

View File

@ -11,7 +11,7 @@ serde = { version = "1.0", features = ["derive"] }
#protobuf = {version = "2.18.0"}
#flowy-derive = { path = "../flowy-derive" }
tokio = {version = "1", features = ["sync"]}
dashmap = "4.0"
dashmap = "5"
md5 = "0.7.0"
anyhow = "1.0"
thiserror = "1.0"

View File

@ -25,7 +25,7 @@ protobuf = {version = "2.18.0"}
strum = "0.21"
strum_macros = "0.21"
parking_lot = "0.11"
dashmap = "4.0"
dashmap = "5"
[build-dependencies]
lib-infra = { path = "../lib-infra", features = ["protobuf_file_gen"] }