Documentation ¶
Index ¶
- Constants
- Variables
- func ETCDKey(id string, ktype KeyType) (string, error)
- func IsServiceAddress(str string) bool
- func ReadConfig(source Source, id string, keyType KeyType) ([]byte, error)
- func ValidateBlockSize(bs int64) bool
- func ValidateNBDServerConfigs(source Source, serverID string) error
- func ValidateTlogServerConfigs(source Source, serverID string) error
- func WatchNBDStorageConfig(ctx context.Context, source Source, vdiskID string) (<-chan NBDStorageConfig, error)
- func WatchNBDVdisksConfig(ctx context.Context, source Source, serverID string) (<-chan NBDVdisksConfig, error)
- func WatchStorageClusterConfig(ctx context.Context, source Source, clusterID string) (<-chan StorageClusterConfig, error)
- func WatchTlogClusterConfig(ctx context.Context, source Source, clusterID string) (<-chan TlogClusterConfig, error)
- func WatchTlogStorageConfig(ctx context.Context, source Source, vdiskID string) (<-chan TlogStorageConfig, error)
- func WatchVdiskNBDConfig(ctx context.Context, source Source, vdiskID string) (<-chan VdiskNBDConfig, error)
- func WatchVdiskTlogConfig(ctx context.Context, source Source, vdiskID string) (<-chan VdiskTlogConfig, error)
- func WatchZeroStorClusterConfig(ctx context.Context, source Source, clusterID string) (<-chan ZeroStorClusterConfig, error)
- type FileFormatCompleteConfig
- func (cfg *FileFormatCompleteConfig) NBDVdisksConfig() (*NBDVdisksConfig, error)
- func (cfg *FileFormatCompleteConfig) StorageClusterConfig(id string) (*StorageClusterConfig, error)
- func (cfg *FileFormatCompleteConfig) TlogClusterConfig(id string) (*TlogClusterConfig, error)
- func (cfg *FileFormatCompleteConfig) VdiskConfig(id string) (*FileFormatVdiskConfig, error)
- func (cfg *FileFormatCompleteConfig) ZeroStorClusterConfig(id string) (*ZeroStorClusterConfig, error)
- type FileFormatVdiskConfig
- type FormatValidator
- type IYOCredentials
- type InvalidConfigError
- type Key
- type KeyType
- type NBDStorageConfig
- type NBDVdisksConfig
- type ServerConfig
- type Source
- type SourceCloser
- type SourceConfig
- type SourceType
- type StorageClusterConfig
- type StorageServerConfig
- type StorageType
- type StubSource
- func (s *StubSource) Close() error
- func (s *StubSource) Get(key Key) ([]byte, error)
- func (s *StubSource) InvalidKey() <-chan Key
- func (s *StubSource) MarkInvalidKey(key Key, vdiskID string)
- func (s *StubSource) SetPrimaryStorageCluster(vdiskID, clusterID string, cfg *StorageClusterConfig)
- func (s *StubSource) SetSlaveStorageCluster(vdiskID, clusterID string, cfg *StorageClusterConfig)
- func (s *StubSource) SetStorageCluster(clusterID string, cfg *StorageClusterConfig)
- func (s *StubSource) SetTemplateStorageCluster(vdiskID, clusterID string, cfg *StorageClusterConfig)
- func (s *StubSource) SetTlogCluster(clusterID string, cfg *TlogClusterConfig)
- func (s *StubSource) SetTlogServerCluster(vdiskID, clusterID string, cfg *TlogClusterConfig)
- func (s *StubSource) SetTlogZeroStorCluster(vdiskID, clusterID string, cfg *ZeroStorClusterConfig)
- func (s *StubSource) SetVdiskConfig(vdiskID string, cfg *VdiskStaticConfig)
- func (s *StubSource) SetZeroStorCluster(clusterID string, cfg *ZeroStorClusterConfig)
- func (s *StubSource) SourceConfig() interface{}
- func (s *StubSource) Type() string
- func (s *StubSource) Watch(ctx context.Context, key Key) (<-chan []byte, error)
- type TlogClusterConfig
- type TlogStorageConfig
- type VdiskNBDConfig
- type VdiskStaticConfig
- type VdiskTlogConfig
- type VdiskType
- func (vdiskType VdiskType) MarshalYAML() (interface{}, error)
- func (vdiskType *VdiskType) SetString(s string) error
- func (vdiskType VdiskType) StorageType() StorageType
- func (vdiskType VdiskType) String() string
- func (vdiskType VdiskType) TemplateSupport() bool
- func (vdiskType VdiskType) TlogSupport() bool
- func (vdiskType *VdiskType) UnmarshalYAML(unmarshal func(interface{}) error) (err error)
- func (vdiskType VdiskType) Validate() error
- type ZeroStorClusterConfig
Constants ¶
const ( VdiskTypeBoot = propDeduped | propPersistent | propTlogSupport | propTemplateSupport VdiskTypeDB = propPersistent | propTlogSupport | propTemplateSupport VdiskTypeCache = propPersistent VdiskTypeTmp = propTemporary )
valid vdisk types based on /docs/README.md#zero-os-0-disk
const ( KeyVdiskStaticStr = "VdiskStatic" KeyVdiskNBDStr = "VdiskNBD" KeyVdiskTlogStr = "VdiskTlog" KeyClusterStorageStr = "ClusterStorage" KeyClusterTlogStr = "ClusterTlog" KeyNBDServerVdisksStr = "NBDServerVdisks" )
KeyType string representations
Variables ¶
var ( // ErrNilSource is returned from any config API // function which received a nil source as its parameter. ErrNilSource = errors.New("no config source given") // ErrContextDone is returned from any config watch function // where the context is already finished, // while the watch function is still being created. ErrContextDone = errors.New("context is already done") )
var ( // ErrNilResource is returned when for a given config function // a nil resource was given by the user. ErrNilResource = errors.New("invalid nil resource given") // ErrNilID is returned when for a given config function // a nil string was given as the id. ErrNilID = errors.New("nil ID given") )
var ( // is unavailable due to any kind of critical failure. ErrSourceUnavailable = errors.New("config: source is unavailable") // could not be found in the given source. ErrConfigUnavailable = errors.New("config is not available in source") // ErrInvalidKey is returned when a config is requested using // a config key which is either invalid or not supported by // the given source. ErrInvalidKey = errors.New("config key is invalid or not supported") )
Functions ¶
func IsServiceAddress ¶
IsServiceAddress checks if a string is a valid service address, which means it's either a unix address or a dial string.
func ReadConfig ¶
ReadConfig returns the requested config as a byte slice from the given source.
func ValidateBlockSize ¶
ValidateBlockSize allows you to validate a block size, returning true if the given block size is valid.
func ValidateNBDServerConfigs ¶
ValidateNBDServerConfigs validates all available NBD Vdisk Configurations, for a given NBD server config, using a given config source.
func ValidateTlogServerConfigs ¶
ValidateTlogServerConfigs validates all available Tlog Vdisk Configurations, for a given Tlog server config, using a given config source.
func WatchNBDStorageConfig ¶
func WatchNBDStorageConfig(ctx context.Context, source Source, vdiskID string) (<-chan NBDStorageConfig, error)
WatchNBDStorageConfig watches a given source for NBDStorageConfig updates. Sends the initial config to the channel when created, as well as any future updated versions of that config, for as long as the given context allows it.
func WatchNBDVdisksConfig ¶
func WatchNBDVdisksConfig(ctx context.Context, source Source, serverID string) (<-chan NBDVdisksConfig, error)
WatchNBDVdisksConfig watches a given source for NBDVdisksConfig updates. Sends the initial config to the channel when created, as well as any future updated versions of that config, for as long as the given context allows it. An error is returned in case the watcher couldn't be started.
func WatchStorageClusterConfig ¶
func WatchStorageClusterConfig(ctx context.Context, source Source, clusterID string) (<-chan StorageClusterConfig, error)
WatchStorageClusterConfig watches a given source for StorageClusterConfig updates. Sends the initial config to the channel when created, as well as any future updated versions of that config, for as long as the given context allows it. An error is returned in case the watcher couldn't be started.
func WatchTlogClusterConfig ¶
func WatchTlogClusterConfig(ctx context.Context, source Source, clusterID string) (<-chan TlogClusterConfig, error)
WatchTlogClusterConfig watches a given source for TlogClusterConfig updates. Sends the initial config to the channel when created, as well as any future updated versions of that config, for as long as the given context allows it. An error is returned in case the watcher couldn't be started.
func WatchTlogStorageConfig ¶
func WatchTlogStorageConfig(ctx context.Context, source Source, vdiskID string) (<-chan TlogStorageConfig, error)
WatchTlogStorageConfig watches a given source for TlogStorageConfig updates. Sends the initial config to the channel when created, as well as any future updated versions of that config, for as long as the given context allows it.
func WatchVdiskNBDConfig ¶
func WatchVdiskNBDConfig(ctx context.Context, source Source, vdiskID string) (<-chan VdiskNBDConfig, error)
WatchVdiskNBDConfig watches a given source for VdiskNBDConfig updates. Sends the initial config to the channel when created, as well as any future updated versions of that config, for as long as the given context allows it. An error is returned in case the watcher couldn't be started.
func WatchVdiskTlogConfig ¶
func WatchVdiskTlogConfig(ctx context.Context, source Source, vdiskID string) (<-chan VdiskTlogConfig, error)
WatchVdiskTlogConfig watches a given source for VdiskTlogConfig updates. Sends the initial config to the channel when created, as well as any future updated versions of that config, for as long as the given context allows it. An error is returned in case the watcher couldn't be started.
func WatchZeroStorClusterConfig ¶
func WatchZeroStorClusterConfig(ctx context.Context, source Source, clusterID string) (<-chan ZeroStorClusterConfig, error)
WatchZeroStorClusterConfig watches a given source for ZeroStorClusterConfig updates. Sends the initial config to the channel when created, as well as any future updated versions of that config, for as long as the given context allows it. An error is returned in case the watcher couldn't be started.
Types ¶
type FileFormatCompleteConfig ¶
type FileFormatCompleteConfig struct { Vdisks map[string]FileFormatVdiskConfig `yaml:"vdisks" valid:"required"` StorageClusters map[string]StorageClusterConfig `yaml:"storageClusters" valid:"required"` TlogClusters map[string]TlogClusterConfig `yaml:"tlogClusters" valid:"optional"` ZeroStorClusters map[string]ZeroStorClusterConfig `yaml:"zeroStorClusters" valid:"optional"` }
FileFormatCompleteConfig is the YAML format struct used for a zerodisk config file.
func (*FileFormatCompleteConfig) NBDVdisksConfig ¶
func (cfg *FileFormatCompleteConfig) NBDVdisksConfig() (*NBDVdisksConfig, error)
NBDVdisksConfig returns the NBD Vdisks configuration embedded in the YAML zerodisk config file.
func (*FileFormatCompleteConfig) StorageClusterConfig ¶
func (cfg *FileFormatCompleteConfig) StorageClusterConfig(id string) (*StorageClusterConfig, error)
StorageClusterConfig returns the StorageCluster configuration embedded in the YAML zerodisk config file.
func (*FileFormatCompleteConfig) TlogClusterConfig ¶
func (cfg *FileFormatCompleteConfig) TlogClusterConfig(id string) (*TlogClusterConfig, error)
TlogClusterConfig returns the TlogCluster configuration embedded in the YAML zerodisk config file.
func (*FileFormatCompleteConfig) VdiskConfig ¶
func (cfg *FileFormatCompleteConfig) VdiskConfig(id string) (*FileFormatVdiskConfig, error)
VdiskConfig returns the full vdisk configuration embedded in the YAML zerodisk config file.
func (*FileFormatCompleteConfig) ZeroStorClusterConfig ¶
func (cfg *FileFormatCompleteConfig) ZeroStorClusterConfig(id string) (*ZeroStorClusterConfig, error)
ZeroStorClusterConfig returns ZeroStorCluster configuration embedded in the YAML zerodisk config file
type FileFormatVdiskConfig ¶
type FileFormatVdiskConfig struct { BlockSize uint64 `yaml:"blockSize" valid:"required"` ReadOnly bool `yaml:"readOnly" valid:"optional"` Size uint64 `yaml:"size" valid:"required"` VdiskType VdiskType `yaml:"type" valid:"required"` TemplateVdiskID string `yaml:"vdiskTemplateID" valid:"required"` NBD *VdiskNBDConfig `yaml:"nbd" valid:"optional"` Tlog *VdiskTlogConfig `yaml:"tlog" valid:"optional"` }
FileFormatVdiskConfig is the YAML format struct used for all vdisk file-originated configurations.
func (*FileFormatVdiskConfig) NBDConfig ¶
func (cfg *FileFormatVdiskConfig) NBDConfig() (*VdiskNBDConfig, error)
NBDConfig returns the vdisk's NBD configuration embedded in the vdisk config file format.
func (*FileFormatVdiskConfig) StaticConfig ¶
func (cfg *FileFormatVdiskConfig) StaticConfig() (*VdiskStaticConfig, error)
StaticConfig returns the vdisk's Static configuration embedded in the vdisk config file format.
func (*FileFormatVdiskConfig) TlogConfig ¶
func (cfg *FileFormatVdiskConfig) TlogConfig() (*VdiskTlogConfig, error)
TlogConfig returns the vdisk's Tlog configuration embedded in the vdisk config file format.
type FormatValidator ¶
type FormatValidator interface { // Validate the parsed format, // such that deserialized content is only used if valid. Validate() error }
FormatValidator defines the validator interface of each format struct. All Content is serialized in the YAML 1.2 format.
type IYOCredentials ¶
type IYOCredentials struct { Org string `yaml:"org" valid:"required"` Namespace string `yaml:"namespace" valid:"required"` ClientID string `yaml:"clientID" valid:"required"` Secret string `yaml:"secret" valid:"required"` }
IYOCredentials represents Itsyou.online credentials needed for 0-Stor namespacing More information about the namespacing of the 0-Stor: https://github.com/zero-os/0-stor/blob/master/specs/concept.md#namespaces-concept
type InvalidConfigError ¶
type InvalidConfigError struct {
// contains filtered or unexported fields
}
InvalidConfigError is returned when a config read from a source is invalid, because its an illegal config or because it is not acceptable for the current vdisk usage.
func NewInvalidConfigError ¶
func NewInvalidConfigError(err error) *InvalidConfigError
NewInvalidConfigError creates a new InvalidConfigError from a given error
func (*InvalidConfigError) Error ¶
func (err *InvalidConfigError) Error() string
Error implements Error.Error
type KeyType ¶
type KeyType uint8
KeyType defines the type of a key, which together with the ID makes it unique.
type NBDStorageConfig ¶
type NBDStorageConfig struct { StorageCluster StorageClusterConfig TemplateStorageCluster *StorageClusterConfig SlaveStorageCluster *StorageClusterConfig }
NBDStorageConfig contains all information needed to store and use the (meta)data of a vdisk.
func ReadNBDStorageConfig ¶
func ReadNBDStorageConfig(source Source, vdiskID string, staticConfig *VdiskStaticConfig) (*NBDStorageConfig, error)
ReadNBDStorageConfig reads, validates and returns the requested NBDStorageConfig from a given source, or returns an error in case something went wrong along the way. The NBDStorageConfig is composed out of several subconfigs, and thus reading this Config might require multiple roundtrips.
func (*NBDStorageConfig) Clone ¶
func (cfg *NBDStorageConfig) Clone() NBDStorageConfig
Clone this config
func (*NBDStorageConfig) Validate ¶
func (cfg *NBDStorageConfig) Validate(storageType StorageType) error
Validate all properties of this config, using the Storage Type information for the optional properties.
func (*NBDStorageConfig) ValidateOptional ¶
func (cfg *NBDStorageConfig) ValidateOptional(storageType StorageType) error
ValidateOptional validates the optional properties of this config, using the Storage Type information.
type NBDVdisksConfig ¶
type NBDVdisksConfig struct {
Vdisks []string `yaml:"vdisks" valid:"required"`
}
NBDVdisksConfig contains a list of all Vdisks exposed by a given NBD Server.
func NewNBDVdisksConfig ¶
func NewNBDVdisksConfig(data []byte) (*NBDVdisksConfig, error)
NewNBDVdisksConfig creates a new NBDVdisksConfig from a given YAML slice.
func ReadNBDVdisksConfig ¶
func ReadNBDVdisksConfig(source Source, serverID string) (*NBDVdisksConfig, error)
ReadNBDVdisksConfig returns the requested NBDVdisksConfig from a given config source.
func (*NBDVdisksConfig) Validate ¶
func (cfg *NBDVdisksConfig) Validate() error
Validate implements FormatValidator.Validate.
type ServerConfig ¶
type ServerConfig struct {
Address string `yaml:"address" valid:"serviceaddress,required"`
}
ServerConfig represents a generic server config with only a service address.
type Source ¶
type Source interface { // Get a content value as a YAML byte slice, // using a given Key. Get(key Key) ([]byte, error) // Watch a content value based on its Key // and receive its value each time it is updated, // using a returned channel. Watch(ctx context.Context, key Key) (<-chan []byte, error) // MarkInvalidKey marks an invalid key, // in the hope that it can be fixed in the source, // and it becomes a valid key soon. // Optionally a vdiskID can be given, // in case the invalid state is related to // it being used for a specific vdisk. MarkInvalidKey(key Key, vdiskID string) // SourceConfig returns this source configuration. // For etcd this means a comma seperated list of its etcd cluster addresses. SourceConfig() interface{} // returns the type of this source Type() string }
Source defines a minimalistic API used to fetch configs either once, or watching a channel for updates.
type SourceCloser ¶
SourceCloser defines a Source which can and has to be closed by the user.
func ETCDV3Source ¶
func ETCDV3Source(endpoints []string) (SourceCloser, error)
ETCDV3Source creates a config source, where the configurations originate from an ETCD v3 cluster.
func FileSource ¶
func FileSource(path string) (SourceCloser, error)
FileSource creates a config source, where the configurations originate from a file on the local file system. WARNING: this is only to be used for development and testing purposes, it is by no means intended for production.
func NewSource ¶
func NewSource(config SourceConfig) (SourceCloser, error)
NewSource creates a new Source based on the given configuration. Make sure to close the returned Source to avoid any leaks.
type SourceConfig ¶
type SourceConfig struct { // The resource used to identify the specific config origins. // Type = file -> Resource defines file path. // Type = etcd -> Resource defines etcd endpoints. Resource interface{} // Defines the type of source to be read from, // and thus also what type of Resource this is. SourceType SourceType }
SourceConfig is the configuration used to create a source based on a given type and resource.
func NewSourceConfig ¶
func NewSourceConfig(data string) (SourceConfig, error)
NewSourceConfig creates a new source config by implicitly infering the source type based on the given data, and based on it use the data as the config's resource.
func (*SourceConfig) Set ¶
func (cfg *SourceConfig) Set(value string) (err error)
Set implements flag.Value.Set
func (*SourceConfig) String ¶
func (cfg *SourceConfig) String() string
String implements Stringer.String
func (*SourceConfig) Validate ¶
func (cfg *SourceConfig) Validate() error
Validate this SourceConfig struct.
type SourceType ¶
type SourceType uint8
SourceType specifies the type of config source to retrieve the configuration from.
const ( // FileSourceType defines the file config resource // This is the default config resource, // as the file config is the only config resource with // a valid default resource. FileSourceType SourceType = 0 // ETCDSourceType defines the etcd config resource ETCDSourceType SourceType = 1 )
func (*SourceType) Set ¶
func (st *SourceType) Set(str string) error
Set allows you to set this Config Source Type using a raw string. Options: {etcd, file}
func (SourceType) String ¶
func (st SourceType) String() string
String returns the name of the Config Source Type
func (*SourceType) Type ¶
func (st *SourceType) Type() string
Type returns the flag type for a SourceType.
type StorageClusterConfig ¶
type StorageClusterConfig struct { DataStorage []StorageServerConfig `yaml:"dataStorage" valid:"required"` MetadataStorage *StorageServerConfig `yaml:"metadataStorage" valid:"optional"` }
StorageClusterConfig defines the config for a storageCluster. A storage cluster is composed out of multiple data storage servers, and a single (optional) metadata storage.
func NewStorageClusterConfig ¶
func NewStorageClusterConfig(data []byte) (*StorageClusterConfig, error)
NewStorageClusterConfig creates a new StorageClusterConfig from a given YAML slice.
func ReadStorageClusterConfig ¶
func ReadStorageClusterConfig(source Source, clusterID string) (*StorageClusterConfig, error)
ReadStorageClusterConfig returns the requested StorageClusterConfig from a given config source.
func (*StorageClusterConfig) Clone ¶
func (cfg *StorageClusterConfig) Clone() StorageClusterConfig
Clone implements Cloner.Clone
func (*StorageClusterConfig) Equal ¶
func (cfg *StorageClusterConfig) Equal(other *StorageClusterConfig) bool
Equal checks if the 2 configs are equal. Note that the order of data storage servers matters, as this order defines where vdisk's data will end up being.
func (*StorageClusterConfig) Validate ¶
func (cfg *StorageClusterConfig) Validate() error
Validate implements FormatValidator.Validate.
func (*StorageClusterConfig) ValidateStorageType ¶
func (cfg *StorageClusterConfig) ValidateStorageType(t StorageType) error
ValidateStorageType is an extra validation method, allowing you to check if this cluster is valid for a certain storage type.
type StorageServerConfig ¶
type StorageServerConfig struct { Address string `yaml:"address" valid:"dialstring,required"` // Database '0' is assumed, in case no value is given. 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. The parsing algorithm of this function is very forgiving, and returns an error only in case an invalid address is given.
func ParseStorageServerConfigString ¶
func ParseStorageServerConfigString(dialConfigString string) (config StorageServerConfig, err error)
ParseStorageServerConfigString allows you to parse a raw dial config string. Dial Config String 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>]`, where the db_index is optional. The parsing algorithm of this function is very forgiving, and returns an error only in case an invalid address is given.
func (*StorageServerConfig) Equal ¶
func (cfg *StorageServerConfig) Equal(other *StorageServerConfig) bool
Equal checks if the 2 configs are equal. Note that the order of data storage servers matters, as this order defines where vdisk's data will end up being.
type StorageType ¶
type StorageType uint8
StorageType represents the type of storage of a vdisk
const ( StorageNil StorageType = 0 StorageDeduped StorageType = 1 << iota StorageNonDeduped // StorageSemiDeduped is not used for now StorageSemiDeduped )
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 StubSource ¶
type StubSource struct {
// contains filtered or unexported fields
}
StubSource is a modified file source using an internal stored config in memory used for testing purposes only.
func NewStubSource ¶
func NewStubSource() *StubSource
NewStubSource create a new stub source, for testing purposes
func (*StubSource) InvalidKey ¶
func (s *StubSource) InvalidKey() <-chan Key
InvalidKey can be used to get a channel to wait for an incoming ivnalid key.
func (*StubSource) MarkInvalidKey ¶
func (s *StubSource) MarkInvalidKey(key Key, vdiskID string)
MarkInvalidKey implements Source.MarkInvalidKey
func (*StubSource) SetPrimaryStorageCluster ¶
func (s *StubSource) SetPrimaryStorageCluster(vdiskID, clusterID string, cfg *StorageClusterConfig)
SetPrimaryStorageCluster is a utility function to set a primary storage cluster config, thread-safe.
func (*StubSource) SetSlaveStorageCluster ¶
func (s *StubSource) SetSlaveStorageCluster(vdiskID, clusterID string, cfg *StorageClusterConfig)
SetSlaveStorageCluster is a utility function to set a tlog storage cluster config, thread-safe.
func (*StubSource) SetStorageCluster ¶
func (s *StubSource) SetStorageCluster(clusterID string, cfg *StorageClusterConfig)
SetStorageCluster is a utility function to set a storage cluster config, thread-safe.
func (*StubSource) SetTemplateStorageCluster ¶
func (s *StubSource) SetTemplateStorageCluster(vdiskID, clusterID string, cfg *StorageClusterConfig)
SetTemplateStorageCluster is a utility function to set a template storage cluster config, thread-safe.
func (*StubSource) SetTlogCluster ¶
func (s *StubSource) SetTlogCluster(clusterID string, cfg *TlogClusterConfig)
SetTlogCluster is a utility function to set a tlog cluster config, thread-safe.
func (*StubSource) SetTlogServerCluster ¶
func (s *StubSource) SetTlogServerCluster(vdiskID, clusterID string, cfg *TlogClusterConfig)
SetTlogServerCluster is a utility function to set a tlog server cluster config, thread-safe.
func (*StubSource) SetTlogZeroStorCluster ¶
func (s *StubSource) SetTlogZeroStorCluster(vdiskID, clusterID string, cfg *ZeroStorClusterConfig)
SetTlogZeroStorCluster is a utility function to set a tlog storage zerostor config, thread-safe.
func (*StubSource) SetVdiskConfig ¶
func (s *StubSource) SetVdiskConfig(vdiskID string, cfg *VdiskStaticConfig)
SetVdiskConfig is a utility function to set a vdisk config, thread-safe.
func (*StubSource) SetZeroStorCluster ¶
func (s *StubSource) SetZeroStorCluster(clusterID string, cfg *ZeroStorClusterConfig)
SetZeroStorCluster is a utility function to set a 0-stor cluster config, thread-safe.
func (*StubSource) SourceConfig ¶
func (s *StubSource) SourceConfig() interface{}
SourceConfig implements Source.SourceConfig
type TlogClusterConfig ¶
type TlogClusterConfig struct {
Servers []string `yaml:"servers" valid:"required"`
}
TlogClusterConfig defines the config for a Tlog Server Custer. A Tlog Server cluster is composed out of one or more Tlog servers.
func NewTlogClusterConfig ¶
func NewTlogClusterConfig(data []byte) (*TlogClusterConfig, error)
NewTlogClusterConfig creates a new TlogClusterConfig from a given YAML slice.
func ReadTlogClusterConfig ¶
func ReadTlogClusterConfig(source Source, clusterID string) (*TlogClusterConfig, error)
ReadTlogClusterConfig returns the requested TlogClusterConfig from a given config source.
func (*TlogClusterConfig) Clone ¶
func (cfg *TlogClusterConfig) Clone() TlogClusterConfig
Clone implements Cloner.Clone
func (*TlogClusterConfig) Validate ¶
func (cfg *TlogClusterConfig) Validate() error
Validate implements FormatValidator.Validate.
type TlogStorageConfig ¶
type TlogStorageConfig struct { ZeroStorCluster ZeroStorClusterConfig SlaveStorageCluster *StorageClusterConfig }
TlogStorageConfig contains all information needed to store tlogserver-related (meta)data.
func ReadTlogStorageConfig ¶
func ReadTlogStorageConfig(source Source, vdiskID string, staticConfig *VdiskStaticConfig) (*TlogStorageConfig, error)
ReadTlogStorageConfig reads, validates and returns the requested TlogStorageConfig from a given source, or returns an error in case something went wrong along the way. The TlogStorageConfig is composed out of several subconfigs, and thus reading this Config might require multiple roundtrips.
func (*TlogStorageConfig) Validate ¶
func (cfg *TlogStorageConfig) Validate(storageType StorageType) error
Validate the required properties of this config, using the VdiskType information.
func (*TlogStorageConfig) ValidateOptional ¶
func (cfg *TlogStorageConfig) ValidateOptional(storageType StorageType) error
ValidateOptional validates the optional properties of this config, using the Storage Type information.
type VdiskNBDConfig ¶
type VdiskNBDConfig struct { StorageClusterID string `yaml:"storageClusterID" valid:"required"` TemplateStorageClusterID string `yaml:"templateStorageClusterID" valid:"optional"` SlaveStorageClusterID string `yaml:"slaveStorageClusterID" valid:"optional"` TlogServerClusterID string `yaml:"tlogServerClusterID" valid:"optional"` }
VdiskNBDConfig represents the nbdserver-related information for a vdisk.
func NewVdiskNBDConfig ¶
func NewVdiskNBDConfig(data []byte) (*VdiskNBDConfig, error)
NewVdiskNBDConfig creates a new VdiskNBDConfig from a given YAML slice.
func ReadVdiskNBDConfig ¶
func ReadVdiskNBDConfig(source Source, vdiskID string) (*VdiskNBDConfig, error)
ReadVdiskNBDConfig returns the requested VdiskNBDConfig from a given config source.
func (*VdiskNBDConfig) Validate ¶
func (cfg *VdiskNBDConfig) Validate() error
Validate implements FormatValidator.Validate.
type VdiskStaticConfig ¶
type VdiskStaticConfig struct { BlockSize uint64 `yaml:"blockSize" valid:"required"` ReadOnly bool `yaml:"readOnly" valid:"optional"` Size uint64 `yaml:"size" valid:"required"` Type VdiskType `yaml:"type" valid:"required"` TemplateVdiskID string `yaml:"templateVdiskID" valid:"optional"` }
VdiskStaticConfig represents the static info of a vdisk.
func NewVdiskStaticConfig ¶
func NewVdiskStaticConfig(data []byte) (*VdiskStaticConfig, error)
NewVdiskStaticConfig creates a new VdiskStaticConfig from a given YAML slice.
func ReadVdiskStaticConfig ¶
func ReadVdiskStaticConfig(source Source, vdiskID string) (*VdiskStaticConfig, error)
ReadVdiskStaticConfig returns the requested VdiskStaticConfig from a given config source.
func (*VdiskStaticConfig) Validate ¶
func (cfg *VdiskStaticConfig) Validate() error
Validate implements FormatValidator.Validate.
type VdiskTlogConfig ¶
type VdiskTlogConfig struct { ZeroStorClusterID string `yaml:"zeroStorClusterID" valid:"required"` SlaveStorageClusterID string `yaml:"slaveStorageClusterID" valid:"optional"` }
VdiskTlogConfig represents the tlogserver-related information for a vdisk.
func NewVdiskTlogConfig ¶
func NewVdiskTlogConfig(data []byte) (*VdiskTlogConfig, error)
NewVdiskTlogConfig creates a new VdiskTlogConfig from a given YAML slice.
func ReadVdiskTlogConfig ¶
func ReadVdiskTlogConfig(source Source, vdiskID string) (*VdiskTlogConfig, error)
ReadVdiskTlogConfig returns the requested VdiskTlogConfig from a given config source.
func (*VdiskTlogConfig) Validate ¶
func (cfg *VdiskTlogConfig) Validate() error
Validate implements FormatValidator.Validate.
type VdiskType ¶
type VdiskType uint8
VdiskType represents the type of a vdisk, and each valid bit defines a property of the vdisk, and its the different collections of valid bits that defines each valid and unique type.
func (VdiskType) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler.MarshalYAML
func (*VdiskType) SetString ¶
SetString allows you to set this VdiskType using the correct string representation
func (VdiskType) StorageType ¶
func (vdiskType VdiskType) StorageType() StorageType
StorageType returns the type of storage this vdisk uses
func (VdiskType) TemplateSupport ¶
TemplateSupport returns whether or not this vdisk supports a template server, to get the data in case the data isn't available on the normal (local) storage cluster.
func (VdiskType) TlogSupport ¶
TlogSupport returns whether or not the data of this vdisk has to send to the tlog server, to log its transactions.
func (*VdiskType) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler.UnmarshalYAML
type ZeroStorClusterConfig ¶
type ZeroStorClusterConfig struct { IYO IYOCredentials `yaml:"iyo" valid:"required"` Servers []ServerConfig `yaml:"servers" valid:"required"` MetadataServers []ServerConfig `yaml:"metadataServers" valid:"required"` }
ZeroStorClusterConfig defines the config for a ZeroStor server cluster
func NewZeroStorClusterConfig ¶
func NewZeroStorClusterConfig(data []byte) (*ZeroStorClusterConfig, error)
NewZeroStorClusterConfig creates a new ZeroStorClusterConfig from a given YAML slice.
func ReadZeroStoreClusterConfig ¶
func ReadZeroStoreClusterConfig(source Source, clusterID string) (*ZeroStorClusterConfig, error)
ReadZeroStoreClusterConfig returns requested ZeroStorClusterConfig from a given config source
func (*ZeroStorClusterConfig) Clone ¶
func (cfg *ZeroStorClusterConfig) Clone() ZeroStorClusterConfig
Clone implements Cloner.Clone
func (*ZeroStorClusterConfig) Equal ¶
func (cfg *ZeroStorClusterConfig) Equal(other *ZeroStorClusterConfig) bool
Equal checks if the 2 configs are equal.
func (*ZeroStorClusterConfig) Validate ¶
func (cfg *ZeroStorClusterConfig) Validate() error
Validate implements FormatValidator.Validate.