-
Notifications
You must be signed in to change notification settings - Fork 28
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
Create BackupWriter and BackupReader traits for async unit backup #443
Conversation
Please make sure the following happened
|
We would strongly prefer not to change the API again, and our reasons for preferring the already existing traits mentioned in #399 still hold. You should be able to implement the |
"tad awkward" is an understatement. It's such a complication for no good reason. The items here are not going to be 16MBs (will they?), to justify needing streaming API that To sum up "tad awkward":
Anyway @joschisan it is definitely possible to implement |
this poll dance for async write doesn't look trivial. I don't know of any such wrappers. |
The implementation needs to copy bytes into its own buffer that gets cleared on flush/close, no way around it. If that's what you mean. |
oh right, you can just make all async stuff happen on flush |
or on Anyway, we are closing this. |
This pr is reproposing the original design in #399 before it was switched to using AsyncRead and AsyncWrite. The initial design proposed here is currently implemented in our fork and allows a very clean integration with our async database abstraction over RocksDB. Please find the integration into Fedimint here https://github.com/fedimint/fedimint/blob/master/fedimint-server/src/atomic_broadcast/backup.rs
The current API using AsyncWrite is quite low level and therefore quite unpractical for us, however I did not notice at the time that the api design in the original pr was changed otherwise I would have brought it up at the time. My apologies for the unnecessary back and forth this caused you; I should have caught this at the time.
I am reopening the issue now as we intend to switch from our fork back to upstream.
Please note that reading the backup was never really the issue and I am proposing it with two traits here for symmetry which makes it a little cleaner imo. We could therefore also stick to AsyncRead instead of defining a new trait or just take a byte vector / boxed slice directly since we are reading it all into a vector at once anyway.
I am aware that there were concerns around introducing new traits for this, however, after implementing both sides integrating via these traits it seems to me that this interface is the cleanest on both sides so it seems worth it.