This PR follows on from @technosophos' pre-compilation work. That work highlighted a flaw in the loading pipeline: it was easiest to inject compilation at the routing table stage because that was the first point at which the modules.toml-based and bindle-based configurations converged. It would be desirable if we could converge them earlier, then put compilation in between that convergence point and the construction of the routing table.
After that it was all basically scope creep.
One of the difficulties left by the previous refactoring work - apart from late convergence - was a bunch of "handler configuration" types representing various stages of the pipeline: HandlerConfigurationSource, PreHandlerConfiguration, HandlerConfiguration, LoadedHandlerConfiguration and now WasmHandlerConfiguration. This was beyond confusing, but was both necessitated and exposed by having the pipeline stages run explicitly in main. This PR therefore moves the loader pipeline - bindle emplacement, reading into memory structures, and compilation - into a handler_loader module whose sole external touchpoint is a load_handlers method which encapsulates the whole pipeline. This reduces duplication across main and the test suite, and means readers who don't need to get into the loader pipeline can basically ignore all of this mess. Plus the mess itself is reduced and reorganised, so even readers who do need to get into the loader pipeline should have it a bit easier.
The upshot is that, although not a lot of stuff has changed, a lot of stuff has moved around. The main substantive change is the introduction of the compiler module and distinct compiled handler config type. This is now built in the loader pipeline, and the result is what gets fed into the routing table.
This PR follows on from @technosophos' pre-compilation work. That work highlighted a flaw in the loading pipeline: it was easiest to inject compilation at the routing table stage because that was the first point at which the
modules.toml
-based and bindle-based configurations converged. It would be desirable if we could converge them earlier, then put compilation in between that convergence point and the construction of the routing table.After that it was all basically scope creep.
One of the difficulties left by the previous refactoring work - apart from late convergence - was a bunch of "handler configuration" types representing various stages of the pipeline: HandlerConfigurationSource, PreHandlerConfiguration, HandlerConfiguration, LoadedHandlerConfiguration and now WasmHandlerConfiguration. This was beyond confusing, but was both necessitated and exposed by having the pipeline stages run explicitly in
main
. This PR therefore moves the loader pipeline - bindle emplacement, reading into memory structures, and compilation - into ahandler_loader
module whose sole external touchpoint is aload_handlers
method which encapsulates the whole pipeline. This reduces duplication acrossmain
and the test suite, and means readers who don't need to get into the loader pipeline can basically ignore all of this mess. Plus the mess itself is reduced and reorganised, so even readers who do need to get into the loader pipeline should have it a bit easier.The upshot is that, although not a lot of stuff has changed, a lot of stuff has moved around. The main substantive change is the introduction of the compiler module and distinct compiled handler config type. This is now built in the loader pipeline, and the result is what gets fed into the routing table.