-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(snot): basic test preparation with storage prep, agent delegatio…
…n, reconciliation (untested) Signed-off-by: Zander Franks <[email protected]>
- Loading branch information
Showing
10 changed files
with
303 additions
and
53 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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use std::path::Path; | ||
|
||
use futures::StreamExt; | ||
use http::StatusCode; | ||
use reqwest::IntoUrl; | ||
use tokio::{fs::File, io::AsyncWriteExt}; | ||
|
||
/// Download a file. Returns a None if 404. | ||
pub async fn download_file(url: impl IntoUrl, to: impl AsRef<Path>) -> anyhow::Result<Option<()>> { | ||
let req = reqwest::get(url).await?; | ||
if req.status() == StatusCode::NOT_FOUND { | ||
return Ok(None); | ||
} | ||
|
||
let mut stream = req.bytes_stream(); | ||
let mut file = File::create(to).await?; | ||
|
||
while let Some(chunk) = stream.next().await { | ||
file.write_all(&chunk?).await?; | ||
} | ||
|
||
Ok(Some(())) | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
mod api; | ||
mod cli; | ||
mod rpc; | ||
mod state; | ||
|
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.