rbd: add wrapper for unexported pool stat functions.

Added wrappers for rbd_pool_stats_create() and rbd_pool_stats_destroy() functions.
Right now, keeping these unexported.

Signed-off-by: Mudit Agarwal <muagarwa@redhat.com>
This commit is contained in:
Mudit Agarwal 2020-07-04 18:44:50 +05:30 committed by John Mulligan
parent 0cd2b21224
commit fec47ac9a9
1 changed files with 27 additions and 0 deletions

View File

@ -99,3 +99,30 @@ func PoolInit(ioctx *rados.IOContext, force bool) error {
ret := C.rbd_pool_init(cephIoctx(ioctx), C.bool(force))
return getError(ret)
}
// poolStats represents RBD pool stats variable.
type poolStats struct {
stats C.rbd_pool_stats_t
}
// poolStatsCreate creates a new poolStats struct.
//
// Implements:
// void rbd_pool_stats_create(rbd_pool_stats_t *stats)
func poolStatsCreate() *poolStats {
poolstats := &poolStats{}
C.rbd_pool_stats_create(&poolstats.stats)
return poolstats
}
// destroy a poolStats struct and free the associated resources.
//
// Implements:
// void rbd_pool_stats_destroy(rbd_pool_stats_t stats)
func (poolstats *poolStats) destroy() {
C.rbd_pool_stats_destroy(poolstats.stats)
if poolstats.stats != nil {
poolstats.stats = nil
}
}