public struct BigtableVersion : IComparable, IComparable<BigtableVersion>, IEquatable<BigtableVersion>
A version which uniquely identifies a cell within a column.
Namespace
Google.Cloud.Bigtable.V2Assembly
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 | |
---|---|
Name | Description |
timestamp | DateTime The timestamp whose milliseconds since the Unix epoch should be used as the version value. It must be specified in UTC. |
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 | |
---|---|
Name | Description |
value | Int64 The non-negative version value, or -1 to initialize from the milliseconds of DateTime.UtcNow. Must be less than or equal to 9223372036854775. |
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 | |
---|---|
Type | Description |
Int64 |
Value
public long Value { get; }
Gets the version value. Greater version values indicate newer cell values.
Property Value | |
---|---|
Type | Description |
Int64 |
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 | |
---|---|
Name | Description |
x | Nullable<BigtableVersion> Left value to compare |
y | Nullable<BigtableVersion> Right value to compare |
Returns | |
---|---|
Type | Description |
Int32 | true if |
CompareTo(BigtableVersion)
public int CompareTo(BigtableVersion other)
Parameter | |
---|---|
Name | Description |
other | BigtableVersion |
Returns | |
---|---|
Type | Description |
Int32 |
CompareTo(Object)
public int CompareTo(object obj)
Parameter | |
---|---|
Name | Description |
obj | Object |
Returns | |
---|---|
Type | Description |
Int32 |
GetHashCode()
public override int GetHashCode()
Returns | |
---|---|
Type | Description |
Int32 |
ToDateTime()
public DateTime ToDateTime()
Gets the DateTime equivalent to the version assuming the value is a timestamp milliseconds value since the Unix epoch.
Returns | |
---|---|
Type | Description |
DateTime | The DateTime representing the version timestamp. |
ToString()
public override string ToString()
Returns | |
---|---|
Type | Description |
String |
Operators
Equality(BigtableVersion, BigtableVersion)
public static bool operator ==(BigtableVersion x, BigtableVersion y)
Operator overload to compare two BigtableVersion values for equality.
Parameters | |
---|---|
Name | Description |
x | BigtableVersion Left value to compare |
y | BigtableVersion Right value to compare |
Returns | |
---|---|
Type | Description |
Boolean | true if |
GreaterThan(BigtableVersion, BigtableVersion)
public static bool operator>(BigtableVersion x, BigtableVersion y)
Operator overload to compare two BigtableVersion values.
Parameters | |
---|---|
Name | Description |
x | BigtableVersion Left value to compare |
y | BigtableVersion Right value to compare |
Returns | |
---|---|
Type | Description |
Boolean | true if |
GreaterThanOrEqual(BigtableVersion, BigtableVersion)
public static bool operator >=(BigtableVersion x, BigtableVersion y)
Operator overload to compare two BigtableVersion values.
Parameters | |
---|---|
Name | Description |
x | BigtableVersion Left value to compare |
y | BigtableVersion Right value to compare |
Returns | |
---|---|
Type | Description |
Boolean | true if |
Inequality(BigtableVersion, BigtableVersion)
public static bool operator !=(BigtableVersion x, BigtableVersion y)
Operator overload to compare two BigtableVersion values for inequality.
Parameters | |
---|---|
Name | Description |
x | BigtableVersion Left value to compare |
y | BigtableVersion Right value to compare |
Returns | |
---|---|
Type | Description |
Boolean | true if |
LessThan(BigtableVersion, BigtableVersion)
public static bool operator <(BigtableVersion x, BigtableVersion y)
Operator overload to compare two BigtableVersion values.
Parameters | |
---|---|
Name | Description |
x | BigtableVersion Left value to compare |
y | BigtableVersion Right value to compare |
Returns | |
---|---|
Type | Description |
Boolean | true if |
LessThanOrEqual(BigtableVersion, BigtableVersion)
public static bool operator <=(BigtableVersion x, BigtableVersion y)
Operator overload to compare two BigtableVersion values.
Parameters | |
---|---|
Name | Description |
x | BigtableVersion Left value to compare |
y | BigtableVersion Right value to compare |
Returns | |
---|---|
Type | Description |
Boolean | true if |