mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
Add metadata-only counterparts to ::database, ::keyspace, and ::table. Apart from being metadata-only objects suitable for the coordinator, the new types are also type-erased and so they can be mocked without being linked to ::database and friends. We use a single abstract class to mediate between data_dictionary objects and the objects they represent (data_dictionary::impl). This makes the data_dictionary objects very lightweight - they only contain a pointer to the impl object (of which only one needs to be instantiated), and a reference to the object that is represented. This allows these objects to be easily passed by value. The abstraction is leaky: in one place it is outright breached with data_dictionary::database::real_database() that returns a ::database reference. This is used so that we can perform the transition incrementally. Another place is that one of the methods returns a secondary_index_manager, which in turn grants access to the real objects. This will be addressed later, probably by type erasing as well. This patch only contains the interface, and no implementation. It is somewhat messy since it mimics the years-old evolution of the real objects, but maybe it will be easier to improve it now.