You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2020/12/10 19:22:14 UTC

[GitHub] [trafficserver] ywkaras commented on a change in pull request #7281: Make s3_auth plugin auto reload the config at expiration time

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



##########
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:
       That would be equivalent, as well as letting the default constructor be defined implicitly.  The only real usefulness for "= default" I've seen is to enable default move cons/assign when copy cons/assign have been deleted.




----------------------------------------------------------------
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:
users@infra.apache.org