Reintroduce instigating paths for snapshot middleware

This commit is contained in:
Lucien Greathouse
2019-10-04 18:36:04 -07:00
parent cb3211cf46
commit 98519da7d9
17 changed files with 36 additions and 10 deletions

View File

@@ -94,9 +94,9 @@ impl ChangeProcessor {
};
let snapshot = match instigating_source {
InstigatingSource::Path(instigating_path) => {
InstigatingSource::Path(path) => {
let entry = imfs
.get(instigating_path)
.get(path)
.expect("could not get instigating path from filesystem");
let snapshot = snapshot_from_imfs(&mut imfs, &entry)

View File

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

View File

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

View File

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

View File

@@ -91,6 +91,7 @@ fn snapshot_lua_file<F: ImfsFetcher>(
Ok(Some(InstanceSnapshot {
snapshot_id: None,
metadata: InstanceMetadata {
instigating_source: Some(entry.path().to_path_buf().into()),
relevant_paths: vec![entry.path().to_path_buf()],
..Default::default()
},

View File

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

View File

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

View File

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

View File

@@ -5,6 +5,8 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
instigating_source:
Path: /foo.client.lua
relevant_paths:
- /foo.client.lua
name: foo
@@ -13,4 +15,4 @@ properties:
Source:
Type: String
Value: Hello there!
children: []
children: []

View File

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

View File

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

View File

@@ -5,6 +5,8 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
instigating_source:
Path: /foo
relevant_paths:
- /foo
name: foo
@@ -14,9 +16,11 @@ children:
- snapshot_id: ~
metadata:
ignore_unknown_instances: false
instigating_source:
Path: /foo/Child
relevant_paths:
- /foo/Child
name: Child
class_name: Folder
properties: {}
children: []
children: []

View File

@@ -5,6 +5,8 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
instigating_source:
Path: /foo.txt
relevant_paths:
- /foo.txt
name: foo
@@ -13,4 +15,4 @@ properties:
Value:
Type: String
Value: Hello there!
children: []
children: []

View File

@@ -5,6 +5,8 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
instigating_source:
Path: /foo.model.json
relevant_paths:
- /foo.model.json
name: foo
@@ -21,4 +23,4 @@ children:
name: The Child
class_name: StringValue
properties: {}
children: []
children: []

View File

@@ -5,6 +5,8 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
instigating_source:
Path: /foo.lua
relevant_paths:
- /foo.lua
name: foo
@@ -13,4 +15,4 @@ properties:
Source:
Type: String
Value: Hello there!
children: []
children: []

View File

@@ -5,6 +5,8 @@ expression: instance_snapshot
snapshot_id: ~
metadata:
ignore_unknown_instances: false
instigating_source:
Path: /foo.server.lua
relevant_paths:
- /foo.server.lua
name: foo
@@ -13,4 +15,4 @@ properties:
Source:
Type: String
Value: Hello there!
children: []
children: []

View File

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