Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change node handling of locations for persisting data #131

Merged
merged 2 commits into from
Jan 23, 2024

Conversation

Maelkum
Copy link
Collaborator

@Maelkum Maelkum commented Jan 18, 2024

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.

  1. User specifies workspace, peer db or function db paths directly via CLI flags - in this case, we use those

  2. 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:

    • .b7s_12D3KooWHUeKgXT4aj8oKvtwovVMki468igSsa5F8izZY3U5UyMD/workspace
    • .b7s_12D3KooWHUeKgXT4aj8oKvtwovVMki468igSsa5F8izZY3U5UyMD/peer-db
    • .b7s_12D3KooWHUeKgXT4aj8oKvtwovVMki468igSsa5F8izZY3U5UyMD/function-db
  3. 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 and runtime-path CLI arguments were empty. Such a worker node would fail all executions and we should detect such an invalid configuration on boot.

WDYT?

@Maelkum Maelkum requested a review from dmikey January 18, 2024 20:41
@Maelkum Maelkum self-assigned this Jan 18, 2024
@dmikey
Copy link
Contributor

dmikey commented Jan 23, 2024

I like this rearrangement. Makes it much easier to run multiple nodes on bare env.

@dmikey dmikey merged commit bab756c into main Jan 23, 2024
2 checks passed
@dmikey dmikey deleted the change-default-db-locations branch January 23, 2024 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants