예제 #1
0
func (r *RadosIoCtx) SnapGetStamp(snapid RadosSnapId) (uint64, error) {
	var stamp C.time_t
	cerr := C.rados_ioctx_snap_get_stamp(*r.ctx, C.rados_snap_t(snapid), &stamp)
	if cerr < 0 {
		return 0, errors.New("get snap stamp failed")
	}

	return uint64(C.uint64_t(stamp)), nil
}
예제 #2
0
// SnapshotTimestamp returns the timestamp the snapshot was created.
func (pool *Pool) SnapshotTimestamp(snapId SnapshotId) (time.Time, error) {
	id := C.rados_snap_t(snapId)
	var t C.time_t
	ret := C.rados_ioctx_snap_get_stamp(pool.context, id, &t)
	if err := toRadosError(ret); err != nil {
		err.Message = fmt.Sprintf("Unable to retrieve timestamp for snapshot id %d.", snapId)
		return time.Now(), err
	}
	goTime := time.Unix(int64(t), 0)
	return goTime, nil
}