connect-go icon indicating copy to clipboard operation
connect-go copied to clipboard

Compatibility layer to work with existing gRPC code

Open jhump opened this issue 3 years ago • 0 comments

gRPC has been around for quite a while now. Lots of organizations have lots of existing code using the client stubs and server interfaces generated by protoc-gen-go-grpc (or its predecessor, the earlier version protoc-gen-go).

This request is for a compatibility layer, that would allow gRPC client stubs to be wired up to a Connect client and gRPC server implementations to be wired up to a Connect server. This would allow an organization to migrate to Connect without having to re-write much of their codebase to refer to new types and interfaces.

This basically boils down to adapting grpc.ClientConnInterface and grpc.ServiceRegistrar to Connect's APIs. Looking at the split of generated code vs. library code with connect, and how generics are used in the library code, it looks like this might require additional generated code. (Though this could possibly be minimized with some additions to both existing generated and library code -- like introduction of a layer that is more generic and transport-agnostic?)

Such a compatibility layer would likely need to be in its own Go module (maybe separate repo?) so as not to pull the gRPC runtime packages into Connect's dependencies.

jhump avatar Jul 28 '22 22:07 jhump