mirror of
https://github.com/signalapp/Signal-Server
synced 2026-02-24 10:35:15 +00:00
DynamoDBExtension refactor and helpers for our schema (#1327)
There's a lot of boilerplate involved in setting up a DynamoDBExtension, and some tests were creating several extensions rather than one with several tables, which is probably slower than it has to be. This change adds a new DynamoDbExtensionSchema class in which we can define the Dynamo schema for tests, and refactors DynamoDbExtension to make it easy to instantiate a single extension with all the tables one wants (and no more, both to minimize test startup time and to ensure we explicitly test our dependencies and lack thereof). Tests requiring a DynamoDbExtension with a table schema that's not part of the normal Signal schema can instantiate a DynamoDbExtension.RawSchema instead. Test timings are unaffected, at least on my machine. Before: ```[INFO] service ............................................ SUCCESS [01:18 min]``` After: ```[INFO] service ............................................ SUCCESS [01:18 min]``` Co-authored-by: Jonathan Klabunde Tomer <jkt@viola.signal.org>
This commit is contained in:
committed by
GitHub
parent
f5726f63bd
commit
48ebafa4e0
@@ -45,11 +45,17 @@ import software.amazon.awssdk.services.dynamodb.model.WriteRequest;
|
||||
|
||||
public class MessagesDynamoDb extends AbstractDynamoDbStore {
|
||||
|
||||
private static final String KEY_PARTITION = "H";
|
||||
private static final String KEY_SORT = "S";
|
||||
@VisibleForTesting
|
||||
static final String KEY_PARTITION = "H";
|
||||
|
||||
private static final String LOCAL_INDEX_MESSAGE_UUID_NAME = "Message_UUID_Index";
|
||||
private static final String LOCAL_INDEX_MESSAGE_UUID_KEY_SORT = "U";
|
||||
@VisibleForTesting
|
||||
static final String KEY_SORT = "S";
|
||||
|
||||
@VisibleForTesting
|
||||
static final String LOCAL_INDEX_MESSAGE_UUID_NAME = "Message_UUID_Index";
|
||||
|
||||
@VisibleForTesting
|
||||
static final String LOCAL_INDEX_MESSAGE_UUID_KEY_SORT = "U";
|
||||
|
||||
private static final String KEY_TTL = "E";
|
||||
private static final String KEY_ENVELOPE_BYTES = "EB";
|
||||
|
||||
Reference in New Issue
Block a user