Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ parking_lot = { version = "0.12.4", features = ["send_guard"] }
fxhash = "0.2.1"
static_assertions = "1.1.0"
rayon = "1.10.0"
thiserror = "2"

[dev-dependencies]
criterion = "0.6.0"
Expand Down
1 change: 1 addition & 0 deletions cli/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use arrayvec::ArrayVec;
use proptest::{arbitrary, strategy, strategy::Strategy};
use proptest_derive::Arbitrary;
use std::cmp::{max, min};
use thiserror::Error;

const MAX_PREFIX_LENGTH: usize = 64;

Expand Down Expand Up @@ -54,10 +55,13 @@ pub enum NodeKind {
},
}

#[derive(Debug)]
#[derive(Debug, Error)]
pub enum NodeError {
#[error("children unsupported")]
ChildrenUnsupported,
#[error("max prefix length exceeded")]
MaxPrefixLengthExceeded,
#[error("no value")]
NoValue,
}

Expand Down
17 changes: 15 additions & 2 deletions src/page/manager.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
use crate::page::PageId;
use thiserror::Error;

pub(super) mod mmap;
pub(super) mod options;

/// Represents various errors that might arise from page operations.
#[derive(Debug)]
#[derive(Debug, Error)]
pub enum PageError {
#[error("page not found: {0}")]
PageNotFound(PageId),
#[error("page occupied: {0}")]
PageOccupied(PageId),
#[error("page dirty: {0}")]
PageDirty(PageId),
#[error("page limit reached")]
PageLimitReached,
#[error("invalid root page: {0}")]
InvalidRootPage(PageId),
#[error("invalid cell pointer")]
InvalidCellPointer,
#[error("no free cells")]
NoFreeCells,
#[error("page is full")]
PageIsFull,
#[error("page split limit reached")]
PageSplitLimitReached,
IO(std::io::Error),
#[error("I/O error: {0}")]
IO(#[from] std::io::Error),
#[error("invalid value")]
InvalidValue,
#[error("invalid page contents: {0}")]
InvalidPageContents(PageId),
// TODO: add more errors here for other cases.
}
Loading