-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: progress bar for iroh add command (#368)
This introduces a progress bar for the `iroh add` command. It touches the following layers: * the various `add_dir`, `add_file` functions in `iroh::resolver::unixfs_builder` now return a stream of `AddEvents` * these are exposed in the `iroh-api` where they are mockable. The `iroh-api` also provides a higher level method to resolve a `AddEvent` stream to a CID * `iroh::size` introduces a way to calculate total size of each file on the filesystem * The `iroh add` command in the `iroh` crate then calculates the total size with a spinner, and then uses this to show a progress bar. Note that `indicatif`, the progress bar library, allows a lot of tweaking of what we see, both color, characters and text. I made a selection to get started. Suggestions for tweaks of what the bar looks like are welcome. I want to also include current file information in the message part of the progress bar, but getting that information requires more rework of the `unixfs_builder` and I think we should punt on that for the time being.
- Loading branch information
Showing
17 changed files
with
327 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ parameters: | |
type: string | ||
default: "nightly-2022-06-23" | ||
|
||
orbs: | ||
orbs: | ||
aws-cli: circleci/[email protected] | ||
|
||
executors: | ||
|
@@ -172,7 +172,7 @@ commands: | |
key: sccache-cache-stable-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ epoch }} | ||
paths: | ||
- "~/.cache/sccache" | ||
|
||
push-to-s3: | ||
parameters: | ||
version: | ||
|
@@ -191,11 +191,11 @@ commands: | |
- run: | ||
name: push to s3 | ||
command: | | ||
source $BASH_ENV | ||
aws s3 cp <<parameters.path>>iroh-gateway s3://vorc/iroh-gateway-<<parameters.os>>-<<parameters.arch>>-${CIRCLE_SHA1::7} --no-progress | ||
aws s3 cp <<parameters.path>>iroh-p2p s3://vorc/iroh-p2p-<<parameters.os>>-<<parameters.arch>>-${CIRCLE_SHA1::7} --no-progress | ||
aws s3 cp <<parameters.path>>iroh-store s3://vorc/iroh-store-<<parameters.os>>-<<parameters.arch>>-${CIRCLE_SHA1::7} --no-progress | ||
aws s3 cp <<parameters.path>>iroh s3://vorc/iroh-<<parameters.os>>-<<parameters.arch>>-${CIRCLE_SHA1::7} --no-progress | ||
source $BASH_ENV | ||
aws s3 cp <<parameters.path>>iroh-gateway s3://vorc/iroh-gateway-<<parameters.os>>-<<parameters.arch>>-${CIRCLE_SHA1::7} --no-progress | ||
aws s3 cp <<parameters.path>>iroh-p2p s3://vorc/iroh-p2p-<<parameters.os>>-<<parameters.arch>>-${CIRCLE_SHA1::7} --no-progress | ||
aws s3 cp <<parameters.path>>iroh-store s3://vorc/iroh-store-<<parameters.os>>-<<parameters.arch>>-${CIRCLE_SHA1::7} --no-progress | ||
aws s3 cp <<parameters.path>>iroh s3://vorc/iroh-<<parameters.os>>-<<parameters.arch>>-${CIRCLE_SHA1::7} --no-progress | ||
push-to-s3-latest: | ||
parameters: | ||
|
@@ -212,11 +212,11 @@ commands: | |
- run: | ||
name: push to s3 latest | ||
command: | | ||
source $BASH_ENV | ||
aws s3 cp <<parameters.path>>iroh-gateway s3://vorc/iroh-gateway-<<parameters.os>>-<<parameters.arch>>-latest --no-progress | ||
aws s3 cp <<parameters.path>>iroh-p2p s3://vorc/iroh-p2p-<<parameters.os>>-<<parameters.arch>>-latest --no-progress | ||
aws s3 cp <<parameters.path>>iroh-store s3://vorc/iroh-store-<<parameters.os>>-<<parameters.arch>>-latest --no-progress | ||
aws s3 cp <<parameters.path>>iroh s3://vorc/iroh-<<parameters.os>>-<<parameters.arch>>-latest --no-progress | ||
source $BASH_ENV | ||
aws s3 cp <<parameters.path>>iroh-gateway s3://vorc/iroh-gateway-<<parameters.os>>-<<parameters.arch>>-latest --no-progress | ||
aws s3 cp <<parameters.path>>iroh-p2p s3://vorc/iroh-p2p-<<parameters.os>>-<<parameters.arch>>-latest --no-progress | ||
aws s3 cp <<parameters.path>>iroh-store s3://vorc/iroh-store-<<parameters.os>>-<<parameters.arch>>-latest --no-progress | ||
aws s3 cp <<parameters.path>>iroh s3://vorc/iroh-<<parameters.os>>-<<parameters.arch>>-latest --no-progress | ||
jobs: | ||
cargo_fetch: | ||
|
@@ -331,7 +331,7 @@ jobs: | |
name: Run cargo clippy (default features) | ||
command: cargo clippy --all --all-targets -- -D warnings | ||
- save-sccache-cache | ||
|
||
audit: | ||
executor: docker-executor | ||
environment: | ||
|
@@ -380,7 +380,7 @@ jobs: | |
os: linux | ||
arch: amd64 | ||
- save-sccache-cache | ||
|
||
build_release_aarch64: | ||
executor: arm-executor | ||
steps: | ||
|
@@ -454,7 +454,6 @@ jobs: | |
arch: aarch64 | ||
- save-sccache-cache | ||
|
||
|
||
workflows: | ||
version: 2.1 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.