the above code is from fdbcli.actor.cpp, setupNetwork() is tied to fdbclient/NativeAPI.h because of the IThreadPool. Any way to make Flow totally independent of fdb ?
I think a minimal FDB-less flow main method would look something like this:
ACTOR void runProgram();
ACTOR void setupMyProgram() {
// Begin some futures, start some tasks, etc.
// If your program is finite have it come back here
// to end the run loop when done
wait(runProgram());
g_network->stop();
}
int main() {
int randomSeed = platform::getRandomSeed();
g_random = new DeterministicRandom(randomSeed);
g_nondeterministic_random = new DeterministicRandom(platform::getRandomSeed());
g_network = newNet2( NetworkAddress(), false );
setupMyProgram();
g_network->run();
}
(There may be a bug in there or two; I don’t write a lot of flow code, tbh.) The key here is setting the random number generators and then beginning the global network.
I think this should all be do-able depending on only the contents of the flow subdirectory, which is supposed to be the “FDB-less” flow. That being said, it contains some data structures that maybe more useful for FoundationDB than for the average project. The error definitions also might seem suspiciously like they are more about the kinds of errors a distributed transactional database might encounter than the errors defined in most programming languages.