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
serverId
ServerIdThe server identifier.
endPoint
EndPointThe end point.
reasonChanged
Optional<string>The reason the server description was last changed.
averageRoundTripTime
Optional<TimeSpan>The average round trip time.
canonicalEndPoint
Optional<EndPoint>The canonical end point.
electionId
Optional<ElectionId>The election identifier.
heartbeatException
Optional<Exception>The heartbeat exception.
heartbeatInterval
Optional<TimeSpan>The heartbeat interval.
helloOk
Optional<bool>Whether the server supports the hello command.
lastHeartbeatTimestamp
Optional<DateTime?>The last heartbeat timestamp.
lastUpdateTimestamp
Optional<DateTime>The last update timestamp.
lastWriteTimestamp
Optional<DateTime?>The last write timestamp.
logicalSessionTimeout
Optional<TimeSpan?>The logical session timeout.
maxBatchCount
Optional<int>The maximum batch count.
maxDocumentSize
Optional<int>The maximum size of a document.
maxMessageSize
Optional<int>The maximum size of a message.
maxWireDocumentSize
Optional<int>The maximum size of a wire document.
replicaSetConfig
Optional<ReplicaSetConfig>The replica set configuration.
state
Optional<ServerState>The server state.
tags
Optional<TagSet>The replica set tags.
topologyVersion
Optional<TopologyVersion>The topology version.
type
Optional<ServerType>The server type.
version
Optional<SemanticVersion>The server version.
wireVersionRange
Optional<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
true
if 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
true
if 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
other
ServerDescription
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
obj
object
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
other
ServerDescriptionThe 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
reasonChanged
Optional<string>The reason the server description changed.
averageRoundTripTime
Optional<TimeSpan>The average round trip time.
canonicalEndPoint
Optional<EndPoint>The canonical end point.
helloOk
Optional<bool>Whether the server supports the hello command.
electionId
Optional<ElectionId>The election identifier.
heartbeatException
Optional<Exception>The heartbeat exception.
heartbeatInterval
Optional<TimeSpan>The heartbeat interval.
lastHeartbeatTimestamp
Optional<DateTime?>The last heartbeat timestamp.
lastUpdateTimestamp
Optional<DateTime>The last update timestamp.
lastWriteTimestamp
Optional<DateTime?>The last write timestamp.
logicalSessionTimeout
Optional<TimeSpan?>The logical session timeout.
maxBatchCount
Optional<int>The maximum batch count.
maxDocumentSize
Optional<int>The maximum size of a document.
maxMessageSize
Optional<int>The maximum size of a message.
maxWireDocumentSize
Optional<int>The maximum size of a wire document.
replicaSetConfig
Optional<ReplicaSetConfig>The replica set configuration.
state
Optional<ServerState>The server state.
tags
Optional<TagSet>The replica set tags.
topologyVersion
Optional<TopologyVersion>The topology version.
type
Optional<ServerType>The server type.
version
Optional<SemanticVersion>The server version.
wireVersionRange
Optional<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
heartbeatException
ExceptionThe heartbeat exception.
Returns
- ServerDescription
A new instance of ServerDescription.