Documentation ¶
Overview ¶
Copyright © 2020 Marvin
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2020 Marvin ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func CheckClusterDirOverlap(entries []DirEntry) error
- func FormatInstanceStatus(status string) string
- func GetClusterNameList(basePath string) ([]string, error)
- func IterHost(topo *cluster.Topology, fn func(inst cluster.Instance))
- func SetClusterSSH(ctx context.Context, topo *cluster.Topology, deployUser string, ...) error
- func SetSSHKeySet(ctx context.Context, privateKeyPath string, publicKeyPath string) error
- type Cluster
- type ClusterMetaInfo
- type Controller
- func (c *Controller) CheckClusterDirConflict(clusters map[string]*cluster.Metadata, clusterName string, ...) error
- func (c *Controller) CheckClusterNameConflict(clusterName string) (exist bool, err error)
- func (c *Controller) CheckClusterPortConflict(clusters map[string]*cluster.Metadata, clusterName string, ...) error
- func (c *Controller) ConfirmTopology(clusterName, clusterVersion string, topo *cluster.Topology, ...) error
- func (c *Controller) EditTopology(origTopo *cluster.Topology, data []byte, newTopoFile string, skipConfirm bool) (*cluster.Topology, error)
- func (c *Controller) FillHostArchOrOS(s, p *operator.SSHConnectionProps, topo *cluster.Topology, ...) error
- func (c *Controller) FillTopologyDir(topo *cluster.Topology)
- func (c *Controller) GetAllClusters() (map[string]*cluster.Metadata, error)
- func (c *Controller) GetClusterList() ([]Cluster, error)
- func (c *Controller) GetClusterTopology(dopt *DisplayOption, opt *operator.Options) ([]InstInfo, map[string]string, error)
- func (c *Controller) GetMetaFilePath(clusterName string) string
- func (c *Controller) InitClusterMetadataDir(clusterName string) error
- func (c *Controller) IsScaleOutLocked(clusterName string) (locked bool, err error)
- func (c *Controller) ListClusterNameAll() ([]string, error)
- func (c *Controller) Metadata(clusterName string, meta any) error
- func (c *Controller) NewMetadata() cluster.IMetadata
- func (c *Controller) NewScaleOutLock(clusterName string, topo *cluster.Topology) error
- func (c *Controller) Path(cluster string, subpath ...string) string
- func (c *Controller) ReleaseScaleOutLock(clusterName string) error
- func (c *Controller) Remove(clusterName string) error
- func (c *Controller) SaveMetadata(clusterName string, meta *cluster.Metadata) error
- func (c *Controller) ScaleOutLockedErr(clusterName string) error
- func (c *Controller) SetMetadata(metadata *cluster.Metadata)
- type DirAccessor
- type DirEntry
- type DisplayOption
- type InstInfo
- type JSONOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckClusterDirOverlap ¶
CheckClusterDirOverlap checks cluster dir overlaps with data or log. this should only be used across clusters. we don't allow to deploy log under data, and vise versa.
func FormatInstanceStatus ¶
func GetClusterNameList ¶
Types ¶
type Cluster ¶
type Cluster struct { Name string `json:"name"` User string `json:"user"` Version string `json:"version"` Path string `json:"path"` PrivateKey string `json:"private_key"` }
Cluster represents a clsuter
type ClusterMetaInfo ¶
type ClusterMetaInfo struct { ClusterType string `json:"cluster_type"` ClusterName string `json:"cluster_name"` ClusterVersion string `json:"cluster_version"` DeployUser string `json:"deploy_user"` SSHType string `json:"ssh_type"` }
ClusterMetaInfo hold the structure for the JSON output of the dashboard info
type Controller ¶
func (*Controller) CheckClusterDirConflict ¶
func (c *Controller) CheckClusterDirConflict(clusters map[string]*cluster.Metadata, clusterName string, topo *cluster.Topology) error
CheckClusterDirConflict checks cluster dir conflict or overlap
func (*Controller) CheckClusterNameConflict ¶
func (c *Controller) CheckClusterNameConflict(clusterName string) (exist bool, err error)
CheckClusterNameConflict check if the cluster exist by checking the meta file.
func (*Controller) CheckClusterPortConflict ¶
func (c *Controller) CheckClusterPortConflict(clusters map[string]*cluster.Metadata, clusterName string, topo *cluster.Topology) error
CheckClusterPortConflict check if the cluster exist by checking the meta file.
func (*Controller) ConfirmTopology ¶
func (c *Controller) ConfirmTopology(clusterName, clusterVersion string, topo *cluster.Topology, patchedRoles stringutil.StringSet) error
ConfirmTopology confirm topology
func (*Controller) EditTopology ¶
func (c *Controller) EditTopology(origTopo *cluster.Topology, data []byte, newTopoFile string, skipConfirm bool) (*cluster.Topology, error)
If the flag --topology-file is specified, the first 2 steps will be skipped. 1. Write Topology to a temporary file. 2. Open file in editor. 3. Check and update Topology. 4. Save meta file.
func (*Controller) FillHostArchOrOS ¶
func (c *Controller) FillHostArchOrOS(s, p *operator.SSHConnectionProps, topo *cluster.Topology, gOpt *operator.Options, user string, sudo bool) error
FillHostArchOrOS fill full host cpu-arch and kernel-name
func (*Controller) FillTopologyDir ¶
func (c *Controller) FillTopologyDir(topo *cluster.Topology)
FillTopologyDir fill topology dir
func (*Controller) GetAllClusters ¶
func (c *Controller) GetAllClusters() (map[string]*cluster.Metadata, error)
GetAllClusters get a metadata list of all clusters deployed by current user
func (*Controller) GetClusterList ¶
func (c *Controller) GetClusterList() ([]Cluster, error)
GetClusterList get the clusters list.
func (*Controller) GetClusterTopology ¶
func (c *Controller) GetClusterTopology(dopt *DisplayOption, opt *operator.Options) ([]InstInfo, map[string]string, error)
func (*Controller) GetMetaFilePath ¶
func (c *Controller) GetMetaFilePath(clusterName string) string
GetMetaFilePath get meta file path
func (*Controller) InitClusterMetadataDir ¶
func (c *Controller) InitClusterMetadataDir(clusterName string) error
InitClusterMetadataDir init cluster metadata dir
func (*Controller) IsScaleOutLocked ¶
func (c *Controller) IsScaleOutLocked(clusterName string) (locked bool, err error)
IsScaleOutLocked judge the cluster scale-out file lock status
func (*Controller) ListClusterNameAll ¶
func (c *Controller) ListClusterNameAll() ([]string, error)
ListClusterNameAll list the all of cluster
func (*Controller) Metadata ¶
func (c *Controller) Metadata(clusterName string, meta any) error
Metadata tries to read the metadata of a cluster from file
func (*Controller) NewMetadata ¶
func (c *Controller) NewMetadata() cluster.IMetadata
func (*Controller) NewScaleOutLock ¶
func (c *Controller) NewScaleOutLock(clusterName string, topo *cluster.Topology) error
NewScaleOutLock save the meta with specified cluster name.
func (*Controller) Path ¶
func (c *Controller) Path(cluster string, subpath ...string) string
CPath 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 (*Controller) ReleaseScaleOutLock ¶
func (c *Controller) ReleaseScaleOutLock(clusterName string) error
ReleaseScaleOutLock remove the scale-out file lock with specified cluster
func (*Controller) Remove ¶
func (c *Controller) Remove(clusterName string) error
Remove remove the data with specified cluster name.
func (*Controller) SaveMetadata ¶
func (c *Controller) SaveMetadata(clusterName string, meta *cluster.Metadata) error
SaveMetadata save the meta with specified cluster name.
func (*Controller) ScaleOutLockedErr ¶
func (c *Controller) ScaleOutLockedErr(clusterName string) error
ScaleOutLockedErr Determine whether there is a lock, and report an error if it exists
func (*Controller) SetMetadata ¶
func (c *Controller) SetMetadata(metadata *cluster.Metadata)
type DirAccessor ¶
type DirAccessor struct {
// contains filtered or unexported fields
}
DirAccessor stands for a directory accessor for an instance
type DirEntry ¶
type DirEntry struct {
// contains filtered or unexported fields
}
DirEntry stands for a directory with attributes and instance
type DisplayOption ¶
type DisplayOption struct { ClusterName string ShowUptime bool ShowManageHost bool ShowNuma bool ShowDataDir bool }
DisplayOption represents option of display command
type InstInfo ¶
type InstInfo struct { ID string `json:"id"` Role string `json:"role"` Host string `json:"host"` ManageHost string `json:"manage_host"` Ports string `json:"ports"` OsArch string `json:"os_arch"` Status string `json:"status"` DataDir string `json:"data_dir"` DeployDir string `json:"deploy_dir"` NumaNode string `json:"numa_node"` NumaCores string `json:"numa_cores"` ComponentName string `json:"component_name"` Port int `json:"port"` Version string `json:"version"` Since string `json:"since"` }
InstInfo represents an instance info
type JSONOutput ¶
type JSONOutput struct { ClusterMetaInfo ClusterMetaInfo `json:"cluster_meta"` InstanceInfos []InstInfo `json:"instances,omitempty"` }