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

Make UploadableFile::get_data async for AsyncRead #82

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ColinKinloch
Copy link
Contributor

@ColinKinloch ColinKinloch commented Feb 14, 2025

I've been attempting to bump the version of this in obs-gitlab-runner from 0.5.0to 0.8.0.
It currently stores a map of path strings to tokio::Files for artifacts, but I've changed it to use a Vec<UploadableFile>.

My current implementation does this:

async fn get_data(&self) -> Result<Self::Data<'_>, ()> {
    let file = AsyncFile::open(&self.real_path).await.map_err(|_| {})?;
    Ok(Box::new(file.compat()))
}

I didn't make get_path async as it is used in a non async context and I'm not sure it's necessary.

@ColinKinloch ColinKinloch force-pushed the async_uploadable_file_get_data branch from 7461a8a to e432dab Compare February 18, 2025 15:44
Prepairing an AsyncRead outside of an async context is difficult.
To fix clippy lifetime warnings on async trait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant