-
Notifications
You must be signed in to change notification settings - Fork 1
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
Allow async implementation for BackupReader and BackupWriter #1
Conversation
removing impls for |
async fn append(&mut self, data: &[u8]) -> std::io::Result<()> { | ||
Write::write_all(self, data)?; | ||
self.flush() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this have to be in some wrapper that tells the async executor that it should be run on a thread that is allowed to block? Otherwise we only fix the problem in case downstream users don't use a writer but implement BackupWriter
themselves. Maybe that's the best way to go anyway and we should just remove this default impl?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so to avoid bigger changes we can keep it this way if it's only used for testing anyway.
async fn read(&mut self) -> std::io::Result<Vec<u8>> { | ||
let mut buf = Vec::new(); | ||
self.read_to_end(&mut buf)?; | ||
Ok(buf) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, this impl is still blocking an async task afaik.
I'm getting a bunch of clippy warnings, nothing too bad but would be good to fix for the upstream PR.
|
Cardinal-Cryptography#399