MCPcopy
hub / github.com/cubefs/cubefs / createRaftServer

Method createRaftServer

authnode/server.go:160–184  ·  view source on GitHub ↗
(cfg *config.Config)

Source from the content-addressed store, hash-verified

158}
159
160func (m *Server) createRaftServer(cfg *config.Config) (err error) {
161 raftCfg := &raftstore.Config{
162 NodeID: m.id,
163 RaftPath: m.walDir,
164 NumOfLogsToRetain: m.retainLogs,
165 HeartbeatPort: m.config.heartbeatPort,
166 ReplicaPort: m.config.replicaPort,
167 TickInterval: m.tickInterval,
168 ElectionTick: m.electionTick,
169 }
170 if m.raftStore, err = raftstore.NewRaftStore(raftCfg, cfg); err != nil {
171 return errors.Trace(err, "NewRaftStore failed! id[%v] walPath[%v]", m.id, m.walDir)
172 }
173 m.initFsm()
174 partitionCfg := &raftstore.PartitionConfig{
175 ID: GroupID,
176 Peers: m.config.peers,
177 Applied: m.fsm.applied,
178 SM: m.fsm,
179 }
180 if m.partition, err = m.raftStore.CreatePartition(partitionCfg); err != nil {
181 return errors.Trace(err, "CreatePartition failed")
182 }
183 return
184}
185
186// Start starts a server
187func (m *Server) Start(cfg *config.Config) (err error) {

Callers 1

StartMethod · 0.95

Calls 4

initFsmMethod · 0.95
NewRaftStoreFunction · 0.92
TraceFunction · 0.92
CreatePartitionMethod · 0.65

Tested by

no test coverage detected