java.lang.Object
com.erudika.para.server.persistence.AWSDynamoUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
createSharedTable
(long readCapacity, long writeCapacity) Creates a table in AWS DynamoDB which will be shared between apps.static boolean
createTable
(String appid) Creates a DynamoDB table.static boolean
createTable
(String appid, int maxReadCapacity, int maxWriteCapacity) Creates a table in AWS DynamoDB.static void
deleteAllFromSharedTable
(String appid) Deletes all objects in a shared table, which belong to a given appid, by scanning the GSI.static boolean
deleteTable
(String appid) Deletes the main table from AWS DynamoDB.static boolean
existsTable
(String appid) Checks if the main table exists in the database.static software.amazon.awssdk.services.dynamodb.DynamoDbClient
Returns a client instance for AWS DynamoDB.static String
getKeyForAppid
(String key, String appIdentifier) Returns the correct key for an object given the appid (table name).Returns the list of regions where a table should be replicated (global table).static software.amazon.awssdk.services.dynamodb.model.GlobalSecondaryIndexDescription
Returns the Index object for the shared table.static String
getTableNameForAppid
(String appIdentifier) Returns the table name for a given app id.getTableStatus
(String appid) Gives basic information about a DynamoDB table (status, creation date, size).static boolean
isSharedAppid
(String appIdentifier) Returns true if appid starts with a space " ".Lists all table names for this account.static <P extends com.erudika.para.core.ParaObject>
List<P> readPageFromSharedTable
(String appid, com.erudika.para.core.utils.Pager pager) Reads a page from a "shared" DynamoDB table.static <P extends com.erudika.para.core.ParaObject>
List<P> readPageFromTable
(String appid, com.erudika.para.core.utils.Pager p) Reads a page from a standard DynamoDB table.static boolean
updateTable
(String appid, long readCapacity, long writeCapacity) Updates the table settings (read and write capacities).
-
Method Details
-
getClient
public static software.amazon.awssdk.services.dynamodb.DynamoDbClient getClient()Returns a client instance for AWS DynamoDB.- Returns:
- a client that talks to DynamoDB
-
existsTable
Checks if the main table exists in the database.- Parameters:
appid
- name of theApp
- Returns:
- true if the table exists
-
createTable
Creates a DynamoDB table.- Parameters:
appid
- name of theApp
- Returns:
- true if created
-
createTable
Creates a table in AWS DynamoDB.- Parameters:
appid
- name of theApp
maxReadCapacity
- max read capacity for autoscaling (only applicable in PROVISIONED billing mode)maxWriteCapacity
- max write capacity for autoscaling (only applicable in PROVISIONED billing mode)- Returns:
- true if created
-
updateTable
Updates the table settings (read and write capacities).- Parameters:
appid
- name of theApp
readCapacity
- read capacitywriteCapacity
- write capacity- Returns:
- true if updated
-
deleteTable
Deletes the main table from AWS DynamoDB.- Parameters:
appid
- name of theApp
- Returns:
- true if deleted
-
getTableStatus
-
listAllTables
-
getTableNameForAppid
-
getKeyForAppid
-
readPageFromTable
public static <P extends com.erudika.para.core.ParaObject> List<P> readPageFromTable(String appid, com.erudika.para.core.utils.Pager p) Reads a page from a standard DynamoDB table.- Type Parameters:
P
- type of object- Parameters:
appid
- the app identifier (name)p
- aPager
- Returns:
- the last row key of the page, or null.
-
getReplicaRegions
-