@@ -24,14 +24,13 @@ import (
2424
2525 "sigs.k8s.io/controller-runtime/pkg/log"
2626 "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/metrics"
27- "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/scheduling/types"
2827 logutil "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/util/logging"
2928)
3029
3130func newIndexer (maxCacheSize int ) * indexer {
3231 t := & indexer {
3332 maxCacheSize : maxCacheSize ,
34- table : make (map [types. BlockHash ]map [types. ServerID ]* node ),
33+ table : make (map [BlockHash ]map [ServerID ]* node ),
3534 list : newLinkedList (),
3635 }
3736 go t .ReportCacheSize (time .Second )
@@ -43,15 +42,15 @@ func newIndexer(maxCacheSize int) *indexer {
4342type indexer struct {
4443 mu sync.RWMutex
4544 maxCacheSize int
46- table map [types. BlockHash ]map [types. ServerID ]* node // from any prefix cache to the cache entry to find the server
47- list * linkedList // LRU list to keep track of the order of entries
45+ table map [BlockHash ]map [ServerID ]* node // from any prefix cache to the cache entry to find the server
46+ list * linkedList // LRU list to keep track of the order of entries
4847}
4948
5049// Get returns the set of servers that have the given prefix hash cached.
51- func (i * indexer ) Get (hash types. BlockHash ) map [types. ServerID ]bool {
50+ func (i * indexer ) Get (hash BlockHash ) map [ServerID ]bool {
5251 i .mu .RLock ()
5352 defer i .mu .RUnlock ()
54- res := map [types. ServerID ]bool {}
53+ res := map [ServerID ]bool {}
5554 for server := range i .table [hash ] {
5655 res [server ] = true
5756 }
@@ -61,15 +60,15 @@ func (i *indexer) Get(hash types.BlockHash) map[types.ServerID]bool {
6160// Add adds a list of prefix hashes of a single request to the server the request was sent to.
6261// The intuition is that this server is likely to have the prefix cached, so next time a request
6362// sharing the longest prefix should be sent to the same server to take advantage of the cache hit.
64- func (i * indexer ) Add (hashes []types. BlockHash , server types. ServerID ) {
63+ func (i * indexer ) Add (hashes []BlockHash , server ServerID ) {
6564 i .mu .Lock ()
6665 defer i .mu .Unlock ()
6766 for _ , hash := range hashes {
6867 i .add (hash , server )
6968 }
7069}
7170
72- func (i * indexer ) check (hash types. BlockHash , server types. ServerID ) (* node , bool ) {
71+ func (i * indexer ) check (hash BlockHash , server ServerID ) (* node , bool ) {
7372 servers , ok := i .table [hash ]
7473 if ! ok {
7574 return nil , false
@@ -78,7 +77,7 @@ func (i *indexer) check(hash types.BlockHash, server types.ServerID) (*node, boo
7877 return n , ok
7978}
8079
81- func (i * indexer ) add (hash types. BlockHash , server types. ServerID ) {
80+ func (i * indexer ) add (hash BlockHash , server ServerID ) {
8281 node , exists := i .check (hash , server )
8382 if exists {
8483 i .list .moveToTail (node )
@@ -87,7 +86,7 @@ func (i *indexer) add(hash types.BlockHash, server types.ServerID) {
8786 }
8887}
8988
90- func (i * indexer ) create (hash types. BlockHash , server types. ServerID ) {
89+ func (i * indexer ) create (hash BlockHash , server ServerID ) {
9190 n := & node {
9291 hash : hash ,
9392 server : server ,
@@ -99,7 +98,7 @@ func (i *indexer) create(hash types.BlockHash, server types.ServerID) {
9998 }
10099
101100 if _ , ok := i .table [hash ]; ! ok {
102- i .table [hash ] = make (map [types. ServerID ]* node )
101+ i .table [hash ] = make (map [ServerID ]* node )
103102 }
104103 i.table [hash ][server ] = n
105104 i .list .add (n )
0 commit comments