本文整理汇总了Golang中github.com/coreos/torus.BlockRef.BlockType方法的典型用法代码示例。如果您正苦于以下问题:Golang BlockRef.BlockType方法的具体用法?Golang BlockRef.BlockType怎么用?Golang BlockRef.BlockType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/coreos/torus.BlockRef
的用法示例。
在下文中一共展示了BlockRef.BlockType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: IsDead
func (b *blockvolGC) IsDead(ref torus.BlockRef) bool {
v, ok := b.highwaters[ref.Volume()]
if !ok {
if clog.LevelAt(capnslog.TRACE) {
clog.Tracef("%s doesn't exist anymore", ref)
}
// Volume doesn't exist anymore
return true
}
// If it's a new block or INode, let it be.
if ref.INode >= v {
if clog.LevelAt(capnslog.TRACE) {
clog.Tracef("%s is new compared to %d", ref, v)
}
return false
}
// If it's an INode block, and it's not in our list
if ref.BlockType() == torus.TypeINode {
for _, x := range b.curINodes {
if ref.HasINode(x, torus.TypeINode) {
if clog.LevelAt(capnslog.TRACE) {
clog.Tracef("%s is in %s", ref, x)
}
return false
}
}
if clog.LevelAt(capnslog.TRACE) {
clog.Tracef("%s is a dead INode", ref)
}
return true
}
// If it's a data block
if v := b.set[ref]; v {
return false
}
if clog.LevelAt(capnslog.TRACE) {
clog.Tracef("%s is dead", ref)
}
return true
}