service

package
v0.2.0-alpha14 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagUpgradeFile = "/var/lib/casaos/upgradeInfo.txt"
)

Variables

View Source
var (
	CurrentReleaseLocalPath = "/etc/release.yaml"
)
View Source
var (
	ErrReleaseNotFound = fmt.Errorf("release not found")
)
View Source
var EventTypeMapMessageType = make(map[EventType]message_bus.EventType)
View Source
var EventTypeMapStatus = make(map[EventType]codegen.Status)
View Source
var FallbackStaticFiles embed.FS
View Source
var MockContent string = ``

Functions

func AlwaysFailedInstallHandler

func AlwaysFailedInstallHandler(raucPath string) error

func AlwaysSuccessInstallHandler

func AlwaysSuccessInstallHandler(raucPath string) error

func BestByDelay

func BestByDelay(urls []string) string

func CheckMemory

func CheckMemory() error

func CheckOfflineRAUCExist

func CheckOfflineRAUCExist(sysRoot string) bool

func CleanupOfflineRAUCTemp

func CleanupOfflineRAUCTemp(sysRoot string) error

func CurrentModuleVersion

func CurrentModuleVersion(module string, sysrootPath string) (*semver.Version, error)

func CurrentReleaseVersion

func CurrentReleaseVersion(sysrootPath string) (*semver.Version, error)

func DownloadChecksum

func DownloadChecksum(ctx context.Context, release codegen.Release, mirror string) (string, error)

func DownloadRelease

func DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error)

returns releaseFilePath if successful

func DownloadUninstallScript

func DownloadUninstallScript(ctx context.Context, sysRoot string) (string, error)

func ExecuteModuleInstallScript

func ExecuteModuleInstallScript(releaseFilePath string, release codegen.Release) error

func ExtractOfflineRAUCToTemp added in v0.2.0

func ExtractOfflineRAUCToTemp(sysRoot string) error

func ExtractRAUCRelease added in v0.2.0

func ExtractRAUCRelease(packageFilepath string, release codegen.Release) error

func FetchRelease

func FetchRelease(ctx context.Context, tag string, constructReleaseFileUrlFunc ConstructReleaseFileUrlFunc) (*codegen.Release, error)

func GetChecksums

func GetChecksums(release codegen.Release) (map[string]string, error)

func GetDescription

func GetDescription(raucInfo string) (string, error)

func GetRAUCInfo

func GetRAUCInfo(path string) (string, error)

func GetRelease

func GetRelease(ctx context.Context, tag string) (*codegen.Release, error)

func GetReleaseBranch added in v0.2.0

func GetReleaseBranch(sysRoot string) string

func GetStatus added in v0.2.0

func GetStatus() (codegen.Status, string)

func GitHubBranchTagReleaseUrl

func GitHubBranchTagReleaseUrl(tag string, _ string) string

func HyperFileTagReleaseUrl

func HyperFileTagReleaseUrl(tag string, mirror string) string

func InitEventTypeMapStatus added in v0.2.0

func InitEventTypeMapStatus()

func InstallDependencies

func InstallDependencies(release codegen.Release, sysRootPath string) error

func InstallRAUC

func InstallRAUC(release codegen.Release, sysRoot string, InstallRAUCHandler func(raucPath string) error) error

dependent config.ServerInfo.CachePath

func InstallRAUCImp

func InstallRAUCImp(raucFilePath string) error

func InstallRelease

func InstallRelease(release codegen.Release, sysRootPath string) error

func IsCasaOS

func IsCasaOS(sysRoot string) bool

func IsUpgradable

func IsUpgradable(release codegen.Release, sysRootPath string) bool

to check the new version is upgradable and packages are already cached(download)

func IsZimaOS

func IsZimaOS(sysRoot string) bool

func LaunchModule

func LaunchModule(release codegen.Release) error

func MarkGood added in v0.2.0

func MarkGood() error

func MigrationToolsDir

func MigrationToolsDir() string

func MockInstallRAUC

func MockInstallRAUC(raucFilePath string) error

func MockRAUCInfo

func MockRAUCInfo(content string) (string, error)

func NormalizationVersion added in v0.2.0

func NormalizationVersion(version string) string

func NormalizeVersion

func NormalizeVersion(version string) string

func OfflineRAUCFilePath

func OfflineRAUCFilePath() string

func PostInstallRAUC added in v0.2.0

func PostInstallRAUC(release codegen.Release, sysRoot string) error

func PublishEventWrapper

func PublishEventWrapper(ctx context.Context, eventType message_bus.EventType, properties map[string]string)

func RAUCFilePath

func RAUCFilePath(release codegen.Release) (string, error)

func RebootSystem

func RebootSystem()

func ShouldUpgrade

func ShouldUpgrade(release codegen.Release, sysRootPath string) bool

func StartFallbackWebsite added in v0.2.0

func StartFallbackWebsite()

func StopFallbackWebsite added in v0.2.0

func StopFallbackWebsite()

func StopModule

func StopModule(release codegen.Release) error

func UpdateStatusWithMessage added in v0.2.0

func UpdateStatusWithMessage(eventType EventType, newPackageStatus string)

func VerifyChecksumByFilePath

func VerifyChecksumByFilePath(filepath, checksum string) error

sha256sum

func VerifyRelease

func VerifyRelease(release codegen.Release) (string, error)

func VerifyUninstallScript

func VerifyUninstallScript(sysRoot string) bool

Types

type BestURLFunc

type BestURLFunc func(urls []string) string

type ConstructReleaseFileUrlFunc

type ConstructReleaseFileUrlFunc func(tag string, mirror string) string

type EventType added in v0.2.0

type EventType string
const (
	DownloadBegin    EventType = "downloadBegin"
	DownloadEnd      EventType = "downloadEnd"
	DownloadError    EventType = "downloadError"
	FetchUpdateEnd   EventType = "fetchUpdateEnd"
	FetchUpdateBegin EventType = "fetchUpdateBegin"
	FetchUpdateError EventType = "fetchUpdateError"

	Idle         EventType = "idle"
	InstallEnd   EventType = "installEnd"
	InstallBegin EventType = "installBegin"
	InstallError EventType = "installError"
)

type InstallProgressStatus

type InstallProgressStatus string

type InstallerServiceInterface added in v0.2.0

type InstallerServiceInterface interface {
}

type InstallerType added in v0.2.0

type InstallerType string
const (
	RAUC        InstallerType = "rauc"
	RAUCOFFLINE InstallerType = "rauc_offline"
	TAR         InstallerType = "tar"
)

func GetInstallMethod

func GetInstallMethod(sysRoot string) (InstallerType, error)

type RAUCOfflineService added in v0.2.0

type RAUCOfflineService struct {
	SysRoot            string
	InstallRAUCHandler func(raucPath string) error
	CheckSumHandler    out.CheckSumReleaseUseCase

	GetRAUCInfo func(string) (string, error)
}

func (*RAUCOfflineService) DownloadRelease added in v0.2.0

func (r *RAUCOfflineService) DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error)

func (*RAUCOfflineService) ExtractRelease added in v0.2.0

func (r *RAUCOfflineService) ExtractRelease(packageFilepath string, release codegen.Release) error

func (*RAUCOfflineService) GetRelease added in v0.2.0

func (r *RAUCOfflineService) GetRelease(ctx context.Context, tag string) (*codegen.Release, error)

func (*RAUCOfflineService) Install added in v0.2.0

func (r *RAUCOfflineService) Install(release codegen.Release, sysRoot string) error

func (*RAUCOfflineService) IsUpgradable added in v0.2.0

func (r *RAUCOfflineService) IsUpgradable(release codegen.Release, sysRootPath string) bool

func (*RAUCOfflineService) Launch

func (r *RAUCOfflineService) Launch(sysRoot string) error

func (*RAUCOfflineService) LoadReleaseFromOfflineRAUC added in v0.2.0

func (r *RAUCOfflineService) LoadReleaseFromOfflineRAUC(sysRoot string) (*codegen.Release, error)

func (*RAUCOfflineService) LoadReleaseFromRAUC

func (r *RAUCOfflineService) LoadReleaseFromRAUC(sysRoot string) (*codegen.Release, error)

func (*RAUCOfflineService) PostInstall added in v0.2.0

func (r *RAUCOfflineService) PostInstall(release codegen.Release, sysRoot string) error

func (*RAUCOfflineService) PostMigration added in v0.2.0

func (r *RAUCOfflineService) PostMigration(sysRoot string) error

func (*RAUCOfflineService) ShouldUpgrade added in v0.2.0

func (r *RAUCOfflineService) ShouldUpgrade(release codegen.Release, sysRoot string) bool

func (*RAUCOfflineService) VerifyRelease added in v0.2.0

func (r *RAUCOfflineService) VerifyRelease(release codegen.Release) (string, error)

type RAUCService added in v0.2.0

type RAUCService struct {
	InstallRAUCHandler func(raucPath string) error
	DownloadHandler    out.DownloadReleaseUseCase
	CheckSumHandler    out.CheckSumReleaseUseCase
	UrlHandler         ConstructReleaseFileUrlFunc
}

func (*RAUCService) DownloadRelease added in v0.2.0

func (r *RAUCService) DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error)

func (*RAUCService) ExtractRelease added in v0.2.0

func (r *RAUCService) ExtractRelease(packageFilepath string, release codegen.Release) error

func (*RAUCService) GetRelease added in v0.2.0

func (r *RAUCService) GetRelease(ctx context.Context, tag string) (*codegen.Release, error)

func (*RAUCService) Install added in v0.2.0

func (r *RAUCService) Install(release codegen.Release, sysRoot string) error

func (*RAUCService) IsUpgradable added in v0.2.0

func (r *RAUCService) IsUpgradable(release codegen.Release, sysrootPath string) bool

func (*RAUCService) Launch

func (r *RAUCService) Launch(sysRoot string) error

func (*RAUCService) PostInstall added in v0.2.0

func (r *RAUCService) PostInstall(release codegen.Release, sysRoot string) error

func (*RAUCService) PostMigration added in v0.2.0

func (r *RAUCService) PostMigration(sysRoot string) error

func (*RAUCService) ShouldUpgrade added in v0.2.0

func (r *RAUCService) ShouldUpgrade(release codegen.Release, sysRoot string) bool

func (*RAUCService) VerifyRelease added in v0.2.0

func (r *RAUCService) VerifyRelease(release codegen.Release) (string, error)

type Services

type Services interface {
	Gateway() (external.ManagementService, error)
	MessageBus() (*message_bus.ClientWithResponses, error)
}
var MyService Services

func NewService

func NewService(RuntimePath string) Services

type StatusService added in v0.2.0

type StatusService struct {
	ImplementService UpdaterServiceInterface
	SysRoot          string
}

func (*StatusService) Cronjob added in v0.2.0

func (r *StatusService) Cronjob(sysRoot string) error

func (*StatusService) DownloadRelease added in v0.2.0

func (r *StatusService) DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error)

func (*StatusService) ExtractRelease added in v0.2.0

func (r *StatusService) ExtractRelease(packageFilepath string, release codegen.Release) error

func (*StatusService) GetRelease added in v0.2.0

func (r *StatusService) GetRelease(ctx context.Context, tag string) (*codegen.Release, error)

func (*StatusService) Install added in v0.2.0

func (r *StatusService) Install(release codegen.Release, sysRoot string) error

func (*StatusService) IsUpgradable added in v0.2.0

func (r *StatusService) IsUpgradable(release codegen.Release, sysRootPath string) bool

func (*StatusService) Launch

func (r *StatusService) Launch(sysRoot string) error

func (*StatusService) PostInstall added in v0.2.0

func (r *StatusService) PostInstall(release codegen.Release, sysRoot string) error

func (*StatusService) PostMigration added in v0.2.0

func (r *StatusService) PostMigration(sysRoot string) error

func (*StatusService) ShouldUpgrade added in v0.2.0

func (r *StatusService) ShouldUpgrade(release codegen.Release, sysRoot string) bool

func (*StatusService) VerifyRelease added in v0.2.0

func (r *StatusService) VerifyRelease(release codegen.Release) (string, error)

type TarService added in v0.2.0

type TarService struct {
}

func (*TarService) GetRelease added in v0.2.0

func (r *TarService) GetRelease(ctx context.Context, tag string) (*codegen.Release, error)

func (*TarService) Install added in v0.2.0

func (r *TarService) Install(release codegen.Release, sysRoot string) error

type TestService added in v0.2.0

type TestService struct {
	InstallRAUCHandler func(raucPath string) error
	// contains filtered or unexported fields
}

func (*TestService) DownloadRelease added in v0.2.0

func (r *TestService) DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error)

func (*TestService) ExtractRelease added in v0.2.0

func (r *TestService) ExtractRelease(packageFilepath string, release codegen.Release) error

func (*TestService) GetRelease added in v0.2.0

func (r *TestService) GetRelease(ctx context.Context, tag string) (*codegen.Release, error)

func (*TestService) Install added in v0.2.0

func (r *TestService) Install(release codegen.Release, sysRoot string) error

func (*TestService) IsUpgradable added in v0.2.0

func (r *TestService) IsUpgradable(release codegen.Release, sysRootPath string) bool

func (*TestService) Launch

func (r *TestService) Launch(sysRoot string) error

func (*TestService) PostInstall added in v0.2.0

func (r *TestService) PostInstall(release codegen.Release, sysRoot string) error

func (*TestService) PostMigration added in v0.2.0

func (r *TestService) PostMigration(sysRoot string) error

func (*TestService) ShouldUpgrade added in v0.2.0

func (r *TestService) ShouldUpgrade(release codegen.Release, sysRoot string) bool

func (*TestService) VerifyRelease added in v0.2.0

func (r *TestService) VerifyRelease(release codegen.Release) (string, error)

type UpdaterServiceInterface added in v0.2.0

type UpdaterServiceInterface interface {
	GetRelease(ctx context.Context, tag string) (*codegen.Release, error)
	VerifyRelease(release codegen.Release) (string, error)
	DownloadRelease(ctx context.Context, release codegen.Release, force bool) (string, error)
	ExtractRelease(packageFilepath string, release codegen.Release) error

	Install(release codegen.Release, sysRoot string) error
	PostInstall(release codegen.Release, sysRoot string) error

	Launch(sysRoot string) error
	PostMigration(sysRoot string) error

	ShouldUpgrade(release codegen.Release, sysRoot string) bool
	IsUpgradable(release codegen.Release, sysRootPath string) bool // 检测预下载的包好了没有
}
var InstallerService UpdaterServiceInterface

func NewInstallerService added in v0.2.0

func NewInstallerService(sysRoot string) UpdaterServiceInterface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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