(co *CollectionOptions, storeFooter *Footer)
| 696 | } |
| 697 | |
| 698 | func restoreCollection(co *CollectionOptions, storeFooter *Footer) ( |
| 699 | rv *collection, err error) { |
| 700 | var coll *collection |
| 701 | if storeFooter.incarNum == 0 { |
| 702 | var newColl Collection |
| 703 | newColl, err = NewCollection(*co) |
| 704 | if err != nil { |
| 705 | return nil, err |
| 706 | } |
| 707 | |
| 708 | var ok bool |
| 709 | coll, ok = newColl.(*collection) |
| 710 | if !ok { |
| 711 | return nil, fmt.Errorf("store: wrong collection type") |
| 712 | } |
| 713 | } else { |
| 714 | coll = &collection{ |
| 715 | options: co, |
| 716 | stats: &CollectionStats{}, |
| 717 | incarNum: storeFooter.incarNum, |
| 718 | } |
| 719 | } |
| 720 | |
| 721 | coll.highestIncarNum = coll.incarNum |
| 722 | |
| 723 | for collName, childFooter := range storeFooter.ChildFooters { |
| 724 | if len(coll.childCollections) == 0 { |
| 725 | coll.childCollections = make(map[string]*collection) |
| 726 | } |
| 727 | |
| 728 | // Keep the incarnation numbers of the newly restored child |
| 729 | // collections monotonically increasing. |
| 730 | coll.highestIncarNum++ |
| 731 | childFooter.incarNum = coll.highestIncarNum |
| 732 | |
| 733 | var childCollection *collection |
| 734 | childCollection, err = restoreCollection(co, childFooter) |
| 735 | if err != nil { |
| 736 | break |
| 737 | } |
| 738 | |
| 739 | coll.childCollections[collName] = childCollection |
| 740 | } |
| 741 | |
| 742 | return coll, err |
| 743 | } |
| 744 | |
| 745 | // -------------------------------------------------------- |
| 746 |
no test coverage detected
searching dependent graphs…