Documentation
¶
Overview ¶
@Author: LinkLeong link@icewhale.com
*@Date: 2022-07-13 10:43:45 *@LastEditors: LinkLeong *@LastEditTime: 2022-08-03 14:45:35 *@FilePath: /CasaOS/model/disk.go *@Description: *@Website: https://www.casaos.io *Copyright (c) 2022 by icewhale, All Rights Reserved.
Index ¶
- Constants
- func ExtractFolder(objs []Obj, extractFolder string)
- func GetThumb(obj Obj) (thumb string, ok bool)
- func GetUrl(obj Obj) (url string, ok bool)
- func SortFiles(objs []Obj, orderBy, orderDirection string)
- func WrapObjsName(objs []Obj)
- type APPModel
- type CommonModel
- type DFDiskSpace
- type DiskChildren
- type DiskStatus
- type Drive
- type FileStream
- type FileStreamer
- type FsOtherArgs
- type LSBLKModel
- type Link
- type LinkArgs
- type ListArgs
- type Obj
- type ObjMerge
- type ObjThumb
- type ObjThumbURL
- type ObjWrapName
- type Object
- type ObjectURL
- type OtherArgs
- type Proxy
- type ServerModel
- type SetPath
- type SettingItem
- type SmartctlA
- type Sort
- type Storage
- type StorageA
- type Storages
- type Thumb
- type Thumbnail
- type URL
- type USBChildren
- type USBDriveStatus
- type UnwrapObj
- type Url
Constants ¶
View Source
const ( SINGLE = iota SITE STYLE PREVIEW GLOBAL ARIA2 INDEX GITHUB )
View Source
const ( PUBLIC = iota PRIVATE READONLY DEPRECATED )
Variables ¶
This section is empty.
Functions ¶
func ExtractFolder ¶ added in v0.4.3
func WrapObjsName ¶ added in v0.4.3
func WrapObjsName(objs []Obj)
Types ¶
type CommonModel ¶
type CommonModel struct {
RuntimePath string
}
type DFDiskSpace ¶ added in v0.4.1
type DiskChildren ¶ added in v0.4.5
type DiskStatus ¶
type Drive ¶
type Drive struct {
Name string `json:"name"`
Size uint64 `json:"size"`
Model string `json:"model"`
Health string `json:"health"`
Temperature int `json:"temperature"`
DiskType string `json:"disk_type"`
NeedFormat bool `json:"need_format"`
Serial string `json:"serial"`
Path string `json:"path"`
ChildrenNumber int `json:"children_number"`
Children []DiskChildren `json:"children"`
Supported bool `json:"supported"`
}
type FileStream ¶ added in v0.4.3
func (*FileStream) GetMimetype ¶ added in v0.4.3
func (f *FileStream) GetMimetype() string
func (*FileStream) GetOld ¶ added in v0.4.3
func (f *FileStream) GetOld() Obj
func (*FileStream) GetReadCloser ¶ added in v0.4.3
func (f *FileStream) GetReadCloser() io.ReadCloser
func (*FileStream) NeedStore ¶ added in v0.4.3
func (f *FileStream) NeedStore() bool
func (*FileStream) SetReadCloser ¶ added in v0.4.3
func (f *FileStream) SetReadCloser(rc io.ReadCloser)
type FileStreamer ¶ added in v0.4.3
type FileStreamer interface {
io.ReadCloser
Obj
GetMimetype() string
SetReadCloser(io.ReadCloser)
NeedStore() bool
GetReadCloser() io.ReadCloser
GetOld() Obj
}
type FsOtherArgs ¶ added in v0.4.3
type LSBLKModel ¶
type LSBLKModel struct {
Name string `json:"name"`
FsType string `json:"fstype"`
Size uint64 `json:"size"`
FSSize json.Number `json:"fssize"`
Path string `json:"path"`
Model string `json:"model"` // 设备标识符
RM bool `json:"rm"` // 是否为可移动设备
RO bool `json:"ro"` // 是否为只读设备
State string `json:"state"`
PhySec int `json:"phy-sec"` // 物理扇区大小
Type string `json:"type"`
Vendor string `json:"vendor"` // 供应商
Rev string `json:"rev"` // 修订版本
FSAvail json.Number `json:"fsavail"` // 可用空间
FSUse string `json:"fsuse%"` // 已用百分比
MountPoint string `json:"mountpoint"`
Format string `json:"format"`
Health string `json:"health"`
HotPlug bool `json:"hotplug"`
UUID string `json:"uuid"`
PTUUID string `json:"ptuuid"`
PartUUID string `json:"partuuid"`
FSUsed json.Number `json:"fsused"`
Temperature int `json:"temperature"`
Tran string `json:"tran"`
MinIO uint64 `json:"min-io"`
UsedPercent float64 `json:"used_percent"`
Serial string `json:"serial"`
Children []LSBLKModel `json:"children"`
SubSystems string `json:"subsystems"`
Label string `json:"label"`
// 详情特有
StartSector uint64 `json:"start_sector,omitempty"`
Rota bool `json:"rota"` // true(hhd) false(ssd)
DiskType string `json:"disk_type"`
EndSector uint64 `json:"end_sector,omitempty"`
}
func (*LSBLKModel) GetMountPoint ¶
func (m *LSBLKModel) GetMountPoint(name string) string
type Link ¶ added in v0.4.3
type Link struct {
URL string `json:"url"`
Header http.Header `json:"header"` // needed header
Data io.ReadCloser // return file reader directly
Status int // status maybe 200 or 206, etc
FilePath *string // local file, return the filepath
Expiration *time.Duration // url expiration time
Method string `json:"method"` // http method
}
type Obj ¶ added in v0.4.3
type Obj interface {
GetSize() int64
GetName() string
ModTime() time.Time
IsDir() bool
// The internal information of the driver.
// If you want to use it, please understand what it means
GetID() string
GetPath() string
}
func UnwrapObjs ¶ added in v0.4.3
type ObjMerge ¶ added in v0.4.3
type ObjMerge struct {
// contains filtered or unexported fields
}
func (*ObjMerge) InitHideReg ¶ added in v0.4.3
type ObjThumbURL ¶ added in v0.4.3
type ObjWrapName ¶ added in v0.4.3
func (*ObjWrapName) GetName ¶ added in v0.4.3
func (o *ObjWrapName) GetName() string
func (*ObjWrapName) Unwrap ¶ added in v0.4.3
func (o *ObjWrapName) Unwrap() Obj
type Object ¶ added in v0.4.3
type Proxy ¶ added in v0.4.3
type Proxy struct {
WebProxy bool `json:"web_proxy"`
WebdavPolicy string `json:"webdav_policy"`
DownProxyUrl string `json:"down_proxy_url"`
}
func (Proxy) WebdavNative ¶ added in v0.4.3
func (Proxy) WebdavProxy ¶ added in v0.4.3
type SettingItem ¶ added in v0.4.3
type SettingItem struct {
Key string `json:"key" gorm:"primaryKey" binding:"required"` // unique key
Value string `json:"value"` // value
Help string `json:"help"` // help message
Type string `json:"type"` // string, number, bool, select
Options string `json:"options"` // values for select
Group int `json:"group"` // use to group setting in frontend
Flag int `json:"flag"` // 0 = public, 1 = private, 2 = readonly, 3 = deprecated, etc.
}
func (SettingItem) IsDeprecated ¶ added in v0.4.3
func (s SettingItem) IsDeprecated() bool
type SmartctlA ¶
type SmartctlA struct {
Smartctl struct {
Version []int `json:"version"`
SvnRevision string `json:"svn_revision"`
PlatformInfo string `json:"platform_info"`
BuildInfo string `json:"build_info"`
Argv []string `json:"argv"`
ExitStatus int `json:"exit_status"`
Messages []struct {
String string `json:"string"`
Severity string `json:"severity"`
} `json:"messages"`
} `json:"smartctl"`
Device struct {
Name string `json:"name"`
InfoName string `json:"info_name"`
Type string `json:"type"`
Protocol string `json:"protocol"`
} `json:"device"`
ModelName string `json:"model_name"`
SerialNumber string `json:"serial_number"`
FirmwareVersion string `json:"firmware_version"`
UserCapacity struct {
Blocks int `json:"blocks"`
Bytes int64 `json:"bytes"`
} `json:"user_capacity"`
SmartStatus struct {
Passed bool `json:"passed"`
} `json:"smart_status"`
AtaSmartData struct {
OfflineDataCollection struct {
Status struct {
Value int `json:"value"`
String string `json:"string"`
} `json:"status"`
CompletionSeconds int `json:"completion_seconds"`
} `json:"offline_data_collection"`
SelfTest struct {
Status struct {
Value int `json:"value"`
String string `json:"string"`
Passed bool `json:"passed"`
} `json:"status"`
PollingMinutes struct {
Short int `json:"short"`
Extended int `json:"extended"`
Conveyance int `json:"conveyance"`
} `json:"polling_minutes"`
} `json:"self_test"`
Capabilities struct {
Values []int `json:"values"`
ExecOfflineImmediateSupported bool `json:"exec_offline_immediate_supported"`
OfflineIsAbortedUponNewCmd bool `json:"offline_is_aborted_upon_new_cmd"`
OfflineSurfaceScanSupported bool `json:"offline_surface_scan_supported"`
SelfTestsSupported bool `json:"self_tests_supported"`
ConveyanceSelfTestSupported bool `json:"conveyance_self_test_supported"`
SelectiveSelfTestSupported bool `json:"selective_self_test_supported"`
AttributeAutosaveEnabled bool `json:"attribute_autosave_enabled"`
ErrorLoggingSupported bool `json:"error_logging_supported"`
GpLoggingSupported bool `json:"gp_logging_supported"`
} `json:"capabilities"`
} `json:"ata_smart_data"`
PowerOnTime struct {
Hours int `json:"hours"`
} `json:"power_on_time"`
PowerCycleCount int `json:"power_cycle_count"`
Temperature struct {
Current int `json:"current"`
} `json:"temperature"`
}
type Storage ¶
type Storage struct {
UUID string `json:"uuid"`
MountPoint string `json:"mount_point"`
Size string `json:"size"`
Avail string `json:"avail"`
Used string `json:"used"`
Type string `json:"type"`
Path string `json:"path"`
DriveName string `json:"drive_name"`
Label string `json:"label"`
PersistedIn string `json:"persisted_in"` // none, fstab, casaos
}
type StorageA ¶ added in v0.4.3
type StorageA struct {
ID uint `json:"id" gorm:"primaryKey"` // unique key
MountPath string `json:"mount_path" gorm:"unique" binding:"required"` // must be standardized
Order int `json:"order"` // use to sort
Driver string `json:"driver"` // driver used
CacheExpiration int `json:"cache_expiration"` // cache expire time
Status string `json:"status"`
Addition string `json:"addition" gorm:"type:text"` // Additional information, defined in the corresponding driver
Remark string `json:"remark"`
Modified time.Time `json:"modified"`
Disabled bool `json:"disabled"` // if disabled
Sort
Proxy
}
func (*StorageA) GetStorage ¶ added in v0.4.3
func (*StorageA) SetStorage ¶ added in v0.4.3
type USBChildren ¶
type USBDriveStatus ¶
type USBDriveStatus struct {
Name string `json:"name"`
Size uint64 `json:"size"`
Model string `json:"model"`
Avail uint64 `json:"avail"`
Children []USBChildren `json:"children"`
}
Click to show internal directories.
Click to hide internal directories.