CCF
CCF copied to clipboard
Allow JS runtime options to be set individually
We currently have a single proposal to set JS runtime options, and all options must be provided. I think it would be simpler if this took a partial object, and only updated the fields it was provided. On the C++ side, this would mean setting default values at struct construction time, so that we have sane defaults whether-or-not there is a governance-controlled value in the KV.
Motivation is from adding another option here (max_cached_interpreters), and realising how much code is involved in configuring that, even to restore it to a default.
@lynshi brought up the possibility of having patch-style actions when we discussed idempotent actions at first https://github.com/microsoft/CCF/discussions/2169#discussioncomment-339465
For the current use case, we may just set it in a separate proposal. Not written above but I meant to:
There's also some duplication of default values. I think that could be minimised by pushing stuff through C++, materialising default values, and similar. It's all in my head, and unimportant, and I'm sure I won't forget it...
+1 for materialising default values in the KV, which I think can be done as a standalone change before adding a patch mechanism to governance (which may be of interest to applications too, in fact).
Added to programmability API in #6241, but not present in js_generic.
Brain dump: this can be a new action in the sample constitution, which calls the existing patch logic internally.
This is now supported for user-space applications, which is the main recommended way of implementing JS endpoints #6201.