Conversation
|
👋 Hi! I see this is a draft PR. |
391ffb1 to
faa071d
Compare
lightning/src/util/async_persist.rs
Outdated
| 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.
lightning/src/util/async_persist.rs
Outdated
|
|
||
| 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
4678f85
Compare
lightning/src/util/persist.rs
Outdated
| /// 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.
217d757 to
e551842
Compare
| 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?
3d49db7 to
d31760d
Compare
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.
1deba29 to
14134bb
Compare
bfb119a to
e47e7ad
Compare
|
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