Google Bigtable v2 API - Struct BigtableVersion (3.8.0)

public struct BigtableVersion : IComparable, IComparable<BigtableVersion>, IEquatable<BigtableVersion>

Reference documentation and code samples for the Google Bigtable v2 API struct BigtableVersion.

A version which uniquely identifies a cell within a column.

Namespace

Google.Cloud.Bigtable.V2

Assembly

Google.Cloud.Bigtable.V2.dll

Remarks

Note: version values are stored on the server as if they are microseconds since the Unix epoch. However, the server only supports millisecond granularity, so the server only allows microseconds in multiples of 1,000. BigtableVersion attempts to hide this complexity by exposing its underlying Value in terms of milliseconds, so if desired, a custom versioning scheme of 1, 2, ... can be used rather than 1000, 2000, ... However, access to the underlying microsecond value is still provided via Micros.

Note: when using ReadModifyWriteRow, modified columns automatically use a server version, which is based on the current timestamp since the Unix epoch. For those columns, other reads and writes should use BigtableVersion values constructed from DateTime values, as opposed to using a custom versioning scheme with 64-bit values.

Constructors

BigtableVersion(DateTime)

public BigtableVersion(DateTime timestamp)

Creates a new BigtableVersion value from the milliseconds of a timestamp since the Unix epoch.

Parameter
NameDescription
timestampDateTime

The timestamp whose milliseconds since the Unix epoch should be used as the version value. It must be specified in UTC.

Remarks

Note: version values are stored on the server as if they are microseconds since the Unix epoch. However, the server only supports millisecond granularity, so the server only allows microseconds in multiples of 1,000. BigtableVersion attempts to hide this complexity by exposing its underlying Value in terms of milliseconds, so if desired, a custom versioning scheme of 1, 2, ... can be used rather than 1000, 2000, ... However, access to the underlying microsecond value is still provided via Micros.

Note: when using ReadModifyWriteRow, modified columns automatically use a server version, which is based on the current timestamp since the Unix epoch. For those columns, other reads and writes should use BigtableVersion values constructed from DateTime values, as opposed to using a custom versioning scheme with 64-bit values.

BigtableVersion(long)

public BigtableVersion(long value)

Creates a new BigtableVersion value from a 64-bit value.

Parameter
NameDescription
valuelong

The non-negative version value, or -1 to initialize from the milliseconds of DateTime.UtcNow. Must be less than or equal to 9223372036854775.

Remarks

Note: version values are stored on the server as if they are microseconds since the Unix epoch. However, the server only supports millisecond granularity, so the server only allows microseconds in multiples of 1,000. BigtableVersion attempts to hide this complexity by exposing its underlying Value in terms of milliseconds, so if desired, a custom versioning scheme of 1, 2, ... can be used rather than 1000, 2000, ... However, access to the underlying microsecond value is still provided via Micros.

Note: when using ReadModifyWriteRow, modified columns automatically use a server version, which is based on the current timestamp since the Unix epoch. For those columns, other reads and writes should use BigtableVersion values constructed from DateTime values, as opposed to using a custom versioning scheme with 64-bit values.

Properties

Micros

public long Micros { get; }

Gets the version value interpreted as microseconds of a timestamp since the Unix epoch. Greater version values indicate newer cell values.

Property Value
TypeDescription
long

Value

public long Value { get; }

Gets the version value. Greater version values indicate newer cell values.

Property Value
TypeDescription
long
Remarks

If timestamps are used as versions, this would be the milliseconds since the Unix epoch.

Methods

Compare(BigtableVersion?, BigtableVersion?)

public static int Compare(BigtableVersion? x, BigtableVersion? y)

Compares two nullable BigtableVersion values.

Parameters
NameDescription
xBigtableVersion

Left value to compare

yBigtableVersion

Right value to compare

Returns
TypeDescription
int

true if x is less than y; otherwise false.

CompareTo(BigtableVersion)

public int CompareTo(BigtableVersion other)
Parameter
NameDescription
otherBigtableVersion
Returns
TypeDescription
int

CompareTo(object)

public int CompareTo(object obj)
Parameter
NameDescription
objobject
Returns
TypeDescription
int

GetHashCode()

public override int GetHashCode()
Returns
TypeDescription
int
Overrides

ToDateTime()

public DateTime ToDateTime()

Gets the DateTime equivalent to the version assuming the value is a timestamp milliseconds value since the Unix epoch.

Returns
TypeDescription
DateTime

The DateTime representing the version timestamp.

ToString()

public override string ToString()
Returns
TypeDescription
string
Overrides

Operators

operator ==(BigtableVersion, BigtableVersion)

public static bool operator ==(BigtableVersion x, BigtableVersion y)

Operator overload to compare two BigtableVersion values for equality.

Parameters
NameDescription
xBigtableVersion

Left value to compare

yBigtableVersion

Right value to compare

Returns
TypeDescription
bool

true if x is equal to y; otherwise false.

operator >(BigtableVersion, BigtableVersion)

public static bool operator >(BigtableVersion x, BigtableVersion y)

Operator overload to compare two BigtableVersion values.

Parameters
NameDescription
xBigtableVersion

Left value to compare

yBigtableVersion

Right value to compare

Returns
TypeDescription
bool

true if x is greater than y; otherwise false.

operator >=(BigtableVersion, BigtableVersion)

public static bool operator >=(BigtableVersion x, BigtableVersion y)

Operator overload to compare two BigtableVersion values.

Parameters
NameDescription
xBigtableVersion

Left value to compare

yBigtableVersion

Right value to compare

Returns
TypeDescription
bool

true if x is greater than or equal y; otherwise false.

operator !=(BigtableVersion, BigtableVersion)

public static bool operator !=(BigtableVersion x, BigtableVersion y)

Operator overload to compare two BigtableVersion values for inequality.

Parameters
NameDescription
xBigtableVersion

Left value to compare

yBigtableVersion

Right value to compare

Returns
TypeDescription
bool

true if x is not equal to y; otherwise false.

operator <(BigtableVersion, BigtableVersion)

public static bool operator <(BigtableVersion x, BigtableVersion y)

Operator overload to compare two BigtableVersion values.

Parameters
NameDescription
xBigtableVersion

Left value to compare

yBigtableVersion

Right value to compare

Returns
TypeDescription
bool

true if x is less than y; otherwise false.

operator <=(BigtableVersion, BigtableVersion)

public static bool operator <=(BigtableVersion x, BigtableVersion y)

Operator overload to compare two BigtableVersion values.

Parameters
NameDescription
xBigtableVersion

Left value to compare

yBigtableVersion

Right value to compare

Returns
TypeDescription
bool

true if x is less than or equal y; otherwise false.