rainbond: github.com/goodrain/rainbond/worker/master/volumes/provider/lib/util Index | Files

package util

import "github.com/goodrain/rainbond/worker/master/volumes/provider/lib/util"


Package Files



const (
    KiB int64 = 1024
    MiB int64 = 1024 * KiB
    GiB int64 = 1024 * MiB
    TiB int64 = 1024 * GiB

Common allocation units

func AccessModesContainedInAll Uses

func AccessModesContainedInAll(indexedModes []v1.PersistentVolumeAccessMode, requestedModes []v1.PersistentVolumeAccessMode) bool

AccessModesContainedInAll returns whether all of the requested modes are contained by modes

func AccessModesContains Uses

func AccessModesContains(modes []v1.PersistentVolumeAccessMode, mode v1.PersistentVolumeAccessMode) bool

AccessModesContains returns whether the requested mode is contained by modes

func CheckPersistentVolumeClaimModeBlock Uses

func CheckPersistentVolumeClaimModeBlock(pvc *v1.PersistentVolumeClaim) bool

CheckPersistentVolumeClaimModeBlock checks VolumeMode. If the mode is Block, return true otherwise return false.

func RoundUpSize Uses

func RoundUpSize(volumeSizeBytes int64, allocationUnitBytes int64) int64

RoundUpSize calculates how many allocation units are needed to accommodate a volume of given size. E.g. when user wants 1500MiB volume, while AWS EBS allocates volumes in gibibyte-sized chunks, RoundUpSize(1500 * 1024*1024, 1024*1024*1024) returns '2' (2 GiB is the smallest allocatable volume that can hold 1500MiB)

func RoundUpToGiB Uses

func RoundUpToGiB(sizeBytes int64) int64

RoundUpToGiB rounds up given quantity upto chunks of GiB

Package util imports 1 packages (graph) and is imported by 1 packages. Updated 2019-01-18. Refresh now. Tools for package owners.