rbd

package
v0.0.0-...-29d1ad9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Wrappers around librbd.

Index

Constants

This section is empty.

Variables

View Source
var RbdErrorImageNotOpen = errors.New("RBD image not open")
View Source
var RbdErrorNotFound = errors.New("RBD image not found")
View Source
var RbdFeatureLayering = uint64(1 << 0)

Rdb feature

View Source
var RbdFeatureStripingV2 = uint64(1 << 1)

Functions

func GetError

func GetError(err C.int) error

func GetImageNames

func GetImageNames(ioctx *rados.IOContext) (names []string, err error)

GetImageNames returns the list of current RBD images.

func Version

func Version() (int, int, int)

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 GetImage

func GetImage(ioctx *rados.IOContext, name string) *Image

func (*Image) BreakLock

func (image *Image) BreakLock(client string, cookie string) error

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) Close

func (image *Image) Close() error

int rbd_close(rbd_image_t image);

func (*Image) Copy

func (image *Image) Copy(args ...interface{}) error

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

func (image *Image) CreateSnapshot(snapname string) (*Snapshot, error)

int rbd_snap_create(rbd_image_t image, const char *snapname);

func (*Image) Discard

func (image *Image) Discard(ofs uint64, length uint64) error

int rbd_discard(rbd_image_t image, uint64_t ofs, uint64_t len);

func (*Image) Flatten

func (image *Image) Flatten() error

int rbd_flatten(rbd_image_t image);

func (*Image) Flush

func (image *Image) Flush() error

int rbd_flush(rbd_image_t image);

func (*Image) GetFeatures

func (image *Image) GetFeatures() (features uint64, err error)

int rbd_get_features(rbd_image_t image, uint64_t *features);

func (*Image) GetOverlap

func (image *Image) GetOverlap() (overlap uint64, err error)

int rbd_get_overlap(rbd_image_t image, uint64_t *overlap);

func (*Image) GetParentInfo

func (image *Image) GetParentInfo(p_pool, p_name, p_snapname []byte) error

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) GetSize

func (image *Image) GetSize() (size uint64, err error)

int rbd_size(rbd_image_t image, uint64_t *size);

func (*Image) GetSnapshot

func (image *Image) GetSnapshot(snapname string) *Snapshot

func (*Image) GetSnapshotNames

func (image *Image) GetSnapshotNames() (snaps []SnapInfo, err error)

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

func (image *Image) GetStripeCount() (stripe_count uint64, err error)

int rbd_get_stripe_count(rbd_image_t image, uint64_t *stripe_count);

func (*Image) GetStripeUnit

func (image *Image) GetStripeUnit() (stripe_unit uint64, err error)

int rbd_get_stripe_unit(rbd_image_t image, uint64_t *stripe_unit);

func (*Image) IsOldFormat

func (image *Image) IsOldFormat() (old_format bool, err error)

int rbd_get_old_format(rbd_image_t image, uint8_t *old);

func (*Image) ListChildren

func (image *Image) ListChildren() (pools []string, images []string, err error)

ssize_t rbd_list_children(rbd_image_t image, char *pools, size_t *pools_len,

char *images, size_t *images_len);

func (*Image) ListLockers

func (image *Image) ListLockers() (tag string, lockers []Locker, err error)

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

func (image *Image) LockExclusive(cookie string) error

int rbd_lock_exclusive(rbd_image_t image, const char *cookie);

func (*Image) LockShared

func (image *Image) LockShared(cookie string, tag string) error

int rbd_lock_shared(rbd_image_t image, const char *cookie, const char *tag);

func (*Image) Open

func (image *Image) Open(args ...interface{}) error

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

func (image *Image) Read(data []byte) (n int, err error)

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) ReadAt

func (image *Image) ReadAt(data []byte, off int64) (n int, err error)

func (*Image) Remove

func (image *Image) Remove() error

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

func (image *Image) Rename(destname string) error

int rbd_rename(rados_ioctx_t src_io_ctx, const char *srcname, const char *destname);

func (*Image) Resize

func (image *Image) Resize(size uint64) error

int rbd_resize(rbd_image_t image, uint64_t size);

func (*Image) Seek

func (image *Image) Seek(offset int64, whence int) (int64, error)

func (*Image) Stat

func (image *Image) Stat() (info *ImageInfo, err error)

int rbd_stat(rbd_image_t image, rbd_image_info_t *info, size_t infosize);

func (*Image) Unlock

func (image *Image) Unlock(cookie string) error

int rbd_lock_shared(rbd_image_t image, const char *cookie, const char *tag);

func (*Image) Write

func (image *Image) Write(data []byte) (n int, err error)

ssize_t rbd_write(rbd_image_t image, uint64_t ofs, size_t len, const char *buf);

func (*Image) WriteAt

func (image *Image) WriteAt(data []byte, off int64) (n int, err error)

type ImageInfo

type ImageInfo struct {
	Size              uint64
	Obj_size          uint64
	Num_objs          uint64
	Order             int
	Block_name_prefix string
	Parent_pool       int64
	Parent_name       string
}

type Locker

type Locker struct {
	Client string
	Cookie string
	Addr   string
}

type RBDError

type RBDError int

func (RBDError) Error

func (e RBDError) Error() string

type SnapInfo

type SnapInfo struct {
	Id   uint64
	Size uint64
	Name string
}

type Snapshot

type Snapshot struct {
	// contains filtered or unexported fields
}

func (*Snapshot) IsProtected

func (snapshot *Snapshot) IsProtected() (bool, error)

int rbd_snap_is_protected(rbd_image_t image, const char *snap_name,

int *is_protected);

func (*Snapshot) Protect

func (snapshot *Snapshot) Protect() error

int rbd_snap_protect(rbd_image_t image, const char *snap_name);

func (*Snapshot) Remove

func (snapshot *Snapshot) Remove() error

int rbd_snap_remove(rbd_image_t image, const char *snapname);

func (*Snapshot) Rollback

func (snapshot *Snapshot) Rollback() error

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);

func (*Snapshot) Set

func (snapshot *Snapshot) Set() error

int rbd_snap_set(rbd_image_t image, const char *snapname);

func (*Snapshot) Unprotect

func (snapshot *Snapshot) Unprotect() error

int rbd_snap_unprotect(rbd_image_t image, const char *snap_name);

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL