All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scalar.db.storage.dynamo.request.ScanRequest Maven / Gradle / Ivy

Go to download

A universal transaction manager that achieves database-agnostic transactions and distributed transactions that span multiple databases

There is a newer version: 3.14.0
Show newest version
package com.scalar.db.storage.dynamo.request;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Map;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.AttributeValue;
import software.amazon.awssdk.services.dynamodb.model.ScanResponse;

public class ScanRequest implements PaginatedRequest {

  private final software.amazon.awssdk.services.dynamodb.model.ScanRequest dynamoRequest;
  private final DynamoDbClient client;

  @SuppressFBWarnings("EI_EXPOSE_REP2")
  public ScanRequest(
      DynamoDbClient client,
      software.amazon.awssdk.services.dynamodb.model.ScanRequest dynamoRequest) {
    this.client = client;
    this.dynamoRequest = dynamoRequest;
  }

  @Override
  public PaginatedRequestResponse execute(Map exclusiveStartKey) {
    ScanRequest request =
        new ScanRequest(
            this.client,
            this.dynamoRequest.toBuilder().exclusiveStartKey(exclusiveStartKey).build());
    return request.execute();
  }

  @Override
  public PaginatedRequestResponse execute() {
    ScanResponse response = client.scan(dynamoRequest);

    return new PaginatedRequestResponse(
        response.items(), response.hasLastEvaluatedKey(), response.lastEvaluatedKey());
  }

  @Override
  public Integer limit() {
    return dynamoRequest.limit();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy