Uh oh!
There was an error while loading. Please reload this page.
Async KV Store - #3778
Conversation
ldk-reviews-bot
commented
May 15, 2025
👋 Hi! I see this is a draft PR. |
| Poll::Pending => { | ||
| println!("Future not ready, using tokio runtime"); | ||
| self.runtime.spawn(async move { |
There was a problem hiding this comment.
This doesn't need to be tokio, it could be a generic spawn method too of course.
| match fut.as_mut().poll(&mut cx) { | ||
| Poll::Ready(_) => { | ||
| UpdateStatus::Completed |
There was a problem hiding this comment.
This initiates the stable persistence flow in LDK.
d57cf75 to
4678f85Compare| /// Will create the given `primary_namespace` and `secondary_namespace` if not already present | ||
| /// in the store. | ||
| fn write( | ||
| fn write_async( |
There was a problem hiding this comment.
Reminder: document that these calls, even though they are async, need to complete in the order in which they are initiated.
| let mut cx = Context::from_waker(&waker); | ||
| match fut.as_mut().poll(&mut cx) { | ||
| Poll::Ready(Ok(())) => Ok(true), |
There was a problem hiding this comment.
Reminder - can't simply conclude here that we are in sync mode. An async implementation may also sometimes be ready immediately?
Prepare for adding runtime state while avoiding the _unused serialization macro config.
To prepare for an async kv store trait that must be awaited, this commit moves the kv store calls from the chain notification handlers to the background process. It uses a dirty flag to communicate that there is something to persist. The block height is part of the persisted data. If that data does not make it to disk, the chain notifications are replayed after restart.
joostjager
commented
Sep 10, 2025
The background processor parts of this PR have been split out into smaller PRs and merged. Chain monitor persistence is in progress in #4063 with a different approach. Closing this. |
Draft PR for discussion on approach
Relates to #1470