18 std::map<Table_Id, Table_Id> table_map;
21 for (
const auto &[tid, tname]: db.
get_tables())
24 table_map[tid] = mapped_tid;
32 std::map<Table_Id, std::map<Field_Id, Field_Id>> field_maps;
34 for (
const auto &[tid, tname]: db.
get_tables())
37 for (
const auto &[fid, fname]: db.
get_fields(tid))
43 field_maps[tid][fid] = mapped_fid;
45 writable.
add_field(table_map[tid], fname, type);
56 for (
const auto &[tid, tname]: db.
get_tables())
60 for (
Record_Id record_id{0}; record_id < table_size;)
62 while (record_id < table_size && !db.
is_used(tid, record_id))
69 record_id + size < table_size &&
70 db.
is_used(tid, record_id + size)
79 record_id = record_id + size;
83 for (
const auto &[fid, fname]: db.
get_fields(tid))
85 for (
Record_Id record_id{0}; record_id < table_size; ++record_id)
89 Table_Id mapped_tid = table_map[tid];
90 Field_Id mapped_fid = field_maps[tid][fid];
97 #define TYPE_MACRO(type, return_type, type_id, R, W)\
98 case Type::Type_Id::type_id:\
99 writable.update_##type_id\
101 mapped_tid, record_id, mapped_fid, db.get_##type_id(tid, record_id, fid)\
116 for (
const auto &[tid, tname]: db.
get_tables())
121 for (
Record_Id record_id{0}; record_id < table_size;)
125 record_id < table_size &&
126 !freedom_keeper.
is_used(record_id)
136 record_id + size < table_size &&
137 freedom_keeper.
is_used(record_id + size)
147 for (
const auto &[fid, fname]: db.
get_fields(tid))
154 #define TYPE_MACRO(type, return_type, type_id, R, W)\
155 case Type::Type_Id::type_id:\
157 writable.update_vector_##type_id\
180 for (
const auto &[fid, fname]: db.
get_fields(tid))
187 #define TYPE_MACRO(type, return_type, type_id, R, W)\
188 case Type::Type_Id::type_id:\
190 writable.update_##type_id\
195 db.get_##type_id(tid, record_id, fid)\
204 record_id = record_id + size;
Record_Id get_size() const
bool is_used(Record_Id index) const
virtual const Type & get_field_type(Table_Id table_id, Field_Id field_id) const =0
Record_Id get_size(Table_Id table_id) const
bool is_used(Table_Id table_id, Record_Id record_id) const
virtual const std::map< Field_Id, std::string > & get_fields(Table_Id table_id) const =0
virtual const std::map< Table_Id, std::string > & get_tables() const =0
virtual const Freedom_Keeper & get_freedom(Table_Id table_id) const =0
void raw_play_until_checkpoint(Writable &writable)
static Type reference(Table_Id table_id)
Table_Id get_table_id() const
Type_Id get_type_id() const
Superclass with all joedb journal event listeners as virtual functions.
virtual void insert_vector(Table_Id table_id, Record_Id record_id, size_t size)=0
virtual void insert_into(Table_Id table_id, Record_Id record_id)
virtual void create_table(const std::string &name)
virtual void soft_checkpoint()
virtual void add_field(Table_Id table_id, const std::string &name, Type type)
void pack(Readonly_Journal &input_journal, Writable &writable)
void dump(const Readable &db, Writable &writable, bool schema_only)
void dump_data(const Readable &db, Writable &writable)