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

Implement secrets cp command #249

Open
tegefaulkes opened this issue Jul 11, 2024 · 3 comments
Open

Implement secrets cp command #249

tegefaulkes opened this issue Jul 11, 2024 · 3 comments
Assignees
Labels
development Standard development

Comments

@tegefaulkes
Copy link
Contributor

Specification

The secrets cp command is very similar to the secrets mv command. It will copy the provided paths to the provided destination.

  1. copy a file to a destination directory
  2. Multiple source paths can be specified. The last argument is the destination.
  3. Globing and wildcards are supported.
  4. Globing is supported for the destination. but only the last of the list is the destination. I say we don't support it.

There are two main differences between the mv command.

  1. The source files are left unchanged the copied. The Inode of the source and destination are different.
  2. The destination files are always created fresh and overwrite the destination.

So there are no subtle behaviours with the moving the file vs copying them between filesystems.

Additional context

Related #32

Tasks

  1. Implement a secrets cp command
  2. Supports copying a file from source path to destination.
  3. And take a variable number of source paths with the last path being the destination.
  4. Supports globing and wild cards.
  5. Supports copying directories with contents.
@tegefaulkes tegefaulkes added the development Standard development label Jul 11, 2024
Copy link

linear bot commented Jul 11, 2024

@CMCDragonkai
Copy link
Member

I want to point out that cp here is going to be one of the most complex commands and most used commands probably.

You have consider these scenarios:

  • cp from 1 vault to another vault (thankfully sharing all the same EFS root now)
  • cp from vault to real fs
  • cp from real fs to vault
  • cp from real fs to real fs?? If you imagine secrets cp ./a ./b could this just run as usual?

Then imagine that all works also recursively.

@tegefaulkes
Copy link
Contributor Author

Yeah, it's a complex and I've considered most of that already.

I think the most complex part of this is the recursive walking and globing of the file paths. I've already completed a utility for this in MatrixAI/Polykey#767 which works on real fs along with our fs. It supports the whole glob standard using minimatch which is what NPM uses to check glob patterns.

Along with that there's sending the file tree across the network so we can write it between the real FS locally and the node's efs. I'm half way through this now with MatrixAI/Polykey#774.

Besides that I still need to work out how I want to structure the RPC commands. If we say, want a specilized RPC for CP, or more generalised RPC for plumbing. I need to do some prototyping to get an idea of the constraints. The plumbing style might require the ability to lock and hold transactions between RPC calls.

@aryanjassal aryanjassal self-assigned this Oct 1, 2024
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

3 participants