Documentation
¶
Index ¶
- type Interface
- type InterfaceMock
- func (mock *InterfaceMock) AdditionalDevices() []string
- func (mock *InterfaceMock) AdditionalDevicesCalls() []struct{}
- func (mock *InterfaceMock) CreateSpecFile() error
- func (mock *InterfaceMock) CreateSpecFileCalls() []struct{}
- func (mock *InterfaceMock) QualifiedName(s1 string, s2 string) string
- func (mock *InterfaceMock) QualifiedNameCalls() []struct{ ... }
- type Option
- func WithDevRoot(root string) Option
- func WithDeviceIDStrategy(strategy string) Option
- func WithDeviceListStrategies(deviceListStrategies spec.DeviceListStrategies) Option
- func WithDriverRoot(root string) Option
- func WithGdrcopyEnabled(enabled bool) Option
- func WithGdsEnabled(enabled bool) Option
- func WithImexChannels(imexChannels imex.Channels) Option
- func WithMofedEnabled(enabled bool) Option
- func WithNvidiaCTKPath(path string) Option
- func WithTargetDevRoot(root string) Option
- func WithTargetDriverRoot(root string) Option
- func WithVendor(vendor string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Interface ¶
type Interface interface {
CreateSpecFile() error
QualifiedName(string, string) string
AdditionalDevices() []string
}
Interface provides the API to the 'cdi' package
func New ¶
func New(infolib info.Interface, nvmllib nvml.Interface, devicelib device.Interface, opts ...Option) (Interface, error)
New constructs a new instance of the 'cdi' interface
func NewNullHandler ¶
func NewNullHandler() Interface
NewNullHandler returns an instance of the 'cdi' interface that can be used when CDI specs are not required.
type InterfaceMock ¶
type InterfaceMock struct {
// AdditionalDevicesFunc mocks the AdditionalDevices method.
AdditionalDevicesFunc func() []string
// CreateSpecFileFunc mocks the CreateSpecFile method.
CreateSpecFileFunc func() error
// QualifiedNameFunc mocks the QualifiedName method.
QualifiedNameFunc func(s1 string, s2 string) string
// contains filtered or unexported fields
}
InterfaceMock is a mock implementation of Interface.
func TestSomethingThatUsesInterface(t *testing.T) {
// make and configure a mocked Interface
mockedInterface := &InterfaceMock{
AdditionalDevicesFunc: func() []string {
panic("mock out the AdditionalDevices method")
},
CreateSpecFileFunc: func() error {
panic("mock out the CreateSpecFile method")
},
QualifiedNameFunc: func(s1 string, s2 string) string {
panic("mock out the QualifiedName method")
},
}
// use mockedInterface in code that requires Interface
// and then make assertions.
}
func (*InterfaceMock) AdditionalDevices ¶ added in v0.18.0
func (mock *InterfaceMock) AdditionalDevices() []string
AdditionalDevices calls AdditionalDevicesFunc.
func (*InterfaceMock) AdditionalDevicesCalls ¶ added in v0.18.0
func (mock *InterfaceMock) AdditionalDevicesCalls() []struct { }
AdditionalDevicesCalls gets all the calls that were made to AdditionalDevices. Check the length with:
len(mockedInterface.AdditionalDevicesCalls())
func (*InterfaceMock) CreateSpecFile ¶
func (mock *InterfaceMock) CreateSpecFile() error
CreateSpecFile calls CreateSpecFileFunc.
func (*InterfaceMock) CreateSpecFileCalls ¶
func (mock *InterfaceMock) CreateSpecFileCalls() []struct { }
CreateSpecFileCalls gets all the calls that were made to CreateSpecFile. Check the length with:
len(mockedInterface.CreateSpecFileCalls())
func (*InterfaceMock) QualifiedName ¶
func (mock *InterfaceMock) QualifiedName(s1 string, s2 string) string
QualifiedName calls QualifiedNameFunc.
func (*InterfaceMock) QualifiedNameCalls ¶
func (mock *InterfaceMock) QualifiedNameCalls() []struct { S1 string S2 string }
QualifiedNameCalls gets all the calls that were made to QualifiedName. Check the length with:
len(mockedInterface.QualifiedNameCalls())
type Option ¶
type Option func(*cdiHandler)
Option defines a function for passing options to the New() call
func WithDevRoot ¶ added in v0.16.0
WithDevRoot sets the dev root for the `cdi` interface.
func WithDeviceIDStrategy ¶
WithDeviceIDStrategy provides an Option to set the device ID strategy used by the 'cdi' interface
func WithDeviceListStrategies ¶ added in v0.15.0
func WithDeviceListStrategies(deviceListStrategies spec.DeviceListStrategies) Option
WithDeviceListStrategies provides an Option to set the enabled flag used by the 'cdi' interface
func WithDriverRoot ¶
WithDriverRoot provides an Option to set the driver root used by the 'cdi' interface.
func WithGdrcopyEnabled ¶ added in v0.18.0
WithGdrcopyEnabled provides an option to set whether a GDS CDI spec should be generated
func WithGdsEnabled ¶
WithGdsEnabled provides an option to set whether a GDS CDI spec should be generated
func WithImexChannels ¶ added in v0.17.0
WithImexChannels sets the IMEX channels for which CDI specs should be generated.
func WithMofedEnabled ¶
WithMofedEnabled provides an option to set whether a MOFED CDI spec should be generated
func WithNvidiaCTKPath ¶
WithNvidiaCTKPath provides an Option to set the nvidia-ctk path used by the 'cdi' interface
func WithTargetDevRoot ¶ added in v0.16.0
WithTargetDevRoot provides an Option to set the target (host) dev root used by the 'cdi' interface
func WithTargetDriverRoot ¶
WithTargetDriverRoot provides an Option to set the target (host) driver root used by the 'cdi' interface
func WithVendor ¶
WithVendor provides an Option to set the vendor used by the 'cdi' interface