本文整理匯總了Golang中github.com/FactomProject/factomd/common/interfaces.DBOverlay.InsertEntry方法的典型用法代碼示例。如果您正苦於以下問題:Golang DBOverlay.InsertEntry方法的具體用法?Golang DBOverlay.InsertEntry怎麽用?Golang DBOverlay.InsertEntry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/FactomProject/factomd/common/interfaces.DBOverlay
的用法示例。
在下文中一共展示了DBOverlay.InsertEntry方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: CheckDBlockEntries
//.........這裏部分代碼省略.........
fmt.Printf("Found missing aBlock in #%v\n", dBlock.GetDatabaseHeight())
missing++
aBlock, err = GetABlock(e.GetKeyMR().String())
if err != nil {
panic(err)
}
err = dbo.ProcessABlockBatchWithoutHead(aBlock)
if err != nil {
panic(err)
}
break
case "000000000000000000000000000000000000000000000000000000000000000f":
fBlock, err := dbo.FetchFBlock(e.GetKeyMR())
if err != nil {
panic(err)
}
if fBlock != nil {
break
}
fmt.Printf("Found missing fBlock in #%v\n", dBlock.GetDatabaseHeight())
missing++
fBlock, err = GetFBlock(e.GetKeyMR().String())
if err != nil {
panic(err)
}
err = dbo.ProcessFBlockBatchWithoutHead(fBlock)
if err != nil {
panic(err)
}
break
case "000000000000000000000000000000000000000000000000000000000000000c":
ecBlock, err := dbo.FetchECBlock(e.GetKeyMR())
if err != nil {
panic(err)
}
if ecBlock != nil {
break
}
fmt.Printf("Found missing ecBlock in #%v\n", dBlock.GetDatabaseHeight())
missing++
ecBlock, err = GetECBlock(e.GetKeyMR().String())
if err != nil {
panic(err)
}
err = dbo.ProcessECBlockBatchWithoutHead(ecBlock, true)
if err != nil {
panic(err)
}
break
default:
eBlock, err := dbo.FetchEBlock(e.GetKeyMR())
if err != nil {
if err.Error() != "EOF" {
panic(err)
}
}
if eBlock == nil {
fmt.Printf("Found missing eBlock in #%v\n", dBlock.GetDatabaseHeight())
missing++
eBlock, err = GetEBlock(e.GetKeyMR().String())
if err != nil {
panic(err)
}
err = dbo.ProcessEBlockBatchWithoutHead(eBlock, true)
if err != nil {
panic(err)
}
}
eBlockEntries := eBlock.GetEntryHashes()
for _, eHash := range eBlockEntries {
if eHash.IsMinuteMarker() == true {
continue
}
entry, err := dbo.FetchEntry(eHash)
if err != nil {
panic(err)
}
if entry == nil {
fmt.Printf("Found missing entry in #%v\n", dBlock.GetDatabaseHeight())
missing++
entry, err := GetEntry(eHash.String())
if err != nil {
fmt.Printf("Problem getting entry `%v` from block %v\n", eHash.String(), e.GetKeyMR().String())
panic(err)
}
err = dbo.InsertEntry(entry)
if err != nil {
panic(err)
}
}
}
break
}
}
if missing == 0 {
break
}
}
}