本文整理汇总了Golang中github.com/pbberlin/tools/os/fsi.FileSystem.Chtimes方法的典型用法代码示例。如果您正苦于以下问题:Golang FileSystem.Chtimes方法的具体用法?Golang FileSystem.Chtimes怎么用?Golang FileSystem.Chtimes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pbberlin/tools/os/fsi.FileSystem
的用法示例。
在下文中一共展示了FileSystem.Chtimes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: FetchUsingRSS
//.........这里部分代码省略.........
u, _ := url.Parse(a.Url)
lg(" abandoned %v", u.Path)
} else {
lg(" worker spinning down; branch 2")
}
return
}
}
}()
}
//
//
//
// loading stage 1
uriPrefix := config.SearchPrefix
found := 0
uriPrefixExcl := "impossible"
for i := 0; i < 15; i++ {
lg(" searching for prefix %v - excl %q - %v of %v", uriPrefix, uriPrefixExcl, found, config.DesiredNumber)
found += stuffStage1(w, r, config, inn, fin, dirTree,
uriPrefixExcl, uriPrefix, config.DesiredNumber-found)
if found >= config.DesiredNumber {
break
}
if uriPrefix == "/" || uriPrefix == "." {
lg(" root exhausted")
break
}
newPrefix := path.Dir(uriPrefix)
uriPrefixExcl = uriPrefix
uriPrefix = newPrefix
}
lg(" found %v of %v", found, config.DesiredNumber)
//
lg("stage3Wait.Wait() before")
stage3Wait.Wait()
lg("stage3Wait.Wait() after")
// workers spin down earlier -
// but ae log writer and response writer need some time
// to record the spin-down messages
time.Sleep(120 * time.Millisecond)
// compile out directory statistics
histoDir := map[string]int{}
for _, a := range fullArticles {
u, err := url.Parse(a.Url)
lg(err)
semanticUri := condenseTrailingDir(u.Path, config.CondenseTrailingDirs)
dir := path.Dir(semanticUri)
histoDir[dir]++
}
sr := sortmap.SortMapByCount(histoDir)
_ = sr
// Create dirs
for k, _ := range histoDir {
dir := path.Join(docRoot, k) // config.Host already contained in k
err := fs.MkdirAll(dir, 0755)
lg(err)
err = fs.Chtimes(dir, time.Now(), time.Now())
lg(err)
}
// Saving as files
for _, a := range fullArticles {
if len(a.Body) == 0 {
continue
}
u, err := url.Parse(a.Url)
u.Fragment = ""
u.RawQuery = ""
lg(err)
semanticUri := condenseTrailingDir(u.RequestURI(), config.CondenseTrailingDirs)
p := path.Join(docRoot, semanticUri)
err = fs.WriteFile(p, a.Body, 0644)
lg(err)
err = fs.Chtimes(p, a.Mod, a.Mod)
lg(err)
}
{
b, err := json.MarshalIndent(histoDir, " ", "\t")
lg(err)
fnDigest := path.Join(docRoot, config.Host, "fetchDigest.json")
err = fs.WriteFile(fnDigest, b, 0755)
lg(err)
}
// fsm, ok := memfs.Unwrap(fs)
// if ok {
// fsm.Dump()
// }
}