cinemast / libjson-rpc-cpp

C++ framework for json-rpc (json remote procedure call)
MIT License
956 stars 319 forks source link

Split out connectors into separate libraries #224

Open cinemast opened 6 years ago

cinemast commented 6 years ago

I plan to split out the connectors into a separate (or multiple) repositor(y/ies).

Rationale:

cinemast commented 6 years ago

Before I do this, I would love some comments/insights from people already using this library in some way.

Please share your opinions and contribute to this thread.

@debris @chfast @mgorny @alexandre-poirot @bcachet @gogo40 @SE2Dev @MiLk @joegen @cblp @tvannoy @jdmichaud

cblp commented 6 years ago

I don't use it already

jdmichaud commented 6 years ago

Although it seems a good idea, it might be overkill. I mean, it's not like plugins in a complex application (e.g. sublime text). Connectors are really part of your library. I am curious as to why it took 3 days for your to perform your release. You have a CI with tests and coverage running, so anyone modifying a connector has to go through the whole CI and ensure everything works before being able to merge. That being said, I do agree your build infra could be simplified. Adding a connector is more complicated that it should be.

ghost commented 6 years ago

I agree that adding connectors should be easier. I also like the idea of being able to separate connectors out into separate packages, reducing the amount of extra dependencies. Separating the building and testing of connectors from the main library code would also be nice.

I think it's worth refactoring the library to make adding, building, and testing connectors easier and more modular. Separating them into a separate repository might be overkill, though; perhaps refactoring the build system and directory structure could accomplish the most important goals. I definitely think you should move forward with something that makes connectors easier to add and maintain, regardless of what the final solution is.

chfast commented 6 years ago

I agree it might be overkill, unless there is another package that can use connectors only. For my experience, maintaining 2 repos instead of 1 is more, not less work.

Are the connectors JSON-RPC agnostic? If yes, long term it may be useful to separate those.

joegen commented 6 years ago

I'd rather not. I agree that connectors are part of the library. I would advise that this project just convert the connectors to plugins and have separate release cycles. If the plugin is untested, then mark it as unstable. Another would be to use separate module directories for experimental, unstable and release connectors in the plugin hierarchy.

cinemast commented 6 years ago

Thanks for your input. I now agree two repositories might be an overkill. But I think each connector should be split out into a separate library (plug-in) and separate test suites (this would avoid a lot of #ifdefs). Additionally this would reduce the number of dependencies for the core project and external dependencies will only get pulled-in by each connector, not by the client/server library itself.

@chfast connectors are only not JSON-RPC agnostic (they do require the header interfaces), thanks for pointing that out.

So new build-outputs could be:

This allows a client/server to compile with only linking the dependencies that are actually needed:

g++ jsonrpcserver.cpp -ljsonrpc-server -ljsonrpc-connector-microhttpdserver
g++ jsonrpcclient.cpp -ljsonrpc-client -ljsonrpc-connector-curl

The source structure could than be the following:

cinemast commented 6 years ago

@jdmichaud about the 3 days.

It was mostly my own stupdity. I had an unreproducible dep: catch, the unit testing library. Additionally some connectors produced flaky tests under OSX and sometimes linux.

tvannoy commented 6 years ago

I really like the idea of having each connector be it's own library that can be linked in at compile-time.

I think the directory structure @cinemast just proposed would work well. Keeping the connectors in the main libjson-rpc-cpp repo but separating the connectors into their own libraries and test suites is currently my preferred solution.

mgorny commented 6 years ago

I'm not using this library myself anymore but I'm still maintaining the package in Gentoo. I'm happy with whatever works for you guys, as long as it can be built sanely and doesn't use horrible hacks ;-).

cinemast commented 5 years ago

The v2 branch contains the basic ideas.