本文整理匯總了Golang中github.com/youtube/vitess/go/zk.Stat.DataLength方法的典型用法代碼示例。如果您正苦於以下問題:Golang Stat.DataLength方法的具體用法?Golang Stat.DataLength怎麽用?Golang Stat.DataLength使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/youtube/vitess/go/zk.Stat
的用法示例。
在下文中一共展示了Stat.DataLength方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: fmtPath
func fmtPath(stat zk.Stat, zkPath string, showFullPath bool, longListing bool) {
var name, perms string
if !showFullPath {
name = path.Base(zkPath)
} else {
name = zkPath
}
if longListing {
if stat.NumChildren() > 0 {
// FIXME(msolomon) do permissions check?
perms = "drwxrwxrwx"
if stat.DataLength() > 0 {
// give a visual indication that this node has data as well as children
perms = "nrw-rw-rw-"
}
} else if stat.EphemeralOwner() != 0 {
perms = "erw-rw-rw-"
} else {
perms = "-rw-rw-rw-"
}
// always print the Local version of the time. zookeeper's
// go / C library would return a local time anyway, but
// might as well be sure.
fmt.Printf("%v %v %v % 8v % 20v %v\n", perms, "zk", "zk", stat.DataLength(), stat.MTime().Local().Format(timeFmt), name)
} else {
fmt.Printf("%v\n", name)
}
}