SolidWallOfCode commented on a change in pull request #7918: URL: https://github.com/apache/trafficserver/pull/7918#discussion_r645737565
########## File path: proxy/http/remap/RemapHitCount.h ########## @@ -0,0 +1,74 @@ +/** @file + + A brief file description + + @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 "HTTP.h" +#include "I_EventSystem.h" +#include "Show.h" +#include "tscore/ink_platform.h" +#include "tscore/ink_inet.h" +#include "tscore/ink_mutex.h" +#include <unordered_map> +#include <vector> + +/** + * Singleton class to keep track of remap hits per remap rule + */ +class RemapHitCount +{ +public: + /** + * Static method to get the instance of the class + * @return Returns a pointer to the instance of the class + */ + static RemapHitCount * + getInstance() + { + return &_remapHitCountInstance; + } + + /** + * increment the remap hit count + * @param tid - et_net thread id processing this request + * @param fromUrl - mapFrom of the remap rule + */ + void + incrementCount(int tid, const std::string &fromUrl) + { + _perThreadHits[tid][fromUrl]++; + } + + std::string printRemapHits(); + +private: + // Hide the constructor and copy constructor + RemapHitCount() { ink_mutex_init(&_mutex); } + RemapHitCount(const RemapHitCount & /* x ATS_UNUSED */) {} Review comment: `RemapHitCount(RemapHitCount const&) = delete;`? -- 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]
