ywkaras commented on code in PR #11214:
URL: https://github.com/apache/trafficserver/pull/11214#discussion_r1558029788


##########
include/tsutil/Metrics.h:
##########
@@ -276,13 +287,62 @@ class Metrics
     return _makeId(std::get<0>(id), std::get<1>(id));
   }
 
-  void _addBlob();
+  class Storage
+  {
+    BlobStorage _blobs;
+    uint16_t _cur_blob = 0;
+    uint16_t _cur_off  = 0;
+    LookupTable _lookups;
+    mutable std::mutex _mutex;
+
+  public:
+    Storage(const self_type &)          = delete;
+    Storage &operator=(const Storage &) = delete;
+    Storage &operator=(Storage &&)      = delete;
+    Storage(Storage &&)                 = delete;
+
+    Storage()
+    {
+      _blobs[0] = new NamesAndAtomics();
+      release_assert(_blobs[0]);
+      release_assert(0 == _create("proxy.process.api.metrics.bad_id")); // 
Reserve slot 0 for errors, this should always be 0
+    }
+
+    ~Storage()
+    {
+      for (size_t i = 0; i <= _cur_blob; ++i) {
+        delete _blobs[i];
+      }
+    }
+
+    IdType _create(const std::string_view name);
+    void _addBlob();
+    IdType lookup(const std::string_view name) const;
+    AtomicType *lookup(const std::string_view name, IdType *out_id) const;
+    AtomicType *lookup(Metrics::IdType id, std::string_view *out_name = 
nullptr) const;
+    std::string_view name(IdType id) const;
+    SpanType _createSpan(size_t size, IdType *id = nullptr);

Review Comment:
   Why _?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to