Class TopologyVersion
Represents a topology description.
public sealed class TopologyVersion : IEquatable<TopologyVersion>, IConvertibleToBsonDocument
- Inheritance
-
TopologyVersion
- Implements
- Inherited Members
Remarks
Comparing topology descriptions freshness does not exhibit the reversal property of inequalities e.g. IsStalerThan(a, b) (a "<" b) does not imply !IsStalerThan(b, a) (b ">" a) See CompareTopologyVersion(TopologyVersion, TopologyVersion) for more information.
Constructors
TopologyVersion(ObjectId, long)
Initializes a new instance of the TopologyVersion class.
public TopologyVersion(ObjectId processId, long counter)
Parameters
Properties
Counter
Gets the process identifier.
public long Counter { get; }
Property Value
- long
The process identifier.
ProcessId
Gets the process identifier.
public ObjectId ProcessId { get; }
Property Value
- ObjectId
The process identifier.
Methods
CompareTopologyVersion(TopologyVersion, TopologyVersion)
Compares a local TopologyVersion with a server's TopologyVersion and indicates whether the local
TopologyVersion is staler, fresher, or equal to the server's TopologyVersion.
Per the SDAM specification, if the ProcessIds are not equal, this method assumes that
y is more recent. This means that this method does not exhibit
the reversal properties of inequalities i.e. a "<" b does not imply b ">" a.
public static int CompareTopologyVersion(TopologyVersion x, TopologyVersion y)
Parameters
xTopologyVersionThe first TopologyVersion.
yTopologyVersionThe other TopologyVersion.
Returns
- int
Less than zero indicates that the
xis staler than they. Zero indicates that thexdescription is equal to they. Greater than zero indicates that thexis fresher than they.
Equals(TopologyVersion)
public bool Equals(TopologyVersion other)
Parameters
otherTopologyVersion
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
objobject
Returns
FromBsonDocument(BsonDocument)
Attempts to create a TopologyVersion from the supplied BsonDocument.
public static TopologyVersion FromBsonDocument(BsonDocument document)
Parameters
documentBsonDocumentThe document. Should contain an ObjectId named "processId" and a BsonInt64 named "counter".
Returns
- TopologyVersion
A TopologyVersion if one could be constructed from the supplied document and null otherwise.
GetHashCode()
public override int GetHashCode()
Returns
IsFresherThan(TopologyVersion, TopologyVersion)
Gets whether or not x is fresher than y.
Comparing topology descriptions freshness does not exhibit the reversal property of
inequalities e.g. a.IsFresherThan(b) (a "<" b) does not imply
!b.IsFresherThan(a) (b ">" a)
See CompareTopologyVersion(TopologyVersion, TopologyVersion) for more information.
In the case that this.Equals(y), y will be considered to be fresher.
public static bool IsFresherThan(TopologyVersion x, TopologyVersion y)
Parameters
xTopologyVersionThe first TopologyVersion.
yTopologyVersionThe other TopologyVersion.
Returns
- bool
Whether or not this TopologyVersion is fresher than
y.
IsFresherThanOrEqualTo(TopologyVersion, TopologyVersion)
Gets whether or not x is fresher than or Equal to y.
Comparing topology descriptions freshness does not exhibit the reversal property of
inequalities e.g. a.IsFresherThan(b) (a "<" b) does not imply
!b.IsFresherThan(a) (b ">" a)
See CompareTopologyVersion(TopologyVersion, TopologyVersion) for more information.
In the case that this.Equals(y), y will be considered to be fresher.
public static bool IsFresherThanOrEqualTo(TopologyVersion x, TopologyVersion y)
Parameters
xTopologyVersionThe first TopologyVersion.
yTopologyVersionThe other TopologyVersion.
Returns
- bool
Whether or not this TopologyVersion is fresher than
y.
IsStalerThan(TopologyVersion, TopologyVersion)
Gets whether or not x is staler than or Equal to y.
Comparing topology descriptions freshness does not exhibit the reversal property of
inequalities e.g. a.IsStalerThan(b) (a "<" b) does not imply
!b.IsStalerThan(a) (b ">" a).
See CompareTopologyVersion(TopologyVersion, TopologyVersion) for more information.
In the case that this == y, y will be considered to be fresher.
public static bool IsStalerThan(TopologyVersion x, TopologyVersion y)
Parameters
xTopologyVersionThe first TopologyVersion.
yTopologyVersionThe other TopologyVersion.
Returns
- bool
Whether or not this TopologyVersion is staler than
y.
IsStalerThanOrEqualTo(TopologyVersion, TopologyVersion)
Gets whether or not x is staler than or Equal to y.
Comparing topology descriptions freshness does not exhibit the reversal property of
inequalities e.g. a.IsStalerThan(b) (a "<" b) does not imply
!b.IsStalerThan(a) (b ">" a).
See CompareTopologyVersion(TopologyVersion, TopologyVersion) for more information.
In the case that this == y, y will be considered to be fresher.
public static bool IsStalerThanOrEqualTo(TopologyVersion x, TopologyVersion y)
Parameters
xTopologyVersionThe first TopologyVersion.
yTopologyVersionThe other TopologyVersion.
Returns
- bool
Whether or not this TopologyVersion is staler than
y.
ToBsonDocument()
Converts this object to a BsonDocument.
public BsonDocument ToBsonDocument()
Returns
- BsonDocument
A BsonDocument.
ToString()
public override string ToString()