Skip to content

Commit b739261

Browse files
committed
Temporarily swap JSON models and Meta files back to BTreeMap
1 parent 5c7ed6e commit b739261

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

src/snapshot_middleware/csv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ pub fn syncback_csv<'sync>(
113113
if let Some(mut meta) = meta {
114114
// LocalizationTables have relatively few properties that we care
115115
// about, so shifting is fine.
116-
meta.properties.shift_remove(&ustr("Contents"));
116+
meta.properties.remove(&ustr("Contents"));
117117

118118
if !meta.is_empty() {
119119
let parent = snapshot.path.parent_err()?;
@@ -153,7 +153,7 @@ pub fn syncback_csv_init<'sync>(
153153
if let Some(mut meta) = meta {
154154
// LocalizationTables have relatively few properties that we care
155155
// about, so shifting is fine.
156-
meta.properties.shift_remove(&ustr("Contents"));
156+
meta.properties.remove(&ustr("Contents"));
157157
if !meta.is_empty() {
158158
dir_syncback.fs_snapshot.add_file(
159159
snapshot.path.join("init.meta.json"),

src/snapshot_middleware/lua.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub fn syncback_lua<'sync>(
163163
if let Some(mut meta) = meta {
164164
// Scripts have relatively few properties that we care about, so shifting
165165
// is fine.
166-
meta.properties.shift_remove(&ustr("Source"));
166+
meta.properties.remove(&ustr("Source"));
167167

168168
if !meta.is_empty() {
169169
let parent_location = snapshot.path.parent_err()?;
@@ -207,7 +207,7 @@ pub fn syncback_lua_init<'sync>(
207207
if let Some(mut meta) = meta {
208208
// Scripts have relatively few properties that we care about, so shifting
209209
// is fine.
210-
meta.properties.shift_remove(&ustr("Source"));
210+
meta.properties.remove(&ustr("Source"));
211211

212212
if !meta.is_empty() {
213213
dir_syncback.fs_snapshot.add_file(

src/snapshot_middleware/meta_file.rs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
use std::path::{Path, PathBuf};
1+
use std::{
2+
collections::BTreeMap,
3+
path::{Path, PathBuf},
4+
};
25

36
use anyhow::{format_err, Context};
4-
use indexmap::IndexMap;
57
use memofs::{IoResultExt as _, Vfs};
68
use rbx_dom_weak::{
79
types::{Attributes, Variant},
@@ -29,11 +31,11 @@ pub struct AdjacentMetadata {
2931
#[serde(skip_serializing_if = "Option::is_none")]
3032
pub ignore_unknown_instances: Option<bool>,
3133

32-
#[serde(default, skip_serializing_if = "IndexMap::is_empty")]
33-
pub properties: IndexMap<Ustr, UnresolvedValue>,
34+
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
35+
pub properties: BTreeMap<Ustr, UnresolvedValue>,
3436

35-
#[serde(default, skip_serializing_if = "IndexMap::is_empty")]
36-
pub attributes: IndexMap<String, UnresolvedValue>,
37+
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
38+
pub attributes: BTreeMap<String, UnresolvedValue>,
3739

3840
#[serde(skip)]
3941
pub path: PathBuf,
@@ -58,8 +60,8 @@ impl AdjacentMetadata {
5860
snapshot: &SyncbackSnapshot,
5961
path: PathBuf,
6062
) -> anyhow::Result<Option<Self>> {
61-
let mut properties = IndexMap::new();
62-
let mut attributes = IndexMap::new();
63+
let mut properties = BTreeMap::new();
64+
let mut attributes = BTreeMap::new();
6365
// TODO make this more granular.
6466
// I am breaking the cycle of bad TODOs. This is in reference to the fact
6567
// that right now, this will just not write any metadata at all for
@@ -213,11 +215,11 @@ pub struct DirectoryMetadata {
213215
#[serde(skip_serializing_if = "Option::is_none")]
214216
pub ignore_unknown_instances: Option<bool>,
215217

216-
#[serde(default, skip_serializing_if = "IndexMap::is_empty")]
217-
pub properties: IndexMap<Ustr, UnresolvedValue>,
218+
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
219+
pub properties: BTreeMap<Ustr, UnresolvedValue>,
218220

219-
#[serde(default, skip_serializing_if = "IndexMap::is_empty")]
220-
pub attributes: IndexMap<String, UnresolvedValue>,
221+
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
222+
pub attributes: BTreeMap<String, UnresolvedValue>,
221223

222224
#[serde(skip_serializing_if = "Option::is_none")]
223225
pub class_name: Option<Ustr>,
@@ -248,8 +250,8 @@ impl DirectoryMetadata {
248250
snapshot: &SyncbackSnapshot,
249251
path: PathBuf,
250252
) -> anyhow::Result<Option<Self>> {
251-
let mut properties = IndexMap::new();
252-
let mut attributes = IndexMap::new();
253+
let mut properties = BTreeMap::new();
254+
let mut attributes = BTreeMap::new();
253255
// TODO make this more granular.
254256
// I am breaking the cycle of bad TODOs. This is in reference to the fact
255257
// that right now, this will just not write any metadata at all for

src/snapshot_middleware/txt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub fn syncback_txt<'sync>(
5959
if let Some(mut meta) = meta {
6060
// StringValues have relatively few properties that we care about, so
6161
// shifting is fine.
62-
meta.properties.shift_remove(&ustr("Value"));
62+
meta.properties.remove(&ustr("Value"));
6363

6464
if !meta.is_empty() {
6565
let parent = snapshot.path.parent_err()?;

0 commit comments

Comments
 (0)