@Immutable public class ReplicaSets extends Object
| Modifier and Type | Field and Description |
|---|---|
private List<ReplicaSet> |
nonReplicaSets |
private static Pattern |
REPLICA_DELIMITER_PATTERN |
private Map<String,ReplicaSet> |
replicaSetsByName |
| Constructor and Description |
|---|
ReplicaSets(Collection<ReplicaSet> rsSpecs)
Create a set of replica set specifications.
|
| Modifier and Type | Method and Description |
|---|---|
List<ReplicaSet> |
all()
Get a copy of all of the
ReplicaSet objects. |
static ReplicaSets |
empty()
Get an instance that contains no replica sets.
|
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
haveChangedSince(ReplicaSets priorState)
Determine if one or more replica sets has been added or removed since the prior state.
|
String |
hosts()
Get the string containing the host names for the replica sets.
|
void |
onEachReplicaSet(Consumer<ReplicaSet> function)
Perform the supplied function on each of the replica sets
|
static ReplicaSets |
parse(String hosts)
Parse the supplied string for the information about the replica set hosts.
|
int |
replicaSetCount()
Get the number of replica sets.
|
void |
subdivide(int maxSubdivisionCount,
Consumer<ReplicaSets> subdivisionConsumer)
Subdivide this collection of replica sets into the maximum number of groups.
|
String |
toString() |
List<ReplicaSet> |
unnamedReplicaSets()
Get a copy of all of the
ReplicaSet objects that have no names. |
int |
validReplicaSetCount()
Get the number of replica sets with names.
|
List<ReplicaSet> |
validReplicaSets()
Get a copy of all of the valid
ReplicaSet objects that have names. |
private static final Pattern REPLICA_DELIMITER_PATTERN
private final Map<String,ReplicaSet> replicaSetsByName
private final List<ReplicaSet> nonReplicaSets
public ReplicaSets(Collection<ReplicaSet> rsSpecs)
rsSpecs - the replica set specifications; may be null or emptypublic static ReplicaSets parse(String hosts)
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").hosts - the hosts string; may be nullhosts()public static ReplicaSets empty()
public int replicaSetCount()
public int validReplicaSetCount()
public void onEachReplicaSet(Consumer<ReplicaSet> function)
function - the consumer function; may not be nullpublic void subdivide(int maxSubdivisionCount,
Consumer<ReplicaSets> subdivisionConsumer)
maxSubdivisionCount - the maximum number of subdivisionssubdivisionConsumer - the function to be called with each subdivision; may not be nullpublic List<ReplicaSet> all()
ReplicaSet objects.public List<ReplicaSet> validReplicaSets()
ReplicaSet objects that have names.public List<ReplicaSet> unnamedReplicaSets()
ReplicaSet objects that have no names.public boolean haveChangedSince(ReplicaSets priorState)
priorState - the prior state of the replica sets; may be nulltrue if the replica sets have changed since the prior state, or false otherwisepublic String hosts()
parse(String)Copyright © 2020 JBoss by Red Hat. All rights reserved.