cdi

package
v0.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

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
}

Interface provides the API to the 'cdi' package

func New

func New(opts ...Option) (Interface, error)

New is a factory method that creates a CDI handler for creating CDI specs.

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 {
	// 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{
		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) 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 WithDeviceIDStrategy

func WithDeviceIDStrategy(strategy string) Option

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

func WithDriverRoot(root string) Option

WithDriverRoot provides an Option to set the driver root used by the 'cdi' interface

func WithGdsEnabled

func WithGdsEnabled(enabled bool) Option

WithGdsEnabled provides and option to set whether a GDS CDI spec should be generated

func WithMofedEnabled

func WithMofedEnabled(enabled bool) Option

WithMofedEnabled provides and option to set whether a MOFED CDI spec should be generated

func WithNvidiaCTKPath

func WithNvidiaCTKPath(path string) Option

WithNvidiaCTKPath provides an Option to set the nvidia-ctk path used by the 'cdi' interface

func WithNvml

func WithNvml(nvml nvml.Interface) Option

WithNvml provides an Option to set the NVML library used by the 'cdi' interface

func WithTargetDriverRoot

func WithTargetDriverRoot(root string) Option

WithTargetDriverRoot provides an Option to set the target driver root used by the 'cdi' interface

func WithVendor

func WithVendor(vendor string) Option

WithVendor provides an Option to set the vendor used by the 'cdi' interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL