use super::*;
use crate::background::CheckpointAllocationOwner;
pub(crate) struct CheckpointWalEntry {
entry: WalEntry,
memory: CheckpointAllocationOwner,
}
impl std::ops::Deref for CheckpointWalEntry {
type Target = WalEntry;
fn deref(&self) -> &Self::Target {
&self.entry
}
}
impl std::borrow::Borrow<WalEntry> for CheckpointWalEntry {
fn borrow(&self) -> &WalEntry {
&self.entry
}
}
impl CheckpointWalEntry {
pub(crate) fn new(entry: WalEntry, memory: CheckpointAllocationOwner) -> Self {
Self { entry, memory }
}
#[cfg(test)]
pub(crate) fn replay_into(
self,
store: &mut crate::store::GraphStore,
catalog: &mut hawdb_core::Catalog,
work: &CheckpointWorkContext,
) -> Result<()> {
self.replay_into_with_boundary(store, catalog, work, &mut false)
}
pub(crate) fn replay_into_with_boundary(
mut self,
store: &mut crate::store::GraphStore,
catalog: &mut hawdb_core::Catalog,
work: &CheckpointWorkContext,
mutation_started: &mut bool,
) -> Result<()> {
store.apply_replayed_checkpoint_wal_transaction_with_boundary(
catalog,
self.entry.op,
work,
mutation_started,
Some(&mut self.memory),
)
}
}