-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use std::io; | ||
|
||
use thiserror::Error; | ||
|
||
/// Errors of the `WALStorage` | ||
#[derive(Debug, Error)] | ||
pub(crate) enum WALError { | ||
/// The WAL segment might reach on end | ||
/// | ||
/// NOTE: This exists because we cannot tell the difference between a corrupted WAL | ||
/// and a normally ended WAL, as the segment files are all preallocated with zeros | ||
#[error("WAL ended")] | ||
MaybeEnded, | ||
/// The WAL corrupt error | ||
#[error("WAL corrupted: {0}")] | ||
Corrupted(CorruptType), | ||
/// The IO error | ||
#[error("IO error: {0}")] | ||
IO(#[from] io::Error), | ||
} | ||
|
||
/// The type of the `Corrupted` error | ||
#[derive(Debug, Error)] | ||
pub(crate) enum CorruptType { | ||
/// Corrupt because of decode failure | ||
#[error("Error occurred when decoding WAL: {0}")] | ||
Codec(String), | ||
/// Corrupt because of checksum failure | ||
#[error("Checksumming for the file has failed")] | ||
Checksum, | ||
/// Corrupt because of some logs is missing | ||
#[error("The recovered logs are not continue")] | ||
LogNotContinue, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
#![allow(unused)] // TODO: remove this until used | ||
|
||
/// WAL errors | ||
mod error; | ||
|
||
/// File utils | ||
mod util; |