Struct agde::fast_forward::Metadata
source · pub struct Metadata { /* private fields */ }
Expand description
The metadata for all files we’re tracking.
The implementations of agde need to provide methods to create and save this.
You can call Clone::clone_from
for an optimized cloning method.
Implementations§
source§impl Metadata
impl Metadata
sourcepub fn new(map: HashMap<String, ResourceMeta>) -> Self
pub fn new(map: HashMap<String, ResourceMeta>) -> Self
Create a new metadata map.
sourcepub fn iter(&self) -> impl Iterator<Item = (&str, ResourceMeta)>
pub fn iter(&self) -> impl Iterator<Item = (&str, ResourceMeta)>
Get an iterator over all the resources and their respective metadata.
sourcepub fn get(&self, resource: &str) -> Option<ResourceMeta>
pub fn get(&self, resource: &str) -> Option<ResourceMeta>
Get the metadata for resource
.
sourcepub fn insert(&mut self, resource: String, meta: ResourceMeta)
pub fn insert(&mut self, resource: String, meta: ResourceMeta)
Insert the meta
for resource
.
sourcepub fn changes(
&self,
target: &Self,
ignore_mtime_of_last_event: bool
) -> Vec<MetadataChange>
pub fn changes( &self, target: &Self, ignore_mtime_of_last_event: bool ) -> Vec<MetadataChange>
Calculate the changes to get the metadata from self
to target
.
ignore_mtime_of_last_event
is used when diffing locally, as we don’t care about the
unrelated mtime_of_last_event
in the current storage.
sourcepub fn apply_changes(&mut self, changes: &[MetadataChange], target: &Self)
pub fn apply_changes(&mut self, changes: &[MetadataChange], target: &Self)
Apply the changes gathered from Self::changes
to self
, while fetching data from
target
.
This means you can apply the changes between two metadata sets on a third set.
Also see Self::apply_current_mtime_changes
sourcepub fn apply_current_mtime_changes(&mut self, changes: &[MetadataChange])
pub fn apply_current_mtime_changes(&mut self, changes: &[MetadataChange])
Same as Self::apply_changes
but also
apply the ResourceMeta::mtime_in_current
to get self
to target
.
This is here to update the mtime of resources which did not get their mtime updated due to the diff being empty.