#include "tensorstore/kvstore/read_result.h"
struct tensorstore::kvstore::ReadResult;

Result of a Read operation.

Types

enum class State;

Specifies the interpretation of value.

Methods

static ReadResult Unspecified(TimestampedStorageGeneration stamp);

Constructs a read result with unspecified value and generation.

static ReadResult Missing(TimestampedStorageGeneration stamp);
static ReadResult Missing(absl::Time time);

Constructs a read result for a missing value.

static ReadResult
Value(absl::Cord valueTimestampedStorageGeneration stamp);

Constructs a read result for a value.

bool aborted() const;

Returns true if the read was aborted because the conditions were not satisfied.

bool not_found() const;

Returns true if the key was not found.

bool has_value() const;

Returns true if a value is available.

std::optional<absl::Cord> optional_value() const&;
std::optional<absl::Cord> optional_value() &&;

Returns the value, or std::nullopt if not available.

Data members

State state = kUnspecified;

Indicates the interpretation of value.

absl::Cord value;

Specifies the value if state == kValue. Otherwise must be empty.

TimestampedStorageGeneration stamp;

Generation and timestamp associated with value and state.

Friend functions

friend bool operator==(const ReadResultaconst ReadResultb);
friend bool operator!=(const ReadResultaconst ReadResultb);

Compares two read results for equality.

friend std::ostream&
operator<<(std::ostreamosconst ReadResultx);

Prints a debugging string representation to an std::ostream.