lora_wal/recorder/
errors.rs1use thiserror::Error;
5
6use crate::errors::WalError;
7
8#[derive(Debug, Clone, Copy, PartialEq, Eq)]
13pub enum WroteCommit {
14 Yes,
17 No,
20}
21
22impl WroteCommit {
23 pub fn wrote(self) -> bool {
24 matches!(self, Self::Yes)
25 }
26}
27
28#[derive(Debug, Error)]
29pub enum WalCommitError {
30 #[error("WAL commit failed: {0}")]
31 Commit(#[source] WalError),
32 #[error("WAL flush failed: {0}")]
33 Flush(#[source] WalError),
34}
35
36#[derive(Debug, Error)]
37#[error("WAL poisoned: {reason}")]
38pub struct WalPoisonError {
39 pub(super) reason: String,
40}
41
42impl WalPoisonError {
43 pub fn reason(&self) -> &str {
44 &self.reason
45 }
46}
47
48#[derive(Debug, Error)]
49pub enum WalBufferedCommitError {
50 #[error("WAL arm failed: {0}")]
51 Arm(#[source] WalError),
52 #[error("WAL poisoned: {0}")]
53 Poisoned(String),
54 #[error("WAL poisoned during commit replay: {0}")]
55 ReplayPoisoned(String),
56 #[error(transparent)]
57 Commit(#[from] WalCommitError),
58}