mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: support skip gc (#4926)
* chore: support skip gc * chore: fix test
This commit is contained in:
@ -151,6 +151,7 @@ where
|
||||
&old_user.session.user_workspace.workspace_database_object_id,
|
||||
"phantom",
|
||||
vec![],
|
||||
false,
|
||||
);
|
||||
database_with_views_collab.with_origin_transact_mut(|txn| {
|
||||
old_collab_r_txn.load_doc_with_txn(
|
||||
@ -214,7 +215,7 @@ where
|
||||
let new_uid = new_user_session.user_id;
|
||||
let new_workspace_id = &new_user_session.user_workspace.id;
|
||||
|
||||
let old_folder_collab = Collab::new(old_uid, old_workspace_id, "phantom", vec![]);
|
||||
let old_folder_collab = Collab::new(old_uid, old_workspace_id, "phantom", vec![], false);
|
||||
old_folder_collab.with_origin_transact_mut(|txn| {
|
||||
old_collab_r_txn.load_doc_with_txn(old_uid, old_workspace_id, txn)
|
||||
})?;
|
||||
@ -304,8 +305,9 @@ where
|
||||
}
|
||||
|
||||
let origin = CollabOrigin::Client(CollabClient::new(new_uid, "phantom"));
|
||||
let new_folder_collab = Collab::new_with_doc_state(origin, new_workspace_id, vec![], vec![])
|
||||
.map_err(|err| PersistenceError::Internal(err.into()))?;
|
||||
let new_folder_collab =
|
||||
Collab::new_with_doc_state(origin, new_workspace_id, vec![], vec![], false)
|
||||
.map_err(|err| PersistenceError::Internal(err.into()))?;
|
||||
let mutex_collab = Arc::new(MutexCollab::from_collab(new_folder_collab));
|
||||
let new_user_id = UserId::from(new_uid);
|
||||
info!("migrated folder: {:?}", folder_data);
|
||||
@ -450,7 +452,13 @@ where
|
||||
{
|
||||
let mut collab_by_oid = HashMap::new();
|
||||
for object_id in object_ids {
|
||||
let collab = Collab::new(old_user.session.user_id, object_id, "phantom", vec![]);
|
||||
let collab = Collab::new(
|
||||
old_user.session.user_id,
|
||||
object_id,
|
||||
"phantom",
|
||||
vec![],
|
||||
false,
|
||||
);
|
||||
match collab.with_origin_transact_mut(|txn| {
|
||||
old_collab_r_txn.load_doc_with_txn(old_user.session.user_id, &object_id, txn)
|
||||
}) {
|
||||
|
@ -207,7 +207,7 @@ fn get_collab_doc_state(
|
||||
collab_object: &CollabObject,
|
||||
collab_db: &Arc<CollabKVDB>,
|
||||
) -> Result<Vec<u8>, PersistenceError> {
|
||||
let collab = Collab::new(uid, &collab_object.object_id, "phantom", vec![]);
|
||||
let collab = Collab::new(uid, &collab_object.object_id, "phantom", vec![], false);
|
||||
let _ = collab.with_origin_transact_mut(|txn| {
|
||||
collab_db
|
||||
.read_txn()
|
||||
@ -226,7 +226,7 @@ fn get_database_doc_state(
|
||||
collab_object: &CollabObject,
|
||||
collab_db: &Arc<CollabKVDB>,
|
||||
) -> Result<(Vec<u8>, Vec<String>), PersistenceError> {
|
||||
let collab = Collab::new(uid, &collab_object.object_id, "phantom", vec![]);
|
||||
let collab = Collab::new(uid, &collab_object.object_id, "phantom", vec![], false);
|
||||
let _ = collab.with_origin_transact_mut(|txn| {
|
||||
collab_db
|
||||
.read_txn()
|
||||
@ -250,7 +250,7 @@ async fn sync_folder(
|
||||
user_service: Arc<dyn UserCloudService>,
|
||||
) -> Result<MutexFolder, Error> {
|
||||
let (folder, update) = {
|
||||
let collab = Collab::new(uid, workspace_id, "phantom", vec![]);
|
||||
let collab = Collab::new(uid, workspace_id, "phantom", vec![], false);
|
||||
// Use the temporary result to short the lifetime of the TransactionMut
|
||||
collab.with_origin_transact_mut(|txn| {
|
||||
collab_db
|
||||
@ -308,7 +308,7 @@ async fn sync_database_views(
|
||||
|
||||
// Use the temporary result to short the lifetime of the TransactionMut
|
||||
let result = {
|
||||
let collab = Collab::new(uid, database_views_aggregate_id, "phantom", vec![]);
|
||||
let collab = Collab::new(uid, database_views_aggregate_id, "phantom", vec![], false);
|
||||
collab
|
||||
.with_origin_transact_mut(|txn| {
|
||||
collab_db
|
||||
|
@ -80,7 +80,7 @@ where
|
||||
{
|
||||
// If the document is not exist, we don't need to migrate it.
|
||||
if load_collab(user_id, write_txn, &view.id).is_err() {
|
||||
let collab = Arc::new(MutexCollab::new(origin.clone(), &view.id, vec![]));
|
||||
let collab = Arc::new(MutexCollab::new(origin.clone(), &view.id, vec![], false));
|
||||
let document = Document::create_with_data(collab, default_document_data())?;
|
||||
let encode = document.get_collab().encode_collab_v1();
|
||||
write_txn.flush_doc_with(user_id, &view.id, &encode.doc_state, &encode.state_vector)?;
|
||||
|
@ -15,7 +15,7 @@ where
|
||||
R: CollabKVAction<'a>,
|
||||
PersistenceError: From<R::Error>,
|
||||
{
|
||||
let collab = Collab::new(uid, object_id, "phantom", vec![]);
|
||||
let collab = Collab::new(uid, object_id, "phantom", vec![], false);
|
||||
collab.with_origin_transact_mut(|txn| collab_r_txn.load_doc_with_txn(uid, &object_id, txn))?;
|
||||
Ok(Arc::new(MutexCollab::from_collab(collab)))
|
||||
}
|
||||
|
@ -271,6 +271,7 @@ where
|
||||
&other_session.user_workspace.workspace_database_object_id,
|
||||
"phantom",
|
||||
vec![],
|
||||
false,
|
||||
);
|
||||
database_view_tracker_collab.with_origin_transact_mut(|txn| {
|
||||
other_collab_read_txn.load_doc_with_txn(
|
||||
@ -455,7 +456,8 @@ where
|
||||
W: CollabKVAction<'a>,
|
||||
PersistenceError: From<W::Error>,
|
||||
{
|
||||
let collab = Collab::new_with_doc_state(CollabOrigin::Empty, new_object_id, doc_state, vec![])?;
|
||||
let collab =
|
||||
Collab::new_with_doc_state(CollabOrigin::Empty, new_object_id, doc_state, vec![], false)?;
|
||||
write_collab_object(&collab, new_uid, new_object_id, w_txn);
|
||||
Ok(())
|
||||
}
|
||||
@ -475,6 +477,7 @@ where
|
||||
&other_session.user_workspace.id,
|
||||
"phantom",
|
||||
vec![],
|
||||
false,
|
||||
);
|
||||
other_folder_collab.with_origin_transact_mut(|txn| {
|
||||
other_collab_read_txn.load_doc_with_txn(
|
||||
|
@ -32,7 +32,7 @@ where
|
||||
{
|
||||
let mut collab_by_oid = HashMap::new();
|
||||
for object_id in object_ids {
|
||||
let collab = Collab::new(uid, object_id, "phantom", vec![]);
|
||||
let collab = Collab::new(uid, object_id, "phantom", vec![], false);
|
||||
match collab
|
||||
.with_origin_transact_mut(|txn| collab_read_txn.load_doc_with_txn(uid, &object_id, txn))
|
||||
{
|
||||
|
Reference in New Issue
Block a user