re: #22218 (review)
Should we prefix this structure to avoid reviewers confusion with process specific contexts i.e NodeContext
, WalletContext
?
For e.g, IpcState
or LowLevelContext
?
It would help to know a specific example of how someone might interpret the current names and make a mistake or a wrong assumption, because I don’t understand what is less confusing about these suggestions.
I am using the word “context” in the same way in wallet, node, and IPC code. I think “context” is different than “state” because can “state” refer can refer to any type of data including temporary data, while “context” refers to longer lasting environmental data. Like data from a high-level outer environment that is is passed through low level code, but the low level code just treats as opaque. So “context” seems more appropriate than “state”. And LowLevelContext
seems incorrect because the context struct is holding higher-level bitcoin-specific data that the lower-level IPC code is treats as opaque. It is high level data, not low level data.
On namespaces, I am using a namespace structure that mirrors the directory structure, so code in src/interfaces/
is in the interfaces::
namespace, code in src/ipc/
is in the ipc::
namespace, code in src/ipc/capnp/
is in the ipc::capnp::
namespace, code in src/util/
is in the util::
namespace, etc. This means when you see a reference to interfaces::Node
in the code you can know where to find the definition and where it fits in the source code organization in a way that would not be possible if the class were called NodeInterface
. Similarly, the struct name ipc::Context
reveals a little more about that struct than the name IpcContext
would.