Branch data Line data Source code
1 : : #include <mutable/catalog/TableFactory.hpp> 2 : : 3 : : #include <mutable/catalog/Catalog.hpp> 4 : : 5 : : 6 : : using namespace m; 7 : : 8 : : 9 : : namespace { 10 : : 11 : : 12 : : __attribute__((constructor(201))) 13 : 1 : void add_table_args() 14 : : { 15 : 1 : Catalog &C = Catalog::Get(); 16 : : 17 : : /*----- Command-line arguments -----*/ 18 : : // TODO add "multi-versioning" to default when multi-versioning support is complete. 19 : 1 : C.arg_parser().add<std::vector<std::string_view>>( 20 : : /* group= */ "TableFactory", 21 : : /* short= */ nullptr, 22 : : /* long= */ "--table-properties", 23 : : /* description= */ "enable multiple table properties.", 24 : 0 : /* callback= */ [](std::vector<std::string_view> properties) { 25 : 0 : Catalog &C = Catalog::Get(); 26 : 0 : std::unique_ptr<TableFactory> table_factory = std::make_unique<ConcreteTableFactory>(); 27 [ # # ]: 0 : for (auto property : properties) 28 [ # # # # ]: 0 : table_factory = C.apply_table_property(C.pool(property), std::move(table_factory)); 29 : 0 : C.table_factory(std::move(table_factory)); 30 : 0 : } 31 : : ); 32 : 1 : } 33 : : 34 : : 35 : : } 36 : : 37 : : 38 : : __attribute__((constructor(202))) 39 : 1 : void register_table_factories() 40 : : { 41 : 1 : Catalog &C = Catalog::Get(); 42 : : 43 : 1 : std::unique_ptr<TableFactory> table_factory = std::make_unique<ConcreteTableFactory>(); 44 [ + - ]: 1 : C.table_factory(std::move(table_factory)); 45 : : 46 [ + - - + ]: 1 : C.register_table_property<ConcreteTableFactoryDecorator<MultiVersioningTable>>(C.pool("multi-versioning"), 47 : : "enables multi-versioning"); 48 : 1 : }