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



##########
File path: mgmt2/config/FileManager.h
##########
@@ -0,0 +1,171 @@
+/** @file
+
+  Interface for class to manage configuration updates
+
+  @section license License
+
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ */
+
+#pragma once
+
+#include "tscore/ink_mutex.h"
+#include "tscore/List.h"
+
+#include "tscore/Errata.h"
+
+#include <unordered_map>
+#include <string_view>
+#include <forward_list>
+#include <mutex>
+#include <functional>
+
+class ConfigUpdateCbTable;
+
+class FileManager
+{
+public:
+  enum RollBackCheckType {
+    ROLLBACK_CHECK_AND_UPDATE,
+    ROLLBACK_CHECK_ONLY,
+  };
+  class ConfigManager
+  {
+  public:
+    // fileName_ should be rooted or a base file name.
+    ConfigManager(const char *fileName_, const char *configName_, bool 
root_access_needed, bool isRequired_,
+                  ConfigManager *parentConfig_);
+    ~ConfigManager();
+
+    // Manual take out of lock required
+    void
+    acquireLock()
+    {
+      ink_mutex_acquire(&fileAccessLock);
+    };
+
+    void
+    releaseLock()
+    {
+      ink_mutex_release(&fileAccessLock);
+    };

Review comment:
       If you make this BasicLockable ( 
https://en.cppreference.com/w/cpp/named_req/BasicLockable ) you can use 
std::lock_guard for RAII.




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