code: func (s *Store) Flush() error {
  	if s.readOnly {
  		return errors.New("readonly, so cannot Flush()")
  	}
  	if s.file == nil {
  		return errors.New("no file / in-memory only, so cannot Flush()")
  	}
  	coll := *(*map[string]*Collection)(atomic.LoadPointer(&s.coll))
  	rnls := map[string]*rootNodeLoc{}
  	cnames := collNames(coll)
  	for _, name := range cnames {
  		c := coll[name]
  		rnls[name] = c.rootAddRef()
  	}
  	defer func() {
  		for _, name := range cnames {
  			coll[name].rootDecRef(rnls[name])
  		}
  	}()
  	for _, name := range cnames {
  		if err := coll[name].write(rnls[name].root); err != nil {
  			return err
  		}
  	}
  	return s.writeRoots(rnls)
  }
docs: // Writes (appends) any dirty, unpersisted data to file.  As a
  // greater-window-of-data-loss versus higher-performance tradeoff,
  // consider having many mutations (Set()'s & Delete()'s) and then
  // have a less occasional Flush() instead of Flush()'ing after every
  // mutation.  Users may also wish to file.Sync() after a Flush() for
  // extra data-loss protection.