service

package
v0.4.2-alpha5 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: Apache-2.0 Imports: 57 Imported by: 0

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

This section is empty.

Variables

View Source
var (
	WebSocketConns []*websocket.Conn
	SocketRun      bool
)
View Source
var Cache *cache.Cache
View Source
var FileQueue sync.Map
View Source
var OpStrArr []string

Functions

func CheckFileStatus added in v0.3.2

func CheckFileStatus()

file move or copy and send notify

func ExecOpFile added in v0.3.2

func ExecOpFile()

func FileOperate added in v0.3.2

func FileOperate(k string)

func GetAllStorages added in v0.4.2

func GetAllStorages() []driver.Driver

func GetCPUThermalZone added in v0.3.8

func GetCPUThermalZone() string

find thermal_zone of cpu. assertions:

func GetDeviceAllIP added in v0.2.9

func GetDeviceAllIP() []string

func GetStorageByMountPath added in v0.4.2

func GetStorageByMountPath(mountPath string) (driver.Driver, error)

func IsMounted added in v0.4.2

func IsMounted(path string) bool

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 CasaService

type CasaService interface {
	GetCasaosVersion() model.Version
}

func NewCasaService added in v0.2.10

func NewCasaService() CasaService

type ConnectionsService added in v0.3.5

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) string
	UnmountSmaba(mountPoint string) error
}

func NewConnectionsService added in v0.3.5

func NewConnectionsService(db *gorm.DB) ConnectionsService

type FsLinkService added in v0.4.2

type FsLinkService interface {
	Link(ctx context.Context, path string, args model.LinkArgs) (*model.Link, model.Obj, error)
}

func NewFsLinkService added in v0.4.2

func NewFsLinkService() FsLinkService

type FsListService added in v0.4.2

type FsListService interface {
	FsList(ctx context.Context, path string, refresh ...bool) ([]model.Obj, error)
	Key(storage driver.Driver, path string) string
	Get(ctx context.Context, storage driver.Driver, path string) (model.Obj, error)
	GetUnwrap(ctx context.Context, storage driver.Driver, path string) (model.Obj, error)
	List(ctx context.Context, storage driver.Driver, path string, args model.ListArgs, refresh ...bool) ([]model.Obj, error)
}

func NewFsListService added in v0.4.2

func NewFsListService() FsListService

type FsService added in v0.4.2

type FsService interface {
	FList(ctx context.Context, path string, refresh ...bool) ([]model.Obj, error)
	GetStorage(path string) (driver.Driver, error)
	Link(ctx context.Context, path string, args model.LinkArgs) (*model.Link, model.Obj, error)
}

func NewFsService added in v0.4.2

func NewFsService() FsService

type HealthService added in v0.4.2

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

func NewHealthService added in v0.4.2

func NewHealthService() HealthService

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 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
	Storages() StoragesService
	StoragePath() StoragePathService
	FsListService() FsListService
	FsLinkService() FsLinkService
	FsService() FsService
	MessageBus() *message_bus.ClientWithResponses
}
var (
	MyService Repository
)

func NewService

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

type SharesService added in v0.3.5

type SharesService interface {
	GetSharesList() (shares []model2.SharesDBModel)
	GetSharesByPath(path string) (shares []model2.SharesDBModel)
	GetSharesByName(name string) (shares []model2.SharesDBModel)
	CreateShare(share model2.SharesDBModel)
	DeleteShare(id string)
	UpdateConfigFile()
	InitSambaConfig()
	DeleteShareByPath(path string)
}

func NewSharesService added in v0.3.5

func NewSharesService(db *gorm.DB) SharesService

type StorageOldService added in v0.4.2

type StorageOldService interface {
	CreateStorage(storage *model.Storage) error
	UpdateStorage(storage *model.Storage) error
	DeleteStorageById(id uint) error
	GetStorages(pageIndex, pageSize int) ([]model.Storage, int64, error)
	GetStorageById(id uint) (*model.Storage, error)
	GetEnabledStorages() ([]model.Storage, error)
}

func NewStorageOldService added in v0.4.2

func NewStorageOldService(db *gorm.DB) StorageOldService

type StoragePathService added in v0.4.2

type StoragePathService interface {
	GetStorageAndActualPath(rawPath string) (storage driver.Driver, actualPath string, err error)
}

func NewStoragePathService added in v0.4.2

func NewStoragePathService() StoragePathService

type StorageService added in v0.4.2

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

func NewStorageService() StorageService

type StoragesService added in v0.4.2

type StoragesService interface {
	HasStorage(mountPath string) bool
	CreateStorage(ctx context.Context, storage model.Storage) (uint, error)
	LoadStorage(ctx context.Context, storage model.Storage) error
	EnableStorage(ctx context.Context, id uint) error
	DisableStorage(ctx context.Context, id uint) error
	UpdateStorage(ctx context.Context, storage model.Storage) error
	DeleteStorageById(ctx context.Context, id uint) error
	MustSaveDriverStorage(driver driver.Driver) error
	GetStorageVirtualFilesByPath(prefix string) []model.Obj

	InitStorages()
	GetBalancedStorage(path string) driver.Driver
	// contains filtered or unexported methods
}

func NewStoragesService added in v0.4.2

func NewStoragesService() StoragesService

type SystemService

type SystemService interface {
	UpdateSystemVersion(version string)
	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
	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
}

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