in iep-spring-leader-dynamodb/src/main/java/com/netflix/iep/leader/dynamodb/DynamoDbLeaderDatabase.java [108:150]
public DynamoDbLeaderDatabase(
DynamoDbClient db,
Config config,
LeaderId leaderId,
String tableName,
String hashKeyName,
Long readCapacityUnits,
Long writeCapacityUnits,
Duration tableActiveTimeout,
String leaderIdAttributeName,
String lastUpdateAttributeName
) {
Objects.requireNonNull(db, "db");
Objects.requireNonNull(config, "config");
Objects.requireNonNull(leaderId, "leaderId");
Objects.requireNonNull(tableName, "tableName");
Objects.requireNonNull(hashKeyName, "hashKeyName");
Objects.requireNonNull(readCapacityUnits, "readCapacityUnits");
Objects.requireNonNull(writeCapacityUnits, "writeCapacityUnits");
Objects.requireNonNull(tableActiveTimeout, "tableActiveTimeout");
Objects.requireNonNull(leaderIdAttributeName, "leaderIdAttributeName");
Objects.requireNonNull(lastUpdateAttributeName, "lastUpdateAttributeName");
this.db = db;
this.config = config;
this.leaderId = leaderId;
this.tableName = tableName;
this.hashKeyName = hashKeyName;
this.readCapacityUnits = readCapacityUnits;
this.writeCapacityUnits = writeCapacityUnits;
this.tableActiveTimeout = tableActiveTimeout;
this.leaderIdAttributeName = leaderIdAttributeName;
this.lastUpdateAttributeName = lastUpdateAttributeName;
this.leaderUpdateExpression =
formatUpdateLeader(LEADER_UPDATE_FORMAT, NOW_MILLIS_PLACEHOLDER);
this.leaderUpdateConditionExpression =
formatUpdateLeader(LEADER_UPDATE_CONDITION_FORMAT, LEADER_TIMEOUT_PLACEHOLDER);
this.removeLeadershipExpression =
formatRemoveLeader(LEADER_REMOVE_FORMAT, NO_LEADER_PLACEHOLDER);
this.removeLeadershipConditionExpression =
formatRemoveLeader(LEADER_REMOVE_CONDITION, LEADER_ID_PLACEHOLDER);
}