mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 20:18:05 +01:00
Use storage-manager's copy implementation
This commit is contained in:
committed by
ravi-signal
parent
843151859d
commit
fc097db2a0
@@ -1,17 +1,44 @@
|
||||
package org.whispersystems.textsecuregcm.configuration;
|
||||
|
||||
import org.whispersystems.textsecuregcm.configuration.secrets.SecretString;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import org.whispersystems.textsecuregcm.configuration.secrets.SecretString;
|
||||
|
||||
/**
|
||||
* Configuration for the cdn3 storage manager
|
||||
*
|
||||
* @param baseUri The base URI of the storage manager
|
||||
* @param clientId The cloudflare client ID to use to authenticate to the storage manager
|
||||
* @param clientSecret The cloudflare client secret to use to authenticate to the storage manager
|
||||
* @param sourceSchemes A map of cdn id to a retrieval scheme understood by the storage-manager. This is used by the
|
||||
* storage-manager when copying to determine how to read a source object. Current schemes are
|
||||
* 'gcs' and 'r2'
|
||||
* @param numHttpClients The number http clients to use with the storage-manager to support request striping
|
||||
* @param circuitBreaker A circuit breaker configuration for the storage-manager http client
|
||||
* @param retry A retry configuration for the storage-manager http client
|
||||
*/
|
||||
public record Cdn3StorageManagerConfiguration(
|
||||
@NotNull String baseUri,
|
||||
@NotNull String clientId,
|
||||
@NotNull SecretString clientSecret,
|
||||
@NotNull Integer numHttpClients) {
|
||||
@NotNull Map<Integer, String> sourceSchemes,
|
||||
@NotNull Integer numHttpClients,
|
||||
@NotNull CircuitBreakerConfiguration circuitBreaker,
|
||||
@NotNull RetryConfiguration retry) {
|
||||
|
||||
public Cdn3StorageManagerConfiguration {
|
||||
if (numHttpClients == null) {
|
||||
numHttpClients = 2;
|
||||
}
|
||||
if (sourceSchemes == null) {
|
||||
sourceSchemes = Collections.emptyMap();
|
||||
}
|
||||
if (circuitBreaker == null) {
|
||||
circuitBreaker = new CircuitBreakerConfiguration();
|
||||
}
|
||||
if (retry == null) {
|
||||
retry = new RetryConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,20 +13,6 @@ import java.util.Map;
|
||||
*/
|
||||
public class ClientCdnConfiguration {
|
||||
|
||||
/**
|
||||
* Map from cdn number to the base url for attachments.
|
||||
* <p>
|
||||
* For example, if an attachment with the id 'abc' can be retrieved from cdn 2 at https://example.org/attachments/abc,
|
||||
* the attachment url for 2 should https://example.org/attachments
|
||||
*/
|
||||
@JsonProperty
|
||||
@NotNull
|
||||
Map<Integer, @NotBlank String> attachmentUrls;
|
||||
|
||||
@JsonProperty
|
||||
@NotNull
|
||||
@NotEmpty List<@NotBlank String> caCertificates = new ArrayList<>();
|
||||
|
||||
@JsonProperty
|
||||
@NotNull
|
||||
CircuitBreakerConfiguration circuitBreaker = new CircuitBreakerConfiguration();
|
||||
@@ -35,10 +21,6 @@ public class ClientCdnConfiguration {
|
||||
@NotNull
|
||||
RetryConfiguration retry = new RetryConfiguration();
|
||||
|
||||
public List<String> getCaCertificates() {
|
||||
return caCertificates;
|
||||
}
|
||||
|
||||
public CircuitBreakerConfiguration getCircuitBreaker() {
|
||||
return circuitBreaker;
|
||||
}
|
||||
@@ -46,8 +28,4 @@ public class ClientCdnConfiguration {
|
||||
public RetryConfiguration getRetry() {
|
||||
return retry;
|
||||
}
|
||||
|
||||
public Map<Integer, String> getAttachmentUrls() {
|
||||
return attachmentUrls;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user