/
local.go
42 lines (35 loc) · 1005 Bytes
/
local.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package finder
import (
"github.com/uopensail/ulib/commonconfig"
"github.com/uopensail/ulib/prome"
"github.com/uopensail/ulib/utils"
)
type LocalFinder struct {
Config *commonconfig.FinderConfig
}
func NewLocalFinder(conf *commonconfig.FinderConfig) *LocalFinder {
finder := &LocalFinder{
Config: conf,
}
return finder
}
func (finder *LocalFinder) ListDir(dir string) ([]string, error) {
stat := prome.NewStat("LocalFinder.ListDir")
defer stat.End()
return utils.ListDir(dir)
}
func (finder *LocalFinder) Download(src, dst string) (int64, error) {
stat := prome.NewStat("LocalFinder.Download")
defer stat.End()
return utils.CopyFile(src, dst)
}
func (finder *LocalFinder) GetUpdateTime(filepath string) int64 {
stat := prome.NewStat("LocalFinder.GetUpdateTime")
defer stat.End()
return utils.GetFileModifyTime(filepath)
}
func (finder *LocalFinder) GetETag(filepath string) string {
stat := prome.NewStat("LocalFinder.GetETag")
defer stat.End()
return utils.GetMD5(filepath)
}