Package io.debezium.connector.mongodb
Class ReplicaSet
java.lang.Object
io.debezium.connector.mongodb.ReplicaSet
- All Implemented Interfaces:
Comparable<ReplicaSet>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<com.mongodb.ServerAddress>Get the immutable list of server addresses.protected static intcompare(com.mongodb.ServerAddress address1, com.mongodb.ServerAddress address2) protected static intcompareNullable(String str1, String str2) protected static intcompareServerAddresses(com.mongodb.ServerAddress one, com.mongodb.ServerAddress two) intcompareTo(ReplicaSet that) booleaninthashCode()booleanReturn whether the address(es) represents a replica set, where thereplica set nameis notnull.booleanReturn whether the address(es) represent a standalone server, where thereplica set nameisnull.static ReplicaSetParse the supplied string for the information about the hosts for a replica set.Get the name of this replica set.Get the shard name for this replica set.toString()
-
Field Details
-
HOST_PATTERN
Regular expression that extracts the hosts for the replica sets. The raw expression is((([^=]+)[=])?(([^/]+)\/))?(.+). -
addresses
-
replicaSetName
-
shardName
-
hc
private final int hc
-
-
Constructor Details
-
ReplicaSet
-
-
Method Details
-
parse
Parse the supplied string for the information about the hosts for a replica set. The string is a shard host specification (e.g., "shard01=replicaSet1/host1:27017,host2:27017"), replica set hosts (e.g., "replicaSet1/host1:27017,host2:27017"), or standalone host (e.g., "host1:27017" or "1.2.3.4:27017").- Parameters:
hosts- the hosts string; may be null- Returns:
- the replica set; or
nullif the host string could not be parsed
-
addresses
Get the immutable list of server addresses.- Returns:
- the server addresses; never null
-
replicaSetName
Get the name of this replica set.- Returns:
- the replica set name, or
nullif the addresses are for standalone servers.
-
shardName
Get the shard name for this replica set.- Returns:
- the shard name, or
nullif this replica set is not used as a shard
-
isStandaloneServer
public boolean isStandaloneServer()Return whether the address(es) represent a standalone server, where thereplica set nameisnull. This method returns the opposite ofhasReplicaSetName().- Returns:
trueif this represents the address of a standalone server, orfalseif it represents the address of a replica set- See Also:
-
hasReplicaSetName
public boolean hasReplicaSetName()Return whether the address(es) represents a replica set, where thereplica set nameis notnull. This method returns the opposite ofisStandaloneServer().- Returns:
trueif this represents the address of a replica set, orfalseif it represents the address of a standalone server- See Also:
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<ReplicaSet>
-
toString
-
compareServerAddresses
protected static int compareServerAddresses(com.mongodb.ServerAddress one, com.mongodb.ServerAddress two) -
compareNullable
-
compare
protected static int compare(com.mongodb.ServerAddress address1, com.mongodb.ServerAddress address2)
-