Documentation ¶
Overview ¶
Wrappers around librbd.
Index ¶
- Variables
- func GetError(err C.int) error
- func GetImageNames(ioctx *rados.IOContext) (names []string, err error)
- func Version() (int, int, int)
- type Image
- func (image *Image) BreakLock(client string, cookie string) error
- func (image *Image) Clone(snapname string, c_ioctx *rados.IOContext, c_name string, features uint64, ...) (*Image, error)
- func (image *Image) Close() error
- func (image *Image) Copy(args ...interface{}) error
- func (image *Image) CreateSnapshot(snapname string) (*Snapshot, error)
- func (image *Image) Discard(ofs uint64, length uint64) error
- func (image *Image) Flatten() error
- func (image *Image) Flush() error
- func (image *Image) GetFeatures() (features uint64, err error)
- func (image *Image) GetOverlap() (overlap uint64, err error)
- func (image *Image) GetParentInfo(p_pool, p_name, p_snapname []byte) error
- func (image *Image) GetSize() (size uint64, err error)
- func (image *Image) GetSnapshot(snapname string) *Snapshot
- func (image *Image) GetSnapshotNames() (snaps []SnapInfo, err error)
- func (image *Image) GetStripeCount() (stripe_count uint64, err error)
- func (image *Image) GetStripeUnit() (stripe_unit uint64, err error)
- func (image *Image) IsOldFormat() (old_format bool, err error)
- func (image *Image) ListChildren() (pools []string, images []string, err error)
- func (image *Image) ListLockers() (tag string, lockers []Locker, err error)
- func (image *Image) LockExclusive(cookie string) error
- func (image *Image) LockShared(cookie string, tag string) error
- func (image *Image) Open(args ...interface{}) error
- func (image *Image) Read(data []byte) (n int, err error)
- func (image *Image) ReadAt(data []byte, off int64) (n int, err error)
- func (image *Image) Remove() error
- func (image *Image) Rename(destname string) error
- func (image *Image) Resize(size uint64) error
- func (image *Image) Seek(offset int64, whence int) (int64, error)
- func (image *Image) Stat() (info *ImageInfo, err error)
- func (image *Image) Unlock(cookie string) error
- func (image *Image) Write(data []byte) (n int, err error)
- func (image *Image) WriteAt(data []byte, off int64) (n int, err error)
- type ImageInfo
- type Locker
- type RBDError
- type SnapInfo
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
var RbdErrorImageNotOpen = errors.New("RBD image not open")
var RbdErrorNotFound = errors.New("RBD image not found")
var RbdFeatureLayering = uint64(1 << 0)
Rdb feature
var RbdFeatureStripingV2 = uint64(1 << 1)
Functions ¶
func GetImageNames ¶
GetImageNames returns the list of current RBD images.
Types ¶
type Image ¶
type Image struct { io.Reader io.Writer io.Seeker io.ReaderAt io.WriterAt // contains filtered or unexported fields }
func Create ¶
func Create(ioctx *rados.IOContext, name string, size uint64, order int, args ...uint64) (image *Image, err error)
int rbd_create(rados_ioctx_t io, const char *name, uint64_t size, int *order); int rbd_create2(rados_ioctx_t io, const char *name, uint64_t size,
uint64_t features, int *order);
int rbd_create3(rados_ioctx_t io, const char *name, uint64_t size,
uint64_t features, int *order, uint64_t stripe_unit, uint64_t stripe_count);
func (*Image) BreakLock ¶
int rbd_break_lock(rbd_image_t image, const char *client, const char *cookie);
func (*Image) Clone ¶
func (image *Image) Clone(snapname string, c_ioctx *rados.IOContext, c_name string, features uint64, order int) (*Image, error)
int rbd_clone(rados_ioctx_t p_ioctx, const char *p_name,
const char *p_snapname, rados_ioctx_t c_ioctx, const char *c_name, uint64_t features, int *c_order);
int rbd_clone2(rados_ioctx_t p_ioctx, const char *p_name,
const char *p_snapname, rados_ioctx_t c_ioctx, const char *c_name, uint64_t features, int *c_order, uint64_t stripe_unit, int stripe_count);
func (*Image) Copy ¶
int rbd_copy(rbd_image_t image, rados_ioctx_t dest_io_ctx, const char *destname); int rbd_copy2(rbd_image_t src, rbd_image_t dest); int rbd_copy_with_progress(rbd_image_t image, rados_ioctx_t dest_p, const char *destname,
librbd_progress_fn_t cb, void *cbdata);
int rbd_copy_with_progress2(rbd_image_t src, rbd_image_t dest,
librbd_progress_fn_t cb, void *cbdata);
func (*Image) CreateSnapshot ¶
int rbd_snap_create(rbd_image_t image, const char *snapname);
func (*Image) GetFeatures ¶
int rbd_get_features(rbd_image_t image, uint64_t *features);
func (*Image) GetOverlap ¶
int rbd_get_overlap(rbd_image_t image, uint64_t *overlap);
func (*Image) GetParentInfo ¶
int rbd_get_parent_info(rbd_image_t image,
char *parent_pool_name, size_t ppool_namelen, char *parent_name, size_t pnamelen, char *parent_snap_name, size_t psnap_namelen)
func (*Image) GetSnapshot ¶
func (*Image) GetSnapshotNames ¶
int rbd_snap_list(rbd_image_t image, rbd_snap_info_t *snaps, int *max_snaps); void rbd_snap_list_end(rbd_snap_info_t *snaps);
func (*Image) GetStripeCount ¶
int rbd_get_stripe_count(rbd_image_t image, uint64_t *stripe_count);
func (*Image) GetStripeUnit ¶
int rbd_get_stripe_unit(rbd_image_t image, uint64_t *stripe_unit);
func (*Image) IsOldFormat ¶
int rbd_get_old_format(rbd_image_t image, uint8_t *old);
func (*Image) ListChildren ¶
ssize_t rbd_list_children(rbd_image_t image, char *pools, size_t *pools_len,
char *images, size_t *images_len);
func (*Image) ListLockers ¶
ssize_t rbd_list_lockers(rbd_image_t image, int *exclusive,
char *tag, size_t *tag_len, char *clients, size_t *clients_len, char *cookies, size_t *cookies_len, char *addrs, size_t *addrs_len);
func (*Image) LockExclusive ¶
int rbd_lock_exclusive(rbd_image_t image, const char *cookie);
func (*Image) LockShared ¶
int rbd_lock_shared(rbd_image_t image, const char *cookie, const char *tag);
func (*Image) Open ¶
int rbd_open(rados_ioctx_t io, const char *name, rbd_image_t *image, const char *snap_name); int rbd_open_read_only(rados_ioctx_t io, const char *name, rbd_image_t *image,
const char *snap_name);
func (*Image) Read ¶
ssize_t rbd_read(rbd_image_t image, uint64_t ofs, size_t len, char *buf); TODO: int64_t rbd_read_iterate(rbd_image_t image, uint64_t ofs, size_t len,
int (*cb)(uint64_t, size_t, const char *, void *), void *arg);
TODO: int rbd_read_iterate2(rbd_image_t image, uint64_t ofs, uint64_t len,
int (*cb)(uint64_t, size_t, const char *, void *), void *arg);
TODO: int rbd_diff_iterate(rbd_image_t image,
const char *fromsnapname, uint64_t ofs, uint64_t len, int (*cb)(uint64_t, size_t, int, void *), void *arg);
func (*Image) Remove ¶
int rbd_remove(rados_ioctx_t io, const char *name); int rbd_remove_with_progress(rados_ioctx_t io, const char *name,
librbd_progress_fn_t cb, void *cbdata);
func (*Image) Rename ¶
int rbd_rename(rados_ioctx_t src_io_ctx, const char *srcname, const char *destname);
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
func (*Snapshot) IsProtected ¶
int rbd_snap_is_protected(rbd_image_t image, const char *snap_name,
int *is_protected);
func (*Snapshot) Rollback ¶
int rbd_snap_rollback(rbd_image_t image, const char *snapname); int rbd_snap_rollback_with_progress(rbd_image_t image, const char *snapname,
librbd_progress_fn_t cb, void *cbdata);