From: Joel Rosdahl Date: Fri, 18 Aug 2023 19:30:33 +0000 (+0200) Subject: refactor: Improve name of LocalStorage::increment_level_2_counters X-Git-Tag: v4.8.3~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a59c3a743f3fcde185a5d8eab89ba288a7a72a4;p=thirdparty%2Fccache.git refactor: Improve name of LocalStorage::increment_level_2_counters (cherry picked from commit 0df72d6809f188cd294f95ddd5c18f2ffc5f96eb) --- diff --git a/src/storage/local/LocalStorage.cpp b/src/storage/local/LocalStorage.cpp index 988155961..b2dfbb845 100644 --- a/src/storage/local/LocalStorage.cpp +++ b/src/storage/local/LocalStorage.cpp @@ -446,7 +446,7 @@ LocalStorage::put(const Digest& key, int64_t size_change_kibibyte = Util::size_change_kibibyte(cache_file.stat, new_stat); auto counters = - increment_level_2_counters(key, files_change, size_change_kibibyte); + increment_files_and_size_counters(key, files_change, size_change_kibibyte); l2_content_lock.release(); @@ -485,7 +485,7 @@ LocalStorage::remove(const Digest& key, const core::CacheEntryType type) } LOG("Removed {} from local storage ({})", key.to_string(), cache_file.path); - increment_level_2_counters( + increment_files_and_size_counters( key, -1, -static_cast(cache_file.stat.size_on_disk() / 1024)); } @@ -943,9 +943,9 @@ LocalStorage::recount_level_1_dir(util::LongLivedLockFileManager& lock_manager, } std::optional -LocalStorage::increment_level_2_counters(const Digest& key, - int64_t files, - int64_t size_kibibyte) +LocalStorage::increment_files_and_size_counters(const Digest& key, + int64_t files, + int64_t size_kibibyte) { uint8_t l1_index = key.bytes()[0] >> 4; uint8_t l2_index = key.bytes()[0] & 0xF; diff --git a/src/storage/local/LocalStorage.hpp b/src/storage/local/LocalStorage.hpp index 29f8a028f..7b72c5f8d 100644 --- a/src/storage/local/LocalStorage.hpp +++ b/src/storage/local/LocalStorage.hpp @@ -151,7 +151,7 @@ private: void recount_level_1_dir(util::LongLivedLockFileManager& lock_manager, uint8_t l1_index); - std::optional increment_level_2_counters( + std::optional increment_files_and_size_counters( const Digest& key, int64_t files, int64_t size_kibibyte); void perform_automatic_cleanup();