mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: rename some function & add more documentation
This commit is contained in:
@ -215,7 +215,7 @@ impl DefaultFolderBuilder {
|
||||
for app in workspace_rev.apps.iter() {
|
||||
for (index, view) in app.belongings.iter().enumerate() {
|
||||
let view_data = if index == 0 {
|
||||
initial_read_me().to_delta_str()
|
||||
initial_read_me().to_json_str()
|
||||
} else {
|
||||
initial_quill_delta_string()
|
||||
};
|
||||
|
@ -10,7 +10,7 @@ use flowy_sync::{
|
||||
entities::{revision::Revision, ws_data::ServerRevisionWSData},
|
||||
};
|
||||
use lib_infra::future::FutureResult;
|
||||
use lib_ot::core::PlainTextAttributes;
|
||||
use lib_ot::core::PhantomAttributes;
|
||||
|
||||
use parking_lot::RwLock;
|
||||
use std::sync::Arc;
|
||||
@ -80,7 +80,7 @@ impl FolderEditor {
|
||||
pub(crate) fn apply_change(&self, change: FolderChange) -> FlowyResult<()> {
|
||||
let FolderChange { delta, md5 } = change;
|
||||
let (base_rev_id, rev_id) = self.rev_manager.next_rev_id_pair();
|
||||
let delta_data = delta.to_delta_bytes();
|
||||
let delta_data = delta.to_json_bytes();
|
||||
let revision = Revision::new(
|
||||
&self.rev_manager.object_id,
|
||||
base_rev_id,
|
||||
@ -132,7 +132,7 @@ impl FolderEditor {
|
||||
pub struct FolderRevisionCompactor();
|
||||
impl RevisionCompactor for FolderRevisionCompactor {
|
||||
fn bytes_from_revisions(&self, revisions: Vec<Revision>) -> FlowyResult<Bytes> {
|
||||
let delta = make_delta_from_revisions::<PlainTextAttributes>(revisions)?;
|
||||
Ok(delta.to_delta_bytes())
|
||||
let delta = make_delta_from_revisions::<PhantomAttributes>(revisions)?;
|
||||
Ok(delta.to_json_bytes())
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ impl FolderPersistence {
|
||||
pub async fn save_folder(&self, user_id: &str, folder_id: &FolderId, folder: FolderPad) -> FlowyResult<()> {
|
||||
let pool = self.database.db_pool()?;
|
||||
let json = folder.to_json()?;
|
||||
let delta_data = PlainTextDeltaBuilder::new().insert(&json).build().to_delta_bytes();
|
||||
let delta_data = PlainTextDeltaBuilder::new().insert(&json).build().to_json_bytes();
|
||||
let revision = Revision::initial_revision(user_id, folder_id.as_ref(), delta_data);
|
||||
let record = RevisionRecord {
|
||||
revision,
|
||||
|
@ -10,7 +10,7 @@ use flowy_sync::{
|
||||
},
|
||||
};
|
||||
use lib_infra::future::{BoxResultFuture, FutureResult};
|
||||
use lib_ot::core::{OperationTransformable, PlainTextAttributes, PlainTextDelta};
|
||||
use lib_ot::core::{OperationTransformable, PhantomAttributes, PlainTextDelta};
|
||||
use parking_lot::RwLock;
|
||||
use std::{sync::Arc, time::Duration};
|
||||
|
||||
@ -24,7 +24,7 @@ pub(crate) async fn make_folder_ws_manager(
|
||||
) -> Arc<RevisionWebSocketManager> {
|
||||
let ws_data_provider = Arc::new(WSDataProvider::new(folder_id, Arc::new(rev_manager.clone())));
|
||||
let resolver = Arc::new(FolderConflictResolver { folder_pad });
|
||||
let conflict_controller = ConflictController::<PlainTextAttributes>::new(
|
||||
let conflict_controller = ConflictController::<PhantomAttributes>::new(
|
||||
user_id,
|
||||
resolver,
|
||||
Arc::new(ws_data_provider.clone()),
|
||||
@ -55,7 +55,7 @@ struct FolderConflictResolver {
|
||||
folder_pad: Arc<RwLock<FolderPad>>,
|
||||
}
|
||||
|
||||
impl ConflictResolver<PlainTextAttributes> for FolderConflictResolver {
|
||||
impl ConflictResolver<PhantomAttributes> for FolderConflictResolver {
|
||||
fn compose_delta(&self, delta: PlainTextDelta) -> BoxResultFuture<DeltaMD5, FlowyError> {
|
||||
let folder_pad = self.folder_pad.clone();
|
||||
Box::pin(async move {
|
||||
@ -67,7 +67,7 @@ impl ConflictResolver<PlainTextAttributes> for FolderConflictResolver {
|
||||
fn transform_delta(
|
||||
&self,
|
||||
delta: PlainTextDelta,
|
||||
) -> BoxResultFuture<TransformDeltas<PlainTextAttributes>, FlowyError> {
|
||||
) -> BoxResultFuture<TransformDeltas<PhantomAttributes>, FlowyError> {
|
||||
let folder_pad = self.folder_pad.clone();
|
||||
Box::pin(async move {
|
||||
let read_guard = folder_pad.read();
|
||||
|
Reference in New Issue
Block a user