Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Iowar/protobuf.0 #33

Merged
merged 5 commits into from
Oct 3, 2023
Merged

Iowar/protobuf.0 #33

merged 5 commits into from
Oct 3, 2023

Conversation

iowar
Copy link
Collaborator

@iowar iowar commented Oct 3, 2023

No description provided.

"google.golang.org/protobuf/proto"
)

type IProtobuf interface {
Copy link
Contributor

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.

out p2p.Stream
}

const delimitedReaderMaxSize = 1024 * 1024 //nolint:unused
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this


const delimitedReaderMaxSize = 1024 * 1024 //nolint:unused

func NewReaderWriter(in p2p.Stream, out p2p.Stream) IProtobuf {
Copy link
Contributor

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.

Copy link
Contributor

@aloknerurkar aloknerurkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@iowar iowar merged commit eb2120d into main Oct 3, 2023
1 check passed
@aloknerurkar aloknerurkar linked an issue Oct 3, 2023 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add protobuf encoding for msg handling
2 participants