Package com.google.api.gax.batching
Interface BatchResource
Represent the resource used by a batch including element and byte. It can also be extended to
other things to determine if adding a new element needs to be flow controlled or if the current
batch needs to be flushed.
-
Method Summary
Modifier and TypeMethodDescriptionadd(BatchResource resource) Adds the additional resource.longReturns the byte count of this resource.longReturns the element count of this resource.booleanshouldFlush(long maxElementThreshold, long maxBytesThreshold) Checks if the currentBatchResourceshould be flushed based on the maxElementThreshold and maxBytesThreshold.
-
Method Details
-
add
Adds the additional resource. -
getElementCount
long getElementCount()Returns the element count of this resource. -
getByteCount
long getByteCount()Returns the byte count of this resource. -
shouldFlush
boolean shouldFlush(long maxElementThreshold, long maxBytesThreshold) Checks if the currentBatchResourceshould be flushed based on the maxElementThreshold and maxBytesThreshold.
-