rom-rb / rom

Data mapping and persistence toolkit for Ruby
https://rom-rb.org
MIT License
2.07k stars 161 forks source link

Make relation registry lazy #643

Closed solnic closed 3 years ago

solnic commented 3 years ago

This is a huge step towards lazy-loadable rom runtime and it makes it possible to remove the remainder of global class-level variables that are still used by the setup.

There are a bunch of silly workarounds in rom/compat that will be removed eventually once everything is handled by the new resolver. This includes schemas which are still waiting to be refactored, and that's the next step of this setup rework effort.

This particular PR makes relations lazy-loadable as a result of introducing Resolver object. One practical outcome is that loading a rom container takes milliseconds now because relations and schemas are not loaded by default.

The resolver itself is going to be simplified eventually, because now it handles all component types and due to various inconsistencies there's a little bit of extra complexity. All of this will go away in the upcoming refactorings.