61 lines
1.6 KiB
Go
61 lines
1.6 KiB
Go
package gonetworkmanager
|
|
|
|
import "github.com/godbus/dbus"
|
|
|
|
const (
|
|
CheckpointInterface = NetworkManagerInterface + ".Checkpoint"
|
|
|
|
/* Properties */
|
|
CheckpointPropertyDevices = CheckpointInterface + ".Devices" // readable ao
|
|
CheckpointPropertyCreated = CheckpointInterface + ".Created" // readable x
|
|
CheckpointPropertyRollbackTimeout = CheckpointInterface + ".RollbackTimeout" // readable u
|
|
)
|
|
|
|
type Checkpoint interface {
|
|
GetPath() dbus.ObjectPath
|
|
|
|
// Array of object paths for devices which are part of this checkpoint.
|
|
GetPropertyDevices() []Device
|
|
|
|
// The timestamp (in CLOCK_BOOTTIME milliseconds) of checkpoint creation.
|
|
GetPropertyCreated() int64
|
|
|
|
// Timeout in seconds for automatic rollback, or zero.
|
|
GetPropertyRollbackTimeout() uint32
|
|
}
|
|
|
|
func NewCheckpoint(objectPath dbus.ObjectPath) (Checkpoint, error) {
|
|
var c checkpoint
|
|
return &c, c.init(NetworkManagerInterface, objectPath)
|
|
}
|
|
|
|
type checkpoint struct {
|
|
dbusBase
|
|
}
|
|
|
|
func (c *checkpoint) GetPropertyDevices() []Device {
|
|
devicesPaths := c.getSliceObjectProperty(CheckpointPropertyDevices)
|
|
devices := make([]Device, len(devicesPaths))
|
|
|
|
var err error
|
|
for i, path := range devicesPaths {
|
|
devices[i], err = NewDevice(path)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
return devices
|
|
}
|
|
|
|
func (c *checkpoint) GetPropertyCreated() int64 {
|
|
return c.getInt64Property(CheckpointPropertyCreated)
|
|
}
|
|
|
|
func (c *checkpoint) GetPropertyRollbackTimeout() uint32 {
|
|
return c.getUint32Property(CheckpointPropertyRollbackTimeout)
|
|
}
|
|
|
|
func (c *checkpoint) GetPath() dbus.ObjectPath {
|
|
return c.obj.Path()
|
|
}
|