Documentation
¶
Index ¶
- Constants
- Variables
- type DirPaths
- type ResourceControl
- type SpecManager
- func (s *SpecManager) Exist(name string) (exist bool, err error)
- func (s *SpecManager) List() (names []string, err error)
- func (s *SpecManager) Metadata(clusterName string, meta interface{}) error
- func (s *SpecManager) Path(cluster string, subpath ...string) string
- func (s *SpecManager) SaveMeta(clusterName string, meta interface{}) error
- type ValidateErr
Constants ¶
const ( TypeConflict = "conflict" TypeMismatch = "mismatch" )
error types
const ( // PatchDirName is the directory to store patch file eg. {PatchDirName}/tidb-hotfix.tar.gz PatchDirName = "patch" // BackupDirName is the directory to save backup files. BackupDirName = "backup" )
Variables ¶
var ( // ErrCreateDirFailed is ErrCreateDirFailed ErrCreateDirFailed = errNS.NewType("create_dir_failed") // ErrSaveMetaFailed is ErrSaveMetaFailed ErrSaveMetaFailed = errNS.NewType("save_meta_failed") )
var ( // ErrValidate is an empty ValidateErr object, useful for type checking ErrValidate = &ValidateErr{} )
Functions ¶
This section is empty.
Types ¶
type ResourceControl ¶
type ResourceControl struct {
MemoryLimit string `yaml:"memory_limit,omitempty"`
CPUQuota string `yaml:"cpu_quota,omitempty"`
IOReadBandwidthMax string `yaml:"io_read_bandwidth_max,omitempty"`
IOWriteBandwidthMax string `yaml:"io_write_bandwidth_max,omitempty"`
}
ResourceControl is used to control the system resource See: https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html
type SpecManager ¶ added in v1.0.8
type SpecManager struct {
// contains filtered or unexported fields
}
SpecManager control management of spec meta data.
func NewSpec ¶ added in v1.0.8
func NewSpec(base string) *SpecManager
NewSpec create a spec instance.
func (*SpecManager) Exist ¶ added in v1.0.8
func (s *SpecManager) Exist(name string) (exist bool, err error)
Exist check if the cluster exist by checking the meta file.
func (*SpecManager) List ¶ added in v1.0.8
func (s *SpecManager) List() (names []string, err error)
List return the cluster names.
func (*SpecManager) Metadata ¶ added in v1.0.8
func (s *SpecManager) Metadata(clusterName string, meta interface{}) error
Metadata tries to read the metadata of a cluster from file
func (*SpecManager) Path ¶ added in v1.0.8
func (s *SpecManager) Path(cluster string, subpath ...string) string
Path returns the full path to a subpath (file or directory) of a cluster, it is a subdir in the profile dir of the user, with the cluster name as its name.
func (*SpecManager) SaveMeta ¶ added in v1.0.8
func (s *SpecManager) SaveMeta(clusterName string, meta interface{}) error
SaveMeta save the meta with specified cluster name.
type ValidateErr ¶
type ValidateErr struct {
Type string // conflict type
Target string // conflict Target
Value interface{} // conflict Value
LHS string // object 1
RHS string // object 2
}
ValidateErr is the error when meta validation fails with conflicts
func (*ValidateErr) Error ¶
func (e *ValidateErr) Error() string
Error implements the error interface
func (*ValidateErr) Is ¶
func (e *ValidateErr) Is(target error) bool
Is implements the error interface
func (*ValidateErr) Unwrap ¶
func (e *ValidateErr) Unwrap() error
Unwrap implements the error interface