re: #19160 (review)
I think this comment can be improved:
- “Init interface providing access to other interfaces”, this should underscores access is provided across process boundaries.
Could you be specific about the change you would suggest here? The next sentence after the quote in your comment says how the interface is used connecting to another process, so I don’t know how I would emphasize the point more.
Also, every interface in src/interfaces/ is called across process boundaries. From https://github.com/bitcoin/bitcoin/blob/master/doc/developer-notes.md#internal-interface-guidelines: “Interface classes are written in a particular style so node, wallet, and GUI code doesn’t need to run in the same process”
Also, there is nothing special about the Init interface returning pointers to other interfaces. Node and Wallet and Chain interface methods all return pointers to other interfaces as well.
The only special thing about the Init interface is that it is the first interface pointer you get access to when you make a connection to a process. It’s the initial interface.
- “providing virtual methods that can be called from other processes”, AFAIU, this is confusing as interfaces::Init provides both process control method (e.g makeEchoIpc(), in the futuremakeWallet) and an interfaceIpcProtocolwrapping a libmultiprocessProxyClient/ProxyServer. I would be better to document that both control and data exchange functions are supported by interfaces::Init
Could you be more specific about what should be documented? This comment seems to be referring to LocalInit methods not Init methods. The Init methods are makeEcho, makeNode, makeChain, and makeWalletClient. These are all methods called to get access to other interfaces.
LocalInit is a different class from Init. It’s a connector between src/init code and IPC code. It could be broken up or renamed, but I’d be reluctant to make changes without knowing specific design goals.
Overall, I still think Init/LocalInit are loosely-defining names. The names doesn’t indicate what is initiated nor who is local and remote. IPCSupervisor/IPCWrapper as suggested would be better.
There is no special supervision or wrapping happening in the Init interface that isn’t happening in all the other interfaces (Node/Wallet/Chain) when IPC is enabled. The only unique thing about the Init interface is that it is the first, initial interface that a process gets access to before it can access other interfaces it actually wants to use. Other reasonable names for interfaces::Init might be interfaces::Initial or interfaces::Factory or interfaces::Process or interfaces::Global.
The LocalInit class is different than the Init class. For one thing it is an actual class with implemented methods and not a pure interface. Maybe it could be called interfaces::InitImpl or interfaces::Startup or interfaces::LocalProcess. Maybe it could be structured differently or not inherit from Init.
I do think neither Init nor LocalInit classes should contain IPC in their names, because it would be misleading in places where they are not implemented to use IPC. The LocalInit class is used in startup in code in src/init, src/wallet/, and src/qt/ to create initial interfaces pointers whether or not there is any IPC. In bitcoind and bitcoin-qt binaries where there is no IPC, the LocalInit implementations do not contain IPC code and they don’t do any supervision or wrapping, so naming these IPCSupervisor/IPCWrapper would be more misleading than illuminating.