2021-11-22 21:43:59 +01:00
|
|
|
package device
|
2021-10-12 23:00:24 +02:00
|
|
|
|
|
|
|
// Device represents a device, with a name easy to remember and the UUID to identify it, optionally an owner.
|
|
|
|
type Device struct {
|
|
|
|
Name string `mapstructure:",omitempty"`
|
|
|
|
UUID string `mapstructure:"uuid"`
|
|
|
|
OwnerUser string `mapstructure:"owner,omitempty"`
|
2021-11-14 15:07:20 +01:00
|
|
|
isMounted bool
|
2021-10-12 23:00:24 +02:00
|
|
|
}
|
|
|
|
|
2021-10-27 23:17:18 +02:00
|
|
|
// Mount will mount a device
|
2021-10-12 23:00:24 +02:00
|
|
|
func (d Device) Mount() {
|
2021-11-14 15:07:20 +01:00
|
|
|
|
|
|
|
d.isMounted = true
|
2021-10-12 23:00:24 +02:00
|
|
|
}
|
|
|
|
|
2021-10-27 23:17:18 +02:00
|
|
|
// Unmount will unmount a device
|
2021-10-12 23:00:24 +02:00
|
|
|
func (d Device) Unmount() {
|
2021-11-14 15:07:20 +01:00
|
|
|
|
|
|
|
d.isMounted = false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (d Device) IsMounted() bool {
|
|
|
|
return d.isMounted
|
2021-10-12 23:00:24 +02:00
|
|
|
}
|