storageclass

package
v0.0.0-...-1526e7e Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Reduced redundancy storage class
	RRS = "REDUCED_REDUNDANCY"
	// Standard storage class
	STANDARD = "STANDARD"
)

Standard constants for all storage class

View Source
const (
	ClassStandard = "standard"
	ClassRRS      = "rrs"
	Optimize      = "optimize"
	InlineBlock   = "inline_block"

	// Reduced redundancy storage class environment variable
	RRSEnv = "MINIO_STORAGE_CLASS_RRS"
	// Standard storage class environment variable
	StandardEnv = "MINIO_STORAGE_CLASS_STANDARD"
	// Optimize storage class environment variable
	OptimizeEnv = "MINIO_STORAGE_CLASS_OPTIMIZE"
	// Inline block indicates the size of the shard
	// that is considered for inlining, remember this
	// shard value is the value per drive shard it
	// will vary based on the parity that is configured
	// for the STANDARD storage_class.
	// inlining means data and metadata are written
	// together in a single file i.e xl.meta
	InlineBlockEnv = "MINIO_STORAGE_CLASS_INLINE_BLOCK"
)

Standard constats for config info storage class

Variables

View Source
var ConfigLock sync.RWMutex

ConfigLock is a global lock for storage-class config

View Source
var (
	DefaultKVS = config.KVS{
		config.KV{
			Key:   ClassStandard,
			Value: "",
		},
		config.KV{
			Key:   ClassRRS,
			Value: "EC:1",
		},
		config.KV{
			Key:   Optimize,
			Value: "availability",
		},
		config.KV{
			Key:           InlineBlock,
			Value:         "",
			HiddenIfEmpty: true,
		},
	}
)

DefaultKVS - default storage class config

View Source
var (
	Help = config.HelpKVS{
		config.HelpKV{
			Key:         ClassStandard,
			Description: `set the parity count for default standard storage class` + defaultHelpPostfix(ClassStandard),
			Optional:    true,
			Type:        "string",
		},
		config.HelpKV{
			Key:         ClassRRS,
			Description: `set the parity count for reduced redundancy storage class` + defaultHelpPostfix(ClassRRS),
			Optional:    true,
			Type:        "string",
		},
		config.HelpKV{
			Key:         Optimize,
			Description: `optimize parity calculation for standard storage class, set 'capacity' for capacity optimized (no additional parity)` + defaultHelpPostfix(Optimize),
			Optional:    true,
			Type:        "string",
		},
		config.HelpKV{
			Key:         config.Comment,
			Description: config.DefaultComment,
			Optional:    true,
			Type:        "sentence",
		},
	}
)

Help template for storageclass feature.

Functions

func DefaultParityBlocks

func DefaultParityBlocks(drive int) int

DefaultParityBlocks returns default parity blocks for 'drive' count

func Enabled

func Enabled(kvs config.KVS) bool

Enabled returns if storageClass is enabled is enabled.

func IsValid

func IsValid(sc string) bool

IsValid - returns true if input string is a valid storage class kind supported.

func SetStorageClass

func SetStorageClass(s config.Config, cfg Config)

SetStorageClass - One time migration code needed, for migrating from older config to new for StorageClass.

func ValidateParity

func ValidateParity(ssParity, setDriveCount int) error

ValidateParity validate standard storage class parity.

Types

type Config

type Config struct {
	Standard StorageClass `json:"standard"`
	RRS      StorageClass `json:"rrs"`
	Optimize string       `json:"optimize"`
	// contains filtered or unexported fields
}

Config storage class configuration

func LookupConfig

func LookupConfig(kvs config.KVS, setDriveCount int) (cfg Config, err error)

LookupConfig - lookup storage class config and override with valid environment settings if any.

func (*Config) AvailabilityOptimized

func (sCfg *Config) AvailabilityOptimized() bool

AvailabilityOptimized - returns true if the storage-class is availability optimized, meaning we will use additional parities when drives are offline to retain parity SLA.

Default is "availability" optimized.

func (*Config) CapacityOptimized

func (sCfg *Config) CapacityOptimized() bool

CapacityOptimized - returns true if the storage-class is capacity optimized meaning we will not use additional parities when drives are offline.

Default is "availability" optimized, unless this is configured.

func (*Config) GetParityForSC

func (sCfg *Config) GetParityForSC(sc string) (parity int)

GetParityForSC - Returns the data and parity drive count based on storage class If storage class is set using the env vars MINIO_STORAGE_CLASS_RRS and MINIO_STORAGE_CLASS_STANDARD or server config fields corresponding values are returned.

-- if input storage class is empty then standard is assumed

-- if input is RRS but RRS is not configured/initialized '-1' parity

for RRS is assumed, the caller is expected to choose the right parity
at that point.

-- if input is STANDARD but STANDARD is not configured/initialized '-1' parity

is returned, the caller is expected to choose the right parity
at that point.

func (*Config) InlineBlock

func (sCfg *Config) InlineBlock() int64

InlineBlock indicates the size of the block which will be used to inline an erasure shard and written along with xl.meta on the drive, on a versioned bucket this value is automatically chosen to 1/8th of the this value, make sure to put this into consideration when choosing this value.

func (*Config) UnmarshalJSON

func (sCfg *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON - Validate SS and RRS parity when unmarshalling JSON.

func (*Config) Update

func (sCfg *Config) Update(newCfg Config)

Update update storage-class with new config

type StorageClass

type StorageClass struct {
	Parity int
}

StorageClass - holds storage class information

func (*StorageClass) MarshalText

func (sc *StorageClass) MarshalText() ([]byte, error)

MarshalText - marshals storage class string.

func (*StorageClass) String

func (sc *StorageClass) String() string

func (*StorageClass) UnmarshalText

func (sc *StorageClass) UnmarshalText(b []byte) error

UnmarshalText unmarshals storage class from its textual form into storageClass structure.

Jump to

Keyboard shortcuts

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