Skip to content
New issue

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

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

Already on GitHub? # to your account

Implement --ephemeral flag #81

Closed
ogenev opened this issue Aug 24, 2021 · 4 comments · Fixed by #364
Closed

Implement --ephemeral flag #81

ogenev opened this issue Aug 24, 2021 · 4 comments · Fixed by #364
Labels
good-first-issue Good for newcomers

Comments

@ogenev
Copy link
Member

ogenev commented Aug 24, 2021

When testing internal p2p network calls, we would like to be able to run multiple node instances simultaneously.
To avoid db folder collusion, we want to set unique db folder name for every node id.

As a default db folder, current implementation is using last 8 characters of base64 encoded Enr appended to the application name:
https://github.com/carver/trin/blob/d99232fd43c8dd0ec055150f382546cbba747bef/trin-core/src/utils.rs#L58

It will be better, if we change this to append the first few characters (instead of last 8) of the as-displayed node-id to the application name.

@ogenev ogenev added the good-first-issue Good for newcomers label Aug 24, 2021
@pipermerriam
Copy link
Member

When I was doing this in the python implementation I came up with the --ephemeral flag which took care of establishing a temporary directory in which all data would be housed. In most cases the desired shutdown behavior would be to cleanup this directory (delete it and all of its contents), though it would almost definitely be valuable to be able to retain this information. I would recommend potentially combining these two approaches ad doing this:

  • Implement --ephemeral mode that uses a temporary directory within XDG_CACHE_HOME, using the node-id prefix solution outlined here for determining the directory
  • Leave some sort of marker in that directory to signal when the directory was last used
  • Maybe make some form of automation that will cleanup this directory, or alternatively, make the --ephemeral flag automatically purge the oldest directories once there are too many.

@mrferris
Copy link
Collaborator

mrferris commented Sep 23, 2021

It will be better, if we change this to append the first few characters (instead of last 8)

What's the reasoning for using the first few instead of last 8?

Now that I ask I'm guessing it's because the beginning part is more easily comparable by eye, like with git commit hashes.

@ogenev
Copy link
Member Author

ogenev commented Sep 23, 2021

What's the reasoning for using the first few instead of last 8?

Now that I ask I'm guessing it's because the beginning part is more easily comparable by eye, like with git commit hashes.

Yeah, it is related to Jason's comment here.

@mrferris mrferris changed the title Use first few characters of the as-displayed node-id as default data folder suffix Implement --ephemeral flag Oct 14, 2021
@hmrtn
Copy link
Contributor

hmrtn commented Apr 21, 2022

PR #277 is ready for review 👍

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
good-first-issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants