Replace snapshot mechanism with epochs (#5764)
* Make tag identifiers monotonic Signed-off-by: Nick Cameron <nrc@ncameron.org> * Use epochs rather than snapshots in memory Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -639,19 +639,35 @@ impl GetTangentialInfoFromPathsResult {
|
||||
}
|
||||
|
||||
impl Sketch {
|
||||
pub(crate) fn add_tag(&mut self, tag: NodeRef<'_, TagDeclarator>, current_path: &Path) {
|
||||
pub(crate) fn add_tag(&mut self, tag: NodeRef<'_, TagDeclarator>, current_path: &Path, exec_state: &ExecState) {
|
||||
let mut tag_identifier: TagIdentifier = tag.into();
|
||||
let base = current_path.get_base();
|
||||
tag_identifier.info = Some(TagEngineInfo {
|
||||
id: base.geo_meta.id,
|
||||
sketch: self.id,
|
||||
path: Some(current_path.clone()),
|
||||
surface: None,
|
||||
});
|
||||
tag_identifier.info.push((
|
||||
exec_state.stack().current_epoch(),
|
||||
TagEngineInfo {
|
||||
id: base.geo_meta.id,
|
||||
sketch: self.id,
|
||||
path: Some(current_path.clone()),
|
||||
surface: None,
|
||||
},
|
||||
));
|
||||
|
||||
self.tags.insert(tag.name.to_string(), tag_identifier);
|
||||
}
|
||||
|
||||
pub(crate) fn merge_tags<'a>(&mut self, tags: impl Iterator<Item = &'a TagIdentifier>) {
|
||||
for t in tags {
|
||||
match self.tags.get_mut(&t.value) {
|
||||
Some(id) => {
|
||||
id.merge_info(t);
|
||||
}
|
||||
None => {
|
||||
self.tags.insert(t.value.clone(), t.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the path most recently sketched.
|
||||
pub(crate) fn latest_path(&self) -> Option<&Path> {
|
||||
self.paths.last()
|
||||
|
Reference in New Issue
Block a user