@InternalApi public class ReadRowsResumptionStrategy extends Object implements StreamResumptionStrategy<com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsRequest,com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsResponse>
StreamResumptionStrategy
for the ReadRows API. This class tracks
the offset of the last row received and, upon retry, attempts to resume the stream at the next
offset.
This class is considered an internal implementation detail and not meant to be used by applications.
Constructor and Description |
---|
ReadRowsResumptionStrategy() |
Modifier and Type | Method and Description |
---|---|
boolean |
canResume() |
StreamResumptionStrategy<com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsRequest,com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsResponse> |
createNew() |
com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsRequest |
getResumeRequest(com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsRequest originalRequest) |
com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsResponse |
processResponse(com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsResponse response) |
public StreamResumptionStrategy<com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsRequest,com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsResponse> createNew()
createNew
in interface StreamResumptionStrategy<com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsRequest,com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsResponse>
public com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsResponse processResponse(com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsResponse response)
processResponse
in interface StreamResumptionStrategy<com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsRequest,com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsResponse>
public com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsRequest getResumeRequest(com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsRequest originalRequest)
Given the initial/original request, this implementation generates a request that will yield a new stream whose first response would come right after the last response received by processResponse. It takes into account the offset from the original request.
getResumeRequest
in interface StreamResumptionStrategy<com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsRequest,com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsResponse>
public boolean canResume()
canResume
in interface StreamResumptionStrategy<com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsRequest,com.google.cloud.bigquery.storage.v1beta1.Storage.ReadRowsResponse>
Copyright © 2019 Google LLC. All rights reserved.