Skip to content

Commit 86fe72e

Browse files
authored
Merge pull request #195 from klihub/devel/deprecate-registry
pkg/cdi: deprecate Registry and related interfaces.
2 parents 5c8b677 + 16506da commit 86fe72e

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

pkg/cdi/doc.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
//
4242
// # CDI Registry
4343
//
44+
// Note: the Registry and its related interfaces are deprecated and will
45+
// be removed in a future version. Please use the default cache and its
46+
// related package-level function instead.
47+
//
4448
// The primary interface to interact with CDI devices is the Registry. It
4549
// is essentially a cache of all Specs and devices discovered in standard
4650
// CDI directories on the host. The registry has two main functionality,

pkg/cdi/registry.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ import (
2929
//
3030
// The most commonly used Registry functions are for refreshing the
3131
// registry and injecting CDI devices into an OCI Spec.
32+
//
33+
// Deprecated: Registry is deprecated and will be removed in a future
34+
// version. Please update your code to use the corresponding package-
35+
// level functions Configure(), Refresh(), InjectDevices(), GetErrors(),
36+
// and GetDefaultCache().
3237
type Registry interface {
3338
RegistryResolver
3439
RegistryRefresher
@@ -54,6 +59,10 @@ type Registry interface {
5459
//
5560
// GetSpecDirErrors returns any errors related to the configured
5661
// Spec directories.
62+
//
63+
// Deprecated: RegistryRefresher is deprecated and will be removed
64+
// in a future version. Please use the default cache and its related
65+
// package-level functions instead.
5766
type RegistryRefresher interface {
5867
Configure(...Option) error
5968
Refresh() error
@@ -68,6 +77,10 @@ type RegistryRefresher interface {
6877
// InjectDevices takes an OCI Spec and injects into it a set of
6978
// CDI devices given by qualified name. It returns the names of
7079
// any unresolved devices and an error if injection fails.
80+
//
81+
// Deprecated: RegistryRefresher is deprecated and will be removed
82+
// in a future version. Please use the default cache and its related
83+
// package-level functions instead.
7184
type RegistryResolver interface {
7285
InjectDevices(spec *oci.Spec, device ...string) (unresolved []string, err error)
7386
}
@@ -79,6 +92,12 @@ type RegistryResolver interface {
7992
//
8093
// ListDevices returns a slice with the names of qualified device
8194
// known. The returned slice is sorted.
95+
//
96+
// Deprecated: RegistryDeviceDB is deprecated and will be removed
97+
// in a future version. Please use the default cache and its related
98+
// package-level functions instead.
99+
// and will be removed in a future version. Please use the default
100+
// cache and its related package-level functions instead.
82101
type RegistryDeviceDB interface {
83102
GetDevice(device string) *Device
84103
ListDevices() []string
@@ -99,6 +118,10 @@ type RegistryDeviceDB interface {
99118
//
100119
// WriteSpec writes the Spec with the given content and name to the
101120
// last Spec directory.
121+
//
122+
// Deprecated: RegistrySpecDB is deprecated and will be removed
123+
// in a future version. Please use the default cache and its related
124+
// package-level functions instead.
102125
type RegistrySpecDB interface {
103126
ListVendors() []string
104127
ListClasses() []string
@@ -121,6 +144,10 @@ var (
121144

122145
// GetRegistry returns the CDI registry. If any options are given, those
123146
// are applied to the registry.
147+
//
148+
// Deprecated: GetRegistry is deprecated and will be removed in a future
149+
// version. Please use the default cache and its related package-level
150+
// functions instead.
124151
func GetRegistry(options ...Option) Registry {
125152
initOnce.Do(func() {
126153
reg = &registry{GetDefaultCache()}
@@ -133,11 +160,19 @@ func GetRegistry(options ...Option) Registry {
133160
}
134161

135162
// DeviceDB returns the registry interface for querying devices.
163+
//
164+
// Deprecated: DeviceDB is deprecated and will be removed in a future
165+
// version. Please use the default cache and its related package-level
166+
// functions instead.
136167
func (r *registry) DeviceDB() RegistryDeviceDB {
137168
return r
138169
}
139170

140171
// SpecDB returns the registry interface for querying Specs.
172+
//
173+
// Deprecated: SpecDB is deprecated and will be removed in a future
174+
// version. Please use the default cache and its related package-level
175+
// functions instead.
141176
func (r *registry) SpecDB() RegistrySpecDB {
142177
return r
143178
}

0 commit comments

Comments
 (0)