Exemplo n.º 1
0
// SnapshotLookup returns the id of the given snapshot.
func (pool *Pool) LookupPoolSnapshot(snapshotName string) (SnapshotId, error) {
	name := C.CString(snapshotName)
	defer freeString(name)
	var id C.rados_snap_t
	ret := C.rados_ioctx_snap_lookup(pool.context, name, &id)
	if err := toRadosError(ret); err != nil {
		err.Message = fmt.Sprintf("Unable to lookup id for pool snapshot %s.", snapshotName)
		return 0, err
	}
	return SnapshotId(id), nil
}
Exemplo n.º 2
0
func (r *RadosIoCtx) SnapLookup(snapname string) (RadosSnapId, error) {
	var snapid C.rados_snap_t
	csnapname := C.CString(snapname)
	defer func() {
		C.free(unsafe.Pointer(csnapname))
	}()
	cerr := C.rados_ioctx_snap_lookup(*r.ctx, csnapname, &snapid)
	if cerr < 0 {
		return 0, errors.New("lookup snap failed")
	}

	return RadosSnapId(snapid), nil
}