component

package
v1.0.56 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Running = "active (running)"
	Dead    = "inactive (dead)"
	Unknown = "unknown"
)

Variables

This section is empty.

Functions

func CheckComponents

func CheckComponents(c Component, parameters []*ComponentParameters) error

func DockerStatus

func DockerStatus(ip string, name string) (bool, error)

func IsRunning

func IsRunning(client *ssh.SSHClient, c SystemComponent) (bool, error)

func ReStart

func ReStart(client *ssh.SSHClient, c SystemComponent) error

func Start

func Start(client *ssh.SSHClient, c SystemComponent) error

func Stop

func Stop(client *ssh.SSHClient, c SystemComponent) error

func SystemStatus

func SystemStatus(client *ssh.SSHClient, c SystemComponent) (string, error)

func Uninstall

func Uninstall(client *ssh.SSHClient, c SystemComponent) error

func UntarInstalledPackage

func UntarInstalledPackage(client *ssh.SSHClient, compressedFilePath, aimPath string) error

UntarInstalledPackage

Types

type Component

type Component interface {
	GetCode() string
	GetName() string
	DownloadURL() string
	Parameters() []*ComponentParameters
}

type ComponentParameters

type ComponentParameters struct {
	ParameterType  ParameterType
	ParameterName  string
	ParameterValue string
}

type OperateType

type OperateType uint8
const (
	OperateType_Start OperateType
	OperateType_Restart
	OperateType_Stop
)

type ParameterType

type ParameterType uint8
const (
	Dir      ParameterType //选择路径 1
	FilePath               //选择文件 2
	Server                 //选择服务器 3
)

type Product

type Product interface {
	GetName() string
	GetCode() string
	GetDepends() []*ProductSystemdComponentDepend
	ServicesList() map[string]ServiceComponent
}

type ProductDepends

type ProductDepends struct {
	Depends []*ProductSystemdComponentDepend
}

func (*ProductDepends) Scan

func (m *ProductDepends) Scan(v interface{}) error

func (ProductDepends) Value

func (m ProductDepends) Value() (driver.Value, error)

type ProductSystemdComponentDepend

type ProductSystemdComponentDepend struct {
	SystemComponentCode string
	ServerID            int64
	IP                  string
}

type ServiceComponent

type ServiceComponent interface {
	Component
	NeedInit() bool
	Init(depends []*ProductSystemdComponentDepend) error
	DockerRun(version string, parameters []*ComponentParameters) string
	ImageName() string
}

type SystemComponent

type SystemComponent interface {
	Component
	RunOnDocker() bool
	Depends() []Component

	Install(client *ssh.SSHClient, installPackagePath string, params []*ComponentParameters) error
	Uninstall(*ssh.SSHClient) error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL