From 98765088877986e013ca863ef350ec477c7dd870 Mon Sep 17 00:00:00 2001 From: Boegie19 <34578426+Boegie19@users.noreply.github.com> Date: Sun, 21 Aug 2022 04:32:58 +0200 Subject: [PATCH] added attributes to AdjacentMetadata (#624) * added attributes to AdjacentMetadata * ran fmt --- src/snapshot_middleware/meta_file.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/snapshot_middleware/meta_file.rs b/src/snapshot_middleware/meta_file.rs index abf53fba..72930e49 100644 --- a/src/snapshot_middleware/meta_file.rs +++ b/src/snapshot_middleware/meta_file.rs @@ -19,6 +19,9 @@ pub struct AdjacentMetadata { #[serde(default, skip_serializing_if = "HashMap::is_empty")] pub properties: HashMap, + #[serde(default, skip_serializing_if = "HashMap::is_empty")] + pub attributes: HashMap, + #[serde(skip)] pub path: PathBuf, } @@ -53,6 +56,19 @@ impl AdjacentMetadata { snapshot.properties.insert(key, value); } + if !self.attributes.is_empty() { + let mut attributes = Attributes::new(); + + for (key, unresolved) in self.attributes.drain() { + let value = unresolved.resolve_unambiguous()?; + attributes.insert(key, value); + } + + snapshot + .properties + .insert("Attributes".into(), attributes.into()); + } + Ok(()) }