code: func (s *Store) setMetadata(id string, md map[string]string) error {
  	// Check local data first.
  	if func() bool {
  		s.metaMu.RLock()
  		defer s.metaMu.RUnlock()
  		if _, ok := s.meta[id]; ok {
  			for k, v := range md {
  				if s.meta[id][k] != v {
  					return false
  				}
  			}
  			return true
  		}
  		return false
  	}() {
  		// Local data is same as data being pushed in,
  		// nothing to do.
  		return nil
  	}
  
  	c, err := newMetadataSetCommand(id, md)
  	if err != nil {
  		return err
  	}
  	b, err := json.Marshal(c)
  	if err != nil {
  		return err
  	}
  	f := s.raft.Apply(b, s.ApplyTimeout)
  	if e := f.(raft.Future); e.Error() != nil {
  		if e.Error() == raft.ErrNotLeader {
  			return ErrNotLeader
  		}
  		return e.Error()
  	}
  
  	return f.Response().(*fsmGenericResponse).error
  }
docs: // setMetadata adds the metadata md to any existing metadata for
  // the given node ID.