I'd like to new()
up objects that I can interact with. D-BUS provides this functionality. Is there a way to do this with gRPC?
I could get a similar result by defining a service that I can use to new up objects, returning an ID, which I pass to other service methods. On the server side, I'd correlate the ID with the internal list of instances to invoke. I was just wondering if there was first-class support for something like this in gRPC.
No, gRPC does not have first-class support for object references. D-Bus is an object-oriented protocol (for example, the first step is to look up objects on the bus) whereas gRPC is more plain functions with message-passing. gRPC also does not have first-class concepts for properties and interfaces, as well.
Most object-oriented protocols that go over networks, like CORBA and DCOM, have died out because they were very complex and tend to encourage slow application designs. Local-only IPC systems can be object oriented with fewer problems as local IPC is more reliable with lower latency.
Depending on what you are doing, using a streaming call in gRPC can be useful for defining the lifetime of a server-side object. For example, you can use a stream as a transaction and use messages on that stream for the parts of the transaction. If the client crashes, the stream will naturally be killed which can release any resources for the transaction. That doesn't work well for long-lived objects.