func mustUnmarshalState(d []byte) raftpb.State { var s raftpb.State if err := s.Unmarshal(d); err != nil { panic(err) } return s }
func (w *WAL) SaveState(s *raftpb.State) error { log.Printf("path=%s wal.saveState state=\"%+v\"", w.f.Name(), s) b, err := s.Marshal() if err != nil { panic(err) } rec := &walpb.Record{Type: stateType, Data: b} return w.encoder.encode(rec) }