file_mgr

package
v0.0.0-...-12b7791 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const STATUS_DOWNLOADED = "DOWNLOADED"
View Source
const STATUS_DOWNLOADING = "DOWNLOADING"

Variables

This section is empty.

Functions

func CleanDownloadingFiles

func CleanDownloadingFiles() error

func DeleteEmptyFolder

func DeleteEmptyFolder(deletedFileAbsPath string)

func DeleteFile

func DeleteFile(file_hash string) error

func GetFileAbsPath

func GetFileAbsPath(file_hash string) string

func GetLastReqTime

func GetLastReqTime(file_hash string) (int64, error)

func LoopDeleteEmptyFolder

func LoopDeleteEmptyFolder()

func RemoveFileFromDisk

func RemoveFileFromDisk(fileHash string)

func ScanLeakFiles

func ScanLeakFiles()

ScanLeakFiles Scan disk and delete files not in db

func SetLastReqTime

func SetLastReqTime(file_hash string)

func UpdateFile

func UpdateFile(newData map[string]interface{}, file_hash string) error

func UrlHashToPublicFileRelPath

func UrlHashToPublicFileRelPath(file_hash string) string

file_hash to a rel_path to "public" folder

Types

type DiskFile

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

type FileModel

type FileModel struct {
	File_hash         string `json:"file_hash" gorm:"primaryKey"`
	Last_req_unixtime int64  `json:"last_req_unixtime" gorm:"index"`
	//Last_scan_unixtime     int64  `json:"last_scan_unixtime" gorm:"index"`
	//Last_download_unixtime int64  `json:"last_download_unixtime"`
	Size_byte int64  `json:"size_byte" gorm:"index"`
	Rel_path  string `json:"rel_path"`
	Status    string `json:"status" gorm:"index"`
}

func CreateFile

func CreateFile(file *FileModel) (*FileModel, error)

func GetFile

func GetFile(file_hash string, fromRef bool, updateRef bool) (*FileModel, error)

func RequestPublicFile

func RequestPublicFile(file_hash string) (string, map[string][]string, *FileModel, error)

return abs_file_path file_header_json error

func (FileModel) TableName

func (FileModel) TableName() string

type QueryFileResult

type QueryFileResult struct {
	Files      []*FileModel
	TotalCount int64
}

func QueryFile

func QueryFile(file_hash *string, less_than_req_unixtime *int64, status *[]string, file_hashs *[]string, limit int, offset int, fromRef bool, updateRef bool) (*QueryFileResult, error)

Jump to

Keyboard shortcuts

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