github.com/kata-containers/runtime@v0.0.0-20210505125100-04f29832a923/virtcontainers/device/api/mockDeviceReceiver.go (about) 1 // Copyright (c) 2018 Huawei Corporation 2 // 3 // SPDX-License-Identifier: Apache-2.0 4 // 5 6 package api 7 8 import ( 9 "github.com/kata-containers/runtime/virtcontainers/device/config" 10 ) 11 12 // MockDeviceReceiver is a fake DeviceReceiver API implementation only used for test 13 type MockDeviceReceiver struct{} 14 15 // HotplugAddDevice adds a new device 16 func (mockDC *MockDeviceReceiver) HotplugAddDevice(Device, config.DeviceType) error { 17 return nil 18 } 19 20 // HotplugRemoveDevice removes a device 21 func (mockDC *MockDeviceReceiver) HotplugRemoveDevice(Device, config.DeviceType) error { 22 return nil 23 } 24 25 // GetAndSetSandboxBlockIndex is used for get and set virtio-blk indexes 26 func (mockDC *MockDeviceReceiver) GetAndSetSandboxBlockIndex() (int, error) { 27 return 0, nil 28 } 29 30 // DecrementSandboxBlockIndex decreases virtio-blk index by one 31 func (mockDC *MockDeviceReceiver) UnsetSandboxBlockIndex(int) error { 32 return nil 33 } 34 35 // AppendDevice adds new vhost user device 36 func (mockDC *MockDeviceReceiver) AppendDevice(Device) error { 37 return nil 38 } 39 40 // GetHypervisorType is used for getting Hypervisor name currently used. 41 func (mockDC *MockDeviceReceiver) GetHypervisorType() string { 42 return "" 43 } 44 45 // GetSandboxBlockOffset returns an offset w.r.t. the sandbox block index 46 func (mockDC *MockDeviceReceiver) GetSandboxBlockOffset() int { 47 return 0 48 }