Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
bufdev committed Nov 7, 2024
1 parent fdc034f commit 8d08e5b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions private/bufpkg/bufmodule/bufmodulecache/base_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,17 @@ func (p *baseProvider[K, V]) getValuesForKeys(ctx context.Context, keys []K) ([]
); err != nil {
return nil, err
}
// We are getting the values again so that we retrieve the values from the cache directly.
// This matters for ie ModuleDatas where the storage.Bucket attached will have local paths
// instead of empty local paths if read from the cache. We documment NewModuleDataProvider
// to return a ModuleDataProvider that will always have local paths for returned storage.Buckets.
delegateValues, err = p.delegateGetValuesForKeys(
ctx,
notFoundKeys,
)
if err != nil {
return nil, err
}

p.keysRetrieved.Add(int64(len(keys)))
p.keysHit.Add(int64(len(foundValues)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
// NewModuleDataProvider returns a new ModuleDataProvider that caches the results of the delegate.
//
// The ModuleDataStore is used as a cache.
//
// All files in returned [storage.Bucket]s will have local paths.
func NewModuleDataProvider(
logger *slog.Logger,
delegate bufmodule.ModuleDataProvider,
Expand Down

0 comments on commit 8d08e5b

Please sign in to comment.