Example usage for com.amazonaws.services.dynamodbv2.model ScanRequest getSegment

List of usage examples for com.amazonaws.services.dynamodbv2.model ScanRequest getSegment

Introduction

In this page you can find the example usage for com.amazonaws.services.dynamodbv2.model ScanRequest getSegment.

Prototype


public Integer getSegment() 

Source Link

Document

For a parallel Scan request, Segment identifies an individual segment to be scanned by an application worker.

Usage

From source file:com.amazon.janusgraph.diskstorage.dynamodb.DynamoDbDelegate.java

License:Open Source License

public static ScanRequest copyScanRequest(final ScanRequest request) {
    return new ScanRequest().withAttributesToGet(request.getAttributesToGet())
            .withScanFilter(request.getScanFilter()).withConditionalOperator(request.getConditionalOperator())
            .withExclusiveStartKey(request.getExclusiveStartKey())
            .withExpressionAttributeNames(request.getExpressionAttributeNames())
            .withExpressionAttributeValues(cloneItem(request.getExpressionAttributeValues()))
            .withFilterExpression(request.getFilterExpression()).withIndexName(request.getIndexName())
            .withLimit(request.getLimit()).withProjectionExpression(request.getProjectionExpression())
            .withReturnConsumedCapacity(request.getReturnConsumedCapacity())
            .withScanFilter(request.getScanFilter()).withSelect(request.getSelect())
            .withTableName(request.getTableName()).withTotalSegments(request.getTotalSegments())
            .withSegment(request.getSegment());
}

From source file:com.amazon.janusgraph.diskstorage.dynamodb.iterator.ParallelScanner.java

License:Open Source License

/**
 * This method gets a segmentedScanResult and submits the next scan request for that segment, if there is one.
 * @return the next available ScanResult
 * @throws ExecutionException if one of the segment pages threw while executing
 * @throws InterruptedException if one of the segment pages was interrupted while executing.
 *//*w w  w .  ja  v  a 2 s.  c  om*/
private ScanContext grab() throws ExecutionException, InterruptedException {
    final Future<ScanContext> ret = exec.take();

    final ScanRequest originalRequest = ret.get().getScanRequest();
    final int segment = originalRequest.getSegment();

    final ScanSegmentWorker sw = workers[segment];

    if (sw.hasNext()) {
        currentFutures[segment] = exec.submit(sw);
    } else {
        finishSegment(segment);
        currentFutures[segment] = null;
    }

    return ret.get(); //This might block if nothing is available.
}

From source file:com.rapid7.diskstorage.dynamodb.DynamoDBDelegate.java

License:Open Source License

public static ScanRequest copyScanRequest(ScanRequest request) {
    return new ScanRequest().withAttributesToGet(request.getAttributesToGet())
            .withScanFilter(request.getScanFilter()).withConditionalOperator(request.getConditionalOperator())
            .withExclusiveStartKey(request.getExclusiveStartKey())
            .withExpressionAttributeNames(request.getExpressionAttributeNames())
            .withExpressionAttributeValues(cloneItem(request.getExpressionAttributeValues()))
            .withFilterExpression(request.getFilterExpression()).withIndexName(request.getIndexName())
            .withLimit(request.getLimit()).withProjectionExpression(request.getProjectionExpression())
            .withReturnConsumedCapacity(request.getReturnConsumedCapacity())
            .withScanFilter(request.getScanFilter()).withSelect(request.getSelect())
            .withTableName(request.getTableName()).withTotalSegments(request.getTotalSegments())
            .withSegment(request.getSegment());
}

From source file:com.rapid7.diskstorage.dynamodb.iterator.ParallelScanner.java

License:Open Source License

/**
 * This method gets a segmentedScanResult and submits the next scan request for that segment, if there is one.
 * @return the next available ScanResult
 * @throws ExecutionException if one of the segment pages threw while executing
 * @throws InterruptedException if one of the segment pages was interrupted while executing.
 *//*  w ww.j a  v  a 2s . co  m*/
private ScanContext grab() throws ExecutionException, InterruptedException {
    Future<ScanContext> ret = exec.take();

    ScanRequest originalRequest = ret.get().getScanRequest();
    int segment = originalRequest.getSegment();

    ScanSegmentWorker sw = workers[segment];

    if (sw.hasNext()) {
        currentFutures[segment] = exec.submit(sw);
    } else {
        finishSegment(segment);
        currentFutures[segment] = null;
    }

    return ret.get();
}