-
#include "tensorstore/kvstore/byte_range.h"
- struct tensorstore::OptionalByteRangeRequest;
Specifies an optional byte range request.
Constructors¶
- constexpr OptionalByteRangeRequest();
Constructs a request for a full (unconstrained) byte range.
-
explicit constexpr OptionalByteRangeRequest(
int64_t inclusive_min,
int64_t exclusive_max = -1); Constructs from the specified bounds.
- constexpr OptionalByteRangeRequest(ByteRange r);
Constructs from an existing byte range.
Methods¶
- bool IsFull() const;
Checks if no byte range restriction is specified.
- bool IsRange() const;
Checks if this request specifies an explicit range with both
inclusive_min
andexclusive_max
.
- bool IsSuffixLength() const;
Check if this request specifies a suffix length.
- bool IsSuffix() const;
Checks if this request specifies a suffix, with only
inclusive_min
specified.
-
static OptionalByteRangeRequest
Range(int64_t inclusive_min, int64_t exclusive_max); Constructs a request for an explicit range.
- static OptionalByteRangeRequest SuffixLength(int64_t length);
Constructs a request for a suffix of the specified length.
- static OptionalByteRangeRequest Suffix(int64_t inclusive_min);
Constructs a request for a suffix starting at the specified
inclusive_min
.
- ByteRange AsByteRange() const;
Converts to a
ByteRange
.
- constexpr bool SatisfiesInvariants() const;
Checks that this byte range is valid.
Data members¶
- int64_t inclusive_min = 0;
Specifies the starting byte if non-negative, or suffix length if negative.
- int64_t exclusive_max = -1;
Specifies the exclusive max, or
-1
to indicate no upper bound.
Friend functions¶
-
friend bool operator==(const OptionalByteRangeRequest& a,
const OptionalByteRangeRequest& b); -
friend bool operator!=(const OptionalByteRangeRequest& a,
const OptionalByteRangeRequest& b); Compares for equality.
-
friend std::ostream&
operator<<(std::ostream& os, const OptionalByteRangeRequest& r); Prints a debugging string representation to an
std::ostream
.