Google Bigtable v2 API - Struct BigtableVersion (3.2.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(Int64)

public BigtableVersion(long value)

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

Parameter
NameDescription
valueInt64

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 readonly 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
Int64

Value

public readonly long Value { get; }

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

Property Value
TypeDescription
Int64
Remarks

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

Methods

Compare(Nullable<BigtableVersion>, Nullable<BigtableVersion>)

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

Compares two nullable BigtableVersion values.

Parameters
NameDescription
xNullable<BigtableVersion>

Left value to compare

yNullable<BigtableVersion>

Right value to compare

Returns
TypeDescription
Int32

true if x is less than y; otherwise false.

CompareTo(BigtableVersion)

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

CompareTo(Object)

public int CompareTo(object obj)
Parameter
NameDescription
objObject
Returns
TypeDescription
Int32

GetHashCode()

public override int GetHashCode()
Returns
TypeDescription
Int32
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

Equality(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
Boolean

true if x is equal to y; otherwise false.

GreaterThan(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
Boolean

true if x is greater than y; otherwise false.

GreaterThanOrEqual(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
Boolean

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

Inequality(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
Boolean

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

LessThan(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
Boolean

true if x is less than y; otherwise false.

LessThanOrEqual(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
Boolean

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