Package com.google.cloud.spanner.spi.v1
Interface ReplicaSelector
- All Known Implementing Classes:
PowerOfTwoReplicaSelector
Interface for selecting a replica from a list of candidates.
-
Method Summary
Modifier and TypeMethodDescriptionselect(List<ChannelEndpoint> candidates, Function<ChannelEndpoint, Double> scoreLookup) Selects a replica from the given list of candidates.
-
Method Details
-
select
ChannelEndpoint select(List<ChannelEndpoint> candidates, Function<ChannelEndpoint, Double> scoreLookup) Selects a replica from the given list of candidates.- Parameters:
candidates- the list of eligible candidates.scoreLookup- a function to look up the latency score for a candidate.- Returns:
- the selected candidate, or null if the list is empty.
-