zhaofengli / attic

Multi-tenant Nix Binary Cache
https://docs.attic.rs
Other
1.04k stars 79 forks source link

attic push: option to read paths from stdin #175

Closed jzbor closed 1 month ago

jzbor commented 1 month ago

Currently tools like attic-action are limited in how many paths can be pushed at a time because of a limit in the command line length. It would be grad if attic could read the paths that it should push from stdin.

adamcstephens commented 1 month ago

I’ve worked around this by piping to xargs which will chunk according to the argument limit.

That said, I agree we should be able to pipe directly to attic push.

jzbor commented 1 month ago

The issue with chunking is that it greatly slows down the upload process, especially if most paths are already known.

jzbor commented 1 month ago

If this is a desired feature I would gladly open up a PR for it, should not take a lot of code anyway...

jzbor commented 1 month ago

Just created a pull request (#176) and later noticed that there is also (#118), which sadly does not have any comments yet.

As the two implementations are quite different approaches I chose to open mine nevertheless. #118 uses tokio and provides reading from stdin as a fallback behavior, while #176 uses the standard library (which could however easily be changed to something async if desired) and provides a separate flag -i/--stdin.