Rename 'contributing paths' to 'relevant paths'

This commit is contained in:
Lucien Greathouse
2019-10-04 17:36:26 -07:00
parent 052ca52cc3
commit 530a7aa834
34 changed files with 73 additions and 73 deletions

View File

@@ -23,7 +23,7 @@ pub struct InstanceMetadata {
/// even if they don't exist, since the presence of a file can change the /// even if they don't exist, since the presence of a file can change the
/// outcome of a snapshot function. /// outcome of a snapshot function.
/// ///
/// For example, a file named foo.lua might have these contributing paths: /// For example, a file named foo.lua might have these relevant paths:
/// - foo.lua /// - foo.lua
/// - foo.meta.json (even if this file doesn't exist!) /// - foo.meta.json (even if this file doesn't exist!)
/// ///
@@ -39,7 +39,7 @@ pub struct InstanceMetadata {
/// that may need updates. /// that may need updates.
// TODO: Change this to be a SmallVec for performance in common cases? // TODO: Change this to be a SmallVec for performance in common cases?
#[serde(serialize_with = "path_serializer::serialize_vec_absolute")] #[serde(serialize_with = "path_serializer::serialize_vec_absolute")]
pub contributing_paths: Vec<PathBuf>, pub relevant_paths: Vec<PathBuf>,
} }
impl Default for InstanceMetadata { impl Default for InstanceMetadata {
@@ -47,7 +47,7 @@ impl Default for InstanceMetadata {
InstanceMetadata { InstanceMetadata {
ignore_unknown_instances: false, ignore_unknown_instances: false,
instigating_source: None, instigating_source: None,
contributing_paths: Vec::new(), relevant_paths: Vec::new(),
} }
} }
} }

View File

@@ -11,5 +11,5 @@ properties:
Value: Value of Foo Value: Value of Foo
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: [] relevant_paths: []
children: [] children: []

View File

@@ -8,5 +8,5 @@ class_name: ROOT
properties: {} properties: {}
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: [] relevant_paths: []
children: [] children: []

View File

@@ -11,5 +11,5 @@ properties:
Value: Should be removed Value: Should be removed
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: [] relevant_paths: []
children: [] children: []

View File

@@ -8,5 +8,5 @@ class_name: Folder
properties: {} properties: {}
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: [] relevant_paths: []
children: [] children: []

View File

@@ -9,9 +9,9 @@ added_instances:
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: [] relevant_paths: []
name: New name: New
class_name: Folder class_name: Folder
properties: {} properties: {}
children: [] children: []
updated_instances: [] updated_instances: []

View File

@@ -113,12 +113,12 @@ impl RojoTree {
// If this instance's source path changed, we need to update our // If this instance's source path changed, we need to update our
// path associations so that file changes will trigger updates // path associations so that file changes will trigger updates
// to this instance correctly. // to this instance correctly.
if existing_metadata.contributing_paths != metadata.contributing_paths { if existing_metadata.relevant_paths != metadata.relevant_paths {
for existing_path in &existing_metadata.contributing_paths { for existing_path in &existing_metadata.relevant_paths {
self.path_to_ids.remove(existing_path, id); self.path_to_ids.remove(existing_path, id);
} }
for new_path in &metadata.contributing_paths { for new_path in &metadata.relevant_paths {
self.path_to_ids.insert(new_path.clone(), id); self.path_to_ids.insert(new_path.clone(), id);
} }
} }
@@ -147,7 +147,7 @@ impl RojoTree {
} }
fn insert_metadata(&mut self, id: RbxId, metadata: InstanceMetadata) { fn insert_metadata(&mut self, id: RbxId, metadata: InstanceMetadata) {
for path in &metadata.contributing_paths { for path in &metadata.relevant_paths {
self.path_to_ids.insert(path.clone(), id); self.path_to_ids.insert(path.clone(), id);
} }
@@ -164,7 +164,7 @@ impl RojoTree {
) { ) {
let metadata = self.metadata_map.remove(&id).unwrap(); let metadata = self.metadata_map.remove(&id).unwrap();
for path in &metadata.contributing_paths { for path in &metadata.relevant_paths {
self.path_to_ids.remove(path, id); self.path_to_ids.remove(path, id);
path_to_ids.insert(path.clone(), id); path_to_ids.insert(path.clone(), id);
} }

View File

@@ -40,7 +40,7 @@ impl SnapshotMiddleware for SnapshotCsv {
Ok(Some(InstanceSnapshot { Ok(Some(InstanceSnapshot {
snapshot_id: None, snapshot_id: None,
metadata: InstanceMetadata { metadata: InstanceMetadata {
contributing_paths: vec![entry.path().to_path_buf()], relevant_paths: vec![entry.path().to_path_buf()],
..Default::default() ..Default::default()
}, },
name: Cow::Owned(instance_name), name: Cow::Owned(instance_name),

View File

@@ -44,7 +44,7 @@ impl SnapshotMiddleware for SnapshotDir {
Ok(Some(InstanceSnapshot { Ok(Some(InstanceSnapshot {
snapshot_id: None, snapshot_id: None,
metadata: InstanceMetadata { metadata: InstanceMetadata {
contributing_paths: vec![entry.path().to_path_buf()], relevant_paths: vec![entry.path().to_path_buf()],
..Default::default() ..Default::default()
}, },
name: Cow::Owned(instance_name), name: Cow::Owned(instance_name),

View File

@@ -52,7 +52,7 @@ impl SnapshotMiddleware for SnapshotJsonModel {
let mut snapshot = instance.core.into_snapshot(instance_name); let mut snapshot = instance.core.into_snapshot(instance_name);
snapshot.metadata.contributing_paths = vec![entry.path().to_path_buf()]; snapshot.metadata.relevant_paths = vec![entry.path().to_path_buf()];
Ok(Some(snapshot)) Ok(Some(snapshot))
} }

View File

@@ -91,7 +91,7 @@ fn snapshot_lua_file<F: ImfsFetcher>(
Ok(Some(InstanceSnapshot { Ok(Some(InstanceSnapshot {
snapshot_id: None, snapshot_id: None,
metadata: InstanceMetadata { metadata: InstanceMetadata {
contributing_paths: vec![entry.path().to_path_buf()], relevant_paths: vec![entry.path().to_path_buf()],
..Default::default() ..Default::default()
}, },
name: Cow::Owned(instance_name.to_owned()), name: Cow::Owned(instance_name.to_owned()),

View File

@@ -31,9 +31,9 @@ impl SnapshotMiddleware for SnapshotProject {
Err(ref err) if err.kind() == FsErrorKind::NotFound => {} Err(ref err) if err.kind() == FsErrorKind::NotFound => {}
Err(err) => return Err(err), Err(err) => return Err(err),
// TODO: Do we need to muck with the contributing paths if we're // TODO: Do we need to muck with the relevant paths if we're a
// a project file within a folder? Should the folder path be the // project file within a folder? Should the folder path be the
// contributing path instead of the project file path? // relevant path instead of the project file path?
Ok(entry) => return SnapshotProject::from_imfs(imfs, &entry), Ok(entry) => return SnapshotProject::from_imfs(imfs, &entry),
} }
} }
@@ -57,12 +57,12 @@ impl SnapshotMiddleware for SnapshotProject {
// file and not the snapshot's original instigating path, or else we // file and not the snapshot's original instigating path, or else we
// won't pick up new changes from the project file. // won't pick up new changes from the project file.
// //
// We SHOULD NOT mark the project file as a contributing path for any // We SHOULD NOT mark the project file as a relevant path for any
// nodes that aren't roots. They'll be updated as part of the project // nodes that aren't roots. They'll be updated as part of the project
// file being updated. // file being updated.
snapshot snapshot
.metadata .metadata
.contributing_paths .relevant_paths
.push(entry.path().to_path_buf()); .push(entry.path().to_path_buf());
Ok(Some(snapshot)) Ok(Some(snapshot))

View File

@@ -43,7 +43,7 @@ impl SnapshotMiddleware for SnapshotRbxlx {
let mut snapshot = InstanceSnapshot::from_tree(&temp_tree, root_id); let mut snapshot = InstanceSnapshot::from_tree(&temp_tree, root_id);
snapshot.name = Cow::Owned(instance_name); snapshot.name = Cow::Owned(instance_name);
snapshot.metadata.contributing_paths = vec![entry.path().to_path_buf()]; snapshot.metadata.relevant_paths = vec![entry.path().to_path_buf()];
Ok(Some(snapshot)) Ok(Some(snapshot))
} }

View File

@@ -49,7 +49,7 @@ impl SnapshotMiddleware for SnapshotRbxm {
if children.len() == 1 { if children.len() == 1 {
let mut snapshot = InstanceSnapshot::from_tree(&temp_tree, children[0]); let mut snapshot = InstanceSnapshot::from_tree(&temp_tree, children[0]);
snapshot.name = Cow::Owned(instance_name); snapshot.name = Cow::Owned(instance_name);
snapshot.metadata.contributing_paths = vec![entry.path().to_path_buf()]; snapshot.metadata.relevant_paths = vec![entry.path().to_path_buf()];
Ok(Some(snapshot)) Ok(Some(snapshot))
} else { } else {

View File

@@ -45,7 +45,7 @@ impl SnapshotMiddleware for SnapshotRbxmx {
if children.len() == 1 { if children.len() == 1 {
let mut snapshot = InstanceSnapshot::from_tree(&temp_tree, children[0]); let mut snapshot = InstanceSnapshot::from_tree(&temp_tree, children[0]);
snapshot.name = Cow::Owned(instance_name); snapshot.name = Cow::Owned(instance_name);
snapshot.metadata.contributing_paths = vec![entry.path().to_path_buf()]; snapshot.metadata.relevant_paths = vec![entry.path().to_path_buf()];
Ok(Some(snapshot)) Ok(Some(snapshot))
} else { } else {

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: relevant_paths:
- /foo.client.lua - /foo.client.lua
name: foo name: foo
class_name: LocalScript class_name: LocalScript
@@ -13,4 +13,4 @@ properties:
Source: Source:
Type: String Type: String
Value: Hello there! Value: Hello there!
children: [] children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: relevant_paths:
- /foo.csv - /foo.csv
name: foo name: foo
class_name: LocalizationTable class_name: LocalizationTable
@@ -13,4 +13,4 @@ properties:
Contents: Contents:
Type: String Type: String
Value: "[{\"key\":\"Ack\",\"example\":\"An exclamation of despair\",\"source\":\"Ack!\",\"values\":{\"es\":\"¡Ay!\"}}]" Value: "[{\"key\":\"Ack\",\"example\":\"An exclamation of despair\",\"source\":\"Ack!\",\"values\":{\"es\":\"¡Ay!\"}}]"
children: [] children: []

View File

@@ -5,9 +5,9 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: relevant_paths:
- /foo - /foo
name: foo name: foo
class_name: Folder class_name: Folder
properties: {} properties: {}
children: [] children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: relevant_paths:
- /foo - /foo
name: foo name: foo
class_name: Folder class_name: Folder
@@ -14,9 +14,9 @@ children:
- snapshot_id: ~ - snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: relevant_paths:
- /foo/Child - /foo/Child
name: Child name: Child
class_name: Folder class_name: Folder
properties: {} properties: {}
children: [] children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: relevant_paths:
- /foo.txt - /foo.txt
name: foo name: foo
class_name: StringValue class_name: StringValue
@@ -13,4 +13,4 @@ properties:
Value: Value:
Type: String Type: String
Value: Hello there! Value: Hello there!
children: [] children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: relevant_paths:
- /foo.model.json - /foo.model.json
name: foo name: foo
class_name: IntValue class_name: IntValue
@@ -17,8 +17,8 @@ children:
- snapshot_id: ~ - snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: [] relevant_paths: []
name: The Child name: The Child
class_name: StringValue class_name: StringValue
properties: {} properties: {}
children: [] children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: relevant_paths:
- /foo.lua - /foo.lua
name: foo name: foo
class_name: ModuleScript class_name: ModuleScript
@@ -13,4 +13,4 @@ properties:
Source: Source:
Type: String Type: String
Value: Hello there! Value: Hello there!
children: [] children: []

View File

@@ -5,9 +5,9 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: true ignore_unknown_instances: true
contributing_paths: relevant_paths:
- /foo/hello.project.json - /foo/hello.project.json
name: direct-project name: direct-project
class_name: Model class_name: Model
properties: {} properties: {}
children: [] children: []

View File

@@ -5,9 +5,9 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: true ignore_unknown_instances: true
contributing_paths: relevant_paths:
- /foo/default.project.json - /foo/default.project.json
name: indirect-project name: indirect-project
class_name: Folder class_name: Folder
properties: {} properties: {}
children: [] children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: true ignore_unknown_instances: true
contributing_paths: relevant_paths:
- /foo/other.project.json - /foo/other.project.json
- /foo/default.project.json - /foo/default.project.json
name: path-property-override name: path-property-override
@@ -14,4 +14,4 @@ properties:
Value: Value:
Type: String Type: String
Value: Changed Value: Changed
children: [] children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: true ignore_unknown_instances: true
contributing_paths: relevant_paths:
- /foo/default.project.json - /foo/default.project.json
name: children name: children
class_name: Folder class_name: Folder
@@ -14,8 +14,8 @@ children:
- snapshot_id: ~ - snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: true ignore_unknown_instances: true
contributing_paths: [] relevant_paths: []
name: Child name: Child
class_name: Model class_name: Model
properties: {} properties: {}
children: [] children: []

View File

@@ -5,10 +5,10 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: true ignore_unknown_instances: true
contributing_paths: relevant_paths:
- /foo/other.project.json - /foo/other.project.json
- /foo/default.project.json - /foo/default.project.json
name: path-project name: path-project
class_name: Model class_name: Model
properties: {} properties: {}
children: [] children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: true ignore_unknown_instances: true
contributing_paths: relevant_paths:
- /foo/other.project.json - /foo/other.project.json
- /foo/default.project.json - /foo/default.project.json
name: path-child-project name: path-child-project
@@ -15,8 +15,8 @@ children:
- snapshot_id: ~ - snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: true ignore_unknown_instances: true
contributing_paths: [] relevant_paths: []
name: SomeChild name: SomeChild
class_name: Model class_name: Model
properties: {} properties: {}
children: [] children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: relevant_paths:
- /foo/other.txt - /foo/other.txt
- /foo/default.project.json - /foo/default.project.json
name: path-project name: path-project
@@ -14,4 +14,4 @@ properties:
Value: Value:
Type: String Type: String
Value: "Hello, world!" Value: "Hello, world!"
children: [] children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: true ignore_unknown_instances: true
contributing_paths: relevant_paths:
- /foo/default.project.json - /foo/default.project.json
name: resolved-properties name: resolved-properties
class_name: StringValue class_name: StringValue
@@ -13,4 +13,4 @@ properties:
Value: Value:
Type: String Type: String
Value: "Hello, world!" Value: "Hello, world!"
children: [] children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: true ignore_unknown_instances: true
contributing_paths: relevant_paths:
- /foo/default.project.json - /foo/default.project.json
name: unresolved-properties name: unresolved-properties
class_name: StringValue class_name: StringValue
@@ -13,4 +13,4 @@ properties:
Value: Value:
Type: String Type: String
Value: Hi! Value: Hi!
children: [] children: []

View File

@@ -5,7 +5,7 @@ expression: instance_snapshot
snapshot_id: ~ snapshot_id: ~
metadata: metadata:
ignore_unknown_instances: false ignore_unknown_instances: false
contributing_paths: relevant_paths:
- /foo.server.lua - /foo.server.lua
name: foo name: foo
class_name: Script class_name: Script
@@ -13,4 +13,4 @@ properties:
Source: Source:
Type: String Type: String
Value: Hello there! Value: Hello there!
children: [] children: []

View File

@@ -52,7 +52,7 @@ impl SnapshotMiddleware for SnapshotTxt {
Ok(Some(InstanceSnapshot { Ok(Some(InstanceSnapshot {
snapshot_id: None, snapshot_id: None,
metadata: InstanceMetadata { metadata: InstanceMetadata {
contributing_paths: vec![entry.path().to_path_buf()], relevant_paths: vec![entry.path().to_path_buf()],
..Default::default() ..Default::default()
}, },
name: Cow::Owned(instance_name), name: Cow::Owned(instance_name),

View File

@@ -248,17 +248,17 @@ impl<F: ImfsFetcher> UiService<F> {
let metadata_container = { let metadata_container = {
let metadata = instance.metadata(); let metadata = instance.metadata();
let contributing_paths = if metadata.contributing_paths.is_empty() { let relevant_paths = if metadata.relevant_paths.is_empty() {
HtmlContent::None HtmlContent::None
} else { } else {
let list = metadata let list = metadata
.contributing_paths .relevant_paths
.iter() .iter()
.map(|path| html! { <li>{ format!("{}", path.display()) }</li> }); .map(|path| html! { <li>{ format!("{}", path.display()) }</li> });
html! { html! {
<div> <div>
"contributing_paths: " "relevant_paths: "
<ul class="path-list">{ Fragment::new(list) }</ul> <ul class="path-list">{ Fragment::new(list) }</ul>
</div> </div>
} }
@@ -268,7 +268,7 @@ impl<F: ImfsFetcher> UiService<F> {
<> <>
<div>"ignore_unknown_instances: " { metadata.ignore_unknown_instances.to_string() }</div> <div>"ignore_unknown_instances: " { metadata.ignore_unknown_instances.to_string() }</div>
<div>"instigating source: " { format!("{:?}", metadata.instigating_source) }</div> <div>"instigating source: " { format!("{:?}", metadata.instigating_source) }</div>
{ contributing_paths } { relevant_paths }
</> </>
}; };