Beispiel #1
0
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)
}
Beispiel #2
0
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)
}
Beispiel #3
0
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
}