// SwitchSnapshot switches to a specified snapshot, // creates a new empty delta on top of it, and makes it a top one // (i.e. the one new data will be written to). // Old top delta (i.e. data modified since the last snapshot) is lost. func (d Ploop) SwitchSnapshot(uuid string) error { var p C.struct_ploop_snapshot_switch_param p.guid = C.CString(uuid) defer cfree(p.guid) ret := C.ploop_switch_snapshot_ex(d.d, &p) return mkerr(ret) }
// SwitchSnapshotExtended is same as SwitchSnapshot but with additional // flags modifying its behavior. Please see individual flags description. // Returns uuid of what was the old top delta if SkipDestroy flag is set. func (d Ploop) SwitchSnapshotExtended(uuid string, flags SwitchFlag) (string, error) { var p C.struct_ploop_snapshot_switch_param oldUUID := "" p.guid = C.CString(uuid) defer cfree(p.guid) p.flags = C.int(flags) if flags&SkipDestroy != 0 { oldUUID, err := UUID() if err != nil { return "", err } p.guid_old = C.CString(oldUUID) defer cfree(p.guid_old) } ret := C.ploop_switch_snapshot_ex(d.d, &p) return oldUUID, mkerr(ret) }