rbd: add doc comments for (Get|Set|Remove)Metadata funcs

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-02-25 14:48:55 -05:00 committed by John Mulligan
parent 53fd07425a
commit 8f2671fee9
1 changed files with 12 additions and 3 deletions

View File

@ -911,7 +911,10 @@ func (image *Image) GetSnapshotNames() (snaps []SnapInfo, err error) {
return snaps[:len(snaps)-1], nil
}
// int rbd_metadata_get(rbd_image_t image, const char *key, char *value, size_t *vallen)
// GetMetadata returns the metadata string associated with the given key.
//
// Implements:
// int rbd_metadata_get(rbd_image_t image, const char *key, char *value, size_t *vallen)
func (image *Image) GetMetadata(key string) (string, error) {
if err := image.validate(imageIsOpen); err != nil {
return "", err
@ -938,7 +941,10 @@ func (image *Image) GetMetadata(key string) (string, error) {
return string(value), nil
}
// int rbd_metadata_set(rbd_image_t image, const char *key, const char *value)
// SetMetadata updates the metadata string associated with the given key.
//
// Implements:
// int rbd_metadata_set(rbd_image_t image, const char *key, const char *value)
func (image *Image) SetMetadata(key string, value string) error {
if err := image.validate(imageIsOpen); err != nil {
return err
@ -957,7 +963,10 @@ func (image *Image) SetMetadata(key string, value string) error {
return nil
}
// int rbd_metadata_remove(rbd_image_t image, const char *key)
// RemoveMetadata clears the metadata associated with the given key.
//
// Implements:
// int rbd_metadata_remove(rbd_image_t image, const char *key)
func (image *Image) RemoveMetadata(key string) error {
if err := image.validate(imageIsOpen); err != nil {
return err