Skip to content

Commit a94850c

Browse files
committed
kvclient: remove MakeEvictionToken from the interface
This method was only used internally and is simple to create manually now. It was confusing to have it on the public interface as its not the right way to create a token. Epic: none Release note: None
1 parent 8593e8f commit a94850c

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

pkg/kv/kvclient/rangecache/range_cache.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -278,18 +278,6 @@ type EvictionToken struct {
278278
entry *cacheEntry
279279
}
280280

281-
func (rc *RangeCache) makeEvictionToken(entry *cacheEntry) EvictionToken {
282-
return EvictionToken{
283-
rdc: rc,
284-
entry: entry,
285-
}
286-
}
287-
288-
// MakeEvictionToken is the exported ctor. For tests only.
289-
func (rc *RangeCache) MakeEvictionToken(entry *cacheEntry) EvictionToken {
290-
return rc.makeEvictionToken(entry)
291-
}
292-
293281
func (et EvictionToken) String() string {
294282
if !et.Valid() {
295283
return "<empty>"
@@ -622,7 +610,9 @@ func (rc *RangeCache) Lookup(ctx context.Context, key roachpb.RKey) (roachpb.Ran
622610

623611
// GetCachedOverlapping returns all the cached entries which overlap a given
624612
// span [Key, EndKey). The results are sorted ascendingly.
625-
func (rc *RangeCache) GetCachedOverlapping(ctx context.Context, span roachpb.RSpan) []roachpb.RangeInfo {
613+
func (rc *RangeCache) GetCachedOverlapping(
614+
ctx context.Context, span roachpb.RSpan,
615+
) []roachpb.RangeInfo {
626616
rc.rangeCache.RLock()
627617
defer rc.rangeCache.RUnlock()
628618
rawEntries := rc.getCachedOverlappingRLocked(ctx, span)
@@ -711,7 +701,7 @@ func (rc *RangeCache) tryLookup(
711701
rc.rangeCache.RLock()
712702
if entry, _ := rc.getCachedRLocked(ctx, key, useReverseScan); entry != nil {
713703
rc.rangeCache.RUnlock()
714-
returnToken := rc.makeEvictionToken(entry)
704+
returnToken := EvictionToken{rdc: rc, entry: entry}
715705
return returnToken, nil
716706
}
717707

@@ -967,7 +957,7 @@ func tryLookupImpl(
967957
}
968958
entry = &newEntry
969959
}
970-
lookupRes = rc.makeEvictionToken(entry)
960+
lookupRes = EvictionToken{rdc: rc, entry: entry}
971961
return lookupRes, nil
972962
}
973963

0 commit comments

Comments
 (0)