Class GoogleCloudStorageReadOptions.Builder

  • Enclosing class:
    GoogleCloudStorageReadOptions

    public abstract static class GoogleCloudStorageReadOptions.Builder
    extends Object
    Mutable builder for GoogleCloudStorageReadOptions.
    • Constructor Detail

      • Builder

        public Builder()
    • 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 to RANDOM mode if backward read or forward read for more than setInplaceSeekLimit(long) bytes is detected.
        • AUTO_RANDOM - Uses RANDOM to start with and automatically switches to SEQUENTIAL mode if more than 2 requests fall within setInplaceSeekLimit(long) limits.
        • RANDOM - sends HTTP requests with Range header set to greater of provided reade buffer by user.
        • SEQUENTIAL - sends HTTP requests with unbounded Range header.
      • 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.

      • setGrpcReadZeroCopyEnabled

        public abstract GoogleCloudStorageReadOptions.Builder setGrpcReadZeroCopyEnabled​(boolean grpcReadZeroCopyEnabled)
        Sets the property to use the zero-copy deserializer for gRPC read.