Documentation ¶
Index ¶
- func AppendToDownloadQueue(fileInfo *FileInfo, conf *config.Config)
- func AppendToQueue(fileInfo *FileInfo, conf *config.Config)
- func AutoRepair(forceRepair bool, conf *config.Config)
- func BackUpMetaDataByDate(date string, conf *config.Config)
- func BenchMark(ctx *gin.Context, conf *config.Config)
- func CheckAuth(r *http.Request, conf *config.Config) bool
- func CheckClusterStatus(conf *config.Config)
- func CheckDownloadAuth(ctx *gin.Context, conf *config.Config) (bool, error)
- func CheckFileAndSendToPeer(date string, filename string, isForceUpload bool, conf *config.Config)
- func CheckFileExistByInfo(md5s string, fileInfo *FileInfo, conf *config.Config) bool
- func CheckScene(scene string, conf *config.Config) (bool, error)
- func CleanAndBackUp(conf *config.Config)
- func CleanLogLevelDBByDate(date string, filename string, conf *config.Config)
- func ConsumerDownLoad(conf *config.Config)
- func ConsumerPostToPeer(conf *config.Config)
- func DownloadFromPeer(peer string, fileInfo *FileInfo, conf *config.Config)
- func DownloadNormalFileByURI(ctx *gin.Context, conf *config.Config) (bool, error)
- func DownloadNotFound(ctx *gin.Context, conf *config.Config)
- func DownloadSmallFileByURI(ctx *gin.Context, conf *config.Config) (bool, error)
- func FormatStatInfo(conf *config.Config)
- func GetClusterNotPermitMessage(r *http.Request) string
- func GetFileInfo(relativePath string, router *gin.RouterGroup, conf *config.Config)
- func GetFilePathByInfo(fileInfo *FileInfo, withDocker bool) string
- func GetFilePathFromRequest(reqURI string, conf *config.Config) (string, string)
- func GetMd5sByDate(date string, filename string, conf *config.Config) (mapSet.Set, error)
- func GetMd5sMapByDate(date string, filename string, conf *config.Config) (*pkg.CommonMap, error)
- func GetRequestURI(action string) string
- func GetSmallFileByURI(ctx *gin.Context, conf *config.Config) ([]byte, bool, error)
- func HeartBeat(ctx *gin.Context)
- func InitComponent(isReload bool, conf *config.Config)
- func IsPeer(r *http.Request, conf *config.Config) bool
- func LoadFileInfoByDate(date string, filename string, levelDB *leveldb.DB) (mapSet.Set, error)
- func LoadQueueSendToPeer(ctx context.Context, conf *config.Config)
- func LoadSearchDict(conf *config.Config)
- func ParseSmallFile(filename string, conf *config.Config) (string, int64, int, error)
- func PostFileToPeer(fileInfo *FileInfo, conf *config.Config)
- func ReceiveMd5s(relativePath string, router *gin.RouterGroup, conf *config.Config)
- func RemoveDownloading(conf *config.Config)
- func RemoveKeyFromLevelDB(key string, db *leveldb.DB) error
- func RepairFileInfoFromFile(conf *config.Config)
- func RepairStatWeb(relativePath string, router *gin.RouterGroup, conf *config.Config)
- func SaveFileInfoToLevelDB(key string, fileInfo *FileInfo, db *leveldb.DB, conf *config.Config) error
- func SaveFileMd5Log(fileInfo *FileInfo, md5FileName string, conf *config.Config)
- func SaveSearchDict(conf *config.Config)
- func SaveSmallFile(fileInfo *FileInfo, conf *config.Config) error
- func SaveStat(conf *config.Config)
- func SendMail(to, subject, body, mailType string, conf *config.Config) error
- func SetHttp(conf *config.Config)
- func Stat(relativePath string, router *gin.RouterGroup, conf *config.Config)
- func Status(relativePath string, router *gin.RouterGroup, conf *config.Config)
- func Sync(relativePath string, router *gin.RouterGroup, conf *config.Config)
- func SyncFileInfo(relativePath string, router *gin.RouterGroup, conf *config.Config)
- func VerifyGoogleCode(secret string, code string, discrepancy int64) bool
- func WatchFilesChange(conf *config.Config)
- type FileInfo
- type FileInfoResult
- type FileLog
- type FileResult
- type JsonResult
- type StatDateFileInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendToDownloadQueue ¶
func AppendToQueue ¶
Read: append the file info to queen channel, the file info will send to all peers
func AutoRepair ¶
TODO: to check Read : AutoRepair what?
func BackUpMetaDataByDate ¶
Read: BackUpMetaDataByDate back up the file 'files.md5' and 'meta.data' in the directory name with 'date'
func CheckDownloadAuth ¶
func CheckFileAndSendToPeer ¶
func CheckFileExistByInfo ¶
func CleanLogLevelDBByDate ¶
TODO: to check
func ConsumerPostToPeer ¶
func DownloadNormalFileByURI ¶
TODO: to check
func DownloadSmallFileByURI ¶
TODO: to check
func FormatStatInfo ¶
func GetClusterNotPermitMessage ¶
GetClusterNotPermitMessage
func GetFileInfo ¶
func GetFileInfo(relativePath string, router *gin.RouterGroup, conf *config.Config)
func GetFilePathByInfo ¶
func GetFilePathFromRequest ¶
GetFilePathFromRequest TODO: fix path error
func GetMd5sByDate ¶
TODO: to check Read: ??
func GetMd5sMapByDate ¶
TODO: to check, no use Read: GetMd5sMapByDate use given date and file name to get md5 which will uer to create a commonMap
func GetSmallFileByURI ¶
TODO: to check GetSmallFileByURI
func InitComponent ¶
TODO: TO optimise initComponent init current host ip
func LoadFileInfoByDate ¶
func LoadQueueSendToPeer ¶
TODO: to check
func ParseSmallFile ¶
TODO: to check
func PostFileToPeer ¶
func ReceiveMd5s ¶
func ReceiveMd5s(relativePath string, router *gin.RouterGroup, conf *config.Config)
Read: ReceiveMd5s get md5s from request, and append every one that exist in levelDB to queue channel
func RepairStatWeb ¶
func RepairStatWeb(relativePath string, router *gin.RouterGroup, conf *config.Config)
TODO: to check
func SaveFileInfoToLevelDB ¶
func SaveFileMd5Log ¶
TODO: to optimise
func SaveSmallFile ¶
TODO: to check
func SaveStat ¶
Read: SaveStat read data from statMap(which is concurrent safe map), check if the "StatisticsFileCountKey" key exists, if exists, then load all statMap data to file "stat.json"
func Stat ¶
func Stat(relativePath string, router *gin.RouterGroup, conf *config.Config)
TODO: to check
func Status ¶
func Status(relativePath string, router *gin.RouterGroup, conf *config.Config)
TODO: check if can be replaced with pprof
func SyncFileInfo ¶
func SyncFileInfo(relativePath string, router *gin.RouterGroup, conf *config.Config)
Types ¶
type FileInfo ¶
type FileInfo struct { Name string `json:"name"` ReName string `json:"rename"` Path string `json:"path"` Md5 string `json:"md5"` Size int64 `json:"size"` Peers []string `json:"peers"` Scene string `json:"scene"` TimeStamp int64 `json:"timeStamp"` OffSet int64 `json:"offset"` Retry int Op string }
func GetFileInfoFromLevelDB ¶
type FileInfoResult ¶
type FileResult ¶
type FileResult struct { Url string `json:"url"` Md5 string `json:"md5"` Path string `json:"path"` Domain string `json:"domain"` Scene string `json:"scene"` Size int64 `json:"size"` ModTime int64 `json:"mtime"` //Just for Compatibility Scenes string `json:"scenes"` RetMsg string `json:"retmsg"` RetCode int `json:"retcode"` Src string `json:"src"` }
func BuildFileResult ¶
func BuildFileResult(fileInfo *FileInfo, reqHost string, conf *config.Config) FileResult
type JsonResult ¶
type StatDateFileInfo ¶
type StatDateFileInfo struct { Date string `json:"date"` TotalSize int64 `json:"totalSize"` FileCount int64 `json:"fileCount"` }
func GetStat ¶
func GetStat(conf *config.Config) []StatDateFileInfo
func RepairStatByDate ¶
func RepairStatByDate(date string, conf *config.Config) StatDateFileInfo