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