model

package
v0.0.0-...-d1719c8 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCachedFile

func AddCachedFile(info *CachedFile) error

func AddDownloadingFile

func AddDownloadingFile(info *DownloadingFile) error

func AddFolderToDB

func AddFolderToDB(id uint32, absPath string) error

func DeleteCachedFile

func DeleteCachedFile(nameHash []string) error

func DeleteCachedFileByFolderID

func DeleteCachedFileByFolderID(folderID uint32) error

func DeleteDownloadingFile

func DeleteDownloadingFile(nameHash []string) error

func DeleteDownloadingFileByFolderID

func DeleteDownloadingFileByFolderID(folderID uint32) error

func GetCachedFileDistinctFolderID

func GetCachedFileDistinctFolderID() ([]uint32, error)

func GetCachedFileNameByFolderID

func GetCachedFileNameByFolderID(folderID uint32, limit int, offset int) ([]string, error)

func GetCachedFileNameInGivenNames

func GetCachedFileNameInGivenNames(fileNames []string) ([]string, error)

func GetDownloadingFileDistinctFolderID

func GetDownloadingFileDistinctFolderID() ([]uint32, error)

func GetDownloadingFileNameByFolderID

func GetDownloadingFileNameByFolderID(folderID uint32, limit int, offset int) ([]string, error)

func GetDownloadingFileNameByState

func GetDownloadingFileNameByState(state DownloadState, limit int, offset int) ([]string, error)

func GetDownloadingFileNameInGivenNames

func GetDownloadingFileNameInGivenNames(fileNames []string) ([]string, error)

func GetTotalCachedFileCount

func GetTotalCachedFileCount() (int64, error)

func InitLocalDB

func InitLocalDB(absDbFolder string, logger ULog.Logger) error

func SetDownloadingFileDeleteTag

func SetDownloadingFileDeleteTag(nameHash []string) (int64, error)

func UpdateDownloadTask

func UpdateDownloadTask(nameHash string, newValueMap map[string]interface{}) error

func UpdateLastAccessTime

func UpdateLastAccessTime(nameHash string, lastAccessTime int64) (int64, error)

Types

type CachedFile

type CachedFile struct {
	NameHash       string `gorm:"primarykey;size:16"`
	FolderID       uint32 `gorm:"index"`
	Size           int64
	LastAccessTime int64 `gorm:"index"`
	Encrypted      bool
	IsTempFile     bool `gorm:"index"`
}

func BatchGetCachedFile

func BatchGetCachedFile(limit int, offset int) ([]*CachedFile, error)

func GetCachedFile

func GetCachedFile(nameHash string) (*CachedFile, error)

func GetCachedFileInfoByGivenNames

func GetCachedFileInfoByGivenNames(fileNames []string) ([]*CachedFile, error)

func GetFilesBeforeAccessTime

func GetFilesBeforeAccessTime(limitLineUnix int64, limit int, offset int) ([]*CachedFile, error)

func GetFilesOrderByAccessTime

func GetFilesOrderByAccessTime(limit int) ([]*CachedFile, error)

type DownloadState

type DownloadState string
const (
	DownloadState_Downloading DownloadState = "downloading"
	DownloadState_Success     DownloadState = "success"
	DownloadState_Failed      DownloadState = "failed"
)

type DownloadingFile

type DownloadingFile struct {
	NameHash         string `gorm:"primarykey;size:16"`
	TaskId           uint64 `gorm:"index"`
	FolderID         uint32 `gorm:"index"`
	OriginUrl        urlArray
	UsingUrlIndex    int
	TaskType         downloadmgr.TaskType `gorm:"index"`
	Encrypted        bool
	SizeLimit        int64
	CreatedTimeStamp int64         `gorm:"index"`
	ExpireTimeStamp  int64         `gorm:"index"`
	State            DownloadState `gorm:"index"` //downloading, success, failed
	FailReason       downloadmgr.FailReasonType
	FileSize         int64
}

func BatchGetDownloadingFile

func BatchGetDownloadingFile(conditions map[string]interface{}, limit int, offset int) ([]*DownloadingFile, error)

func GetDownloadingFile

func GetDownloadingFile(nameHash string) (*DownloadingFile, error)

type Folder

type Folder struct {
	ID      uint32 `gorm:"primaryKey"`
	AbsPath string `gorm:"index"`
}

func GetFolder

func GetFolder(id uint32) (*Folder, error)

Jump to

Keyboard shortcuts

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