本文整理匯總了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
}