Package com.amazonaws.services.dynamodbv2.model

Examples of com.amazonaws.services.dynamodbv2.model.UpdateTableRequest


    private List<ScanRequest> createParallelScanRequestsFromExpression(Class<?> clazz, DynamoDBScanExpression scanExpression, int totalSegments, DynamoDBMapperConfig config) {
      if (totalSegments < 1)
      throw new IllegalArgumentException("Parallel scan should have at least one scan segment.");
      List<ScanRequest> parallelScanRequests= new LinkedList<ScanRequest>();
        for (int segment = 0; segment < totalSegments; segment++) {
          ScanRequest scanRequest = createScanRequestFromExpression(clazz, scanExpression, config);
          parallelScanRequests.add(scanRequest.withSegment(segment).withTotalSegments(totalSegments));
        }
        return parallelScanRequests;
    }
View Full Code Here


    }
    return scanResults;
  }
 
  private ScanResult scanNextPageOfSegment(int currentSegment, boolean checkLastEvaluatedKey) {
    ScanRequest segmentScanRequest = parallelScanRequests.get(currentSegment);
    if (checkLastEvaluatedKey) {
      ScanResult lastScanResult = segmentScanResults.get(currentSegment);
      segmentScanRequest.setExclusiveStartKey(lastScanResult.getLastEvaluatedKey());
    } else {
      segmentScanRequest.setExclusiveStartKey(null);
    }
    ScanResult scanResult = dynamo.scan(mapper.applyUserAgent(segmentScanRequest));
   
    /**
     * Cache the scan result in segmentScanResults.
View Full Code Here

    public <T> PaginatedScanList<T> scan(Class<T> clazz, DynamoDBScanExpression scanExpression, DynamoDBMapperConfig config) {
        config = mergeConfig(config);

        ScanRequest scanRequest = createScanRequestFromExpression(clazz, scanExpression, config);

        ScanResult scanResult = db.scan(applyUserAgent(scanRequest));
        return new PaginatedScanList<T>(this, clazz, db, scanRequest, scanResult, config.getPaginationLoadingStrategy());
    }
View Full Code Here

    public <T> ScanResultPage<T> scanPage(Class<T> clazz, DynamoDBScanExpression scanExpression, DynamoDBMapperConfig config) {
        config = mergeConfig(config);

        ScanRequest scanRequest = createScanRequestFromExpression(clazz, scanExpression, config);

        ScanResult scanResult = db.scan(applyUserAgent(scanRequest));
        ScanResultPage<T> result = new ScanResultPage<T>();
        result.setResults(marshallIntoObjects(clazz, scanResult.getItems()));
        result.setLastEvaluatedKey(scanResult.getLastEvaluatedKey());

        return result;
    }
View Full Code Here

        ScanRequest scanRequest = createScanRequestFromExpression(clazz, scanExpression, config);
        scanRequest.setSelect(Select.COUNT);

        // Count scans can also be truncated for large datasets
        int count = 0;
        ScanResult scanResult = null;
        do {
            scanResult = db.scan(applyUserAgent(scanRequest));
            count += scanResult.getCount();
            scanRequest.setExclusiveStartKey(scanResult.getLastEvaluatedKey());
        } while (scanResult.getLastEvaluatedKey() != null);

        return count;
    }
View Full Code Here

    public <T> PaginatedScanList<T> scan(Class<T> clazz, DynamoDBScanExpression scanExpression, DynamoDBMapperConfig config) {
        config = mergeConfig(config);

        ScanRequest scanRequest = createScanRequestFromExpression(clazz, scanExpression, config);

        ScanResult scanResult = db.scan(applyUserAgent(scanRequest));
        return new PaginatedScanList<T>(this, clazz, db, scanRequest, scanResult);
    }
View Full Code Here

    public <T> ScanResultPage<T> scanPage(Class<T> clazz, DynamoDBScanExpression scanExpression, DynamoDBMapperConfig config) {
        config = mergeConfig(config);

        ScanRequest scanRequest = createScanRequestFromExpression(clazz, scanExpression, config);

        ScanResult scanResult = db.scan(applyUserAgent(scanRequest));
        ScanResultPage<T> result = new ScanResultPage<T>();
        result.setResults(marshallIntoObjects(clazz, scanResult.getItems()));
        result.setLastEvaluatedKey(scanResult.getLastEvaluatedKey());

        return result;
    }
View Full Code Here

        ScanRequest scanRequest = createScanRequestFromExpression(clazz, scanExpression, config);
        scanRequest.setSelect(Select.COUNT);

        // Count scans can also be truncated for large datasets
        int count = 0;
        ScanResult scanResult = null;
        do {
            scanResult = db.scan(applyUserAgent(scanRequest));
            count += scanResult.getCount();
            scanRequest.setExclusiveStartKey(scanResult.getLastEvaluatedKey());
        } while (scanResult.getLastEvaluatedKey() != null);

        return count;
    }
View Full Code Here

      /**
       * Get the ScanResult from cache if the segment scan has finished.
       */
      else if (currentSegmentState == SegmentScanState.HasNextPage
          || currentSegmentState == SegmentScanState.SegmentScanCompleted) {
        ScanResult scanResult = segmentScanResults.get(segment);
        scanResults.add(scanResult);
      }
      else if (currentSegmentState == SegmentScanState.Waiting
          || currentSegmentState == SegmentScanState.Scanning){
        throw new AmazonClientException("Should never see a 'Scanning' or 'Waiting' state when marshalling parallel scan results.");
View Full Code Here

  }
 
  private ScanResult scanNextPageOfSegment(int currentSegment, boolean checkLastEvaluatedKey) {
    ScanRequest segmentScanRequest = parallelScanRequests.get(currentSegment);
    if (checkLastEvaluatedKey) {
      ScanResult lastScanResult = segmentScanResults.get(currentSegment);
      segmentScanRequest.setExclusiveStartKey(lastScanResult.getLastEvaluatedKey());
    } else {
      segmentScanRequest.setExclusiveStartKey(null);
    }
    ScanResult scanResult = dynamo.scan(mapper.applyUserAgent(segmentScanRequest));
   
    /**
     * Cache the scan result in segmentScanResults.
     * We should never try to get these scan results by calling get() on the cached future tasks.
     */
    segmentScanResults.set(currentSegment, scanResult);
   
    /**
     * Update the state and notify any waiting thread.
     */
    synchronized(segmentScanStates) {
      if (null == scanResult.getLastEvaluatedKey())
        segmentScanStates.set(currentSegment, SegmentScanState.SegmentScanCompleted);
      else
        segmentScanStates.set(currentSegment, SegmentScanState.HasNextPage);
      segmentScanStates.notifyAll();
    }
View Full Code Here

TOP

Related Classes of com.amazonaws.services.dynamodbv2.model.UpdateTableRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.