cephfs admin: rename "NewSize" type to "QuotaSize"

This clarifies what the size values are for when this interface is used
and hopefully clarifies what the size actually does to a subvolume. This
also generalizes the type a bit in preparation for it being used in
other upcoming functions.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
John Mulligan 2020-09-02 08:29:48 -04:00 committed by John Mulligan
parent fbb4f957eb
commit d8143f5bae
2 changed files with 12 additions and 12 deletions

View File

@ -13,25 +13,25 @@ const (
tebiByte = 1024 * gibiByte
)
// newSizeValue returns a size value as a string, as needed by the subvolume
// resizeValue returns a size value as a string, as needed by the subvolume
// resize command json.
func (bc ByteCount) newSizeValue() string {
func (bc ByteCount) resizeValue() string {
return uint64String(uint64(bc))
}
// NewSize interface values can be used to change the size of a volume.
type NewSize interface {
newSizeValue() string
// QuotaSize interface values can be used to change the size of a volume.
type QuotaSize interface {
resizeValue() string
}
// specialSize is a custom non-numeric new size value.
// specialSize is a custom non-numeric quota size value.
type specialSize string
// newSizeValue for a specialSize returns the literal string.
func (s specialSize) newSizeValue() string {
// resizeValue for a specialSize returns the original string value.
func (s specialSize) resizeValue() string {
return string(s)
}
// Infinite is a special NewSize value that can be used to clear size limits on
// a subvolume.
// Infinite is a special QuotaSize value that can be used to clear size limits
// on a subvolume.
const Infinite = specialSize("infinite")

View File

@ -125,7 +125,7 @@ type SubVolumeResizeResult struct {
// ceph fs subvolume resize <volume> --group-name=<group> <name> ...
func (fsa *FSAdmin) ResizeSubVolume(
volume, group, name string,
newSize NewSize, noShrink bool) (*SubVolumeResizeResult, error) {
newSize QuotaSize, noShrink bool) (*SubVolumeResizeResult, error) {
f := &subVolumeResizeFields{
Prefix: "fs subvolume resize",
@ -133,7 +133,7 @@ func (fsa *FSAdmin) ResizeSubVolume(
VolName: volume,
GroupName: group,
SubName: name,
NewSize: newSize.newSizeValue(),
NewSize: newSize.resizeValue(),
NoShrink: noShrink,
}
var result []*SubVolumeResizeResult