Interface BatchingDescriptor<RequestT,ResponseT> (2.19.0)

public interface BatchingDescriptor<RequestT,ResponseT>

Interface which represents an object that transforms request/response data for the purposes of batching.

Implementations of BatchingDescriptor must guarantee that all methods are stateless and thread safe.

This class is designed to be used by generated code.

Type Parameters

NameDescription
RequestT
ResponseT

Methods

countBytes(RequestT request)

public abstract long countBytes(RequestT request)

Returns the size in bytes of this request.

Parameter
NameDescription
requestRequestT
Returns
TypeDescription
long

countElements(RequestT request)

public abstract long countElements(RequestT request)

Returns the number of elements contained in this request.

Parameter
NameDescription
requestRequestT
Returns
TypeDescription
long

getBatchPartitionKey(RequestT request)

public abstract PartitionKey getBatchPartitionKey(RequestT request)

Returns the value of the partition key for the given request.

Parameter
NameDescription
requestRequestT
Returns
TypeDescription
PartitionKey

getRequestBuilder()

public abstract RequestBuilder<RequestT> getRequestBuilder()

Get the Builder object for the request type RequestT.

Returns
TypeDescription
RequestBuilder<RequestT>

splitException(Throwable throwable, Collection<? extends BatchedRequestIssuer<ResponseT>> batch)

public abstract void splitException(Throwable throwable, Collection<? extends BatchedRequestIssuer<ResponseT>> batch)

Splits the exception that resulted from a batched call into an individual setException call on each RequestIssuer.

Parameters
NameDescription
throwableThrowable
batchCollection<? extends com.google.api.gax.rpc.BatchedRequestIssuer<ResponseT>>

splitResponse(ResponseT batchResponse, Collection<? extends BatchedRequestIssuer<ResponseT>> batch)

public abstract void splitResponse(ResponseT batchResponse, Collection<? extends BatchedRequestIssuer<ResponseT>> batch)

Splits the result from a batched call into an individual setResponse call on each RequestIssuer.

Parameters
NameDescription
batchResponseResponseT
batchCollection<? extends com.google.api.gax.rpc.BatchedRequestIssuer<ResponseT>>