Bootstrap executes a cluster bootstrap on this node, using the given Servers as the configuration.
(servers ...*Server)
| 856 | // Bootstrap executes a cluster bootstrap on this node, using the given |
| 857 | // Servers as the configuration. |
| 858 | func (s *Store) Bootstrap(servers ...*Server) error { |
| 859 | raftServers := make([]raft.Server, len(servers)) |
| 860 | for i := range servers { |
| 861 | raftServers[i] = raft.Server{ |
| 862 | ID: raft.ServerID(servers[i].ID), |
| 863 | Address: raft.ServerAddress(servers[i].Addr), |
| 864 | } |
| 865 | } |
| 866 | fut := s.raft.BootstrapCluster(raft.Configuration{ |
| 867 | Servers: raftServers, |
| 868 | }) |
| 869 | return fut.Error() |
| 870 | } |
| 871 | |
| 872 | // getServerAddressByID returns the server address for the given server ID. |
| 873 | // It returns an error if the server ID is not found in the cluster configuration. |