Documentation
¶
Index ¶
- Constants
- Variables
- type Process
- type Profile
- func (p *Profile) ComponentInstalledPath(component string, version utils.Version) (string, error)
- func (p *Profile) GetComponentInstalledVersion(component string, ver utils.Version) (utils.Version, error)
- func (p *Profile) InstalledComponents() ([]string, error)
- func (p *Profile) InstalledVersions(component string) ([]string, error)
- func (p *Profile) Path(relpath ...string) string
- func (p *Profile) ReadMetaFile(dirName string) (*Process, error)
- func (p *Profile) ResetMirror(addr, root string) error
- func (p *Profile) Root() string
- func (p *Profile) SaveTo(path string, data []byte, perm os.FileMode) error
- func (p *Profile) VersionIsInstalled(component, version string) (bool, error)
- func (p *Profile) WriteJSON(path string, data interface{}) error
- type TiUPConfig
Constants ¶
const ( // ComponentParentDir represent the parent directory of all downloaded components ComponentParentDir = "components" // ManifestParentDir represent the parent directory of all manifests ManifestParentDir = "manifests" // KeyInfoParentDir represent the parent directory of all keys KeyInfoParentDir = "keys" // DefaultPrivateKeyName represents the default private key file stored in ${TIUP_HOME}/keys DefaultPrivateKeyName = "private.json" // DataParentDir represent the parent directory of all running instances DataParentDir = "data" // TelemetryDir represent the parent directory of telemetry info TelemetryDir = "telemetry" // StorageParentDir represent the parent directory of running component StorageParentDir = "storage" // EnvNameInstanceDataDir represents the working directory of specific instance EnvNameInstanceDataDir = "TIUP_INSTANCE_DATA_DIR" // EnvNameComponentDataDir represents the working directory of specific component EnvNameComponentDataDir = "TIUP_COMPONENT_DATA_DIR" // EnvNameComponentInstallDir represents the install directory of specific component EnvNameComponentInstallDir = "TIUP_COMPONENT_INSTALL_DIR" // EnvNameWorkDir represents the work directory of TiUP where user type the command `tiup xxx` EnvNameWorkDir = "TIUP_WORK_DIR" // EnvNameUserInputVersion represents the version user specified when running a component by `tiup component:version` EnvNameUserInputVersion = "TIUP_USER_INPUT_VERSION" // EnvNameTiUPVersion represents the version of TiUP itself, not the version of component EnvNameTiUPVersion = "TIUP_VERSION" // EnvNameHome represents the environment name of tiup home directory EnvNameHome = "TIUP_HOME" // EnvNameTelemetryStatus represents the environment name of tiup telemetry status EnvNameTelemetryStatus = "TIUP_TELEMETRY_STATUS" // EnvNameTelemetryUUID represents the environment name of tiup telemetry uuid EnvNameTelemetryUUID = "TIUP_TELEMETRY_UUID" // EnvNameTelemetrySecret represents the environment name of tiup telemetry secret EnvNameTelemetrySecret = "TIUP_TELEMETRY_SECRET" // EnvTag is the tag of the running component EnvTag = "TIUP_TAG" // EnvNameSSHPassPrompt is the variable name by which user specific the password prompt for sshpass EnvNameSSHPassPrompt = "TIUP_SSHPASS_PROMPT" // EnvNameNativeSSHClient is the variable name by which user can specific use native ssh client or not EnvNameNativeSSHClient = "TIUP_NATIVE_SSH" // EnvNameSSHPath is the variable name by which user can specific the executable ssh binary path EnvNameSSHPath = "TIUP_SSH_PATH" // EnvNameSCPPath is the variable name by which user can specific the executable scp binary path EnvNameSCPPath = "TIUP_SCP_PATH" // EnvNameKeepSourceTarget is the variable name by which user can keep the source target or not EnvNameKeepSourceTarget = "TIUP_KEEP_SOURCE_TARGET" // EnvNameMirrorSyncScript make it possible for user to sync mirror commit to other place (eg. CDN) EnvNameMirrorSyncScript = "TIUP_MIRROR_SYNC_SCRIPT" // EnvNameLogPath is the variable name by which user can write the log files into EnvNameLogPath = "TIUP_LOG_PATH" // EnvNameDebug is the variable name by which user can set tiup runs in debug mode(eg. print panic logs) EnvNameDebug = "TIUP_CLUSTER_DEBUG" // MetaFilename represents the process meta file name MetaFilename = "tiup_process_meta" )
Notice: if you try to add a new env name which is notable by the user, shou should add it to cmd/env.go:envList so that the command `tiup env` will show that env.
Variables ¶
var DefaultTiUPHome string
DefaultTiUPHome represents the default home directory for this build of tiup If this is left empty, the default will be thee combination of the running user's home directory and ProfileDirName
var ProfileDirName = ".tiup"
ProfileDirName is the name of the profile directory to be used
Functions ¶
This section is empty.
Types ¶
type Process ¶
type Process struct { Component string `json:"component"` CreatedTime string `json:"created_time"` Pid int `json:"pid"` // PID of the process Exec string `json:"exec"` // Path to the binary Args []string `json:"args,omitempty"` // Command line arguments Env []string `json:"env,omitempty"` // Environment variables Dir string `json:"dir,omitempty"` // Data directory Cmd *exec.Cmd `json:"-"` }
Process represents a process as written to a meta file.
type Profile ¶
type Profile struct { Config *TiUPConfig // contains filtered or unexported fields }
Profile represents the `tiup` profile
func InitProfile ¶
func InitProfile() *Profile
InitProfile creates a new profile using environment variables and defaults.
func NewProfile ¶
func NewProfile(root string, config *TiUPConfig) *Profile
NewProfile returns a new profile instance
func (*Profile) ComponentInstalledPath ¶
ComponentInstalledPath returns the path where the component installed
func (*Profile) GetComponentInstalledVersion ¶
func (p *Profile) GetComponentInstalledVersion(component string, ver utils.Version) (utils.Version, error)
GetComponentInstalledVersion return the installed version of component.
func (*Profile) InstalledComponents ¶
InstalledComponents returns the installed components
func (*Profile) InstalledVersions ¶
InstalledVersions returns the installed versions of specific component
func (*Profile) ReadMetaFile ¶
ReadMetaFile reads a Process object from dirName/MetaFilename. Returns (nil, nil) if a metafile does not exist.
func (*Profile) ResetMirror ¶ added in v1.0.7
ResetMirror reset root.json and cleanup manifests directory
func (*Profile) SaveTo ¶
SaveTo saves file to the profile directory, path is relative to the profile directory of current user
func (*Profile) VersionIsInstalled ¶
VersionIsInstalled returns true if exactly version of component is installed.
type TiUPConfig ¶ added in v1.0.7
type TiUPConfig struct { Mirror string `toml:"mirror"` // contains filtered or unexported fields }
TiUPConfig represent the config file of TiUP
func InitConfig ¶ added in v1.0.7
func InitConfig(root string) (*TiUPConfig, error)
InitConfig returns a TiUPConfig struct which can flush config back to disk