55 "Database index ${space_id}.${type_id} does not exist, index size is ${index.size}",
56 (
"space_id",space_id)(
"type_id",type_id)(
"index.size",_index.size()) );
57 FC_ASSERT( _index[space_id].size() > type_id,
58 "Database index ${space_id}.${type_id} does not exist, space size is ${index[space_id].size}",
59 (
"space_id",space_id)(
"type_id",type_id)(
"index[space_id].size",_index[space_id].size()) );
60 const auto& tmp = _index[space_id][type_id];
62 "Database index ${space_id}.${type_id} has not been initialized",
63 (
"space_id",space_id)(
"type_id",type_id) );
69 "Database index ${space_id}.${type_id} does not exist, index size is ${index.size}",
70 (
"space_id",space_id)(
"type_id",type_id)(
"index.size",_index.size()) );
71 FC_ASSERT( _index[space_id].size() > type_id ,
72 "Database index ${space_id}.${type_id} does not exist, space size is ${index[space_id].size}",
73 (
"space_id",space_id)(
"type_id",type_id)(
"index[space_id].size",_index[space_id].size()) );
74 const auto& idx = _index[space_id][type_id];
76 "Database index ${space_id}.${type_id} has not been initialized",
77 (
"space_id",space_id)(
"type_id",type_id) );
83 const auto tmp_dir = _data_dir /
"object_database.tmp";
84 const auto old_dir = _data_dir /
"object_database.old";
85 const auto target_dir = _data_dir /
"object_database";
90 std::vector<fc::future<void>> tasks;
91 constexpr
size_t max_tasks = 200;
92 tasks.reserve(max_tasks);
94 auto push_task = [
this,&tasks,&tmp_dir](
size_t space,
size_t type ) {
95 if( _index[space][type] )
101 const auto spaces = _index.size();
102 for(
size_t space = 0; space < spaces; ++space )
105 const auto types = _index[space].size();
106 for(
size_t type = 0; type < types; ++type )
107 push_task( space, type );
109 for(
auto& task : tasks )
125 ilog(
"Wiping object database...");
127 ilog(
"Done wiping object database.");
132 _data_dir = data_dir;
133 if(
fc::exists( _data_dir /
"object_database" /
"lock" ) )
135 wlog(
"Ignoring locked object_database");
138 std::vector<fc::future<void>> tasks;
141 auto push_task = [
this,&tasks](
size_t space,
size_t type ) {
142 if( _index[space][type] )
148 ilog(
"Opening object database from ${d} ...", (
"d", data_dir));
149 const auto spaces = _index.size();
150 for(
size_t space = 0; space < spaces; ++space )
152 const auto types = _index[space].size();
153 for(
size_t type = 0; type < types; ++type )
154 push_task( space, type );
156 for(
auto& task : tasks )
158 ilog(
"Done opening object database." );
168 void object_database::save_undo(
const object& obj )
173 void object_database::save_undo_add(
const object& obj )
178 void object_database::save_undo_remove(
const object& obj)