-
Notifications
You must be signed in to change notification settings - Fork 3
Conversation
pkg/p2p/protobuf/protobuf.go
Outdated
"google.golang.org/protobuf/proto" | ||
) | ||
|
||
type IProtobuf interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets call this Encoding/Encoder
When users import this package they will have protobuf as pkg name already. So protobuf.Encoder/Encoding
makes more sense.
pkg/p2p/protobuf/protobuf.go
Outdated
out p2p.Stream | ||
} | ||
|
||
const delimitedReaderMaxSize = 1024 * 1024 //nolint:unused |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this
pkg/p2p/protobuf/protobuf.go
Outdated
|
||
const delimitedReaderMaxSize = 1024 * 1024 //nolint:unused | ||
|
||
func NewReaderWriter(in p2p.Stream, out p2p.Stream) IProtobuf { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the p2p.Stream is already duplex. It has Read and Write functions. So I dont think we need to pass separately.
Take a look at the test in msgpack. You can create two separate reader/writer and pass the duplex stream to test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
No description provided.