當前位置: 首頁>>代碼示例>>Java>>正文


Java LocalSecondaryIndexDescription類代碼示例

本文整理匯總了Java中com.amazonaws.services.dynamodbv2.model.LocalSecondaryIndexDescription的典型用法代碼示例。如果您正苦於以下問題:Java LocalSecondaryIndexDescription類的具體用法?Java LocalSecondaryIndexDescription怎麽用?Java LocalSecondaryIndexDescription使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LocalSecondaryIndexDescription類屬於com.amazonaws.services.dynamodbv2.model包,在下文中一共展示了LocalSecondaryIndexDescription類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: toIndexDescriptions

import com.amazonaws.services.dynamodbv2.model.LocalSecondaryIndexDescription; //導入依賴的package包/類
private static Collection<IndexDescription> toIndexDescriptions(com.amazonaws.services.dynamodbv2.model.TableDescription table) {
    List<IndexDescription> indexes = new ArrayList<>();

    // Main
    indexes.add(
        toIndex(
            null,
            IndexType.MAIN_INDEX,
            table.getKeySchema(),
            table.getAttributeDefinitions(),
            table.getProvisionedThroughput()));

    if ( null != table.getLocalSecondaryIndexes() ) {
        for ( LocalSecondaryIndexDescription lsi : table.getLocalSecondaryIndexes() ) {
            indexes.add(
                toIndex(
                    lsi.getIndexName(),
                    IndexType.LOCAL_SECONDARY_INDEX,
                    lsi.getKeySchema(),
                    table.getAttributeDefinitions(),
                    null));
        }
    }

    if ( null != table.getGlobalSecondaryIndexes() ) {
        for ( GlobalSecondaryIndexDescription gsi : table.getGlobalSecondaryIndexes() ) {
            indexes.add(
                toIndex(
                    gsi.getIndexName(),
                    IndexType.GLOBAL_SECONDARY_INDEX,
                    gsi.getKeySchema(),
                    table.getAttributeDefinitions(),
                    gsi.getProvisionedThroughput()));
        }
    }
    return indexes;
}
 
開發者ID:Distelli,項目名稱:java-persistence,代碼行數:38,代碼來源:DdbSchema.java

示例2: waitForTableCreation

import com.amazonaws.services.dynamodbv2.model.LocalSecondaryIndexDescription; //導入依賴的package包/類
public void waitForTableCreation(final String tableName, final boolean verifyIndexesList,
    final List<LocalSecondaryIndexDescription> expectedLsiList, final List<GlobalSecondaryIndexDescription> expectedGsiList) throws BackendException {
    boolean successFlag = false;
    int retryCount = 0;
    while (!successFlag && retryCount < maxRetries) {
        try {
            boolean areAllGsisActive = true;
            final TableDescription td = describeTable(tableName);
            if (verifyIndexesList) {
                final Set<LocalSecondaryIndexDescription> expectedLSIs = new HashSet<LocalSecondaryIndexDescription>();
                if (expectedLsiList != null) {
                    expectedLSIs.addAll(expectedLsiList);
                }
                final Set<LocalSecondaryIndexDescription> actualLSIs = new HashSet<LocalSecondaryIndexDescription>();
                if (td.getLocalSecondaryIndexes() != null) {
                    actualLSIs.addAll(td.getLocalSecondaryIndexes());
                }
                // the lsi list should be there even if the table is in creating state
                if (!(expectedLsiList == null && td.getLocalSecondaryIndexes() == null || expectedLSIs.equals(actualLSIs))) {
                    throw new PermanentBackendException("LSI list is not as expected during table creation. expectedLsiList="
                        + expectedLsiList.toString() + "; table description=" + td.toString());
                }

                // ignore the status of all GSIs since they will mess up .equals()
                if (td.getGlobalSecondaryIndexes() != null) {
                    for (final GlobalSecondaryIndexDescription gDesc : td.getGlobalSecondaryIndexes()) {
                        if (!isTableAcceptingWrites(gDesc.getIndexStatus())) {
                            areAllGsisActive = false;
                            break;
                        }
                    }
                }

                // the gsi list should be there even if the table is in creating state
                if (!areGsisSameConfiguration(expectedGsiList, td.getGlobalSecondaryIndexes())) {
                    throw new PermanentBackendException("GSI list is not as expected during table creation. expectedGsiList="
                        + expectedGsiList.toString() + "; table description=" + td.toString());
                }
            }
            successFlag = isTableAcceptingWrites(td.getTableStatus()) && areAllGsisActive;
        } catch (BackendNotFoundException ignore) {
            successFlag = false;
        }

        if (!successFlag) {
            interruptibleSleep(CONTROL_PLANE_RETRY_DELAY_MS);
        }
        retryCount++;
    }
    if (!successFlag) {
        throw new PermanentBackendException("Table creation not completed for table " + tableName + " after retrying "
                + this.maxRetries + " times for a duration of " + CONTROL_PLANE_RETRY_DELAY_MS * this.maxRetries + " ms");
    }
}
 
開發者ID:awslabs,項目名稱:dynamodb-janusgraph-storage-backend,代碼行數:55,代碼來源:DynamoDbDelegate.java


注:本文中的com.amazonaws.services.dynamodbv2.model.LocalSecondaryIndexDescription類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。