Refactor spam filter's S3MonitoredObject to server parent module.

Allows other parts of server to use S3MonitoredObjects.
This commit is contained in:
adel-signal
2024-01-08 10:34:12 -08:00
committed by GitHub
parent 3c64d9292f
commit 2b688b1a60
5 changed files with 436 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
/*
* Copyright 2013-2021 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.whispersystems.textsecuregcm.configuration;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.annotations.VisibleForTesting;
import java.time.Duration;
import javax.validation.constraints.NotBlank;
public record MonitoredS3ObjectConfiguration(
@NotBlank String s3Region,
@NotBlank String s3Bucket,
@NotBlank String objectKey,
long maxSize,
Duration refreshInterval
) {
static long DEFAULT_MAXSIZE = 16*1024*1024;
static Duration DEFAULT_DURATION = Duration.ofMinutes(5);
public MonitoredS3ObjectConfiguration(String s3Region, String s3Bucket, String objectKey) {
this(s3Region, s3Bucket, objectKey, DEFAULT_MAXSIZE, DEFAULT_DURATION);
}
}