service

package
v0.3.4-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 58 Imported by: 0

Documentation

Overview

* @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.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-07-15 10:58:54 * @FilePath: /CasaOS/service/service.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

* @Author: LinkLeong link@icewhale.com * @Date: 2022-03-18 11:40:55 * @LastEditors: LinkLeong * @LastEditTime: 2022-07-12 10:05:37 * @FilePath: /CasaOS/service/user.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 Cache *cache.Cache
View Source
var ClientCount int = 0
View Source
var FileQueue sync.Map
View Source
var NewVersionApp map[string]string
View Source
var NotifyMsg chan notify.Message
View Source
var OpStrArr []string
View Source
var SocketRun bool
View Source
var UserRegisterHash = make(map[string]string)
View Source
var WebSocketConns []*websocket.Conn

Functions

func CheckFileStatus added in v0.3.2

func CheckFileStatus()

file move or copy and send notify

func Containerd

func Containerd()

func DockerContainerStats1

func DockerContainerStats1() error

func DockerEx

func DockerEx()

拉取镜像

func DockerImageRemove

func DockerImageRemove(name string) error

func DockerLog

func DockerLog()

func DockerLogs

func DockerLogs()

func DockerNetwork

func DockerNetwork()

创建默认网络

func DockerPull

func DockerPull()

拉取镜像

func Exec

func Exec(container, row, col string) (hr types.HijackedResponse, err error)

func ExecOpFile added in v0.3.2

func ExecOpFile()

func FileOperate added in v0.3.2

func FileOperate(k string)

func GetDeviceAllIP added in v0.2.9

func GetDeviceAllIP() []string

func GetToken

func GetToken() string

func MsqlExec

func MsqlExec(container string) error

func NewReader added in v0.2.4

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 added in v0.2.4

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

func SendMeg added in v0.2.9

func SendMeg()

Types

type AppService

type AppService interface {
	GetMyList(index, size int, position bool) (*[]model2.MyAppList, *[]model2.MyAppList)
	SaveContainer(m model2.AppListDBModel)
	GetUninstallInfo(id string) model2.AppListDBModel
	DeleteApp(id string)
	GetContainerInfo(id string) (types.Container, error)
	GetAppDBInfo(id string) model2.AppListDBModel
	UpdateApp(m model2.AppListDBModel)
	GetSimpleContainerInfo(id string) (types.Container, error)
	DelAppConfigDir(path string)
	GetSystemAppList() []types.Container
	GetHardwareUsageStream()
	GetHardwareUsage() []model.DockerStatsModel
	GetAppStats(id string) string
	GetAllDBApps() []model2.AppListDBModel
	ImportApplications(casaApp bool)
	CheckNewImage()
}

func NewAppService

func NewAppService(db *gorm.DB) AppService

type CasaService

type CasaService interface {
	GetServerList(index, size, tp, categoryId, key string) (model.ServerAppListCollection, error)
	GetServerCategoryList() (list []model.CategoryList, err error)
	GetServerAppInfo(id, t string, language string) (model.ServerAppList, error)
	ShareAppFile(body []byte) string
	GetCasaosVersion() model.Version
	AsyncGetServerList() (collection model.ServerAppListCollection, err error)
	AsyncGetServerCategoryList() ([]model.CategoryList, error)
}

func NewCasaService added in v0.2.10

func NewCasaService() CasaService

type DiskService

type DiskService interface {
	GetPlugInDisk() []string
	LSBLK(isUseCache bool) []model.LSBLKModel
	SmartCTL(path string) model.SmartctlA
	FormatDisk(path, format string) []string
	UmountPointAndRemoveDir(path string) []string
	GetDiskInfo(path string) model.LSBLKModel
	DelPartition(path, num string) string
	AddPartition(path string) string
	GetDiskInfoByPath(path string) *disk.UsageStat
	MountDisk(path, volume string)
	GetSerialAll() []model2.SerialDisk
	SaveMountPoint(m model2.SerialDisk)
	DeleteMountPoint(path, mountPoint string)
	DeleteMount(id string)
	UpdateMountPoint(m model2.SerialDisk)
	RemoveLSBLKCache()
}

func NewDiskService

func NewDiskService(db *gorm.DB) DiskService

type DockerService

type DockerService interface {
	DockerPullImage(imageName string, icon, name string) error
	IsExistImage(imageName string) bool
	DockerContainerCreate(imageName string, m model.CustomizationPostData) (containerId string, err error)
	DockerContainerCopyCreate(info *types.ContainerJSON) (containerId string, err error)
	DockerContainerStart(name string) error
	DockerContainerStats(name string) (string, error)
	DockerListByName(name string) (*types.Container, error)
	DockerListByImage(image, version string) (*types.Container, error)
	DockerContainerInfo(name string) (*types.ContainerJSON, error)
	DockerImageRemove(name string) error
	DockerContainerRemove(name string, update bool) error
	DockerContainerStop(id string) error
	DockerContainerUpdateName(name, id string) (err error)
	DockerContainerUpdate(m model.CustomizationPostData, id string) (err error)
	DockerContainerLog(name string) (string, error)
	DockerContainerCommit(name string)
	DockerContainerList() []types.Container
	DockerNetworkModelList() []types.NetworkResource
	DockerImageInfo(image string) (types.ImageInspect, error)
	GetNetWorkNameByNetWorkID(id string) (string, error)
	ContainerExecShell(container_id string) string
}

func NewDockerService added in v0.2.3

func NewDockerService() DockerService

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)
	//	SendText(m model.AppNotify)
	SendUninstallAppBySocket(app notify.Application)
	SendNetInfoBySocket(netList []model2.IOCountersStat)
	SendCPUInfoBySocket(cpu map[string]interface{})
	SendMemInfoBySocket(mem map[string]interface{})
	SendUSBInfoBySocket(list []model2.DriveUSB)
	SendDiskInfoBySocket(disk model2.Summary)
	SendFileOperateNotify(nowSend bool)
	SendInstallAppBySocket(app notify.Application)
	SendAllHardwareStatusBySocket(disk model2.Summary, list []model2.DriveUSB, mem map[string]interface{}, cpu map[string]interface{}, netList []model2.IOCountersStat)
	SendStorageBySocket(message notify.StorageMessage)
}

func NewNotifyService

func NewNotifyService(db *gorm.DB) NotifyServer

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 {
	App() AppService
	User() UserService
	Docker() DockerService
	Casa() CasaService
	Disk() DiskService
	Notify() NotifyServer
	Rely() RelyService
	System() SystemService
}
var MyService Repository

func NewService

func NewService(db *gorm.DB) Repository

type SystemService

type SystemService interface {
	UpdateSystemVersion(version string)
	GetSystemConfigDebug() []string
	GetCasaOSLogs(lineNumber int) string
	UpdateAssist()
	UpSystemPort(port string)
	GetTimeZone() string
	UpdateUSBAutoMount(state string)
	ExecUSBAutoMountShell(state 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
	GetDirPathOne(path string) (m model.Path)
	GetNetState(name string) string
	GetDiskInfo() *disk.UsageStat
	GetSysInfo() host.InfoStat
	GetDeviceTree() string
	CreateFile(path string) (int, error)
	RenameFile(oldF, newF string) (int, error)
	MkdirAll(path string) (int, error)
}

func NewSystemService

func NewSystemService() SystemService

type UserService

type UserService interface {
	UpLoadFile(file multipart.File, name string) error
	CreateUser(m model.UserDBModel) model.UserDBModel
	GetUserCount() (userCount int64)
	UpdateUser(m model.UserDBModel)
	UpdateUserPassword(m model.UserDBModel)
	GetUserInfoById(id string) (m model.UserDBModel)
	GetUserAllInfoById(id string) (m model.UserDBModel)
	GetUserAllInfoByName(userName string) (m model.UserDBModel)
	DeleteUserById(id string)
	DeleteAllUser()
	GetUserInfoByUserName(userName string) (m model.UserDBModel)
	GetAllUserName() (list []model.UserDBModel)
}

func NewUserService

func NewUserService(db *gorm.DB) UserService

获取用户Service

Directories

Path Synopsis
* @Author: LinkLeong link@icewhale.com * @Date: 2022-05-13 18:15:46 * @LastEditors: LinkLeong * @LastEditTime: 2022-07-13 10:56:34 * @FilePath: /CasaOS/service/model/o_container.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.
* @Author: LinkLeong link@icewhale.com * @Date: 2022-05-13 18:15:46 * @LastEditors: LinkLeong * @LastEditTime: 2022-07-13 10:56:34 * @FilePath: /CasaOS/service/model/o_container.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