code: func (s *Store) Backup(leader bool, fmt BackupFormat, dst io.Writer) error {
  	s.restoreMu.RLock()
  	defer s.restoreMu.RUnlock()
  
  	if leader && s.raft.State() != raft.Leader {
  		return ErrNotLeader
  	}
  
  	var err error
  	if fmt == BackupBinary {
  		err = s.database(leader, dst)
  		if err != nil {
  			return err
  		}
  	} else if fmt == BackupSQL {
  		if err := s.dbConn.Dump(dst); err != nil {
  			return err
  		}
  	} else {
  		return ErrInvalidBackupFormat
  	}
  	stats.Add(numBackups, 1)
  	return nil
  }
docs: // Backup writes a snapshot of the underlying database to dst
  //
  // If leader is true, this operation is performed with a read consistency
  // level equivalent to "weak". Otherwise no guarantees are made about the
  // read consistency level.