Class ServerDescription
Represents information about a server.
public sealed class ServerDescription : IEquatable<ServerDescription>
- Inheritance
-
ServerDescription
- Implements
- Inherited Members
Constructors
ServerDescription(ServerId, EndPoint, Optional<string>, Optional<TimeSpan>, Optional<EndPoint>, Optional<ElectionId>, Optional<Exception>, Optional<TimeSpan>, Optional<bool>, Optional<DateTime?>, Optional<DateTime>, Optional<DateTime?>, Optional<TimeSpan?>, Optional<int>, Optional<int>, Optional<int>, Optional<int>, Optional<ReplicaSetConfig>, Optional<ServerState>, Optional<TagSet>, Optional<TopologyVersion>, Optional<ServerType>, Optional<SemanticVersion>, Optional<Range<int>>)
Initializes a new instance of the ServerDescription class.
public ServerDescription(ServerId serverId, EndPoint endPoint, Optional<string> reasonChanged = default, Optional<TimeSpan> averageRoundTripTime = default, Optional<EndPoint> canonicalEndPoint = default, Optional<ElectionId> electionId = default, Optional<Exception> heartbeatException = default, Optional<TimeSpan> heartbeatInterval = default, Optional<bool> helloOk = default, Optional<DateTime?> lastHeartbeatTimestamp = default, Optional<DateTime> lastUpdateTimestamp = default, Optional<DateTime?> lastWriteTimestamp = default, Optional<TimeSpan?> logicalSessionTimeout = default, Optional<int> maxBatchCount = default, Optional<int> maxDocumentSize = default, Optional<int> maxMessageSize = default, Optional<int> maxWireDocumentSize = default, Optional<ReplicaSetConfig> replicaSetConfig = default, Optional<ServerState> state = default, Optional<TagSet> tags = default, Optional<TopologyVersion> topologyVersion = default, Optional<ServerType> type = default, Optional<SemanticVersion> version = default, Optional<Range<int>> wireVersionRange = default)
Parameters
serverIdServerIdThe server identifier.
endPointEndPointThe end point.
reasonChangedOptional<string>The reason the server description was last changed.
averageRoundTripTimeOptional<TimeSpan>The average round trip time.
canonicalEndPointOptional<EndPoint>The canonical end point.
electionIdOptional<ElectionId>The election identifier.
heartbeatExceptionOptional<Exception>The heartbeat exception.
heartbeatIntervalOptional<TimeSpan>The heartbeat interval.
helloOkOptional<bool>Whether the server supports the hello command.
lastHeartbeatTimestampOptional<DateTime?>The last heartbeat timestamp.
lastUpdateTimestampOptional<DateTime>The last update timestamp.
lastWriteTimestampOptional<DateTime?>The last write timestamp.
logicalSessionTimeoutOptional<TimeSpan?>The logical session timeout.
maxBatchCountOptional<int>The maximum batch count.
maxDocumentSizeOptional<int>The maximum size of a document.
maxMessageSizeOptional<int>The maximum size of a message.
maxWireDocumentSizeOptional<int>The maximum size of a wire document.
replicaSetConfigOptional<ReplicaSetConfig>The replica set configuration.
stateOptional<ServerState>The server state.
tagsOptional<TagSet>The replica set tags.
topologyVersionOptional<TopologyVersion>The topology version.
typeOptional<ServerType>The server type.
versionOptional<SemanticVersion>The server version.
wireVersionRangeOptional<Range<int>>The wire version range.
Exceptions
- ArgumentException
EndPoint and ServerId.EndPoint must match.
Properties
AverageRoundTripTime
Gets the average round trip time.
public TimeSpan AverageRoundTripTime { get; }
Property Value
- TimeSpan
The average round trip time.
CanonicalEndPoint
Gets the canonical end point. This is the endpoint that the cluster knows this server by. Currently, it only applies to a replica set config and will match what is in the replica set configuration.
public EndPoint CanonicalEndPoint { get; }
Property Value
ElectionId
Gets the election identifier.
public ElectionId ElectionId { get; }
Property Value
EndPoint
Gets the end point.
public EndPoint EndPoint { get; }
Property Value
- EndPoint
The end point.
HeartbeatException
Gets the most recent heartbeat exception.
public Exception HeartbeatException { get; }
Property Value
- Exception
The the most recent heartbeat exception (null if the most recent heartbeat succeeded).
HeartbeatInterval
Gets the heartbeat interval.
public TimeSpan HeartbeatInterval { get; }
Property Value
- TimeSpan
The heartbeat interval.
HelloOk
Whether the server supports the hello command.
public bool HelloOk { get; }
Property Value
- bool
True if the server responded with helloOk:true; false otherwise.
IsCompatibleWithDriver
Gets a value indicating whether this server is compatible with the driver.
public bool IsCompatibleWithDriver { get; }
Property Value
- bool
trueif this server is compatible with the driver; otherwise,false.
IsDataBearing
Gets a value indicating whether this instance is a data bearing server.
public bool IsDataBearing { get; }
Property Value
- bool
trueif this instance is a data bearing server; otherwise,false.
LastHeartbeatTimestamp
Gets the last heartbeat timestamp.
public DateTime? LastHeartbeatTimestamp { get; }
Property Value
- DateTime?
The last heartbeat timestamp.
LastUpdateTimestamp
Gets the last update timestamp (when the ServerDescription itself was last updated).
public DateTime LastUpdateTimestamp { get; }
Property Value
- DateTime
The last update timestamp.
LastWriteTimestamp
Gets the last write timestamp (from the lastWrite field of the hello or legacy hello result).
public DateTime? LastWriteTimestamp { get; }
Property Value
- DateTime?
The last write timestamp.
LogicalSessionTimeout
Gets the logical session timeout.
public TimeSpan? LogicalSessionTimeout { get; }
Property Value
- TimeSpan?
The logical session timeout.
MaxBatchCount
Gets the maximum number of documents in a batch.
public int MaxBatchCount { get; }
Property Value
- int
The maximum number of documents in a batch.
MaxDocumentSize
Gets the maximum size of a document.
public int MaxDocumentSize { get; }
Property Value
- int
The maximum size of a document.
MaxMessageSize
Gets the maximum size of a message.
public int MaxMessageSize { get; }
Property Value
- int
The maximum size of a message.
MaxWireDocumentSize
Gets the maximum size of a wire document.
public int MaxWireDocumentSize { get; }
Property Value
- int
The maximum size of a wire document.
MaxWireVersion
Gets the maximum wire version.
public int MaxWireVersion { get; }
Property Value
- int
The maximum wire version.
ReasonChanged
The reason the server description was last changed.
public string ReasonChanged { get; }
Property Value
- string
The reason the server description was last changed.
ReplicaSetConfig
Gets the replica set configuration.
public ReplicaSetConfig ReplicaSetConfig { get; }
Property Value
- ReplicaSetConfig
The replica set configuration.
ServerId
Gets the server identifier.
public ServerId ServerId { get; }
Property Value
- ServerId
The server identifier.
State
Gets the server state.
public ServerState State { get; }
Property Value
- ServerState
The server state.
Tags
Gets the replica set tags.
public TagSet Tags { get; }
Property Value
- TagSet
The replica set tags (null if not a replica set or if the replica set has no tags).
TopologyVersion
Gets the topology version.
public TopologyVersion TopologyVersion { get; }
Property Value
- TopologyVersion
The server topology version.
Type
Gets the server type.
public ServerType Type { get; }
Property Value
- ServerType
The server type.
Version
Gets the approximate server version (only the major and minor version numbers are known).
[Obsolete("This property will be removed in a later release.")]
public SemanticVersion Version { get; }
Property Value
- SemanticVersion
The server version.
WireVersionRange
Gets the wire version range.
public Range<int> WireVersionRange { get; }
Property Value
Methods
Equals(ServerDescription)
public bool Equals(ServerDescription other)
Parameters
otherServerDescription
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
SdamEquals(ServerDescription)
Determines whether the specified ServerDescription can be considered as equal to decide should we publish sdam events or not.
public bool SdamEquals(ServerDescription other)
Parameters
otherServerDescriptionThe other server description.
Returns
- bool
true, if sdam events should be suppressed, otherwisefalse.
ToString()
public override string ToString()
Returns
With(Optional<string>, Optional<TimeSpan>, Optional<EndPoint>, Optional<bool>, Optional<ElectionId>, Optional<Exception>, Optional<TimeSpan>, Optional<DateTime?>, Optional<DateTime>, Optional<DateTime?>, Optional<TimeSpan?>, Optional<int>, Optional<int>, Optional<int>, Optional<int>, Optional<ReplicaSetConfig>, Optional<ServerState>, Optional<TagSet>, Optional<TopologyVersion>, Optional<ServerType>, Optional<SemanticVersion>, Optional<Range<int>>)
Returns a new instance of ServerDescription with some values changed.
public ServerDescription With(Optional<string> reasonChanged = default, Optional<TimeSpan> averageRoundTripTime = default, Optional<EndPoint> canonicalEndPoint = default, Optional<bool> helloOk = default, Optional<ElectionId> electionId = default, Optional<Exception> heartbeatException = default, Optional<TimeSpan> heartbeatInterval = default, Optional<DateTime?> lastHeartbeatTimestamp = default, Optional<DateTime> lastUpdateTimestamp = default, Optional<DateTime?> lastWriteTimestamp = default, Optional<TimeSpan?> logicalSessionTimeout = default, Optional<int> maxBatchCount = default, Optional<int> maxDocumentSize = default, Optional<int> maxMessageSize = default, Optional<int> maxWireDocumentSize = default, Optional<ReplicaSetConfig> replicaSetConfig = default, Optional<ServerState> state = default, Optional<TagSet> tags = default, Optional<TopologyVersion> topologyVersion = default, Optional<ServerType> type = default, Optional<SemanticVersion> version = default, Optional<Range<int>> wireVersionRange = default)
Parameters
reasonChangedOptional<string>The reason the server description changed.
averageRoundTripTimeOptional<TimeSpan>The average round trip time.
canonicalEndPointOptional<EndPoint>The canonical end point.
helloOkOptional<bool>Whether the server supports the hello command.
electionIdOptional<ElectionId>The election identifier.
heartbeatExceptionOptional<Exception>The heartbeat exception.
heartbeatIntervalOptional<TimeSpan>The heartbeat interval.
lastHeartbeatTimestampOptional<DateTime?>The last heartbeat timestamp.
lastUpdateTimestampOptional<DateTime>The last update timestamp.
lastWriteTimestampOptional<DateTime?>The last write timestamp.
logicalSessionTimeoutOptional<TimeSpan?>The logical session timeout.
maxBatchCountOptional<int>The maximum batch count.
maxDocumentSizeOptional<int>The maximum size of a document.
maxMessageSizeOptional<int>The maximum size of a message.
maxWireDocumentSizeOptional<int>The maximum size of a wire document.
replicaSetConfigOptional<ReplicaSetConfig>The replica set configuration.
stateOptional<ServerState>The server state.
tagsOptional<TagSet>The replica set tags.
topologyVersionOptional<TopologyVersion>The topology version.
typeOptional<ServerType>The server type.
versionOptional<SemanticVersion>The server version.
wireVersionRangeOptional<Range<int>>The wire version range.
Returns
- ServerDescription
A new instance of ServerDescription.
WithHeartbeatException(Exception)
Returns a new ServerDescription with a new HeartbeatException.
public ServerDescription WithHeartbeatException(Exception heartbeatException)
Parameters
heartbeatExceptionExceptionThe heartbeat exception.
Returns
- ServerDescription
A new instance of ServerDescription.