Change node handling of locations for persisting data #131
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR changes the default locations where node persists files - the workspace, peer db and function db. Motivation for this is to ease the use of nodes when starting them directly. Before, if you'd start a head and worker node directly, you'd need to specify the paths directly else the nodes would trample each other's files (e.g. use
--peer-db worker-peerdb --function-db worker-function-db
).Changes are not completely backwards compatible.
We differentiate three scenarios.
User specifies workspace, peer db or function db paths directly via CLI flags - in this case, we use those
User starts the node and specifies a private key.
In this case, it will store its files in
.b7s_<peer-id>
directory, in appropriate directories; for example:User starts the node without a private key
In this case, node has a random identity. IMO, this is mostly used for testing and transient stuff anyways, so it's somewhat expected that the DBs and workspace is transient too. In this case, a new temporary directory will be created where files will be stored, e.g.
/tmp/.b7s_2379210846
.I think these changes allow for more control over the node behavior and increase usability.
Also, fixed one bug that was introduced where we didn't detect if both
runtime-cli
andruntime-path
CLI arguments were empty. Such a worker node would fail all executions and we should detect such an invalid configuration on boot.WDYT?