As the graph is built out, a lot more can happen during runs, and restarting with tweaks to the search algorithm, queue, or whatever get more painful as we retrod ground we've already covered. Much of the work is reusable--states always lead to the same states, so there ought to be a way to resume where we left off.
Interrupt: We could direct the program to stop and save its state (intercept ctrl-c for example). Mainly what we need is to save the contents of the heap, so that when we resume we can recreate it. The queue and state dbs are fine as-is (as long as they are fully written to disk, which probably requires enabling WAL or having some other flush function).
Crash: If we can't save the heap, we could try to recreate it by scanning the state db: any state with no next entry has not been done, and if that state is not in the queue db, then it must go in the heap. Alternatively, insert such a state into the queue db, and then create a heap by retrieving from the queue db. This would require WAL enabled as well.
Any changes to the graph would require restarting from scratch. We could add a hash or an id of the build state and save that as a db global or something. If it doesn't match the binary, then we exit with an error (for example, telling us to run with a commandline flag to clean the db directory).
As the graph is built out, a lot more can happen during runs, and restarting with tweaks to the search algorithm, queue, or whatever get more painful as we retrod ground we've already covered. Much of the work is reusable--states always lead to the same states, so there ought to be a way to resume where we left off.
next
entry has not been done, and if that state is not in the queue db, then it must go in the heap. Alternatively, insert such a state into the queue db, and then create a heap by retrieving from the queue db. This would require WAL enabled as well.Any changes to the graph would require restarting from scratch. We could add a hash or an id of the build state and save that as a db global or something. If it doesn't match the binary, then we exit with an error (for example, telling us to run with a commandline flag to clean the db directory).