summaryrefslogtreecommitdiff
path: root/src/buildtool/storage
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/storage')
-rw-r--r--src/buildtool/storage/compactifier.cpp14
-rw-r--r--src/buildtool/storage/garbage_collector.cpp6
-rw-r--r--src/buildtool/storage/repository_garbage_collector.cpp5
3 files changed, 13 insertions, 12 deletions
diff --git a/src/buildtool/storage/compactifier.cpp b/src/buildtool/storage/compactifier.cpp
index 2a6368ca..3bd39324 100644
--- a/src/buildtool/storage/compactifier.cpp
+++ b/src/buildtool/storage/compactifier.cpp
@@ -157,10 +157,10 @@ template <ObjectType kType>
}
// Calculate reference hash size:
- auto const kHashSize =
+ auto const hash_size =
task.cas.GetHashFunction().MakeHasher().GetHashLength();
- auto const kFileNameSize =
- kHashSize - FileStorageData::kDirectoryNameLength;
+ auto const file_name_size =
+ hash_size - FileStorageData::kDirectoryNameLength;
// Check the directory itself is valid:
std::string const d_name = directory.filename();
@@ -178,8 +178,8 @@ template <ObjectType kType>
}
FileSystemManager::ReadDirEntryFunc callback =
- [&task, &directory, kFileNameSize](std::filesystem::path const& file,
- ObjectType type) -> bool {
+ [&task, &directory, file_name_size](std::filesystem::path const& file,
+ ObjectType type) -> bool {
// Directories are unexpected in storage subdirectories
if (IsTreeObject(type)) {
task.Log(LogLevel::Error,
@@ -188,9 +188,9 @@ template <ObjectType kType>
return false;
}
- // Check file has a hexadecimal name of length kFileNameSize:
+ // Check file has a hexadecimal name of length file_name_size:
std::string const f_name = file.filename();
- if (f_name.size() == kFileNameSize and FromHexString(f_name)) {
+ if (f_name.size() == file_name_size and FromHexString(f_name)) {
return true;
}
auto const path = directory / file;
diff --git a/src/buildtool/storage/garbage_collector.cpp b/src/buildtool/storage/garbage_collector.cpp
index 6f41dcd8..c2d9ecd0 100644
--- a/src/buildtool/storage/garbage_collector.cpp
+++ b/src/buildtool/storage/garbage_collector.cpp
@@ -68,13 +68,13 @@ auto GarbageCollector::LockFilePath(
auto GarbageCollector::TriggerGarbageCollection(
StorageConfig const& storage_config,
bool no_rotation) noexcept -> bool {
- auto const kRemoveMe = std::string{"remove-me"};
+ std::string const remove_me = "remove-me";
auto pid = CreateProcessUniqueId();
if (not pid) {
return false;
}
- auto remove_me_prefix = kRemoveMe + *pid + std::string{"-"};
+ auto remove_me_prefix = remove_me + *pid + std::string{"-"};
std::vector<std::filesystem::path> to_remove{};
// With a shared lock, we can remove all directories with the given prefix,
@@ -121,7 +121,7 @@ auto GarbageCollector::TriggerGarbageCollection(
std::vector<std::filesystem::path> left_over{};
for (auto const& entry :
std::filesystem::directory_iterator(storage_config.CacheRoot())) {
- if (entry.path().filename().string().starts_with(kRemoveMe)) {
+ if (entry.path().filename().string().starts_with(remove_me)) {
left_over.emplace_back(entry.path());
}
}
diff --git a/src/buildtool/storage/repository_garbage_collector.cpp b/src/buildtool/storage/repository_garbage_collector.cpp
index f1025795..67a08f9f 100644
--- a/src/buildtool/storage/repository_garbage_collector.cpp
+++ b/src/buildtool/storage/repository_garbage_collector.cpp
@@ -36,13 +36,14 @@ auto RepositoryGarbageCollector::LockFilePath(
auto RepositoryGarbageCollector::TriggerGarbageCollection(
StorageConfig const& storage_config) noexcept -> bool {
- auto const kRemoveMe = std::string{"remove-me"};
+ auto const remove_me_prefix = std::string{"remove-me"};
auto pid = CreateProcessUniqueId();
if (not pid) {
return false;
}
- auto remove_me = storage_config.RepositoryRoot() / (kRemoveMe + *pid);
+ auto remove_me =
+ storage_config.RepositoryRoot() / (remove_me_prefix + *pid);
// With a shared lock, we can remove that directory, if it exists,
// as we own the process id.