storage

package
v0.17.0-unstable13 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CachedRemoteStorageList []StorageInfo

Functions

func API_Rclone_remountAll added in v0.17.0

func API_Rclone_remountAll(w http.ResponseWriter, req *http.Request)

func CreateSinglePartition

func CreateSinglePartition(diskPath string) (io.Reader, error)

func CreateSnapRAID

func CreateSnapRAID(raidOptions utils.SnapRAIDConfig, editRaid string) error

Create a SnapRAID configuration

func DeleteSnapRAID

func DeleteSnapRAID(name string) error

func FormatDisk

func FormatDisk(diskPath string, filesystemType string) (io.Reader, error)

func FormatDiskRoute

func FormatDiskRoute(w http.ResponseWriter, req *http.Request)

func GetDiskUsage

func GetDiskUsage(path string) (perc uint64, err error)

func InitRemoteStorage added in v0.17.0

func InitRemoteStorage() bool

func InitSnapRAIDConfig

func InitSnapRAIDConfig()

func IsDiskMounted

func IsDiskMounted(diskPath string) (bool, error)

check if disk is mounted

func ListDirectoryRoute added in v0.17.0

func ListDirectoryRoute(w http.ResponseWriter, req *http.Request)

func ListDisksRoute

func ListDisksRoute(w http.ResponseWriter, req *http.Request)

func ListMountsRoute

func ListMountsRoute(w http.ResponseWriter, req *http.Request)

func ListSmartDef

func ListSmartDef(w http.ResponseWriter, req *http.Request)

func MergeRoute

func MergeRoute(w http.ResponseWriter, req *http.Request)

MergeRoute handles merging filesystem requests

func Mount

func Mount(path, mountpoint string, permanent bool, chown string) error

Mount mounts a filesystem located at 'path' to 'mountpoint'.

func MountMergerFS

func MountMergerFS(paths []string, mountpoint string, opts string, permanent bool, chown string) error

Mount mounts a filesystem located at 'path' to 'mountpoint'.

func MountRoute

func MountRoute(w http.ResponseWriter, req *http.Request)

MountRoute handles mounting filesystem requests

func Restart added in v0.17.0

func Restart()

func RunRClone added in v0.17.0

func RunRClone(args []string)

func RunRCloneCommand added in v0.17.0

func RunRCloneCommand(command []string) (*exec.Cmd, io.WriteCloser, *bytes.Buffer, *bytes.Buffer)

func RunSnapRAIDFix

func RunSnapRAIDFix(raid utils.SnapRAIDConfig) error

func RunSnapRAIDScrub

func RunSnapRAIDScrub(raid utils.SnapRAIDConfig) error

func RunSnapRAIDStatus

func RunSnapRAIDStatus(raid utils.SnapRAIDConfig) (string, error)

func RunSnapRAIDSync

func RunSnapRAIDSync(raid utils.SnapRAIDConfig) error

func SNAPRaidCRUDRoute

func SNAPRaidCRUDRoute(w http.ResponseWriter, req *http.Request)

func SnapRAIDEditRoute

func SnapRAIDEditRoute(w http.ResponseWriter, req *http.Request)

func SnapRAIDRunRoute

func SnapRAIDRunRoute(w http.ResponseWriter, req *http.Request)

UnmountRoute handles unmounting filesystem requests

func ToggleSnapRAID

func ToggleSnapRAID(name string, enable bool) error

func Unmount

func Unmount(mountpoint string, permanent bool) error

Unmount unmounts the filesystem at 'mountpoint'.

func UnmountRoute

func UnmountRoute(w http.ResponseWriter, req *http.Request)

UnmountRoute handles unmounting filesystem requests

Types

type BlockDevice

type BlockDevice struct {
	lsblk.BlockDevice
	Children []BlockDevice `json:"children"`
	Usage    uint64        `json:"usage"`
	SMART    SMARTData     `json:"smart"` // Add SMART data field
}

func GetRecursiveDiskUsageAndSMARTInfo

func GetRecursiveDiskUsageAndSMARTInfo(devices []lsblk.BlockDevice) ([]BlockDevice, error)

Function to get recursive disk usage and SMART information

func ListDisks

func ListDisks() ([]BlockDevice, error)

type DirectoryListing added in v0.17.0

type DirectoryListing struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Size     int64  `json:"size"`
	IsDir    bool   `json:"isDir"`
	Ext      string `json:"ext"`
	Created  int64  `json:"created"`
	UID      uint32 `json:"uid"`
	GID      uint32 `json:"gid"`
	FullPath string `json:"fullPath"`
}

func ListDirectory added in v0.17.0

func ListDirectory(path string) ([]DirectoryListing, error)

type DiskInfo

type DiskInfo struct {
	Path string
	Name string
	Size uint64
	Used uint64
}

type FormatDiskJSON

type FormatDiskJSON struct {
	Disk     string `json:"disk"`
	Format   string `json:"format"`
	Password string `json:"password"`
}

type MergeRequest

type MergeRequest struct {
	Branches   []string `json:"branches"`
	MountPoint string   `json:"mountPoint"`
	Permanent  bool     `json:"permanent"`
	Chown      string   `json:"chown"`
	Opts       string   `json:"opts"`
}

Assuming the structure for the mount/unmount request

type MountPoint

type MountPoint struct {
	Path      string   `json:"path"`
	Permenant bool     `json:"permenant"`
	Device    string   `json:"device"`
	Type      string   `json:"type"`
	Opts      []string `json:"opts"`
}

func ListMounts

func ListMounts() ([]MountPoint, error)

ListMounts lists all the mount points on the system

type MountRequest

type MountRequest struct {
	Path       string `json:"path"`
	MountPoint string `json:"mountPoint"`
	Permanent  bool   `json:"permanent"`
	Chown      string `json:"chown"`
}

Assuming the structure for the mount/unmount request

type RCloneProcess added in v0.17.0

type RCloneProcess struct {
	RcloneCmd     *exec.Cmd
	RcloneRestart chan bool
	RestartCount  int
	LastRestart   time.Time
	Main          bool
}

func (*RCloneProcess) SetLastRestart added in v0.17.0

func (rp *RCloneProcess) SetLastRestart(v time.Time)

func (*RCloneProcess) SetRcloneRestartCount added in v0.17.0

func (rp *RCloneProcess) SetRcloneRestartCount(v int)

type RcloneStatsObj added in v0.17.0

type RcloneStatsObj struct {
	Bytes  float64
	Errors float64
}

func RCloneStats added in v0.17.0

func RCloneStats() (RcloneStatsObj, error)

type RemoteStorage added in v0.17.0

type RemoteStorage struct {
	Name  string
	Chown string
}

type SMARTData

type SMARTData struct {
	smart.GenericAttributes

	AdditionalData interface{}
	Thresholds     interface{}
}

type SnapRAIDStatus

type SnapRAIDStatus struct {
	utils.SnapRAIDConfig
	Status string
}

type StorageInfo added in v0.17.0

type StorageInfo struct {
	Name string `json:"name"`
	Path string `json:"path"`
}

func ListStorage added in v0.17.0

func ListStorage() ([]StorageInfo, error)

Jump to

Keyboard shortcuts

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