mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-25 04:54:07 +00:00
Tidy up naming for metadata per instance
This commit is contained in:
parent
3f526cd127
commit
da4ed72bb9
3 changed files with 11 additions and 17 deletions
|
|
@ -11,7 +11,7 @@ use log::{info, trace};
|
||||||
use rbx_tree::{RbxTree, RbxId};
|
use rbx_tree::{RbxTree, RbxId};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
project::{Project, InstanceProjectNodeMetadata},
|
project::Project,
|
||||||
message_queue::MessageQueue,
|
message_queue::MessageQueue,
|
||||||
imfs::{Imfs, ImfsItem},
|
imfs::{Imfs, ImfsItem},
|
||||||
path_map::PathMap,
|
path_map::PathMap,
|
||||||
|
|
@ -41,11 +41,7 @@ pub struct RbxSession {
|
||||||
// TODO(#105): Change metadata_per_path to PathMap<Vec<MetadataPerPath>> for
|
// TODO(#105): Change metadata_per_path to PathMap<Vec<MetadataPerPath>> for
|
||||||
// path aliasing.
|
// path aliasing.
|
||||||
metadata_per_path: PathMap<MetadataPerPath>,
|
metadata_per_path: PathMap<MetadataPerPath>,
|
||||||
|
metadata_per_instance: HashMap<RbxId, MetadataPerInstance>,
|
||||||
// TODO: Hold this map, inverted from metadata_per_path
|
|
||||||
// metadata_per_instance: PathMap<MetadataPerInstance>,
|
|
||||||
|
|
||||||
instance_metadata_map: HashMap<RbxId, MetadataPerInstance>,
|
|
||||||
message_queue: Arc<MessageQueue<InstanceChanges>>,
|
message_queue: Arc<MessageQueue<InstanceChanges>>,
|
||||||
imfs: Arc<Mutex<Imfs>>,
|
imfs: Arc<Mutex<Imfs>>,
|
||||||
}
|
}
|
||||||
|
|
@ -57,17 +53,17 @@ impl RbxSession {
|
||||||
message_queue: Arc<MessageQueue<InstanceChanges>>,
|
message_queue: Arc<MessageQueue<InstanceChanges>>,
|
||||||
) -> RbxSession {
|
) -> RbxSession {
|
||||||
let mut metadata_per_path = PathMap::new();
|
let mut metadata_per_path = PathMap::new();
|
||||||
let mut instance_metadata_map = HashMap::new();
|
let mut metadata_per_instance = HashMap::new();
|
||||||
|
|
||||||
let tree = {
|
let tree = {
|
||||||
let temp_imfs = imfs.lock().unwrap();
|
let temp_imfs = imfs.lock().unwrap();
|
||||||
reify_initial_tree(&project, &temp_imfs, &mut metadata_per_path, &mut instance_metadata_map)
|
reify_initial_tree(&project, &temp_imfs, &mut metadata_per_path, &mut metadata_per_instance)
|
||||||
};
|
};
|
||||||
|
|
||||||
RbxSession {
|
RbxSession {
|
||||||
tree,
|
tree,
|
||||||
metadata_per_path,
|
metadata_per_path,
|
||||||
instance_metadata_map,
|
metadata_per_instance,
|
||||||
message_queue,
|
message_queue,
|
||||||
imfs,
|
imfs,
|
||||||
}
|
}
|
||||||
|
|
@ -127,7 +123,7 @@ impl RbxSession {
|
||||||
instance_id,
|
instance_id,
|
||||||
&snapshot,
|
&snapshot,
|
||||||
&mut self.metadata_per_path,
|
&mut self.metadata_per_path,
|
||||||
&mut self.instance_metadata_map,
|
&mut self.metadata_per_instance,
|
||||||
&mut changes,
|
&mut changes,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +179,7 @@ impl RbxSession {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_instance_metadata(&self, id: RbxId) -> Option<&MetadataPerInstance> {
|
pub fn get_instance_metadata(&self, id: RbxId) -> Option<&MetadataPerInstance> {
|
||||||
self.instance_metadata_map.get(&id)
|
self.metadata_per_instance.get(&id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn debug_get_metadata_per_path(&self) -> &PathMap<MetadataPerPath> {
|
pub fn debug_get_metadata_per_path(&self) -> &PathMap<MetadataPerPath> {
|
||||||
|
|
@ -193,15 +189,15 @@ impl RbxSession {
|
||||||
|
|
||||||
pub fn construct_oneoff_tree(project: &Project, imfs: &Imfs) -> RbxTree {
|
pub fn construct_oneoff_tree(project: &Project, imfs: &Imfs) -> RbxTree {
|
||||||
let mut metadata_per_path = PathMap::new();
|
let mut metadata_per_path = PathMap::new();
|
||||||
let mut instance_metadata_map = HashMap::new();
|
let mut metadata_per_instance = HashMap::new();
|
||||||
reify_initial_tree(project, imfs, &mut metadata_per_path, &mut instance_metadata_map)
|
reify_initial_tree(project, imfs, &mut metadata_per_path, &mut metadata_per_instance)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn reify_initial_tree(
|
fn reify_initial_tree(
|
||||||
project: &Project,
|
project: &Project,
|
||||||
imfs: &Imfs,
|
imfs: &Imfs,
|
||||||
metadata_per_path: &mut PathMap<MetadataPerPath>,
|
metadata_per_path: &mut PathMap<MetadataPerPath>,
|
||||||
instance_metadata_map: &mut HashMap<RbxId, MetadataPerInstance>,
|
metadata_per_instance: &mut HashMap<RbxId, MetadataPerInstance>,
|
||||||
) -> RbxTree {
|
) -> RbxTree {
|
||||||
let mut meta = SnapshotMetadata {
|
let mut meta = SnapshotMetadata {
|
||||||
metadata_per_path,
|
metadata_per_path,
|
||||||
|
|
@ -211,7 +207,7 @@ fn reify_initial_tree(
|
||||||
.expect("Project did not produce any instances");
|
.expect("Project did not produce any instances");
|
||||||
|
|
||||||
let mut changes = InstanceChanges::default();
|
let mut changes = InstanceChanges::default();
|
||||||
let tree = reify_root(&snapshot, metadata_per_path, instance_metadata_map, &mut changes);
|
let tree = reify_root(&snapshot, metadata_per_path, metadata_per_instance, &mut changes);
|
||||||
|
|
||||||
tree
|
tree
|
||||||
}
|
}
|
||||||
|
|
@ -3,7 +3,6 @@ use std::{
|
||||||
borrow::Cow,
|
borrow::Cow,
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet},
|
||||||
fmt,
|
fmt,
|
||||||
path::PathBuf,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
use rbx_tree::{RbxTree, RbxId, RbxInstanceProperties, RbxValue};
|
use rbx_tree::{RbxTree, RbxId, RbxInstanceProperties, RbxValue};
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ use rbx_tree::{RbxId, RbxInstance};
|
||||||
use crate::{
|
use crate::{
|
||||||
session::Session,
|
session::Session,
|
||||||
session_id::SessionId,
|
session_id::SessionId,
|
||||||
project::InstanceProjectNodeMetadata,
|
|
||||||
snapshot_reconciler::InstanceChanges,
|
snapshot_reconciler::InstanceChanges,
|
||||||
visualize::{VisualizeRbxSession, VisualizeImfs, graphviz_to_svg},
|
visualize::{VisualizeRbxSession, VisualizeImfs, graphviz_to_svg},
|
||||||
rbx_session::{MetadataPerInstance},
|
rbx_session::{MetadataPerInstance},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue