service

package
v0.4.3-test1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 53 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

@Author: LinkLeong link@icewhale.com

*@Date: 2022-07-12 09:48:56
*@LastEditors: LinkLeong
*@LastEditTime: 2022-09-02 22:10:05
*@FilePath: /CasaOS/service/service.go
*@Description:
*@Website: https://www.casaos.io
*Copyright (c) 2022 by icewhale, All Rights Reserved.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAppStore             = fmt.Errorf("not an appstore")
	ErrDefaultAppStoreNotFound = fmt.Errorf("default appstore not found")
)
View Source
var (
	ErrComposeAppNotFound                  = fmt.Errorf("compose app not found")
	ErrComposeAppNotMatch                  = fmt.Errorf("compose app not match")
	ErrComposeExtensionNameXCasaOSNotFound = fmt.Errorf("extension `%s` not found", common.ComposeExtensionNameXCasaOS)
	ErrComposeFileNotFound                 = fmt.Errorf("compose file not found")
	ErrInvalidComposeAppStatus             = fmt.Errorf("invalid compose app status")
	ErrMainAppNotFound                     = fmt.Errorf("main app not found")
	ErrNoAppFoundInComposeApp              = fmt.Errorf("no app found in compose app")
	ErrNotFoundInAppStore                  = fmt.Errorf("not found in app store")
	ErrSetStoreAppID                       = fmt.Errorf("failed to set store app ID")
	ErrStoreInfoNotFound                   = fmt.Errorf("store info not found")
)
View Source
var (
	NewVersionApp map[string]string // TODO - make use of NewVersionApp map
)

Functions

func BuildCatalog added in v0.4.3

func BuildCatalog(storeRoot string) (map[string]*ComposeApp, error)

func LoadRecommend added in v0.4.3

func LoadRecommend(storeRoot string) []string

func PublishEventWrapper added in v0.4.2

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

func Standardize added in v0.4.3

func Standardize(text string) string

func StoreRoot added in v0.4.3

func StoreRoot(workdir string) (string, error)

Types

type App added in v0.4.3

type App types.ServiceConfig

func (*App) StoreInfo added in v0.4.3

func (a *App) StoreInfo() (*codegen.AppStoreInfo, error)

type AppStore added in v0.4.1

type AppStore interface {
	ComposeApp(id string) *ComposeApp
	Catalog() map[string]*ComposeApp
	UpdateCatalog() error
	Recommend() []string
	WorkDir() (string, error)
}

func NewAppStore added in v0.4.3

func NewAppStore(appstoreURL string) (AppStore, error)

func NewDefaultAppStore added in v0.4.3

func NewDefaultAppStore() (AppStore, error)

type AppStoreManagement added in v0.4.3

type AppStoreManagement struct {
	// contains filtered or unexported fields
}

func NewAppStoreManagement added in v0.4.3

func NewAppStoreManagement() *AppStoreManagement

func (*AppStoreManagement) AppStoreList added in v0.4.3

func (a *AppStoreManagement) AppStoreList() []codegen.AppStoreMetadata

func (*AppStoreManagement) AppStoreMap added in v0.4.3

func (a *AppStoreManagement) AppStoreMap() (map[string]AppStore, error)

func (*AppStoreManagement) Catalog added in v0.4.3

func (a *AppStoreManagement) Catalog() map[string]*ComposeApp

func (*AppStoreManagement) ComposeApp added in v0.4.3

func (a *AppStoreManagement) ComposeApp(id string) *ComposeApp

func (*AppStoreManagement) OnAppStoreRegister added in v0.4.3

func (a *AppStoreManagement) OnAppStoreRegister(fn func(string) error)

func (*AppStoreManagement) OnAppStoreUnregister added in v0.4.3

func (a *AppStoreManagement) OnAppStoreUnregister(fn func(string) error)

func (*AppStoreManagement) Recommend added in v0.4.3

func (a *AppStoreManagement) Recommend() []string

func (*AppStoreManagement) RegisterAppStore added in v0.4.3

func (a *AppStoreManagement) RegisterAppStore(appstoreURL string) (chan *codegen.AppStoreMetadata, error)

func (*AppStoreManagement) UnregisterAppStore added in v0.4.3

func (a *AppStoreManagement) UnregisterAppStore(appStoreID uint) error

func (*AppStoreManagement) UpdateCatalog added in v0.4.3

func (a *AppStoreManagement) UpdateCatalog() error

func (*AppStoreManagement) WorkDir added in v0.4.3

func (a *AppStoreManagement) WorkDir() (string, error)

type ComposeApp added in v0.4.3

type ComposeApp codegen.ComposeApp

func LoadComposeAppFromConfigFile added in v0.4.3

func LoadComposeAppFromConfigFile(appID string, configFile string) (*ComposeApp, error)

func NewComposeAppFromYAML added in v0.4.3

func NewComposeAppFromYAML(yaml []byte, skipInterpolation, skipValidation bool) (*ComposeApp, error)

func (*ComposeApp) App added in v0.4.3

func (a *ComposeApp) App(name string) *App

func (*ComposeApp) Apply added in v0.4.3

func (a *ComposeApp) Apply(ctx context.Context, newComposeYAML []byte) error

func (*ComposeApp) Apps added in v0.4.3

func (a *ComposeApp) Apps() map[string]*App

func (*ComposeApp) Containers added in v0.4.3

func (a *ComposeApp) Containers(ctx context.Context) (map[string]api.ContainerSummary, error)

func (*ComposeApp) IsUpdateAvailable added in v0.4.3

func (a *ComposeApp) IsUpdateAvailable() bool

func (*ComposeApp) IsUpdateAvailableWith added in v0.4.3

func (a *ComposeApp) IsUpdateAvailableWith(storeComposeApp *ComposeApp) bool

func (*ComposeApp) Logs added in v0.4.3

func (a *ComposeApp) Logs(ctx context.Context, lines int) ([]byte, error)

func (*ComposeApp) PullAndInstall added in v0.4.3

func (a *ComposeApp) PullAndInstall(ctx context.Context) error

func (*ComposeApp) SetStatus added in v0.4.3

func (a *ComposeApp) SetStatus(ctx context.Context, status codegen.RequestComposeAppStatus) error

func (*ComposeApp) SetStoreAppID added in v0.4.3

func (a *ComposeApp) SetStoreAppID(storeAppID string) (string, bool)

func (*ComposeApp) StoreInfo added in v0.4.3

func (a *ComposeApp) StoreInfo(includeApps bool) (*codegen.ComposeAppStoreInfo, error)

func (*ComposeApp) Uninstall added in v0.4.3

func (a *ComposeApp) Uninstall(ctx context.Context, deleteConfigFolder bool) error

func (*ComposeApp) Update added in v0.4.3

func (a *ComposeApp) Update(ctx context.Context) error

type ComposeService added in v0.4.3

type ComposeService struct{}

func NewComposeService added in v0.4.3

func NewComposeService() *ComposeService

func (*ComposeService) Install added in v0.4.3

func (s *ComposeService) Install(ctx context.Context, composeApp *ComposeApp) error

func (*ComposeService) List added in v0.4.3

func (s *ComposeService) List(ctx context.Context) (map[string]*ComposeApp, error)

func (*ComposeService) PrepareWorkingDirectory added in v0.4.3

func (s *ComposeService) PrepareWorkingDirectory(name string) (string, error)

func (*ComposeService) Status added in v0.4.3

func (s *ComposeService) Status(ctx context.Context, appID string) (string, error)

func (*ComposeService) Uninstall added in v0.4.3

func (s *ComposeService) Uninstall(ctx context.Context, composeApp *ComposeApp, deleteConfigFolder bool) error

type DockerService

type DockerService interface {
	// image
	IsExistImage(imageName string) bool
	PullImage(ctx context.Context, imageName string) error
	PullLatestImage(ctx context.Context, imageName string) (bool, error)
	RemoveImage(name string) error

	// container
	CheckContainerHealth(id string) (bool, error)
	CreateContainer(m model.CustomizationPostData, id string) (containerID string, err error)
	CreateContainerShellSession(container, row, col string) (hr types.HijackedResponse, err error)
	DescribeContainer(ctx context.Context, name string) (*types.ContainerJSON, error)
	GetContainer(id string) (types.Container, error)
	GetContainerAppList(name, image, state *string) (*[]model.MyAppList, *[]model.MyAppList)
	GetContainerByName(name string) (*types.Container, error)
	GetContainerLog(name string) ([]byte, error)
	GetContainerStats() []model.DockerStatsModel
	RecreateContainer(ctx context.Context, id string, pull bool, force bool) error
	RemoveContainer(name string, update bool) error
	RenameContainer(name, id string) (err error)
	StartContainer(name string) error
	StopContainer(id string) error

	// network
	GetNetworkList() []types.NetworkResource

	// docker server
	GetServerInfo() (types.Info, error)
}

func NewDockerService

func NewDockerService() DockerService

type Services

type Services interface {
	AppStoreManagement() *AppStoreManagement

	V1AppStore() v1.AppStore
	V2AppStore() AppStore

	// Git() *GitService
	Compose() *ComposeService
	Docker() DockerService
	Gateway() external.ManagementService
	Notify() external.NotifyService
	MessageBus() *message_bus.ClientWithResponses
}
var (
	MyService Services
)

func NewService

func NewService(RuntimePath string) Services

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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