Make max total backup media configurable

This commit is contained in:
Ravi Khadiwala
2025-09-15 10:29:10 -05:00
committed by ravi-signal
parent e50dcd185d
commit 35ffb208e3
9 changed files with 115 additions and 74 deletions

View File

@@ -5,6 +5,8 @@
package org.whispersystems.textsecuregcm.configuration.dynamic;
import io.dropwizard.util.DataSize;
import jakarta.validation.constraints.NotNull;
import java.time.Duration;
/**
@@ -13,12 +15,14 @@ import java.time.Duration;
* @param copyConcurrency How many cdn object copy requests can be outstanding at a time per batch copy-to-backup operation
* @param usageCheckpointCount When doing batch operations, how often persist usage deltas
* @param maxQuotaStaleness The maximum age of a quota estimate that can be used to enforce a quota limit
* @param maxTotalMediaSize The number of media bytes a paid-tier user may store
*/
public record DynamicBackupConfiguration(
Integer deletionConcurrency,
Integer copyConcurrency,
Integer usageCheckpointCount,
Duration maxQuotaStaleness) {
@NotNull Integer deletionConcurrency,
@NotNull Integer copyConcurrency,
@NotNull Integer usageCheckpointCount,
@NotNull Duration maxQuotaStaleness,
@NotNull Long maxTotalMediaSize) {
public DynamicBackupConfiguration {
if (deletionConcurrency == null) {
@@ -33,9 +37,12 @@ public record DynamicBackupConfiguration(
if (maxQuotaStaleness == null) {
maxQuotaStaleness = Duration.ofSeconds(10);
}
if (maxTotalMediaSize == null) {
maxTotalMediaSize = DataSize.gibibytes(100).toBytes();
}
}
public DynamicBackupConfiguration() {
this(null, null, null, null);
this(null, null, null, null, null);
}
}