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 · 1 comment
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.
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

1 participant