Skip to content

Commit

Permalink
cluster/store: add Bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
gernest committed Mar 1, 2024
1 parent 376f350 commit 7da2b07
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions internal/cluster/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,22 @@ func (s *Store) Open(ctx context.Context) error {
return nil
}

// Bootstrap executes a cluster bootstrap on this node, using the given
// Servers as the configuration.
func (s *Store) Bootstrap(ctx context.Context, ls *v1.Server_List) error {
raftServers := make([]raft.Server, len(ls.Items))
for i := range ls.Items {
raftServers[i] = raft.Server{
ID: raft.ServerID(ls.Items[i].Id),
Address: raft.ServerAddress(ls.Items[i].Addr),
}
}
s.raft.BootstrapCluster(raft.Configuration{
Servers: raftServers,
})
return nil
}

func (s *Store) Status() (*v1.Status_Store, error) {
return &v1.Status_Store{}, nil
}
Expand Down

0 comments on commit 7da2b07

Please sign in to comment.