summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md2
-rw-r--r--doc/future-designs/large-blobs.md5
-rw-r--r--share/man/just.1.md8
-rw-r--r--src/buildtool/common/cli.hpp12
-rw-r--r--src/buildtool/main/cli.cpp1
-rw-r--r--src/buildtool/main/cli.hpp1
-rw-r--r--src/buildtool/main/main.cpp3
7 files changed, 28 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 815ed095..3b292c66 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -34,6 +34,8 @@ A feature release on top of `1.2.0`, backwards compatible.
- Support for fetching archives from FTP and TFTP was added to `just-mr`
if it was built with bundled curl. For package builds, libcurl has
enabled whatever the distro considers suitable.
+- The `gc` subcommand supports an option `--no-rotate` to carry out
+ only local clean up.
### Fixes
diff --git a/doc/future-designs/large-blobs.md b/doc/future-designs/large-blobs.md
index 989d119e..5c94f23b 100644
--- a/doc/future-designs/large-blobs.md
+++ b/doc/future-designs/large-blobs.md
@@ -111,6 +111,5 @@ a blob via `grpc` without having to use the streaming interface,
i.e, we chose 2MB. In this way, we already have correct blobs split
for transfer to an end point that supports blob splicing.
-Additionally, the `gc` will get an option `--compactify-only`
-instructing `gc` to only perform the compactification step, without
-rotating generations.
+The compactification step will also be carried out if the `--no-rotate`
+option is given to `gc`.
diff --git a/share/man/just.1.md b/share/man/just.1.md
index 0c72cb38..8f3e9436 100644
--- a/share/man/just.1.md
+++ b/share/man/just.1.md
@@ -738,6 +738,14 @@ is given by the option **`--log-operations-threshold`**, at most *`2^n`*
operations will be removed, in a FIFO scheme. If unset, defaults to
14. Must be in the range \[0,255\].
+**`gc`** specific options
+-------------------------
+
+**`--no-rotate`**
+Do not rotate gargabe-collection generations. Instead, only carry
+out clean up tasks that do not affect what is stored in the cache.
+
+
EXIT STATUS
===========
diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp
index 387092bc..5b8df960 100644
--- a/src/buildtool/common/cli.hpp
+++ b/src/buildtool/common/cli.hpp
@@ -180,6 +180,10 @@ struct ServeArguments {
std::vector<std::filesystem::path> repositories{};
};
+struct GcArguments {
+ bool no_rotate{};
+};
+
static inline auto SetupCommonArguments(
gsl::not_null<CLI::App*> const& app,
gsl::not_null<CommonArguments*> const& clargs) {
@@ -723,4 +727,12 @@ static inline void SetupRetryArguments(
"the resources that survived the outage. (Default: 60)");
}
+static inline void SetupGcArguments(gsl::not_null<CLI::App*> const& app,
+ gsl::not_null<GcArguments*> const& args) {
+ app->add_flag("--no-rotate",
+ args->no_rotate,
+ "Do not rotate cache generations, only clean up what can be "
+ "done without losing cache.");
+}
+
#endif // INCLUDED_SRC_BUILDTOOL_COMMON_CLI_HPP
diff --git a/src/buildtool/main/cli.cpp b/src/buildtool/main/cli.cpp
index c5da32bb..413befa6 100644
--- a/src/buildtool/main/cli.cpp
+++ b/src/buildtool/main/cli.cpp
@@ -127,6 +127,7 @@ auto SetupGcCommandArguments(
gsl::not_null<CommandLineArguments*> const& clargs) {
SetupLogArguments(app, &clargs->log);
SetupCacheArguments(app, &clargs->endpoint);
+ SetupGcArguments(app, &clargs->gc);
}
/// \brief Setup arguments for sub command "just execute".
diff --git a/src/buildtool/main/cli.hpp b/src/buildtool/main/cli.hpp
index 1ca45255..04ae2a16 100644
--- a/src/buildtool/main/cli.hpp
+++ b/src/buildtool/main/cli.hpp
@@ -52,6 +52,7 @@ struct CommandLineArguments {
ServiceArguments service;
ServeArguments serve;
RetryArguments retry;
+ GcArguments gc;
};
auto ParseCommandLineArguments(int argc, char const* const* argv)
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index 5241fa54..78ec57a7 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -857,7 +857,8 @@ auto main(int argc, char* argv[]) -> int {
SetupAuthConfig(arguments.auth, arguments.cauth, arguments.sauth);
if (arguments.cmd == SubCommand::kGc) {
- if (GarbageCollector::TriggerGarbageCollection()) {
+ if (GarbageCollector::TriggerGarbageCollection(
+ arguments.gc.no_rotate)) {
return kExitSuccess;
}
return kExitFailure;