func (w *WAL) SaveInfo(i *raftpb.Info) error { b, err := i.Marshal() if err != nil { panic(err) } rec := &walpb.Record{Type: infoType, Data: b} return w.encoder.encode(rec) }
func (w *WAL) SaveInfo(i *raftpb.Info) error { log.Printf("path=%s wal.saveInfo id=%d", w.f.Name(), i.Id) b, err := i.Marshal() if err != nil { panic(err) } rec := &walpb.Record{Type: infoType, Data: b} return w.encoder.encode(rec) }
func mustUnmarshalInfo(d []byte) raftpb.Info { var i raftpb.Info if err := i.Unmarshal(d); err != nil { // crc matched, but we cannot unmarshal the struct?! // we must be the next winner of the $1B lottery. panic(err) } return i }