Skip to content

Monitor updating persister#2359

Merged
TheBlueMatt merged 1 commit intolightningdevkit:mainfrom
domZippilli:2023-06-monitor-updating-persister
Sep 27, 2023
Merged

Monitor updating persister#2359
TheBlueMatt merged 1 commit intolightningdevkit:mainfrom
domZippilli:2023-06-monitor-updating-persister

Conversation

@domZippilli
Copy link
Copy Markdown
Contributor

@domZippilli domZippilli commented Jun 15, 2023

Monitor-updating KV store persister

Adds a new MonitorUpdatingPersister struct that customers may choose to use, so that new events on a channel do not serialize the entire monitor to storage.

How it works

  • Stores monitors in monitors/
  • Stores updates in monitor_updates/
  • When the "update persisted monitor" call comes in, either:
    • Rewrites the monitor, cleaning up old updates at this time, or
    • Adds an update file
  • At init when it deserializes monitors, it:
    • Reads each monitor and deserializes it
    • Reads each update for that monitor, deserializes it, and applies it if it has an update_id > the monitor's, or is the closed channel update constant.

Migration Path

No migration should be necessary! It should "just work" since the full monitors are stored the same way. When this persister runs the first time, it'll deserialize the existing full monitors, and the start writing updates.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants