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.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(long)
public BigtableVersion(long value)
Creates a new BigtableVersion value from a 64-bit value.
Parameter | |
---|---|
Name | Description |
value | long 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 |
long |
Value
public long Value { get; }
Gets the version value. Greater version values indicate newer cell values.
Property Value | |
---|---|
Type | Description |
long |
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 | |
---|---|
Name | Description |
x | BigtableVersion Left value to compare |
y | BigtableVersion Right value to compare |
Returns | |
---|---|
Type | Description |
int | true if |
CompareTo(BigtableVersion)
public int CompareTo(BigtableVersion other)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Parameter | |
---|---|
Name | Description |
other | BigtableVersion An object to compare with this instance. |
Returns | |
---|---|
Type | Description |
int | A value that indicates the relative order of the objects being compared. The return value has these meanings: Meaning Less than zero This instance precedes Zero This instance occurs in the same position in the sort order as Greater than zero This instance follows |
CompareTo(object)
public int CompareTo(object obj)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Parameter | |
---|---|
Name | Description |
obj | object An object to compare with this instance. |
Returns | |
---|---|
Type | Description |
int | A value that indicates the relative order of the objects being compared. The return value has these meanings: Meaning Less than zero This instance precedes Zero This instance occurs in the same position in the sort order as Greater than zero This instance follows |
Exceptions | |
---|---|
Type | Description |
ArgumentException |
|
GetHashCode()
public override int GetHashCode()
Returns the hash code for this instance.
Returns | |
---|---|
Type | Description |
int | A 32-bit signed integer that is the hash code for this instance. |
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 the fully qualified type name of this instance.
Returns | |
---|---|
Type | Description |
string | The fully qualified type name. |
Operators
operator ==(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 |
bool | true if |
operator >(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 |
bool | true if |
operator >=(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 |
bool | true if |
operator !=(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 |
bool | true if |
operator <(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 |
bool | true if |
operator <=(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 |
bool | true if |