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

Use tar archival format to transfer file tree structure and data between Polykey vaults and user file systems #811

Open
aryanjassal opened this issue Sep 23, 2024 · 4 comments
Assignees
Labels
development Standard development

Comments

@aryanjassal
Copy link
Contributor

aryanjassal commented Sep 23, 2024

Specification

There are times when we need to transfer the secrets from a vault to either another vault or the user's file system. Sometimes, only one secret needs to be transferred. Other times, we need to transfer multiple file trees including their directory structure.

As all the vaults are stored on the same encrypted file system (efs), to transfer file trees between vaults, we only need to use regular file copying/moving operations on file systems; something along the lines of fs.promises.copy() should work well to transfer secrets between vaults.

However, doing this between the vaults and the user's file system is not as straightforward. To efficiently transmit the file tree, we will be using an archival format like tar. The tar archival format is inherently streamable, and can be used to zip the file tree into a single file, which can then be transmitted over a RPC call, then be unpacked on the client, effectively transferring the file structure to the user's file system. Of course, we can also compress the resulting file, but we won't get into that quite yet.

Additional context

Tasks

  1. Make an RPC handler responsible of copying/moving file tree.
  2. To move file tree between vaults, just use the fs operations. Multiple locks might be required if transferring between multiple vaults.
  3. To move file tree between vaults and file systems, make a tarball and stream it over RPC instead.
@aryanjassal aryanjassal added the development Standard development label Sep 23, 2024
@aryanjassal aryanjassal self-assigned this Sep 23, 2024
Copy link
Contributor Author

aryanjassal commented Oct 8, 2024

After taking a look at matrixai/js-virtualtar, I have realised that significant work still needs to go into the repo before it would be ready to be used within the Polykey ecosystem. This alone might take a cycle or two. I will need to play around with it before starting development on it.

@tegefaulkes
Copy link
Contributor

What needs to be done before it's ready to be used?

@aryanjassal
Copy link
Contributor Author

I haven't taken an in-depth dive into the requirements, just a brief skim-through over the code. As such, I'm not sure what exactly needs to be done for that. I'll need to see what it already has and what still needs to be done when I start working on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Standard development
Development

No branches or pull requests

2 participants