wasmer_journal/concrete/
unsupported.rs

1use super::*;
2
3pub static UNSUPPORTED_JOURNAL: UnsupportedJournal = UnsupportedJournal {};
4
5/// The default for runtime is to use the unsupported journal
6/// which will fail to write journal entries if one attempts to do so.
7#[derive(Debug, Default)]
8pub struct UnsupportedJournal {}
9
10impl ReadableJournal for UnsupportedJournal {
11    fn read(&self) -> anyhow::Result<Option<LogReadResult<'_>>> {
12        Ok(None)
13    }
14
15    fn as_restarted(&self) -> anyhow::Result<Box<DynReadableJournal>> {
16        Ok(Box::<UnsupportedJournal>::default())
17    }
18}
19
20impl WritableJournal for UnsupportedJournal {
21    fn write<'a>(&'a self, entry: JournalEntry<'a>) -> anyhow::Result<LogWriteResult> {
22        tracing::debug!("journal event: {:?}", entry);
23        Err(anyhow::format_err!("unsupported"))
24    }
25
26    fn flush(&self) -> anyhow::Result<()> {
27        Ok(())
28    }
29}
30
31impl Journal for UnsupportedJournal {
32    fn split(self) -> (Box<DynWritableJournal>, Box<DynReadableJournal>) {
33        (
34            Box::<UnsupportedJournal>::default(),
35            Box::<UnsupportedJournal>::default(),
36        )
37    }
38}