Skip to content
Snippets Groups Projects

Resolve "Restarting the controller after devices are registered is throwing a panic"

13 files
+ 125
170
Compare changes
  • Side-by-side
  • Inline
Files
13
@@ -51,18 +51,4 @@ type LoadedDevice struct {
@@ -51,18 +51,4 @@ type LoadedDevice struct {
// SBI indicates the southbound interface, which is used by this device as UUID.
// SBI indicates the southbound interface, which is used by this device as UUID.
SBI string `json:"sbi"`
SBI string `json:"sbi"`
Model string `json:"model,omitempty" bson:"model,omitempty"`
Model string `json:"model,omitempty" bson:"model,omitempty"`
convertFunc func(LoadedDevice) (Device, error)
}
// SetConvertFunction allows to set the LoadedDevice's convert function. This
// function should take a LoadedDevice and returns a Device.
func (ld *LoadedDevice) SetConvertFunction(cf func(LoadedDevice) (Device, error)) {
ld.convertFunc = cf
}
// ConvertToDevice calls the LoadedDevice's convert function and converts the
// LoadedDevice into a Device.
func (ld LoadedDevice) ConvertToDevice() (Device, error) {
return ld.convertFunc(ld)
}
}
Loading