mirror of
https://github.com/logos-blockchain/logos-sql-zone.git
synced 2026-06-07 10:19:32 +00:00
remove checkpoint from state
This commit is contained in:
parent
db5e5dd37a
commit
e0f3bb8a35
@ -1,5 +1,5 @@
|
|||||||
use lb_core::mantle::ops::channel::MsgId;
|
use lb_core::mantle::ops::channel::MsgId;
|
||||||
use lb_zone_sdk::{sequencer::SequencerCheckpoint, state::InscriptionInfo};
|
use lb_zone_sdk::state::InscriptionInfo;
|
||||||
|
|
||||||
use crate::message::Msg;
|
use crate::message::Msg;
|
||||||
|
|
||||||
@ -31,9 +31,6 @@ pub trait ZoneState: Send {
|
|||||||
fn published(&self) -> &[Msg];
|
fn published(&self) -> &[Msg];
|
||||||
fn adopted(&self) -> &[Msg];
|
fn adopted(&self) -> &[Msg];
|
||||||
fn finalized(&self) -> &[Msg];
|
fn finalized(&self) -> &[Msg];
|
||||||
|
|
||||||
fn save_checkpoint(&mut self, checkpoint: SequencerCheckpoint);
|
|
||||||
fn load_checkpoint(&self) -> Option<&SequencerCheckpoint>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// In-memory implementation of [`ZoneState`].
|
/// In-memory implementation of [`ZoneState`].
|
||||||
@ -42,7 +39,6 @@ pub struct InMemoryZoneState {
|
|||||||
published: Vec<Msg>,
|
published: Vec<Msg>,
|
||||||
adopted: Vec<Msg>,
|
adopted: Vec<Msg>,
|
||||||
finalized: Vec<Msg>,
|
finalized: Vec<Msg>,
|
||||||
checkpoint: Option<SequencerCheckpoint>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ZoneState for InMemoryZoneState {
|
impl ZoneState for InMemoryZoneState {
|
||||||
@ -95,12 +91,4 @@ impl ZoneState for InMemoryZoneState {
|
|||||||
fn finalized(&self) -> &[Msg] {
|
fn finalized(&self) -> &[Msg] {
|
||||||
&self.finalized
|
&self.finalized
|
||||||
}
|
}
|
||||||
|
|
||||||
fn save_checkpoint(&mut self, checkpoint: SequencerCheckpoint) {
|
|
||||||
self.checkpoint = Some(checkpoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn load_checkpoint(&self) -> Option<&SequencerCheckpoint> {
|
|
||||||
self.checkpoint.as_ref()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -163,7 +163,6 @@ async fn handle_event(
|
|||||||
debug!(msg_id = %hex::encode(info.this_msg.as_ref()), "Published");
|
debug!(msg_id = %hex::encode(info.this_msg.as_ref()), "Published");
|
||||||
state.on_published(&info);
|
state.on_published(&info);
|
||||||
save_checkpoint(Path::new(checkpoint_path), &checkpoint);
|
save_checkpoint(Path::new(checkpoint_path), &checkpoint);
|
||||||
state.save_checkpoint(checkpoint);
|
|
||||||
}
|
}
|
||||||
Event::FinalizedInscriptions { inscriptions } => {
|
Event::FinalizedInscriptions { inscriptions } => {
|
||||||
state.on_finalized(&inscriptions);
|
state.on_finalized(&inscriptions);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user