Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

picobuf compatibility with regards to Marshal and Unmarshal. #53

Open
Tracked by #23
egonelbre opened this issue Jul 19, 2024 · 0 comments
Open
Tracked by #23

picobuf compatibility with regards to Marshal and Unmarshal. #53

egonelbre opened this issue Jul 19, 2024 · 0 comments

Comments

@egonelbre
Copy link
Member

egonelbre commented Jul 19, 2024

At the moment picobuf.Marshal and picobuf.Unmarshal expect messages of type picobuf.Message, which has some specific methods. However, drpc endpoints create typedefinitions such as:

type drpcEncoding_File_certificate_proto struct{}

func (drpcEncoding_File_certificate_proto) Marshal(msg drpc.Message) ([]byte, error) {
	return picobuf.Marshal(msg)
}

func (drpcEncoding_File_certificate_proto) Unmarshal(buf []byte, msg drpc.Message) error {
	return picobuf.Unmarshal(buf, msg)
}

func (c *drpcCertificatesClient) Sign(ctx context.Context, in *SigningRequest) (*SigningResponse, error) {
	out := new(SigningResponse)
	err := c.cc.Invoke(ctx, "/node.Certificates/Sign", drpcEncoding_File_certificate_proto{}, in, out)
	if err != nil {
		return nil, err
	}
	return out, nil
}

I would expect the Invoke to register with a more specific message such as picobuf.Message instead of relying on drpc.Message and expecting that Marshal and Unmarshal don't have additional constraints.

@egonelbre egonelbre transferred this issue from storj/picobuf Jul 19, 2024
@egonelbre egonelbre changed the title drpc compatibility with regards to Marshal and Unmarshal. picobuf compatibility with regards to Marshal and Unmarshal. Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant