code: func (p *Process) Restore(r io.Reader) error {
  	p.mtx.Lock()
  	defer p.mtx.Unlock()
  
  	logger := p.Logger.New("fn", "Restore")
  	logger.Info("begin restore")
  
  	// Stop if running.
  	if p.running {
  		logger.Info("stopping process")
  		if err := p.stop(); err != nil {
  			logger.Error("error stopping process", "err", err)
  			return err
  		}
  	}
  
  	// Create dump file in data directory.
  	logger.Info("copying dump.rdb")
  	if err := func() error {
  		f, err := os.Create(filepath.Join(p.DataDir, "dump.rdb"))
  		if err != nil {
  			logger.Error("error creating dump file", "err", err)
  			return err
  		}
  		defer f.Close()
  
  		// Copy from reader to dump file.
  		n, err := io.Copy(f, r)
  		if err != nil {
  			logger.Error("error creating dump file", "err", err)
  			return err
  		}
  		logger.Info("copy completed", "n", n)
  
  		return nil
  	}(); err != nil {
  		return err
  	}
  
  	// Restart process.
  	if err := p.start(); err != nil {
  		logger.Error("error restarting process", "err", err)
  		return err
  	}
  
  	return nil
  }
docs: // Restore stops the process, copies an RDB from r, and restarts the process.
  // Redis automatically handles recovery when there's a dump.rdb file present.