mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 12:08:05 +01:00
Migrate profiles from a relational database to DynamoDB
This commit is contained in:
@@ -49,15 +49,18 @@ public class DynamoDbTables {
|
||||
private final IssuedReceiptsTableConfiguration issuedReceipts;
|
||||
private final TableWithExpiration redeemedReceipts;
|
||||
private final Table subscriptions;
|
||||
private final Table profiles;
|
||||
|
||||
@JsonCreator
|
||||
public DynamoDbTables(
|
||||
@JsonProperty("issuedReceipts") final IssuedReceiptsTableConfiguration issuedReceipts,
|
||||
@JsonProperty("redeemedReceipts") final TableWithExpiration redeemedReceipts,
|
||||
@JsonProperty("subscriptions") final Table subscriptions) {
|
||||
@JsonProperty("subscriptions") final Table subscriptions,
|
||||
@JsonProperty("profiles") final Table profiles) {
|
||||
this.issuedReceipts = issuedReceipts;
|
||||
this.redeemedReceipts = redeemedReceipts;
|
||||
this.subscriptions = subscriptions;
|
||||
this.profiles = profiles;
|
||||
}
|
||||
|
||||
@Valid
|
||||
@@ -77,4 +80,10 @@ public class DynamoDbTables {
|
||||
public Table getSubscriptions() {
|
||||
return subscriptions;
|
||||
}
|
||||
|
||||
@Valid
|
||||
@NotNull
|
||||
public Table getProfiles() {
|
||||
return profiles;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,10 @@ public class DynamicConfiguration {
|
||||
@Valid
|
||||
private DynamicPushLatencyConfiguration pushLatency = new DynamicPushLatencyConfiguration(Collections.emptyMap());
|
||||
|
||||
@JsonProperty
|
||||
@Valid
|
||||
private DynamicProfileMigrationConfiguration profileMigration = new DynamicProfileMigrationConfiguration();
|
||||
|
||||
public Optional<DynamicExperimentEnrollmentConfiguration> getExperimentEnrollmentConfiguration(
|
||||
final String experimentName) {
|
||||
return Optional.ofNullable(experiments.get(experimentName));
|
||||
@@ -109,4 +113,8 @@ public class DynamicConfiguration {
|
||||
public DynamicPushLatencyConfiguration getPushLatencyConfiguration() {
|
||||
return pushLatency;
|
||||
}
|
||||
|
||||
public DynamicProfileMigrationConfiguration getProfileMigrationConfiguration() {
|
||||
return profileMigration;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright 2013-2021 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.whispersystems.textsecuregcm.configuration.dynamic;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class DynamicProfileMigrationConfiguration {
|
||||
|
||||
@JsonProperty
|
||||
private boolean dynamoDbDeleteEnabled = false;
|
||||
|
||||
@JsonProperty
|
||||
private boolean dynamoDbWriteEnabled = false;
|
||||
|
||||
@JsonProperty
|
||||
private boolean dynamoDbReadForComparisonEnabled = false;
|
||||
|
||||
@JsonProperty
|
||||
private boolean dynamoDbReadPrimary = false;
|
||||
|
||||
public boolean isDynamoDbDeleteEnabled() {
|
||||
return dynamoDbDeleteEnabled;
|
||||
}
|
||||
|
||||
public boolean isDynamoDbWriteEnabled() {
|
||||
return dynamoDbWriteEnabled;
|
||||
}
|
||||
|
||||
public boolean isDynamoDbReadForComparisonEnabled() {
|
||||
return dynamoDbReadForComparisonEnabled;
|
||||
}
|
||||
|
||||
public boolean isDynamoDbReadPrimary() {
|
||||
return dynamoDbReadPrimary;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user