Package io.grpc.rls
Class CachingRlsLbClient.DataCacheEntry
- java.lang.Object
-
- io.grpc.rls.CachingRlsLbClient.CacheEntry
-
- io.grpc.rls.CachingRlsLbClient.DataCacheEntry
-
- Enclosing class:
- CachingRlsLbClient
final class CachingRlsLbClient.DataCacheEntry extends CachingRlsLbClient.CacheEntry
Implementation ofCachingRlsLbClient.CacheEntrycontains valid data.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<LbPolicyConfiguration.ChildPolicyWrapper>childPolicyWrappersprivate longexpireTimeprivate longminEvictionTimeprivate RlsProtoData.RouteLookupResponseresponseprivate longstaleTime-
Fields inherited from class io.grpc.rls.CachingRlsLbClient.CacheEntry
request
-
-
Constructor Summary
Constructors Constructor Description DataCacheEntry(RlsProtoData.RouteLookupRequest request, RlsProtoData.RouteLookupResponse response)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) intcalcStringSize(java.lang.String target)(package private) voidcleanup()(package private) LbPolicyConfiguration.ChildPolicyWrappergetChildPolicyWrapper()(package private) LbPolicyConfiguration.ChildPolicyWrappergetChildPolicyWrapper(java.lang.String target)(package private) java.lang.StringgetHeaderData()(package private) intgetSizeBytes()(package private) booleanisExpired(long now)protected booleanisOldEnoughToBeEvicted(long now)(package private) booleanisStaled(long now)(package private) voidmaybeRefresh()Refreshes cache entry by creatingCachingRlsLbClient.PendingCacheEntry.java.lang.StringtoString()
-
-
-
Field Detail
-
response
private final RlsProtoData.RouteLookupResponse response
-
minEvictionTime
private final long minEvictionTime
-
expireTime
private final long expireTime
-
staleTime
private final long staleTime
-
childPolicyWrappers
private final java.util.List<LbPolicyConfiguration.ChildPolicyWrapper> childPolicyWrappers
-
-
Constructor Detail
-
DataCacheEntry
DataCacheEntry(RlsProtoData.RouteLookupRequest request, RlsProtoData.RouteLookupResponse response)
-
-
Method Detail
-
maybeRefresh
void maybeRefresh()
Refreshes cache entry by creatingCachingRlsLbClient.PendingCacheEntry. When thePendingCacheEntryreceived data from RLS server, it will replace the data entry if valid data still exists. Flow looks like following.Timeline | async refresh V put new cache (entry2) entry1: Pending | hasValue | staled | entry2: | OV* | pending | hasValue | staled | OV: old value
-
getChildPolicyWrapper
LbPolicyConfiguration.ChildPolicyWrapper getChildPolicyWrapper(java.lang.String target)
-
getChildPolicyWrapper
@Nullable LbPolicyConfiguration.ChildPolicyWrapper getChildPolicyWrapper()
-
getHeaderData
java.lang.String getHeaderData()
-
calcStringSize
int calcStringSize(java.lang.String target)
-
getSizeBytes
int getSizeBytes()
- Specified by:
getSizeBytesin classCachingRlsLbClient.CacheEntry
-
isExpired
boolean isExpired(long now)
- Specified by:
isExpiredin classCachingRlsLbClient.CacheEntry
-
isStaled
boolean isStaled(long now)
-
isOldEnoughToBeEvicted
protected boolean isOldEnoughToBeEvicted(long now)
- Overrides:
isOldEnoughToBeEvictedin classCachingRlsLbClient.CacheEntry
-
cleanup
void cleanup()
- Specified by:
cleanupin classCachingRlsLbClient.CacheEntry
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-