Well, the spacing was better in my code. I have written a utility program to create the Master Control Program data, mcpmainbuild and all the other header and class files. The program just creates a new file, MCP.xml, with all of the text for the name for the program and then ten random newly minted UUID values. These will be shared with the other running copies. This allows for a cheap and easy proof of work (POW). Well here is the code, again the editor played havoc with the formatting.
int main() { // Print a header of execution out auto result = std::time(nullptr); std::cout << "Master Control Build Program " << std::endl; std::cout << "Local Time: " << std::asctime(std::localtime(&result)) << std::endl; // Define our tree of data pt::ptree tree; // Create program information tree.put("mcp", "mcpmain"); tree.put("mcp.programtext", "Master Control Program"); tree.put("mcp.version", "0.0.1"); // Create ten UUID in the file boost::uuids::random_generator generator; boost::uuids::uuid uuid1 = generator(); tree.put("UUID.0", uuid1); uuid1 = generator(); tree.put("UUID.1", uuid1); uuid1 = generator(); tree.put("UUID.2", uuid1); uuid1 = generator(); tree.put("UUID.3", uuid1); uuid1 = generator(); tree.put("UUID.4", uuid1); uuid1 = generator(); tree.put("UUID.5", uuid1); uuid1 = generator(); tree.put("UUID.6", uuid1); uuid1 = generator(); tree.put("UUID.7", uuid1); uuid1 = generator(); tree.put("UUID.8", uuid1); uuid1 = generator(); tree.put("UUID.9", uuid1); pt::write_xml("MCP.xml", tree); result = std::time(nullptr); std::cout << "Exit: Master Control Build Program " << std::endl; std::cout << "Local Time: " << std::asctime(std::localtime(&result)) << std::endl; // Leave politely return 0; }
This program just declares a tree using the boost library cool code. It then builds some data in the tree. Lastly, it just writes out the UUID values. Nothing interesting really, but we need to start somewhere.
I will add another table creation for the base value of blockchain file and the run data that is different by instance. I have decided for now to allow up to ten instances of this new blockchain code. The first and master instance is zero and must always be running. It is the one that panic calls will be sent to. If this zero instance does not reply then the blockchain instances panic and shutdown. It is easier to have one instance, I think, play the primary while letting most functions be shared and passed around.
We are starting!
Once I get further we will start referring to GitHub code and not posting it here.
The run looks like this:
Running /home/ec2-user/environment/mcpbuildmain.cpp Master Control Build Program Local Time: Fri May 4 05:08:22 2018 Exit: Master Control Build Program Local Time: Fri May 4 05:08:22 2018 Process exited with code: 0