Versions in this module Expand all Collapse all v1 v1.0.0 Jan 28, 2024 Changes in this version + const BackupDirName + const ComponentGrafana + const ComponentOpenGemini + const ComponentTSMeta + const ComponentTSMonitor + const ComponentTSServer + const ComponentTSSql + const ComponentTSStore + const OpenGeminiClusterDir + const OpenGeminiPackageCacheDir + const TempConfigPath + var ErrCreateDirFailed = errNS.NewType("create_dir_failed") + var ErrSaveMetaFailed = errNS.NewType("save_meta_failed") + var ErrSaveScaleOutFileFailed = errNS.NewType("save_scale-out_lock_failed") + var ErrTopologyParseFailed = errNSTopolohy.NewType("parse_failed", utils.ErrTraitPreCheck) + var ErrTopologyReadFailed = errNSTopolohy.NewType("read_failed", utils.ErrTraitPreCheck) + var ErrUserOrGroupInvalid = errors.New(...) + var ErrorCheckConfig = errors.New("check config failed") + var RoleMonitor = "monitor" + func Abs(user, path string) string + func AllComponentNames() (roles []string) + func CheckClusterDirConflict(clusterList map[string]Metadata, clusterName string, topo Topology) error + func CheckClusterDirOverlap(entries []DirEntry) error + func CheckClusterPortConflict(clusterList map[string]Metadata, clusterName string, topo Topology) error + func ClusterPath(cluster string, subpath ...string) string + func ExpandRelativeDir(topo Topology) + func FillHostArchOrOS(s *Specification, hostArchOrOS map[string]string, fullType FullHostType) error + func FlattenMap(ms map[string]any) map[string]any + func FoldMap(ms map[string]any) map[string]any + func GetValueFromPath(m map[string]any, p string) any + func Initialize(base string) error + func IterHost(topo Topology, fn func(instance Instance)) + func Merge2Toml(comp string, global, overwrite map[string]any) ([]byte, error) + func MergeConfig(orig map[string]any, overwrites ...map[string]any) map[string]any + func MergeResourceControl(lhs, rhs meta.ResourceControl) meta.ResourceControl + func PackageGrafanaPath(comp string, version string, os string, arch string) string + func PackagePath(comp string, version string, os string, arch string) string + func ParseTopologyYaml(file string, out Topology, ignoreGlobal ...bool) error + func PortStarted(ctx context.Context, e ctxt.Executor, port int, timeout uint64) error + func PortStopped(ctx context.Context, e ctxt.Executor, port int, timeout uint64) error + func ProfileDir() string + func ProfilePath(subpath ...string) string + func ReadYamlFile(file string) ([]byte, error) + func RelativePathDetect(topo any, isSkipField func(reflect.Value) bool) error + func SetValueFromGlobal(topo *Specification) + func UptimeByHost(host string, port int, timeout time.Duration, tlsCfg *tls.Config) time.Duration + type BaseInstance struct + Dirs []string + Host string + ListenHost string + ManageHost string + Name string + Port int + Ports []int + SSHP int + Source string + StatusFn func(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, ...) string + UptimeFn func(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config) time.Duration + func (i *BaseInstance) Arch() string + func (i *BaseInstance) ComponentName() string + func (i *BaseInstance) ComponentSource() string + func (i *BaseInstance) DataDir() string + func (i *BaseInstance) DeployDir() string + func (i *BaseInstance) GetHost() string + func (i *BaseInstance) GetListenHost() string + func (i *BaseInstance) GetManageHost() string + func (i *BaseInstance) GetPort() int + func (i *BaseInstance) GetSSHPort() int + func (i *BaseInstance) ID() string + func (i *BaseInstance) InitConfig(ctx context.Context, e ctxt.Executor, opt GlobalOptions, user string, ...) (err error) + func (i *BaseInstance) InstanceName() string + func (i *BaseInstance) IsPatched() bool + func (i *BaseInstance) IteratorLocalConfigDir(ctx context.Context, local string, filter func(string) bool, ...) error + func (i *BaseInstance) LogDir() string + func (i *BaseInstance) MergeServerConfig(ctx context.Context, e ctxt.Executor, globalConf, instanceConf map[string]any, ...) error + func (i *BaseInstance) OS() string + func (i *BaseInstance) PrepareStart(ctx context.Context, tlsCfg *tls.Config) error + func (i *BaseInstance) Ready(ctx context.Context, e ctxt.Executor, timeout uint64, _ *tls.Config) error + func (i *BaseInstance) ResourceControl() meta.ResourceControl + func (i *BaseInstance) ServiceName() string + func (i *BaseInstance) SetPatched(p bool) + func (i *BaseInstance) Status(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, ...) string + func (i *BaseInstance) TLSDir() string + func (i *BaseInstance) TransferLocalConfigDir(ctx context.Context, e ctxt.Executor, local, remote string, ...) error + func (i *BaseInstance) TransferLocalConfigFile(ctx context.Context, e ctxt.Executor, local, remote string) error + func (i *BaseInstance) Uptime(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config) time.Duration + func (i *BaseInstance) UsedDirs() []string + func (i *BaseInstance) UsedPorts() []int + type BaseMeta struct + Group string + User string + Version string + type BaseTopo struct + GlobalOptions *GlobalOptions + GrafanaVersion *string + Grafanas []*GrafanaSpec + MasterList []string + MonitoredOptions *TSMonitoredOptions + Monitors []*TSServerSpec + type BindVersion func(comp string, version string) (bindVersion string) + type ClusterMeta struct + Topology *Specification + User string + Version string + func (m *ClusterMeta) GetBaseMeta() *BaseMeta + func (m *ClusterMeta) GetTopology() Topology + func (m *ClusterMeta) SetTopology(topo Topology) + func (m *ClusterMeta) SetUser(s string) + func (m *ClusterMeta) SetVersion(s string) + type Component interface + Instances func() []Instance + Name func() string + Role func() string + type DirAccessor struct + type DirEntry struct + type FullHostType string + const FullArchType + const FullOSType + type GlobalOptions struct + Arch string + DataDir string + DeployDir string + Group string + ListenHost string + LogDir string + OS string + ResourceControl meta.ResourceControl + SSHPort int + TLSEnabled bool + User string + type GrafanaComponent struct + func (c *GrafanaComponent) Instances() []Instance + func (c *GrafanaComponent) Name() string + func (c *GrafanaComponent) Role() string + type GrafanaInstance struct + func (i *GrafanaInstance) InitConfig(ctx context.Context, e ctxt.Executor, ...) error + func (i *GrafanaInstance) ScaleConfig(ctx context.Context, e ctxt.Executor, topo Topology, clusterName string, ...) error + type GrafanaSpec struct + AnonymousEnable bool + Arch string + Config map[string]string + DashboardDir string + DefaultTheme string + DeployDir string + Domain string + Host string + ManageHost string + OS string + OrgName string + OrgRole string + Password string + Port int + ResourceControl meta.ResourceControl + RootURL string + SSHPort int + Username string + func (s *GrafanaSpec) GetMainPort() int + func (s *GrafanaSpec) GetManageHost() string + func (s *GrafanaSpec) Role() string + func (s *GrafanaSpec) SSH() (string, int) + type Instance interface + Arch func() string + ComponentName func() string + ComponentSource func() string + DataDir func() string + DeployDir func() string + GetHost func() string + GetManageHost func() string + GetPort func() int + GetSSHPort func() int + ID func() string + InitConfig func(ctx context.Context, e ctxt.Executor, clusterName string, ...) error + InstanceName func() string + LogDir func() string + OS func() string + PrepareStart func(ctx context.Context, tlsCfg *tls.Config) error + Ready func(context.Context, ctxt.Executor, uint64, *tls.Config) error + ServiceName func() string + Status func(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, ...) string + Uptime func(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config) time.Duration + UsedDirs func() []string + UsedPorts func() []int + type InstanceSpec interface + Role func() string + SSH func() (string, int) + type Metadata interface + GetBaseMeta func() *BaseMeta + GetTopology func() Topology + SetTopology func(topo Topology) + type MonitorHostInfo struct + Arch string + DataPath string + ErrorLogPath string + MetricPath string + MonitorAddr string + Os string + ProcessName set.StringSet + Ssh int + WALPath string + type ServerConfigs struct + Grafana map[string]string + TsMeta map[string]any + TsMonitor map[string]any + TsSql map[string]any + TsStore map[string]any + type SpecManager struct + func GetSpecManager() *SpecManager + func NewSpec(base string, newMeta func() *ClusterMeta) *SpecManager + func (s *SpecManager) Exist(clusterName string) (exist bool, err error) + func (s *SpecManager) GetAllClusters() (map[string]Metadata, error) + func (s *SpecManager) List() (clusterNames []string, err error) + func (s *SpecManager) Metadata(clusterName string, meta any) error + func (s *SpecManager) NewMetadata() *ClusterMeta + func (s *SpecManager) Path(cluster string, subpath ...string) string + func (s *SpecManager) Remove(clusterName string) error + func (s *SpecManager) SaveMeta(clusterName string, meta *ClusterMeta) error + type Specification struct + GlobalOptions GlobalOptions + Grafanas []*GrafanaSpec + MonitoredOptions TSMonitoredOptions + Monitors []*TSServerSpec + ServerConfigs ServerConfigs + TSMetaServers []*TSMetaSpec + TSSqlServers []*TSSqlSpec + TSStoreServers []*TSStoreSpec + func ReadFromYaml(file string) (*Specification, error) + func (s *Specification) BaseTopo() *BaseTopo + func (s *Specification) ComponentsByStartOrder() (comps []Component) + func (s *Specification) ComponentsByStopOrder() (comps []Component) + func (s *Specification) CountDir(targetHost, dirPrefix string) int + func (s *Specification) FillHostArchOrOS(hostArchOrOS map[string]string, fullType FullHostType) error + func (s *Specification) GetGrafanaConfig() map[string]string + func (s *Specification) GetMonitoredOptions() *TSMonitoredOptions + func (s *Specification) GetTSMetaListWithManageHost() []string + func (s *Specification) GetTsMetaList() []string + func (s *Specification) IterComponent(fn func(comp Component)) + func (s *Specification) IterInstance(fn func(instance Instance), concurrency ...int) + func (s *Specification) UnmarshalYAML(unmarshal func(any) error) error + func (s *Specification) Validate() error + type TSMetaComponent struct + Topology *Specification + func (c *TSMetaComponent) Instances() []Instance + func (c *TSMetaComponent) Name() string + func (c *TSMetaComponent) Role() string + type TSMetaInstance struct + Name string + func (i *TSMetaInstance) InitConfig(ctx context.Context, e ctxt.Executor, clusterName string, ...) error + func (i *TSMetaInstance) SetDefaultConfig(instanceConf map[string]any) map[string]any + type TSMetaSpec struct + Arch string + ClientPort int + Config map[string]any + DataDir string + DeployDir string + GossipPort int + Host string + ListenHost string + LogDir string + ManageHost string + Name string + OS string + PeerPort int + RaftPort int + SSHPort int + Source string + func (s *TSMetaSpec) GetManageHost() string + func (s *TSMetaSpec) GetSource() string + func (s *TSMetaSpec) Role() string + func (s *TSMetaSpec) SSH() (string, int) + func (s *TSMetaSpec) Status(ctx context.Context, timeout time.Duration, tlsCfg *tls.Config, _ ...string) string + type TSMonitorComponent struct + Topology *Specification + func (c *TSMonitorComponent) Instances() []Instance + func (c *TSMonitorComponent) Name() string + func (c *TSMonitorComponent) Role() string + type TSMonitorInstance struct + Name string + func (i *TSMonitorInstance) InitConfig(ctx context.Context, e ctxt.Executor, clusterName string, ...) error + func (i *TSMonitorInstance) Ready(ctx context.Context, e ctxt.Executor, timeout uint64, _ *tls.Config) error + func (i *TSMonitorInstance) SetDefaultConfig(instanceConf map[string]any, clusterName string) map[string]any + type TSMonitorSpec struct + Arch string + Config map[string]any + DeployDir string + Host string + ListenHost string + LogDir string + ManageHost string + MonitorProcess map[string]struct{} + Name string + OS string + SSHPort int + Source string + func (s *TSMonitorSpec) GetManageHost() string + func (s *TSMonitorSpec) GetSource() string + func (s *TSMonitorSpec) Role() string + func (s *TSMonitorSpec) SSH() (string, int) + type TSMonitoredOptions struct + DeployDir string + LogDir string + TSMonitorEnabled bool + type TSServerComponent struct + func (c *TSServerComponent) Instances() []Instance + func (c *TSServerComponent) Name() string + func (c *TSServerComponent) Role() string + type TSServerInstance struct + func (i *TSServerInstance) InitConfig(ctx context.Context, e ctxt.Executor, clusterName string, ...) error + func (i *TSServerInstance) SetDefaultConfig(instanceConf map[string]any) map[string]any + type TSServerSpec struct + Arch string + ClientPort int + Config map[string]any + DataDir string + DeployDir string + Host string + IngestPort int + ListenHost string + LogDir string + ManageHost string + Name string + OS string + PeerPort int + Port int + RaftPort int + SSHPort int + SelectPort int + Source string + func (s *TSServerSpec) GetManageHost() string + func (s *TSServerSpec) GetSource() string + func (s *TSServerSpec) Role() string + func (s *TSServerSpec) SSH() (string, int) + type TSSqlComponent struct + Topology *Specification + func (c *TSSqlComponent) Instances() []Instance + func (c *TSSqlComponent) Name() string + func (c *TSSqlComponent) Role() string + type TSSqlInstance struct + Name string + func (i *TSSqlInstance) InitConfig(ctx context.Context, e ctxt.Executor, clusterName string, ...) error + func (i *TSSqlInstance) SetDefaultConfig(instanceConf map[string]any) map[string]any + type TSSqlSpec struct + Arch string + Config map[string]any + DeployDir string + Host string + IgnoreExporter bool + ListenHost string + LogDir string + ManageHost string + Name string + OS string + Port int + SSHPort int + Source string + func (s *TSSqlSpec) GetManageHost() string + func (s *TSSqlSpec) GetSource() string + func (s *TSSqlSpec) IgnoreMonitorAgent() bool + func (s *TSSqlSpec) Role() string + func (s *TSSqlSpec) SSH() (string, int) + type TSStoreComponent struct + Topology *Specification + func (c *TSStoreComponent) Instances() []Instance + func (c *TSStoreComponent) Name() string + func (c *TSStoreComponent) Role() string + type TSStoreInstance struct + Name string + func (i *TSStoreInstance) InitConfig(ctx context.Context, e ctxt.Executor, clusterName string, ...) error + func (i *TSStoreInstance) SetDefaultConfig(instanceConf map[string]any) map[string]any + type TSStoreSpec struct + Arch string + Config map[string]any + DataDir string + DeployDir string + GossipPort int + Host string + IngestPort int + ListenHost string + LogDir string + ManageHost string + Name string + OS string + SSHPort int + SelectPort int + Source string + func (s *TSStoreSpec) GetManageHost() string + func (s *TSStoreSpec) GetSource() string + func (s *TSStoreSpec) Role() string + func (s *TSStoreSpec) SSH() (string, int) + type Topology interface + BaseTopo func() *BaseTopo + ComponentsByStartOrder func() []Component + ComponentsByStopOrder func() []Component + CountDir func(host string, dir string) int + FillHostArchOrOS func(hostArchmap map[string]string, fullType FullHostType) error + GetGrafanaConfig func() map[string]string + GetMonitoredOptions func() *TSMonitoredOptions + IterInstance func(fn func(instance Instance), concurrency ...int) + Validate func() error