From 55ed9f337ae0cf8e1336448d6b4273b3ee31aca2 Mon Sep 17 00:00:00 2001 From: iximeow Date: Tue, 27 Jun 2023 01:47:29 -0700 Subject: [api] artifacts/ now supports streaming in-progress artifacts back out as they are provided --- src/io.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/io.rs') diff --git a/src/io.rs b/src/io.rs index 219edbf..6e71282 100644 --- a/src/io.rs +++ b/src/io.rs @@ -5,6 +5,14 @@ use std::io::Write; use tokio::fs::OpenOptions; use std::task::{Poll, Context}; use std::pin::Pin; +use std::time::{UNIX_EPOCH, SystemTime}; + +pub fn now_ms() -> u64 { + SystemTime::now() + .duration_since(UNIX_EPOCH) + .expect("now is later than epoch") + .as_millis() as u64 +} pub struct ArtifactStream { sender: hyper::body::Sender, @@ -51,7 +59,7 @@ impl tokio::io::AsyncWrite for ArtifactStream { pub struct ArtifactDescriptor { job_id: u64, - artifact_id: u64, + pub artifact_id: u64, file: File, } -- cgit v1.1