bneradt commented on a change in pull request #7281:
URL: https://github.com/apache/trafficserver/pull/7281#discussion_r540331394



##########
File path: plugins/s3_auth/s3_auth.cc
##########
@@ -143,7 +149,31 @@ class ConfigCache
   S3Config *get(const char *fname);
 
 private:
-  std::unordered_map<std::string, std::pair<S3Config *, int>> _cache;
+  struct _Data {
+    // This is incremented before and after cnf and load_time are set.
+    // Thus, an odd value indicates an update is in progress.
+    std::atomic<unsigned> update_status{0};
+
+    // A config from a file and the last time it was loaded.
+    // config should be written before load_time.  That way,
+    // if config is read after load_time, the load time will
+    // never indicate config is fresh when it isn't.
+    std::atomic<S3Config *> config;
+    std::atomic<time_t> load_time;
+
+    _Data() {}

Review comment:
       For explicit default construction, this is what `= default;` is for.

##########
File path: plugins/s3_auth/s3_auth.cc
##########
@@ -143,7 +149,31 @@ class ConfigCache
   S3Config *get(const char *fname);
 
 private:
-  std::unordered_map<std::string, std::pair<S3Config *, int>> _cache;
+  struct _Data {

Review comment:
       Let's rename this to something more specific.




----------------------------------------------------------------
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.

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


Reply via email to