diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-03-07 16:06:39 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-03-11 15:17:16 +0100 |
commit | 883d4d24118e2e9f1184ab1023a6488c0d12ac0e (patch) | |
tree | 8ce6df9a792ca85f8849a14d820d1a4af0be5ef8 | |
parent | ffeed0b29802118fddbf75a334bb32888a2363da (diff) | |
download | justbuild-883d4d24118e2e9f1184ab1023a6488c0d12ac0e.tar.gz |
local build root layout: collect all ephemeral directories
... under a common root in the youngest generation. This will allow
a simple way of cleaning them up during garbage collection.
-rw-r--r-- | src/buildtool/storage/config.hpp | 9 | ||||
-rw-r--r-- | src/buildtool/storage/fs_utils.cpp | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/buildtool/storage/config.hpp b/src/buildtool/storage/config.hpp index 069daed2..92358d12 100644 --- a/src/buildtool/storage/config.hpp +++ b/src/buildtool/storage/config.hpp @@ -170,11 +170,18 @@ class StorageConfig { } } + /// \brief Root directory for all ephemeral directories, i.e., directories + /// that can (and should) be removed immediately by garbage collection. + [[nodiscard]] static auto EphemeralRoot() noexcept + -> std::filesystem::path { + return GenerationCacheRoot(0) / "ephemeral"; + } + /// \brief Root directory for local action executions; individual actions /// create a working directory below this root. [[nodiscard]] static auto ExecutionRoot() noexcept -> std::filesystem::path { - return GenerationCacheRoot(0) / "exec_root"; + return EphemeralRoot() / "exec_root"; } private: diff --git a/src/buildtool/storage/fs_utils.cpp b/src/buildtool/storage/fs_utils.cpp index 83167181..5cc3d8a0 100644 --- a/src/buildtool/storage/fs_utils.cpp +++ b/src/buildtool/storage/fs_utils.cpp @@ -51,8 +51,7 @@ auto GetGitRoot(LocalPathsPtr const& just_mr_paths, auto CreateTypedTmpDir(std::string const& type) noexcept -> TmpDirPtr { // try to create parent dir - auto parent_path = - StorageConfig::GenerationCacheRoot(0) / "tmp-workspaces" / type; + auto parent_path = StorageConfig::EphemeralRoot() / "tmp-workspaces" / type; return TmpDir::Create(parent_path); } |