Skip to content

Commit 971f340

Browse files
authored
chore: remove revision map (#437)
1 parent ad4d94e commit 971f340

File tree

7 files changed

+18
-401
lines changed

7 files changed

+18
-401
lines changed

collab/src/folder/folder.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use uuid::Uuid;
1616

1717
use super::folder_observe::ViewChangeSender;
1818
use super::hierarchy_builder::{FlattedViews, ParentChildViews};
19-
use super::revision::RevisionMapping;
2019
use super::section::{Section, SectionItem, SectionMap};
2120
use super::{
2221
FolderData, ParentChildRelations, SectionChangeSender, SpacePermission, TrashInfo, View,
@@ -57,7 +56,6 @@ const VIEWS: &str = "views";
5756
const PARENT_CHILD_VIEW_RELATION: &str = "relation";
5857
const CURRENT_VIEW: &str = "current_view";
5958
const CURRENT_VIEW_FOR_USER: &str = "current_view_for_user";
60-
const REVISION_MAP: &str = "revision_map";
6159

6260
pub(crate) const FAVORITES_V1: &str = "favorites";
6361
const SECTION: &str = "section";
@@ -1098,11 +1096,6 @@ impl Folder {
10981096
}
10991097
}
11001098

1101-
pub fn replace_view(&mut self, from: &ViewId, to: &ViewId, uid: i64) -> bool {
1102-
let mut txn = self.collab.transact_mut();
1103-
self.body.replace_view(&mut txn, from, to, Some(uid))
1104-
}
1105-
11061099
/// Get a view by id. When uid is provided, includes user-specific data like is_favorite.
11071100
/// When uid is None, returns base view data without user-specific enrichment.
11081101
pub fn get_view(&self, view_id: &ViewId, uid: Option<i64>) -> Option<Arc<View>> {
@@ -1244,9 +1237,6 @@ impl FolderBody {
12441237
let parent_child_relations = Arc::new(ParentChildRelations::new(
12451238
root.get_or_init(&mut txn, PARENT_CHILD_VIEW_RELATION),
12461239
));
1247-
let revision_map = Arc::new(RevisionMapping::new(
1248-
root.get_or_init(&mut txn, REVISION_MAP),
1249-
));
12501240

12511241
let section = Arc::new(SectionMap::create(
12521242
&mut txn,
@@ -1262,7 +1252,6 @@ impl FolderBody {
12621252
.map(|notifier| notifier.view_change_tx.clone()),
12631253
parent_child_relations,
12641254
section.clone(),
1265-
revision_map,
12661255
));
12671256

12681257
if let Some(folder_data) = folder_data {
@@ -1612,18 +1601,6 @@ impl FolderBody {
16121601
current_view_for_user.try_update(txn, uid.to_string(), view.to_string());
16131602
}
16141603
}
1615-
1616-
pub fn replace_view(
1617-
&self,
1618-
txn: &mut TransactionMut,
1619-
old_view_id: &ViewId,
1620-
new_view_id: &ViewId,
1621-
uid: Option<i64>,
1622-
) -> bool {
1623-
uid
1624-
.map(|uid| self.views.replace_view(txn, old_view_id, new_view_id, uid))
1625-
.unwrap_or(false)
1626-
}
16271604
}
16281605

16291606
pub fn default_folder_data(uid: i64, workspace_id: &str) -> FolderData {

collab/src/folder/folder_observe.rs

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use crate::preclude::{
66
};
77
use tokio::sync::broadcast;
88

9-
use super::revision::RevisionMapping;
109
use super::section::SectionMap;
1110
use super::view::FOLDER_VIEW_ID;
1211
use super::{ParentChildRelations, View, ViewId, view_from_map_ref};
@@ -27,7 +26,6 @@ pub(crate) fn subscribe_view_change(
2726
change_tx: ViewChangeSender,
2827
view_relations: Arc<ParentChildRelations>,
2928
section_map: Arc<SectionMap>,
30-
revision_mapping: Arc<RevisionMapping>,
3129
uid: i64,
3230
) -> Subscription {
3331
let r = root.clone();
@@ -45,16 +43,10 @@ pub(crate) fn subscribe_view_change(
4543
if let Some(view_id_str) = map_ref.get_with_txn::<_, String>(txn, FOLDER_VIEW_ID)
4644
{
4745
if let Ok(view_uuid) = uuid::Uuid::parse_str(&view_id_str) {
48-
let (view_id, mappings) = revision_mapping.mappings(txn, view_uuid);
49-
if let Some(YrsValue::YMap(map_ref)) = r.get(txn, &view_id.to_string()) {
50-
if let Some(view) = view_from_map_ref(
51-
&map_ref,
52-
txn,
53-
&view_relations,
54-
&section_map,
55-
Some(uid),
56-
mappings,
57-
) {
46+
if let Some(YrsValue::YMap(map_ref)) = r.get(txn, &view_uuid.to_string()) {
47+
if let Some(view) =
48+
view_from_map_ref(&map_ref, txn, &view_relations, &section_map, Some(uid))
49+
{
5850
deletion_cache.insert(view.id, Arc::new(view.clone()));
5951

6052
// Send indexing view
@@ -71,16 +63,10 @@ pub(crate) fn subscribe_view_change(
7163
.get_with_txn::<_, String>(txn, FOLDER_VIEW_ID)
7264
{
7365
if let Ok(view_uuid) = uuid::Uuid::parse_str(&view_id_str) {
74-
let (view_id, mappings) = revision_mapping.mappings(txn, view_uuid);
75-
if let Some(YrsValue::YMap(map_ref)) = r.get(txn, &view_id.to_string()) {
76-
if let Some(view) = view_from_map_ref(
77-
&map_ref,
78-
txn,
79-
&view_relations,
80-
&section_map,
81-
Some(uid),
82-
mappings,
83-
) {
66+
if let Some(YrsValue::YMap(map_ref)) = r.get(txn, &view_uuid.to_string()) {
67+
if let Some(view) =
68+
view_from_map_ref(&map_ref, txn, &view_relations, &section_map, Some(uid))
69+
{
8470
// Update deletion cache with the updated view
8571
deletion_cache.insert(view.id, Arc::new(view.clone()));
8672
let _ = change_tx.send(ViewChange::DidUpdate { view });

collab/src/folder/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ mod folder_migration;
1818
mod folder_observe;
1919
pub mod hierarchy_builder;
2020
mod relation;
21-
mod revision;
2221
mod section;
2322
pub mod space_info;
2423
mod view;

collab/src/folder/revision.rs

Lines changed: 0 additions & 79 deletions
This file was deleted.

0 commit comments

Comments
 (0)