runtime: device/persist: drop persist dependency from device pkgs

Rather than have device package depend on persist, let's define the
(almost duplicate) structures within device itself, and have the Kata
Container's persist pkg import these.

This'll help avoid unecessary dependencies within our core packages.

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
This commit is contained in:
Eric Ernst
2022-06-16 00:24:04 -07:00
parent f9e96c6506
commit f97d9b45c8
11 changed files with 37 additions and 43 deletions

View File

@@ -10,7 +10,6 @@ import (
"context"
"github.com/kata-containers/kata-containers/src/runtime/pkg/device/config"
persistapi "github.com/kata-containers/kata-containers/src/runtime/virtcontainers/persist/api"
"github.com/sirupsen/logrus"
)
@@ -78,10 +77,10 @@ type Device interface {
Dereference() uint
// Save converts Device to DeviceState
Save() persistapi.DeviceState
Save() config.DeviceState
// Load loads DeviceState and converts it to specific device
Load(persistapi.DeviceState)
Load(config.DeviceState)
}
// DeviceManager can be used to create a new device, this can be used as single
@@ -94,5 +93,5 @@ type DeviceManager interface {
IsDeviceAttached(string) bool
GetDeviceByID(string) Device
GetAllDevices() []Device
LoadDevices([]persistapi.DeviceState)
LoadDevices([]config.DeviceState)
}