예제 #1
0
//write a sequence of commands to stable storage
func (r *Replica) recordCommand(cmd *state.Command) {
	if !r.Durable {
		return
	}

	if cmd == nil {
		return
	}
	cmd.Marshal(io.Writer(r.StableStore))
}
예제 #2
0
func (r *Replica) send1b(msg *gpaxosproto.M_1b, w *bufio.Writer) {
	w.WriteByte(gpaxosproto.M1B)
	msg.Marshal(w)
	dummy := state.Command{0, 0, 0}
	for _, cid := range msg.Cstruct {
		if cmd, present := r.commands[cid]; present {
			cmd.Marshal(w)
		} else {
			dummy.Marshal(w)
		}
	}
	w.Flush()
}