Skip to content

Commit

Permalink
pkg/cdi: make registry use the default cache.
Browse files Browse the repository at this point in the history
Make the registry use the default cache, essentially turning it
into an alias for it. Add a documentation note about our future
plans to onsolete then remove the registry interface.

Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub committed Jan 24, 2024
1 parent 7e8ad14 commit c7d4144
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 3 additions & 1 deletion pkg/cdi/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
// available and instantiated the first time it is referenced directly
// or indirectly. The most frequently used cache functions are available
// as identically named package level functions which opertate on the
// default cache instance.
// default cache instance. Moreover, the registry also operates on the
// same default cache. We plan to deprecate the registry and eventually
// remove it in a future release.
//
// # CDI Registry
//
Expand Down
7 changes: 2 additions & 5 deletions pkg/cdi/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,12 @@ var (
// GetRegistry returns the CDI registry. If any options are given, those
// are applied to the registry.
func GetRegistry(options ...Option) Registry {
var new bool
initOnce.Do(func() {
reg = &registry{newCache(options...)}
new = true
reg = &registry{GetDefaultCache()}
})
if !new && len(options) > 0 {
if len(options) > 0 {
// We don't care about errors here
_ = reg.Configure(options...)
_ = reg.Refresh()
}
return reg
}
Expand Down

0 comments on commit c7d4144

Please sign in to comment.