Package com.google.cloud.hadoop.gcsio
Class GoogleCloudStorageReadOptions.Builder
- java.lang.Object
-
- com.google.cloud.hadoop.gcsio.GoogleCloudStorageReadOptions.Builder
-
- Enclosing class:
- GoogleCloudStorageReadOptions
public abstract static class GoogleCloudStorageReadOptions.Builder extends Object
Mutable builder for GoogleCloudStorageReadOptions.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description GoogleCloudStorageReadOptionsbuild()abstract GoogleCloudStorageReadOptions.BuildersetBackoffInitialInterval(Duration backoffInitialInterval)On exponential back-off, the initial delay before the first retry; subsequent retries then grow as an exponential function of the current delay interval.abstract GoogleCloudStorageReadOptions.BuildersetBackoffMaxElapsedTime(Duration backoffMaxElapsedTime)The maximum total time elapsed since the first retry over the course of a series of retries.abstract GoogleCloudStorageReadOptions.BuildersetBackoffMaxInterval(Duration backoffMaxInterval)The maximum amount of sleep between retries; at this point, there will be no further exponential back-off.abstract GoogleCloudStorageReadOptions.BuildersetBackoffMultiplier(double backoffMultiplier)The base of the exponent used for exponential back-off; each subsequent sleep interval is roughly this many times the previous interval.abstract GoogleCloudStorageReadOptions.BuildersetBackoffRandomizationFactor(double backoffRandomizationFactor)The amount of jitter introduced when computing the next retry sleep interval so that when many clients are retrying, they don't all retry at the same time.abstract GoogleCloudStorageReadOptions.BuildersetBlockSize(long blockSize)abstract GoogleCloudStorageReadOptions.BuildersetFadvise(GoogleCloudStorageReadOptions.Fadvise fadvise)Sets fadvise mode that tunes behavior to optimize HTTP GET requests for various use cases.abstract GoogleCloudStorageReadOptions.BuildersetFadviseRequestTrackCount(int requestTrackCount)abstract GoogleCloudStorageReadOptions.BuildersetFastFailOnNotFoundEnabled(boolean fastFailOnNotFound)True if attempts to open a new channel on a nonexistent object are required to immediately throw an IOException.abstract GoogleCloudStorageReadOptions.BuildersetGrpcChecksumsEnabled(boolean grpcChecksumsEnabled)Sets whether to validate checksums when doing gRPC reads.abstract GoogleCloudStorageReadOptions.BuildersetGrpcReadMessageTimeout(Duration grpcMessageTimeout)Sets the property for gRPC read message timeout in milliseconds.abstract GoogleCloudStorageReadOptions.BuildersetGrpcReadTimeout(Duration grpcReadTimeout)Sets the property to override the default GCS gRPC read stream timeout.abstract GoogleCloudStorageReadOptions.BuildersetGrpcReadZeroCopyEnabled(boolean grpcReadZeroCopyEnabled)Sets the property to use the zero-copy deserializer for gRPC read.abstract GoogleCloudStorageReadOptions.BuildersetGzipEncodingSupportEnabled(boolean gzipEncodingSupportEnabled)If false then reading a file with GZIP content encoding (HTTP header "Content-Encoding: gzip") will result in failure (IOException is thrown).abstract GoogleCloudStorageReadOptions.BuildersetInplaceSeekLimit(long inplaceSeekLimit)If seeking to a new position which is within this number of bytes in front of the current position, then we will skip forward by reading and discarding the necessary amount of bytes rather than trying to open a brand-new underlying stream.abstract GoogleCloudStorageReadOptions.BuildersetMinRangeRequestSize(long size)Sets the minimum size of the HTTP Range header that could be set in GCS request when opening new stream to read an object.abstract GoogleCloudStorageReadOptions.BuildersetReadExactRequestedBytesEnabled(boolean readExactRequestedBytesEnabled)
-
-
-
Method Detail
-
setBackoffInitialInterval
public abstract GoogleCloudStorageReadOptions.Builder setBackoffInitialInterval(Duration backoffInitialInterval)
On exponential back-off, the initial delay before the first retry; subsequent retries then grow as an exponential function of the current delay interval.
-
setBackoffRandomizationFactor
public abstract GoogleCloudStorageReadOptions.Builder setBackoffRandomizationFactor(double backoffRandomizationFactor)
The amount of jitter introduced when computing the next retry sleep interval so that when many clients are retrying, they don't all retry at the same time.
-
setBackoffMultiplier
public abstract GoogleCloudStorageReadOptions.Builder setBackoffMultiplier(double backoffMultiplier)
The base of the exponent used for exponential back-off; each subsequent sleep interval is roughly this many times the previous interval.
-
setBackoffMaxInterval
public abstract GoogleCloudStorageReadOptions.Builder setBackoffMaxInterval(Duration backoffMaxInterval)
The maximum amount of sleep between retries; at this point, there will be no further exponential back-off. This prevents intervals from growing unreasonably large.
-
setBackoffMaxElapsedTime
public abstract GoogleCloudStorageReadOptions.Builder setBackoffMaxElapsedTime(Duration backoffMaxElapsedTime)
The maximum total time elapsed since the first retry over the course of a series of retries. This makes it easier to bound the maximum time it takes to respond to a permanent failure without having to calculate the summation of a series of exponentiated intervals while accounting for the randomization of back-off intervals.
-
setFastFailOnNotFoundEnabled
public abstract GoogleCloudStorageReadOptions.Builder setFastFailOnNotFoundEnabled(boolean fastFailOnNotFound)
True if attempts to open a new channel on a nonexistent object are required to immediately throw an IOException. If false, then channels may not throw exceptions for such cases until attempting to call read(). Performance can be improved if this is set to false and the caller is equipped to deal with delayed failures for not-found objects. Or if the caller is already sure the object being opened exists, it is recommended to set this to `false` to avoid doing extraneous checks on open().
-
setGzipEncodingSupportEnabled
public abstract GoogleCloudStorageReadOptions.Builder setGzipEncodingSupportEnabled(boolean gzipEncodingSupportEnabled)
If false then reading a file with GZIP content encoding (HTTP header "Content-Encoding: gzip") will result in failure (IOException is thrown). If true then GZIP-encoded files will be read successfully.
-
setInplaceSeekLimit
public abstract GoogleCloudStorageReadOptions.Builder setInplaceSeekLimit(long inplaceSeekLimit)
If seeking to a new position which is within this number of bytes in front of the current position, then we will skip forward by reading and discarding the necessary amount of bytes rather than trying to open a brand-new underlying stream.
-
setFadvise
public abstract GoogleCloudStorageReadOptions.Builder setFadvise(GoogleCloudStorageReadOptions.Fadvise fadvise)
Sets fadvise mode that tunes behavior to optimize HTTP GET requests for various use cases.Supported modes:
AUTO- automatically switches toRANDOMmode if backward read or forward read for more thansetInplaceSeekLimit(long)bytes is detected.AUTO_RANDOM- UsesRANDOMto start with and automatically switches toSEQUENTIALmode if more than 2 requests fall withinsetInplaceSeekLimit(long)limits.RANDOM- sends HTTP requests withRangeheader set to greater of provided reade buffer by user.SEQUENTIAL- sends HTTP requests with unboundedRangeheader.
-
setMinRangeRequestSize
public abstract GoogleCloudStorageReadOptions.Builder setMinRangeRequestSize(long size)
Sets the minimum size of the HTTP Range header that could be set in GCS request when opening new stream to read an object.
-
setGrpcChecksumsEnabled
public abstract GoogleCloudStorageReadOptions.Builder setGrpcChecksumsEnabled(boolean grpcChecksumsEnabled)
Sets whether to validate checksums when doing gRPC reads. If enabled, for sequential reads of a whole object, the object checksums will be validated.TODO(b/134521856): Update this to discuss per-request checksums once the server supplies them and we're validating them.
-
setReadExactRequestedBytesEnabled
public abstract GoogleCloudStorageReadOptions.Builder setReadExactRequestedBytesEnabled(boolean readExactRequestedBytesEnabled)
-
setGrpcReadTimeout
public abstract GoogleCloudStorageReadOptions.Builder setGrpcReadTimeout(Duration grpcReadTimeout)
Sets the property to override the default GCS gRPC read stream timeout.
-
setGrpcReadZeroCopyEnabled
public abstract GoogleCloudStorageReadOptions.Builder setGrpcReadZeroCopyEnabled(boolean grpcReadZeroCopyEnabled)
Sets the property to use the zero-copy deserializer for gRPC read.
-
setGrpcReadMessageTimeout
public abstract GoogleCloudStorageReadOptions.Builder setGrpcReadMessageTimeout(Duration grpcMessageTimeout)
Sets the property for gRPC read message timeout in milliseconds.
-
setBlockSize
public abstract GoogleCloudStorageReadOptions.Builder setBlockSize(long blockSize)
-
setFadviseRequestTrackCount
public abstract GoogleCloudStorageReadOptions.Builder setFadviseRequestTrackCount(int requestTrackCount)
-
build
public GoogleCloudStorageReadOptions build()
-
-