示例#1
0
文件: wal.go 项目: digideskio/etcd
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)
}
示例#2
0
文件: wal.go 项目: leandroferro/etcd
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)
}
示例#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
}