storageclass

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2020 License: Apache-2.0 Imports: 6 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"

	// Reduced redundancy storage class environment variable
	RRSEnv = "MINIO_STORAGE_CLASS_RRS"
	// Standard storage class environment variable
	StandardEnv = "MINIO_STORAGE_CLASS_STANDARD"
)

Standard constats for config info storage class

Variables

View Source
var (
	DefaultKVS = config.KVS{
		config.KV{
			Key:   ClassStandard,
			Value: "",
		},
		config.KV{
			Key:   ClassRRS,
			Value: "EC:2",
		},
	}
)

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 e.g. "EC:4"`,
			Optional:    true,
			Type:        "string",
		},
		config.HelpKV{
			Key:         ClassRRS,
			Description: `set the parity count for reduced redundancy storage class e.g. "EC:2"`,
			Optional:    true,
			Type:        "string",
		},
		config.HelpKV{
			Key:         config.Comment,
			Description: config.DefaultComment,
			Optional:    true,
			Type:        "sentence",
		},
	}
)

Help template for storageclass feature.

Functions

func Enabled

func Enabled(kvs config.KVS) bool

Enabled returns if etcd 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.

Types

type Config

type Config struct {
	Standard StorageClass `json:"standard"`
	RRS      StorageClass `json:"rrs"`
}

Config storage class configuration

func LookupConfig

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

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

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 config.json fields -- corresponding values are returned If storage class is not set during startup, default values are returned -- Default for Reduced Redundancy Storage class is, parity = 2 and data = N-Parity -- Default for Standard Storage class is, parity = N/2, data = N/2 If storage class is empty -- standard storage class is assumed and corresponding data and parity is returned

func (*Config) UnmarshalJSON

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

UnmarshalJSON - Validate SS and RRS parity when unmarshalling JSON.

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