Package org.apache.cassandra.locator
Class Endpoints<E extends Endpoints<E>>
java.lang.Object
org.apache.cassandra.locator.AbstractReplicaCollection<E>
org.apache.cassandra.locator.Endpoints<E>
- Type Parameters:
E- The concrete type of Endpoints, that will be returned by the modifying methods
- All Implemented Interfaces:
Iterable<Replica>,ReplicaCollection<E>
- Direct Known Subclasses:
EndpointsForRange,EndpointsForToken
A collection of Endpoints for a given ring position. This will typically reside in a ReplicaLayout,
representing some subset of the endpoints for the Token or Range
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.cassandra.locator.AbstractReplicaCollection
AbstractReplicaCollection.ReplicaList, AbstractReplicaCollection.ReplicaMap<K>Nested classes/interfaces inherited from interface org.apache.cassandra.locator.ReplicaCollection
ReplicaCollection.Builder<C extends ReplicaCollection<C>> -
Field Summary
Fields inherited from class org.apache.cassandra.locator.AbstractReplicaCollection
EMPTY_LIST, list -
Method Summary
Modifier and TypeMethodDescriptionstatic <E extends Endpoints<E>>
Estatic <E extends Endpoints<E>>
Econcat(E natural, E pending) Care must be taken to ensure no conflicting ranges occur in pending and natural.booleancontains(InetAddressAndPort endpoint) booleanendpoint(int i) keep(Set<InetAddressAndPort> keep) select(Iterable<InetAddressAndPort> endpoints, boolean ignoreMissing) without(Set<InetAddressAndPort> remove) Methods inherited from class org.apache.cassandra.locator.AbstractReplicaCollection
anyMatch, asList, collector, count, equals, filter, filter, filterLazily, filterLazily, forEach, get, hashCode, isEmpty, iterator, newBuilder, size, snapshot, sorted, stream, subList, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
spliterator
-
Method Details
-
endpoints
- Returns:
- a Set of the endpoints of the contained Replicas. Iteration order is maintained where there is a 1:1 relationship between endpoint and Replica Typically this collection offers O(1) access methods, and this is true for all but ReplicaList.
-
endpoint
-
endpointList
-
byEndpoint
-
contains
- Returns:
- true iff a Replica in this collection is equal to the provided Replica. Typically this method is expected to take O(1) time, and this is true for all but ReplicaList.
-
contains
-
withoutSelf
-
selfIfPresent
-
without
- Returns:
- a collection without the provided endpoints, otherwise in the same order as this collection
-
keep
- Returns:
- a collection with only the provided endpoints (ignoring any not present), otherwise in the same order as this collection
-
select
- Returns:
- a collection containing the Replica from this collection for the provided endpoints, in the order of the provided endpoints
-
concat
Care must be taken to ensure no conflicting ranges occur in pending and natural. Conflicts can occur for two reasons: 1) due to lack of isolation when reading pending/natural 2) because a movement that changes the type of replication from transient to full must be handled differently for reads and writes (with the reader treating it as transient, and writer as full) The methodReplicaLayout.haveWriteConflicts(E, E)can be used to detect and resolve any issues -
append
-