config

package
v1.1.0-alpha-3 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2017 License: Apache-2.0 Imports: 6 Imported by: 40

Documentation

Index

Constants

View Source
const (
	VdiskTypeNil   = VdiskType("")
	VdiskTypeBoot  = VdiskType("boot")
	VdiskTypeDB    = VdiskType("db")
	VdiskTypeCache = VdiskType("cache")
)

valid vdisk types

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	StorageClusters map[string]StorageClusterConfig `yaml:"storageClusters" valid:"required"`
	Vdisks          map[string]VdiskConfig          `yaml:"vdisks" valid:"required"`
}

Config for the blockstor backends

func FromBytes

func FromBytes(bytes []byte) (*Config, error)

FromBytes creates a config based on given YAML 1.2 content

func ReadConfig

func ReadConfig(path string) (*Config, error)

ReadConfig reads the config used to configure the blockstor

func (*Config) String

func (cfg *Config) String() string

String returns this config as a YAML marshalled string

func (*Config) Validate

func (cfg *Config) Validate() error

Validate the Config to ensure that all required properties are present, and that all given properties are valid

type StorageClusterConfig

type StorageClusterConfig struct {
	DataStorage     []StorageServerConfig `yaml:"dataStorage" valid:"required"`
	MetadataStorage StorageServerConfig   `yaml:"metadataStorage" valid:"required"`
}

StorageClusterConfig defines the config for a storageCluster

type StorageServerConfig

type StorageServerConfig struct {
	Address  string `yaml:"address" valid:"dialstring,required"`
	Database int    `yaml:"db" valid:"optional"`
}

StorageServerConfig defines the config for a storage server

func ParseCSStorageServerConfigStrings

func ParseCSStorageServerConfigStrings(dialCSConfigString string) (configs []StorageServerConfig, err error)

ParseCSStorageServerConfigStrings allows you to parse a slice of raw dial config strings. Dial Config Strings are a simple format used to specify ardb connection configs easily as a command line argument. The format is as follows: `<ip>:<port>[@<db_index>][,<ip>:<port>[@<db_index>]]`, where the db_index is optional, and you can give multiple configs by seperating them with a comma.

type StorageType

type StorageType uint8

StorageType represents the type of storage of a vdisk

const (
	StorageNil     StorageType = 0
	StorageDeduped StorageType = 1 << iota
	StorageNondeduped
)

Different types of storage

func (StorageType) String

func (st StorageType) String() string

String returns the name of the storage type

func (StorageType) UInt8

func (st StorageType) UInt8() uint8

UInt8 returns the storage type as an uint8 value

type VdiskConfig

type VdiskConfig struct {
	BlockSize          uint64    `yaml:"blockSize" valid:"required"`
	ReadOnly           bool      `yaml:"readOnly" valid:"optional"`
	Size               uint64    `yaml:"size" valid:"required"`
	StorageCluster     string    `yaml:"storageCluster" valid:"required"`
	RootStorageCluster string    `yaml:"rootStorageCluster" valid:"optional"`
	TlogStorageCluster string    `yaml:"tlogStorageCluster" valid:"optional"`
	Type               VdiskType `yaml:"type" valid:"required"`
}

VdiskConfig defines the config for a vdisk

func (*VdiskConfig) StorageType

func (cfg *VdiskConfig) StorageType() StorageType

StorageType returns the type of storage this vdisk uses

type VdiskType

type VdiskType string

VdiskType represents the type of a vdisk

func (*VdiskType) MarshalYAML

func (t *VdiskType) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler.MarshalYAML

func (*VdiskType) UnmarshalYAML

func (t *VdiskType) UnmarshalYAML(unmarshal func(interface{}) error) (err error)

UnmarshalYAML implements yaml.Unmarshaler.UnmarshalYAML

Jump to

Keyboard shortcuts

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