Package com.google.cloud.spanner.spi.v1
Class KeyRangeCache
java.lang.Object
com.google.cloud.spanner.spi.v1.KeyRangeCache
Cache for routing information used by location-aware routing.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDetermines how to handle ranges that span multiple splits. -
Constructor Summary
ConstructorsConstructorDescriptionKeyRangeCache(ChannelEndpointCache endpointCache) KeyRangeCache(ChannelEndpointCache endpointCache, com.google.cloud.spanner.spi.v1.EndpointLifecycleManager lifecycleManager) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRanges(CacheUpdate cacheUpdate) Applies cache updates.voidclear()fillRoutingHint(boolean preferLeader, KeyRangeCache.RangeMode rangeMode, DirectedReadOptions directedReadOptions, RoutingHint.Builder hintBuilder) Fills routing hint and returns the server to use, or null if no routing decision can be made.fillRoutingHint(boolean preferLeader, KeyRangeCache.RangeMode rangeMode, DirectedReadOptions directedReadOptions, RoutingHint.Builder hintBuilder, Predicate<String> excludedEndpoints) voidshrinkTo(int newSize) intsize()
-
Constructor Details
-
KeyRangeCache
-
KeyRangeCache
public KeyRangeCache(ChannelEndpointCache endpointCache, @Nullable com.google.cloud.spanner.spi.v1.EndpointLifecycleManager lifecycleManager)
-
-
Method Details
-
addRanges
Applies cache updates. Tablets are processed inside group updates. -
fillRoutingHint
public ChannelEndpoint fillRoutingHint(boolean preferLeader, KeyRangeCache.RangeMode rangeMode, DirectedReadOptions directedReadOptions, RoutingHint.Builder hintBuilder) Fills routing hint and returns the server to use, or null if no routing decision can be made. -
fillRoutingHint
public ChannelEndpoint fillRoutingHint(boolean preferLeader, KeyRangeCache.RangeMode rangeMode, DirectedReadOptions directedReadOptions, RoutingHint.Builder hintBuilder, Predicate<String> excludedEndpoints) -
clear
public void clear() -
size
public int size() -
shrinkTo
public void shrinkTo(int newSize) -
debugString
-