Ejemplo n.º 1
0
func toEntry2(ent4 *etcd4pb.LogEntry, raftMap map[string]uint64) (*raftpb.Entry, error) {
	cmd4, err := NewCommand4(ent4.GetCommandName(), ent4.GetCommand(), raftMap)
	if err != nil {
		return nil, err
	}

	data, err := cmd4.Data2()
	if err != nil {
		return nil, err
	}

	ent2 := raftpb.Entry{
		Term:  ent4.GetTerm() + termOffset4to2,
		Index: ent4.GetIndex(),
		Type:  cmd4.Type2(),
		Data:  data,
	}

	return &ent2, nil
}
Ejemplo n.º 2
0
func toEntry5(ent4 *etcd4pb.LogEntry, raftMap map[string]uint64) (*raftpb.Entry, error) {
	cmd4, err := NewCommand4(ent4.GetCommandName(), ent4.GetCommand(), raftMap)
	if err != nil {
		return nil, err
	}

	data, err := cmd4.Data5()
	if err != nil {
		return nil, err
	}

	ent5 := raftpb.Entry{
		Term:  ent4.GetTerm(),
		Index: ent4.GetIndex(),
		Type:  cmd4.Type5(),
		Data:  data,
	}

	log.Printf("%d: %s -> %s", ent5.Index, ent4.GetCommandName(), ent5.Type)

	return &ent5, nil
}