Skip to content

grpc: Remove embedded UnimplementedServiceServer structures

Patrick Steinhardt requested to merge pks-go-rpc-unimplemented into master

In order to allow forwards-compatibility of service implementations, gRPC generates an UnimplementedServiceServer structure implementing all of the service's RPCs. As a result, if this structure is embedded into the real service implementation, adding new RPCs to the Protobuf definition won't break compilation. The implementation will simply get a default implementation which just returns an "Unimplemented" error.

In the context of Gitaly, it doesn't really make a lot of sense to use this feature. We control all Protobuf declarations anyway and our service implementations currently implement all of the declared RPCs. Any function that is still declared but not implemented should thus be considered a bug, but it'd actually be a bug that's harder to spot due to embedding the UnimplementedServiceServer. The compiler certainly wouldn't complain as the service's interface is satisfied.

So let's just remove these embedded structures altogether and let the compiler help us in satisfying the Protobuf interfaces.

Merge request reports