func toDBlocksList(source []interfaces.BinaryMarshallableAndCopyable) []interfaces.IDirectoryBlock { answer := make([]interfaces.IDirectoryBlock, len(source)) for i, v := range source { answer[i] = v.(interfaces.IDirectoryBlock) } sort.Sort(util.ByDBlockIDAccending(answer)) return answer }
func ExportDChain(db interfaces.DBOverlay) error { fmt.Printf("ExportDChain\n") // get all ecBlocks from db dBlocks, err := db.FetchAllDBlocks() if err != nil { return err } sort.Sort(util.ByDBlockIDAccending(dBlocks)) for _, block := range dBlocks { err = ExportBlock(block.(interfaces.DatabaseBatchable)) if err != nil { return err } } return nil }
func (be *BlockExtractor) ExportDChain(db interfaces.DBOverlay) error { fmt.Printf("ExportDChain\n") // get all ecBlocks from db dBlocks, err := db.FetchAllDBlocks() if err != nil { return err } sort.Sort(util.ByDBlockIDAccending(dBlocks)) for _, block := range dBlocks { //Making sure Hash and KeyMR are set for the JSON export block.GetFullHash() block.GetKeyMR() err = be.ExportBlock(block.(interfaces.DatabaseBatchable)) if err != nil { return err } } return nil }