drpc
drpc copied to clipboard
picobuf compatibility with regards to Marshal and Unmarshal.
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.