From 06f3cba3b1e1dab6c86913ddf035332ba56a7f89 Mon Sep 17 00:00:00 2001
From: Denis Smirnov <sd@picodata.io>
Date: Thu, 3 Nov 2022 09:45:56 +0700
Subject: [PATCH] refactoring: rename TreeMap to TransformationLog

---
 sbroad-core/src/ir.rs                   | 14 ++++++++------
 sbroad-core/src/otm/statistics/table.rs |  2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/sbroad-core/src/ir.rs b/sbroad-core/src/ir.rs
index bb6a3f89c6..361f80a8df 100644
--- a/sbroad-core/src/ir.rs
+++ b/sbroad-core/src/ir.rs
@@ -24,17 +24,19 @@ pub mod transformation;
 pub mod tree;
 pub mod value;
 
-/// A tree map structure where the value points to the parent key.
+/// Transformation log keep the history of the plan subtree modifications.
+/// When we modify the plan subtree, we add a new entry to the log, where
+/// the key is a new subtree top node and the value is the previous version.
 #[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
-pub struct TreeMap(HashMap<usize, usize, RepeatableState>);
+pub struct TransformationLog(HashMap<usize, usize, RepeatableState>);
 
-impl Default for TreeMap {
+impl Default for TransformationLog {
     fn default() -> Self {
         Self::new()
     }
 }
 
-impl TreeMap {
+impl TransformationLog {
     #[must_use]
     pub fn new() -> Self {
         Self(HashMap::with_hasher(RepeatableState))
@@ -154,7 +156,7 @@ pub struct Plan {
     is_explain: bool,
     /// The undo log keeps the history of the plan transformations. It can
     /// be used to revert the plan subtree to some previous snapshot if needed.
-    pub(crate) undo: TreeMap,
+    pub(crate) undo: TransformationLog,
 }
 
 impl Default for Plan {
@@ -209,7 +211,7 @@ impl Plan {
             slices: None,
             top: None,
             is_explain: false,
-            undo: TreeMap::new(),
+            undo: TransformationLog::new(),
         }
     }
 
diff --git a/sbroad-core/src/otm/statistics/table.rs b/sbroad-core/src/otm/statistics/table.rs
index 308d0ea382..47a68533bb 100644
--- a/sbroad-core/src/otm/statistics/table.rs
+++ b/sbroad-core/src/otm/statistics/table.rs
@@ -6,7 +6,7 @@
 //! - `__sbroad_query` space - stores the queries that are currently being executed.
 //!   Its query id is used as a key for the `__sbroad_stat` space.
 //! - `__sbroad_stat` space - stores the statistics for the query spans. The spans
-//!   are stored as a tree map for each query.
+//!   are stored as a flat tree for each query.
 //! - `SpanMap` hash table - stores the mapping between the span id and the span name.
 //!   The reason is that the span context contains only the span id, so we use
 //!   this table to save the span name when create the span (and remove it when
-- 
GitLab