This is an example of how to use the snapshot capabilities in Metall.
#include <string>
const std::string snapshot_dir_prefix(
"/tmp/snapshot-");
const std::string snapshot_name0 = snapshot_dir_prefix +
"ver0";
const std::string snapshot_name1 = snapshot_dir_prefix +
"ver1";
{
int *a =
manager.construct<
int>(metall::unique_instance)(0);
manager.snapshot(snapshot_name0.c_str());
*a = 1;
manager.snapshot(snapshot_name1.c_str());
*a = 2;
}
int *a =
manager.find<
int>(metall::unique_instance).first;
std::cout << *a << std::endl;
} else {
std::cerr << snapshot_name0 << " is inconsistent" << std::endl;
}
int *a =
manager.find<
int>(metall::unique_instance).first;
std::cout << *a << std::endl;
} else {
std::cerr << snapshot_name1 << " is inconsistent" << std::endl;
}
int *a =
manager.find<
int>(metall::unique_instance).first;
std::cout << *a << std::endl;
} else {
std::cerr << master_path << " is inconsistent" << std::endl;
}
return 0;
}
int main()
Definition: jgraph.cpp:24