Show / Hide Table of Contents

Struct RumorTimestamp

Represents Lamport timestamp of the rumor mixed with the timestamp returned by the local clock.

Implements
IEquatable<RumorTimestamp>
IBinaryFormattable<RumorTimestamp>
IComparable<RumorTimestamp>
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: DotNext.Net.Cluster.Messaging.Gossip
Assembly: DotNext.Net.Cluster.dll
Syntax
public readonly struct RumorTimestamp : IEquatable<RumorTimestamp>, IBinaryFormattable<RumorTimestamp>, IComparable<RumorTimestamp>

Constructors

| Edit this page View Source

RumorTimestamp()

Generates a new fresh timestamp.

Declaration
public RumorTimestamp()
| Edit this page View Source

RumorTimestamp(ReadOnlySpan<byte>)

Decodes the timestamp from a sequence of bytes.

Declaration
public RumorTimestamp(ReadOnlySpan<byte> bytes)
Parameters
Type Name Description
ReadOnlySpan<byte> bytes

The buffer containing encoded timestamp.

Exceptions
Type Condition
ArgumentOutOfRangeException

The length of bytes is less than Size.

Properties

| Edit this page View Source

MaxValue

Gets the maximum possible value of the timestamp.

Declaration
public static RumorTimestamp MaxValue { get; }
Property Value
Type Description
RumorTimestamp
| Edit this page View Source

MinValue

Gets the minimum possible value of the timestamp.

Declaration
public static RumorTimestamp MinValue { get; }
Property Value
Type Description
RumorTimestamp
| Edit this page View Source

Size

Represents the serialized size of this value type.

Declaration
public static int Size { get; }
Property Value
Type Description
int

Methods

| Edit this page View Source

CompareTo(RumorTimestamp)

Compares this timestamp with another one.

Declaration
public int CompareTo(RumorTimestamp other)
Parameters
Type Name Description
RumorTimestamp other

The timestamp to compare.

Returns
Type Description
int

The comparison result.

| Edit this page View Source

Equals(RumorTimestamp)

Determines whether the current timestamp is the same as the specified timestamp.

Declaration
public bool Equals(RumorTimestamp other)
Parameters
Type Name Description
RumorTimestamp other

The timestamp to compare.

Returns
Type Description
bool

true if both timestamps are equal; otherwise, false.

| Edit this page View Source

Equals(object?)

Indicates whether this instance and a specified object are equal.

Declaration
public override bool Equals(object? other)
Parameters
Type Name Description
object other
Returns
Type Description
bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Overrides
ValueType.Equals(object)
| Edit this page View Source

Format(Span<byte>)

Serializes the timestamp as a sequence of bytes.

Declaration
public void Format(Span<byte> output)
Parameters
Type Name Description
Span<byte> output

The buffer.

| Edit this page View Source

GetHashCode()

Returns the hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A 32-bit signed integer that is the hash code for this instance.

Overrides
ValueType.GetHashCode()
| Edit this page View Source

Increment()

Returns an incremented timestamp.

Declaration
public RumorTimestamp Increment()
Returns
Type Description
RumorTimestamp

An incremented timestamp.

| Edit this page View Source

Next(ref RumorTimestamp)

Generates the next timestamp and stores the modified timestamp at the specified location atomically.

Declaration
public static RumorTimestamp Next(ref RumorTimestamp location)
Parameters
Type Name Description
RumorTimestamp location

The location of the timestamp.

Returns
Type Description
RumorTimestamp

A new timestamp that is greater than previous.

Remarks

This method is thread-safe.

| Edit this page View Source

ToString()

Returns hexadecimal representation of this timestamp.

Declaration
public override string ToString()
Returns
Type Description
string

The hexadecimal representation of this timestamp.

Overrides
ValueType.ToString()
| Edit this page View Source

TryParse(ReadOnlySpan<char>, out RumorTimestamp)

Restores the timestamp from its hexadecimal representation.

Declaration
public static bool TryParse(ReadOnlySpan<char> timestamp, out RumorTimestamp result)
Parameters
Type Name Description
ReadOnlySpan<char> timestamp

The hexadecimal representation of the timestamp.

RumorTimestamp result

The parsed timestamp.

Returns
Type Description
bool

true if timestamp parsed successfully; otherwise, false.

| Edit this page View Source

TryParse(string?, out RumorTimestamp)

Restores the timestamp from its hexadecimal representation.

Declaration
public static bool TryParse(string? timestamp, out RumorTimestamp result)
Parameters
Type Name Description
string timestamp

The hexadecimal representation of the timestamp.

RumorTimestamp result

The parsed timestamp.

Returns
Type Description
bool

true if timestamp parsed successfully; otherwise, false.

Operators

| Edit this page View Source

operator ==(in RumorTimestamp, in RumorTimestamp)

Determines whether the two timestamps are equal.

Declaration
public static bool operator ==(in RumorTimestamp x, in RumorTimestamp y)
Parameters
Type Name Description
RumorTimestamp x

The first timestamp to compare.

RumorTimestamp y

The second timestamp to compare.

Returns
Type Description
bool

true if both timestamps are equal; otherwise, false.

| Edit this page View Source

operator >(in RumorTimestamp, in RumorTimestamp)

Determines whether the first timestamp is greater than the second one.

Declaration
public static bool operator >(in RumorTimestamp x, in RumorTimestamp y)
Parameters
Type Name Description
RumorTimestamp x

The first timestamp to compare.

RumorTimestamp y

The second timestamp to compare.

Returns
Type Description
bool

true if x is greater than y.

| Edit this page View Source

operator >=(in RumorTimestamp, in RumorTimestamp)

Determines whether the first timestamp is greater than or equal to the second one.

Declaration
public static bool operator >=(in RumorTimestamp x, in RumorTimestamp y)
Parameters
Type Name Description
RumorTimestamp x

The first timestamp to compare.

RumorTimestamp y

The second timestamp to compare.

Returns
Type Description
bool

true if x is greater than or equal to y.

| Edit this page View Source

operator !=(in RumorTimestamp, in RumorTimestamp)

Determines whether the two timestamps are not equal.

Declaration
public static bool operator !=(in RumorTimestamp x, in RumorTimestamp y)
Parameters
Type Name Description
RumorTimestamp x

The first timestamp to compare.

RumorTimestamp y

The second timestamp to compare.

Returns
Type Description
bool

true if both timestamps are not equal; otherwise, false.

| Edit this page View Source

operator <(in RumorTimestamp, in RumorTimestamp)

Determines whether the first timestamp is less than the second one.

Declaration
public static bool operator <(in RumorTimestamp x, in RumorTimestamp y)
Parameters
Type Name Description
RumorTimestamp x

The first timestamp to compare.

RumorTimestamp y

The second timestamp to compare.

Returns
Type Description
bool

true if x is less than y.

| Edit this page View Source

operator <=(in RumorTimestamp, in RumorTimestamp)

Determines whether the first timestamp is less than or equal to the second one.

Declaration
public static bool operator <=(in RumorTimestamp x, in RumorTimestamp y)
Parameters
Type Name Description
RumorTimestamp x

The first timestamp to compare.

RumorTimestamp y

The second timestamp to compare.

Returns
Type Description
bool

true if x is less than or equal to y.

Implements

IEquatable<T>
IBinaryFormattable<TSelf>
IComparable<T>

Extension Methods

BasicExtensions.Disclosed<T>(T)
BasicExtensions.Enclosed<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
Collection.ToAsyncEnumerator<TEnumerator, T>(TEnumerator, CancellationToken)
Collection.ToClassicEnumerator<TEnumerator, T>(TEnumerator)
Enumerator.Skip<TEnumerator, T>(ref TEnumerator, int)
ExpressionBuilder.Const<T>(T)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾