code: func (s *Store) CopyTo(dstFile StoreFile, flushEvery int) (res *Store, err error) {
  	dstStore, err := NewStore(dstFile)
  	if err != nil {
  		return nil, err
  	}
  	coll := *(*map[string]*Collection)(atomic.LoadPointer(&s.coll))
  	for _, name := range collNames(coll) {
  		srcColl := coll[name]
  		dstColl := dstStore.SetCollection(name, srcColl.compare)
  		minItem, err := srcColl.MinItem(true)
  		if err != nil {
  			return nil, err
  		}
  		if minItem == nil {
  			continue
  		}
  		defer s.ItemDecRef(srcColl, minItem)
  		numItems := 0
  		var errCopyItem error = nil
  		err = srcColl.VisitItemsAscend(minItem.Key, true, func(i *Item) bool {
  			if errCopyItem = dstColl.SetItem(i); errCopyItem != nil {
  				return false
  			}
  			numItems++
  			if flushEvery > 0 && numItems%flushEvery == 0 {
  				if errCopyItem = dstStore.Flush(); errCopyItem != nil {
  					return false
  				}
  			}
  			return true
  		})
  		if err != nil {
  			return nil, err
  		}
  		if errCopyItem != nil {
  			return nil, errCopyItem
  		}
  	}
  	if flushEvery > 0 {
  		if err = dstStore.Flush(); err != nil {
  			return nil, err
  		}
  	}
  	return dstStore, nil
  }
docs: // Copy all active collections and their items to a different file.
  // If flushEvery > 0, then during the item copying, Flush() will be
  // invoked at every flushEvery'th item and at the end of the item
  // copying.  The copy will not include any old items or nodes so the
  // copy should be more compact if flushEvery is relatively large.