我想问是否有人知道我需要在.proto文件中使用的格式来保存Map [uint64] * Struct。
我已经尝试过了:
enum ProgressType {
ProgressStateProbe =0;
ProgressStateReplicate =1;
ProgressStateSnapshot =2;
}
message Progress{
required uint64 match = 1 [(gogoproto.nullable) = false];
required uint64 next = 2 [(gogoproto.nullable) = false];
required ProgressType type = 3 [(gogoproto.nullable) = false];
required bool paused = 4 [(gogoproto.nullable) = false];
required uint64 pendingsnapshot = 5 [(gogoproto.nullable) = false];
}
message Message {
repeated Progress members = 15 [(gogoproto.nullable) = false];
repeated Progress learners = 16 [(gogoproto.nullable) = false];
}
现在在我的Go代码中:
m.Members = members //members are of type Map[uint64]*Progress
m.Learners = learners //learners are of type Map[uint64]*Progress
我收到以下错误消息:无法将成员(类型map [uint64] * Progress)用作类型[] raftpb.Progress,在分配中