// Copyright 2022 gRPC authors. // // Licensed 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. #ifndef GRPC_SRC_CORE_LIB_RESOURCE_QUOTA_PERIODIC_UPDATE_H #define GRPC_SRC_CORE_LIB_RESOURCE_QUOTA_PERIODIC_UPDATE_H #include <grpc/support/port_platform.h> #include <inttypes.h> #include <atomic> #include "absl/functional/function_ref.h" #include "src/core/lib/gprpp/time.h" namespace grpc_core { // Lightweight timer-like mechanism for periodic updates. // Fast path only decrements an atomic int64. // Slow path runs corrections and estimates how many ticks are required to hit // the target period. // This is super inaccurate of course, but for places where we can't run timers, // or places where continuous registration/unregistration would cause problems // it can be quite useful. class PeriodicUpdate { … }; } // namespace grpc_core #endif // GRPC_SRC_CORE_LIB_RESOURCE_QUOTA_PERIODIC_UPDATE_H