Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/cache/v3/linear.go
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ func (cache *LinearCache) getVersion() string {
}

func (cache *LinearCache) Fetch(context.Context, *Request) (Response, error) {
return nil, errors.New("not implemented")
return nil, errors.New("Fetch is not implemented by LinearCache")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: most linters will trigger on capitalized error messages. Not sure if this goes through here as matching the method name though

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah not sure, how this slipped. My IDE also missed it

}

// NumResources returns the number of resources currently in the cache.
Expand Down
12 changes: 9 additions & 3 deletions pkg/cache/v3/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package cache

import (
"context"
"errors"
"fmt"
)

Expand Down Expand Up @@ -54,6 +53,13 @@ func (mux *MuxCache) CreateDeltaWatch(request *DeltaRequest, sub Subscription, v
return cache.CreateDeltaWatch(request, sub, value)
}

func (mux *MuxCache) Fetch(context.Context, *Request) (Response, error) {
return nil, errors.New("not implemented")
func (mux *MuxCache) Fetch(ctx context.Context, request *Request) (Response, error) {
key := mux.Classify(request)
cache, exists := mux.Caches[key]
if !exists {
return nil, fmt.Errorf("no cache defined for key %s", key)
}
// Not all caches may implement Fetch; we delegate to the selected cache and if
// it does not implement Fetch, it will return an error.
return cache.Fetch(ctx, request)
}