本文整理汇总了Golang中github.com/youtube/vitess/go/zk.Stat.EphemeralOwner方法的典型用法代码示例。如果您正苦于以下问题:Golang Stat.EphemeralOwner方法的具体用法?Golang Stat.EphemeralOwner怎么用?Golang Stat.EphemeralOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/youtube/vitess/go/zk.Stat
的用法示例。
在下文中一共展示了Stat.EphemeralOwner方法的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)
}
}