Package io.debezium.connector.mongodb
Class ReplicaSets
java.lang.Object
io.debezium.connector.mongodb.ReplicaSets
A set of replica set specifications.
- Author:
- Randall Hauch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List<ReplicaSet>private static final Patternprivate final Map<String,ReplicaSet> -
Constructor Summary
ConstructorsConstructorDescriptionReplicaSets(Collection<ReplicaSet> rsSpecs) Create a set of replica set specifications. -
Method Summary
Modifier and TypeMethodDescriptionall()Get a copy of all of theReplicaSetobjects.static ReplicaSetsempty()Get an instance that contains no replica sets.booleaninthashCode()booleanhaveChangedSince(ReplicaSets priorState) Determine if one or more replica sets has been added or removed since the prior state.hosts()Get the string containing the host names for the replica sets.voidonEachReplicaSet(Consumer<ReplicaSet> function) Perform the supplied function on each of the replica setsstatic ReplicaSetsParse the supplied string for the information about the replica set hosts.intGet the number of replica sets.splitHosts(String hosts) voidsubdivide(int maxSubdivisionCount, Consumer<ReplicaSets> subdivisionConsumer) Subdivide this collection of replica sets into the maximum number of groups.toString()Get a copy of all of theReplicaSetobjects that have no names.intGet the number of replica sets with names.Get a copy of all of the validReplicaSetobjects that have names.
-
Field Details
-
REPLICA_DELIMITER_PATTERN
-
replicaSetsByName
-
nonReplicaSets
-
-
Constructor Details
-
ReplicaSets
Create a set of replica set specifications.- Parameters:
rsSpecs- the replica set specifications; may be null or empty
-
-
Method Details
-
parse
Parse the supplied string for the information about the replica set hosts. The string is a semicolon-delimited list of shard hosts (e.g., "shard01=replicaSet1/host1:27017,host2:27017"), replica set hosts (e.g., "replicaSet1/host1:27017,host2:27017"), and standalone hosts (e.g., "host1:27017" or "1.2.3.4:27017").- Parameters:
hosts- the hosts string; may be null- Returns:
- the replica sets; never null but possibly empty
- See Also:
-
splitHosts
-
empty
Get an instance that contains no replica sets.- Returns:
- the empty instance; never null
-
replicaSetCount
public int replicaSetCount()Get the number of replica sets.- Returns:
- the replica set count
-
validReplicaSetCount
public int validReplicaSetCount()Get the number of replica sets with names.- Returns:
- the valid replica set count
-
onEachReplicaSet
Perform the supplied function on each of the replica sets- Parameters:
function- the consumer function; may not be null
-
subdivide
Subdivide this collection of replica sets into the maximum number of groups.- Parameters:
maxSubdivisionCount- the maximum number of subdivisionssubdivisionConsumer- the function to be called with each subdivision; may not be null
-
all
Get a copy of all of theReplicaSetobjects.- Returns:
- the replica set objects; never null but possibly empty
-
validReplicaSets
Get a copy of all of the validReplicaSetobjects that have names.- Returns:
- the valid replica set objects; never null but possibly empty
-
unnamedReplicaSets
Get a copy of all of theReplicaSetobjects that have no names.- Returns:
- the unnamed replica set objects; never null but possibly empty
-
haveChangedSince
Determine if one or more replica sets has been added or removed since the prior state.- Parameters:
priorState- the prior state of the replica sets; may be null- Returns:
trueif the replica sets have changed since the prior state, orfalseotherwise
-
hosts
Get the string containing the host names for the replica sets. The result is a string with each replica set hosts separated by a semicolon.- Returns:
- the host names; never null
- See Also:
-
hashCode
public int hashCode() -
equals
-
toString
-