talent-plan/tinykv

peerStorage and storage interface

Closed this issue · 1 comments

Hi, I am new to golang. In project2, the peerStorage implements the Storage interface. However, in the storage interface, the Append function's signature is like this Append(entries []eraftpb.Entry). but the peerStorage's Append function is like this Append(entries []eraftpb.Entry, raftWB *engine_util.WriteBatch). I know golang does not support function overloading. So how do we deal with this?

The interface Storage deos not have method Append. I guess you mean that the struct MemoryStorage has a method with the signature Append(entries []pb.Entry) error and the struct PeerStorage has a method with the signature Append(entries []eraftpb.Entry, raftWB *engine_util.WriteBatch) error. They belong to the structs themselves, not the interface.