service

package
v0.4.72 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 66 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.org * @Date: 2022-07-26 18:13:22 * @LastEditors: LinkLeong * @LastEditTime: 2022-08-04 20:10:31 * @FilePath: /CasaOS/service/connections.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

* @Author: LinkLeong link@icewhale.com * @Date: 2021-12-20 14:15:46 * @LastEditors: LinkLeong * @LastEditTime: 2022-07-04 16:18:23 * @FilePath: /CasaOS/service/file.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

* @Author: LinkLeong link@icewhale.org * @Date: 2022-07-26 18:13:22 * @LastEditors: LinkLeong * @LastEditTime: 2022-08-04 20:10:31 * @FilePath: /CasaOS/service/connections.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

* @Author: LinkLeong link@icewhale.com * @Date: 2021-09-30 18:18:14 * @LastEditors: LinkLeong * @LastEditTime: 2022-06-02 18:00:57 * @FilePath: /CasaOS/service/rely.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

* @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.

* @Author: LinkLeong link@icewhale.org * @Date: 2022-07-26 11:21:14 * @LastEditors: LinkLeong * @LastEditTime: 2022-08-18 11:16:25 * @FilePath: /CasaOS/service/shares.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

Index

Constants

View Source
const (
	// DockerRefusalRunning is the update of Docker, or a System packages update, already running.
	DockerRefusalRunning = "running"
	// DockerRefusalMaintenance is another update or a package manager busy on the box.
	DockerRefusalMaintenance = "maintenance"
	// DockerRefusalApps is an app operation in progress, or AppManagement that cannot say.
	DockerRefusalApps = "apps"
	// DockerRefusalChanged is a plan that is not the one the owner confirmed.
	DockerRefusalChanged = "changed"
	// DockerRefusalNothing is an engine with nothing to update.
	DockerRefusalNothing = "nothing"
)

The reasons the update does not start for, after the static ones of dockerUpdatePreflight (DockerRefusalOrigin and the others): things that change from one minute to the next.

View Source
const (
	// DockerRefusalUnsupported is a host that is not Debian-family root with apt-get and
	// systemd-run.
	DockerRefusalUnsupported = "unsupported"
	// DockerRefusalOrigin is an engine that is not docker-ce from Docker's own repository.
	DockerRefusalOrigin = "origin"
	// DockerRefusalHeld is docker-ce, or another package of the engine, on hold, when the owner
	// has not said that the update may go ahead of the hold. The hold is the owner's: the update
	// goes ahead of it as the terminal command with --allow-change-held-packages does, which drops
	// the hold of the packages dpkg unpacks, and the unit puts it back and says whether it did
	// (HOLDS, holds_kept).
	DockerRefusalHeld = "held"
	// DockerRefusalDpkg is a package operation that was interrupted and left unfinished (a power
	// cut in the middle of an install): the simulations take no lock, so they pass, and the first
	// real apt call refuses, which the run would report as a failed download.
	DockerRefusalDpkg = "dpkg"
	// DockerRefusalDaemon is a Docker that does not answer: no docker command, or the daemon
	// does not tell its version in time.
	DockerRefusalDaemon = "daemon"
	// DockerRefusalSwarm is a node that is part of a swarm.
	DockerRefusalSwarm = "swarm"
	// DockerRefusalPlan is a transaction that is not an upgrade of the engine's own packages
	// and the packages they need: it failed, or it removes a package, or upgrades another, or
	// installs a distribution's Docker package or more than dockerpkg.MaxNewPackages new ones.
	DockerRefusalPlan = "plan"
	// DockerRefusalDisk is too little room for the packages.
	DockerRefusalDisk = "disk"
)

The reasons the button is refused for, in the order they are looked at: the first that applies is the one given (unsupported, origin, held, dpkg, daemon, swarm, plan, disk). The page maps these codes to its own words. A hold is not one for the check: it is said, with the plan (SystemPackageDockerUpdate.Held), and the start refuses it until the owner has allowed it.

Variables

View Source
var (
	ErrSambaUsernameInvalid = errors.New("a share account name must be 1 to 31 characters, start with a lowercase letter or underscore, and contain only lowercase letters, digits, underscores and hyphens")
	ErrSambaPasswordEmpty   = errors.New("a share account password cannot be empty")
	ErrSambaUserExists      = errors.New("a system account with that name already exists")
	ErrSambaUserNotManaged  = errors.New("that account was not created by CasaOS and will not be removed")
)
View Source
var (
	WebSocketConns []*websocket.Conn
	SocketRun      bool
)
View Source
var (
	ErrSharePathNotDirectory = errors.New("only a directory can be shared")
	ErrSharePathOutsideRoots = errors.New("a share must live under /DATA, /mnt, /media or /srv")
)
View Source
var (
	ErrSystemPackageUpdateRunning      = errors.New("system package update is already running")
	ErrSystemPackageUpdatesUnsupported = errors.New("system package updates are not supported on this host")
)
View Source
var (
	ErrSystemPackageNothingToUpdate = errors.New("there is nothing to update")
	ErrSystemPackageTouchesDocker   = errors.New("this update would also change Docker's packages")
	ErrSystemPackageListChanged     = errors.New("the update is no longer the list that was checked")
	ErrSystemMaintenanceBusy        = errors.New("another update or package operation is running on this box")
)
View Source
var Cache *cache.Cache
View Source
var ErrDockerUpdateBadPlanID = errors.New("the plan id is not the id of a plan")

ErrDockerUpdateBadPlanID is a plan id that is not 64 lower case hex digits.

View Source
var ErrTimeMachineUnsupported = errors.New("Time Machine needs Samba's vfs_fruit module (package samba-vfs-modules on Debian and Ubuntu)")
View Source
var FileQueue sync.Map
View Source
var OpStrArr []string

Functions

func CheckFileStatus

func CheckFileStatus()

file move or copy and send notify

func CreateSambaUser

func CreateSambaUser(username, password string) error

CreateSambaUser adds a system account that can only be used for file sharing, then registers it with Samba.

The account gets no home directory and no login shell, so it cannot be used to log in to the host. The password is written to the tool's standard input rather than passed as an argument, which keeps it out of the process table.

func DeleteSambaUser

func DeleteSambaUser(username string) error

DeleteSambaUser removes an account this code created, from Samba and from the system. It refuses to touch anything that does not look CasaOS-managed.

func ExecOpFile

func ExecOpFile()

func FileOperate

func FileOperate(k string)

func GetCPUThermalZone

func GetCPUThermalZone() string

find thermal_zone of cpu. assertions:

func GetDeviceAllIP

func GetDeviceAllIP() []string

func GetIP

func GetIP(request *http.Request) string

func GetPeerId

func GetPeerId(request *http.Request, id string) string

func IsMounted

func IsMounted(path string) bool

func ListSambaUsers

func ListSambaUsers() ([]string, error)

ListSambaUsers returns the share accounts this code created.

func NewReader

func NewReader(ctx context.Context, r io.Reader) io.Reader

NewReader wraps an io.Reader to handle context cancellation.

Context state is checked BEFORE every Read.

func NewWriter

func NewWriter(ctx context.Context, w io.Writer) io.Writer

func SendMeg

func SendMeg()

func SetSambaPassword

func SetSambaPassword(username, password string) error

SetSambaPassword sets or replaces the Samba password of an existing account.

func ValidateSambaUsername

func ValidateSambaUsername(name string) error

ValidateSambaUsername reports whether name is safe to pass to the account tooling. Callers must run this before anything else touches the name.

func ValidateSharePath

func ValidateSharePath(path string) (string, error)

ValidateSharePath resolves path and reports whether it is a real directory inside one of the permitted roots.

Symlinks are resolved before the check rather than after, so a link planted inside a share cannot be used to reach a target outside it.

func ValidateTimeMachineSupport

func ValidateTimeMachineSupport() error

ValidateTimeMachineSupport checks that smbd can load the module a Time Machine share names.

testparm parses the configuration without loading VFS modules, so a missing one sails through validateSambaConfig and only surfaces as that single share refusing every connection. A host without smbd has nothing to check against, which is not an error, and neither is a build that lays its modules out somewhere unexpected: the guard never turns into a false refusal.

Types

type AppOperationsFunc added in v0.4.67

type AppOperationsFunc func(ctx context.Context) ([]string, error)

AppOperationsFunc says which apps have an operation in progress (an install, an update, a backup, a restore), by name. An error is no answer. main sets it from AppManagement.

type CasaService

type CasaService interface {
	GetCasaosVersion() model.Version
	FetchCasaosVersion() model.Version
}

func NewCasaService

func NewCasaService() CasaService

type ConnectionsService

type ConnectionsService interface {
	GetConnectionsList() (connections []model2.ConnectionsDBModel)
	GetConnectionByHost(host string) (connections []model2.ConnectionsDBModel)
	GetConnectionByID(id string) (connections model2.ConnectionsDBModel)
	CreateConnection(connection *model2.ConnectionsDBModel)
	DeleteConnection(id string)
	UpdateConnection(connection *model2.ConnectionsDBModel)
	MountSmaba(username, host, directory, port, mountPoint, password string) error
	UnmountSmaba(mountPoint string) error
}

func NewConnectionsService

func NewConnectionsService(db *gorm.DB) ConnectionsService

type DockerUpdateRefusal added in v0.4.67

type DockerUpdateRefusal struct {
	Code   string
	Detail []string
	Reason string
}

DockerUpdateRefusal is why the update did not start. The page turns the Code into its own words and shows Detail (names the core validated) with them; Reason is English, for a log or a client that does not know the code.

func (*DockerUpdateRefusal) Error added in v0.4.67

func (r *DockerUpdateRefusal) Error() string

type FileInfo

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

type FileUploadService

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

func NewFileUploadService

func NewFileUploadService() *FileUploadService

func (*FileUploadService) TestChunk

func (s *FileUploadService) TestChunk(
	c echo.Context,
	identifier string,
	chunkNumber int64,
) error

func (*FileUploadService) UploadFile

func (s *FileUploadService) UploadFile(
	c echo.Context,
	path string,
	chunkNumber int64,
	chunkSize int64,
	currentChunkSize int64,
	totalChunks int64,
	totalSize int64,
	identifier string,
	relativePath string,
	fileName string,
	bin *multipart.FileHeader,
) error

type HealthService

type HealthService interface {
	Services() (map[bool]*[]string, error)
	Ports() ([]int, []int, error)
}

func NewHealthService

func NewHealthService() HealthService

type Name

type Name struct {
	Model       string `json:"model"`
	OS          string `json:"os"`
	Browser     string `json:"browser"`
	DeviceName  string `json:"deviceName"`
	DisplayName string `json:"displayName"`
}

func GetName

func GetName(request *http.Request) Name

func GetNameByDB

func GetNameByDB(m model2.PeerDriveDBModel) Name

type NotifyServer

type NotifyServer interface {
	GetLog(id string) model.AppNotify
	AddLog(log model.AppNotify)
	UpdateLog(log model.AppNotify)
	UpdateLogByCustomID(log model.AppNotify)
	DelLog(id string)
	GetList(c int) (list []model.AppNotify)
	MarkRead(id string, state int)

	SendFileOperateNotify(nowSend bool)
	//SendInstallAppBySocket(app notifyCommon.Application)
	SendNotify(name string, message map[string]interface{})
	SettingSystemTempData(message map[string]interface{})
	GetSystemTempMap() *syncmap.Map
}

func NewNotifyService

func NewNotifyService(db *gorm.DB) NotifyServer

type OtherService

type OtherService interface {
	Search(key string) ([]model.SearchEngine, error)
	AgentSearch(url string) ([]byte, error)
}

func NewOtherService

func NewOtherService() OtherService

type PeerService

type PeerService interface {
	GetPeerByUserAgent(ua string) (m model2.PeerDriveDBModel)
	GetPeerByID(id string) (m model2.PeerDriveDBModel)
	GetPeers() (peers []model2.PeerDriveDBModel)
	CreatePeer(m *model2.PeerDriveDBModel)
	DeletePeer(id string)
	GetPeerByName(name string) (m model2.PeerDriveDBModel)
}

func NewPeerService

func NewPeerService(db *gorm.DB) PeerService

type RelyService

type RelyService interface {
	Create(rely model2.RelyDBModel)
	Delete(id string)
	GetInfo(id string) model2.RelyDBModel
}

func NewRelyService

func NewRelyService(db *gorm.DB) RelyService

type Repository

type Repository interface {
	Casa() CasaService
	Connections() ConnectionsService
	Gateway() external.ManagementService
	Health() HealthService
	Notify() NotifyServer
	Rely() RelyService
	Shares() SharesService
	System() SystemService
	Storage() StorageService
	MessageBus() *message_bus.ClientWithResponses
	Peer() PeerService
	Other() OtherService
}
var (
	MyService Repository
)

func NewService

func NewService(db *gorm.DB, RuntimePath string) Repository

type SharesService

type SharesService interface {
	GetSharesList() (shares []model2.SharesDBModel)
	GetSharesByPath(path string) (shares []model2.SharesDBModel)
	GetSharesByName(name string) (shares []model2.SharesDBModel)
	CreateShare(share model2.SharesDBModel) error
	GetShareByID(id string) (share model2.SharesDBModel, found bool)
	UpdateShare(id string, username string, timeMachine bool) error
	DeleteShare(id string) error
	UpdateConfigFile() error
	InitSambaConfig()
	DeleteShareByPath(path string) error
}

func NewSharesService

func NewSharesService(db *gorm.DB) SharesService

type StorageService

type StorageService interface {
	MountStorage(mountPoint, fs string) error
	UnmountStorage(mountPoint string) error
	GetStorages() (httper.MountList, error)
	CreateConfig(data map[string]string, name string, t string) error
	CheckAndMountByName(name string) error
	CheckAndMountAll() error
	GetConfigByName(name string) (map[string]string, error)
	DeleteConfigByName(name string) error
	GetConfig() (httper.RemotesResult, error)
}

func NewStorageService

func NewStorageService() StorageService

type SystemDockerContainers added in v0.4.67

type SystemDockerContainers struct {
	// Running is whether the Docker daemon answered. When it did not, there is no list.
	Running bool `json:"running"`
	// Containers are the containers that run now, never null. Names and images are text the
	// owner's apps chose, and are for display only.
	Containers []dockerpkg.Container `json:"containers"`
}

SystemDockerContainers is the running containers, as the confirmation of an update of Docker lists them: the update stops every one of them, and only those with a restart policy start again by themselves.

type SystemDockerUpdateStatus added in v0.4.67

type SystemDockerUpdateStatus struct {
	Supported bool `json:"supported"`
	// State is idle, running, finalizing, succeeded or failed.
	State string `json:"state"`
	// Phase is the step a run that is going on is at: preparing, downloading (the apps run),
	// installing (Docker restarts), waiting_docker (for the daemon), waiting_containers (for the
	// apps). It is "" for a run that has ended and when nothing runs: see dockerpkg.Run.Phase.
	Phase string `json:"phase"`
	// Outcome is success or restart_pending (State succeeded), failed (State failed), or "".
	Outcome string `json:"outcome"`
	Error   string `json:"error"`
	// ErrorCode is guard, download, install, daemon, start or no_result for a run that failed,
	// and the code of the refusal for a start that was refused.
	ErrorCode string `json:"error_code"`
	// RefusalDetail goes with a refusal: the names of the packages or of the apps it is about.
	RefusalDetail []string `json:"refusal_detail,omitempty"`
	// ExitCode is there for the page's sake and is null: the unit reports in its log.
	ExitCode    *int   `json:"exit_code"`
	StartedAt   string `json:"started_at"`
	CompletedAt string `json:"completed_at"`
	// From and To are the engine's versions before and after, from the log: the plan's until the
	// unit says better (what it saw installed, which daemon runs), "" when none is known yet.
	From string `json:"from"`
	To   string `json:"to"`
	// MajorJump is the plan's own word that the update changes the engine's first number (28 to
	// 29), from the PLAN line the core wrote; false for a log that has none. After one the
	// packages can be put back and Docker starts, and the containers do not start again by
	// themselves: no RollbackCommand is given.
	MajorJump bool `json:"major_jump"`
	// Held is whether the unit saw packages of the engine on hold when it started, and HeldPackages
	// which, sorted; never null. The update went ahead of that hold, as the terminal command with
	// --allow-change-held-packages does, and dpkg drops the hold of every package it unpacks: the unit
	// puts it back, and HoldsKept is true only when it said, at its end, that every one of them is on hold
	// again. It is false for a run that held nothing, for one whose hold could not be put back, and for one
	// that did not say (a unit that was lost), which the page tells apart by Held.
	Held         bool     `json:"held"`
	HeldPackages []string `json:"held_packages"`
	HoldsKept    bool     `json:"holds_kept"`
	// NotReturned are the containers that were running before and were not after.
	NotReturned []dockerpkg.NotReturned `json:"not_returned"`
	// RollbackCommand is what to type to put the packages back, for a run that failed and was not
	// a major jump; "" otherwise. For a run that went ahead of a hold it carries
	// --allow-change-held-packages, as the update did, and ends with `; sudo apt-mark hold` and the
	// names of the packages that were on hold (HeldPackages): dpkg drops the hold of every package it
	// unpacks, and this command unpacks them again.
	RollbackCommand string `json:"rollback_command"`
	// Log is the end of the unit's log, at most 128 KiB.
	Log string `json:"log"`
}

SystemDockerUpdateStatus is how the update of Docker is going, or how it went: the same object comes back from the start and from the status.

type SystemPackageDocker added in v0.4.65

type SystemPackageDocker struct {
	Installed bool `json:"installed"`
	// Origin is where Docker came from: see dockerpkg.Origin.
	Origin string `json:"origin,omitempty"`
	// Version is the engine's, from its package: 29.8.1.
	Version string `json:"version,omitempty"`
	// Updates is what apt offers for Docker's packages; none of it is installed by the
	// System packages update.
	Updates []SystemPackageUpdate `json:"updates"`
	// Candidate is a newer engine version that apt knows of and does not offer for an
	// update, with Held saying whether packages of the engine are on hold (any of them: they
	// move together, and a held sibling keeps docker-ce back as much as its own hold does):
	// said, rather than "up to date", of a Docker that is behind and that this update cannot move.
	Candidate string `json:"candidate,omitempty"`
	Held      bool   `json:"held,omitempty"`
	// RestartsDocker is whether installing those updates restarts the daemon: the engine's
	// own packages do, a plugin or the client do not.
	RestartsDocker bool `json:"restarts_docker"`
	// ManualCommand is what to type to update Docker oneself; empty when this does not
	// know a command to stand behind. For a box that has packages of the engine on hold it
	// names all of the engine's installed packages and puts the hold back afterwards (see
	// dockerpkg.ManualCommandHeld).
	ManualCommand string `json:"manual_command,omitempty"`
	// Update is whether the page may update the engine itself, and with what; absent when
	// there is nothing to update.
	Update *SystemPackageDockerUpdate `json:"update,omitempty"`
}

SystemPackageDocker is the Docker line of the System packages check.

type SystemPackageDockerUpdate added in v0.4.67

type SystemPackageDockerUpdate struct {
	// Available is true when the button may be offered: nothing refuses it, and there is
	// something to update.
	Available bool `json:"available"`
	// Refusal is "" or one of the DockerRefusal codes.
	Refusal string `json:"refusal"`
	// RefusalDetail is the names of the packages that make the plan unacceptable (valid
	// package names, or dockerpkg.InvalidName, or dockerpkg.TooManyNew), for DockerRefusalPlan;
	// otherwise empty, never null.
	RefusalDetail []string `json:"refusal_detail"`
	// Held is whether packages of the engine are on hold, and HeldPackages which, sorted; never
	// null. The update may be available all the same: it goes ahead of the hold only when the
	// owner allows it, and PlanID covers the hold, so that one that is set, removed or moved after
	// the owner confirmed is another plan. A refusal that comes before the question of the holds
	// (unsupported, origin) says none.
	Held         bool     `json:"held"`
	HeldPackages []string `json:"held_packages"`
	// From and To are the engine's version before and after, digits and dots: 28.0.4, 29.8.0.
	// They are the same when only a package other than docker-ce moves.
	From string `json:"from"`
	To   string `json:"to"`
	// MajorJump is a change of the engine's first number: 28 to 29.
	MajorJump bool `json:"major_jump"`
	// PlanID names the plan, see dockerpkg.Plan.ID: the page sends it back to say which plan
	// the owner confirmed.
	PlanID string `json:"plan_id"`
	// Packages are what the plan installs, upgrades and new packages, with the whole dpkg
	// versions, sorted by name; never null. A refusal for a reason that comes before the plan
	// has none; neither does one for DockerRefusalPlan.
	Packages []SystemPackageUpdate `json:"packages"`
}

SystemPackageDockerUpdate is what the check says of updating the engine from the page. It is there when the engine has something to update.

type SystemPackageUpdate

type SystemPackageUpdate struct {
	Name             string `json:"name"`
	CurrentVersion   string `json:"current_version"`
	CandidateVersion string `json:"candidate_version"`
	// New is only ever set in the plan of the Docker update (docker.update.packages): a package
	// that is not installed yet, a dependency of the new engine, whose CurrentVersion is "". It
	// is absent from the JSON of an upgrade, and so from every list of updates the check makes.
	New bool `json:"new,omitempty"`
}

type SystemPackageUpdateStatus

type SystemPackageUpdateStatus struct {
	Supported      bool       `json:"supported"`
	Manager        string     `json:"manager,omitempty"`
	State          string     `json:"state"`
	Log            string     `json:"log,omitempty"`
	Error          string     `json:"error,omitempty"`
	ExitCode       *int       `json:"exit_code,omitempty"`
	StartedAt      *time.Time `json:"started_at,omitempty"`
	CompletedAt    *time.Time `json:"completed_at,omitempty"`
	RebootRequired bool       `json:"reboot_required"`
}

type SystemPackageUpdates

type SystemPackageUpdates struct {
	Supported      bool                  `json:"supported"`
	Manager        string                `json:"manager,omitempty"`
	Reason         string                `json:"reason,omitempty"`
	Updates        []SystemPackageUpdate `json:"updates"`
	Count          int                   `json:"count"`
	CheckedAt      *time.Time            `json:"checked_at,omitempty"`
	RebootRequired bool                  `json:"reboot_required"`
	// Docker is shown on a line of its own: the update never installs it.
	Docker *SystemPackageDocker `json:"docker,omitempty"`
}

type SystemService

type SystemService interface {
	UpdateSystemVersion(version string) error
	// MaintenanceBusy says whether a package update, an update of Docker or a package
	// manager is changing the box now.
	MaintenanceBusy() bool
	GetSystemPackageUpdates() (SystemPackageUpdates, error)
	StartSystemPackageUpdate() (SystemPackageUpdateStatus, error)
	GetSystemPackageUpdateStatus() SystemPackageUpdateStatus
	// GetSystemDockerContainers lists the running containers, which an update of Docker stops.
	GetSystemDockerContainers() SystemDockerContainers
	// StartDockerUpdate updates the Docker engine to the plan the owner confirmed (its id), going ahead
	// of a hold on the engine's packages only if allowHeld, the owner's word (dpkg drops the hold of
	// the packages it unpacks: the unit puts it back). A *DockerUpdateRefusal says why it did not
	// start; the status comes with the error.
	StartDockerUpdate(planID string, allowHeld bool) (SystemDockerUpdateStatus, error)
	// DockerUpdateStatus says how the update of Docker is going, or how it went.
	DockerUpdateStatus() SystemDockerUpdateStatus
	// SetAppOperations tells how to ask which apps have an operation in progress; the update of
	// Docker is refused while it cannot be asked.
	SetAppOperations(list AppOperationsFunc)
	// DockerUpdateRun is DockerUpdateStatus and the nonce of the run it is about ("" with none).
	DockerUpdateRun() (SystemDockerUpdateStatus, string)
	// DockerUpdateMuted says whether the alerts about the apps' containers are to be kept quiet:
	// the update of Docker runs, or ended less than ten minutes ago. It takes no lock and is cheap.
	DockerUpdateMuted() bool
	// OnDockerUpdateQueued sets what is called when a run of the Docker update has its log: it
	// must return at once.
	OnDockerUpdateQueued(queued func())
	// GetSystemOS is the operating system and how long its security updates last: it only reads.
	GetSystemOS() ossupport.Report
	// GetSystemOSReadiness is the report of whether the box could be upgraded to the next release of
	// its operating system, and why not: it only reads, and takes up to twenty seconds.
	GetSystemOSReadiness() osreadiness.Answer
	GetSystemConfigDebug() []string
	GetCasaOSLogs(lineNumber int) string
	UpdateAssist()
	UpSystemPort(port string)
	GetTimeZone() string
	UpAppOrderFile(str, id string)
	GetAppOrderFile(id string) []byte
	GetNet(physics bool) []string
	GetNetInfo() []net.IOCountersStat
	GetCpuCoreNum() int
	GetCpuPercent() float64
	GetMemInfo() map[string]interface{}
	GetCpuInfo() []cpu.InfoStat
	GetDirPath(path string) ([]model.Path, error)
	GetDirPathOne(path string) (m model.Path)
	GetNetState(name string) string
	GetDiskInfo() *disk.UsageStat
	GetSysInfo() host.InfoStat
	GetDeviceTree() string
	GetDeviceInfo() model.DeviceInfo
	CreateFile(path string) (int, error)
	RenameFile(oldF, newF string) (int, error)
	MkdirAll(path string) (int, error)
	GetCPUTemperature() int
	GetCPUPower() map[string]string
	GetMacAddress() (string, error)
	SystemReboot() error
	SystemShutdown() error
	GetSystemEntry() string
	GenreateSystemEntry()
}

func NewSystemService

func NewSystemService() SystemService

Directories

Path Synopsis
* @Author: LinkLeong link@icewhale.org * @Date: 2022-07-26 17:17:57 * @LastEditors: LinkLeong * @LastEditTime: 2022-08-01 17:08:08 * @FilePath: /CasaOS/service/model/o_connections.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.
* @Author: LinkLeong link@icewhale.org * @Date: 2022-07-26 17:17:57 * @LastEditors: LinkLeong * @LastEditTime: 2022-08-01 17:08:08 * @FilePath: /CasaOS/service/model/o_connections.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

Jump to

Keyboard shortcuts

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