Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumExplorer committed Aug 24, 2024
2 parents a3575f8 + 4f75a76 commit 214c401
Show file tree
Hide file tree
Showing 69 changed files with 8,627 additions and 986 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ members = [
"visualize",
"path",
"grovedbg-types",
"grovedb-version"
"grovedb-version",
"grovedb-epoch-based-storage-flags"
]
2 changes: 1 addition & 1 deletion costs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "grovedb-costs"
version = "1.0.0"
version = "2.0.0"
edition = "2021"
license = "MIT"
description = "Costs extension crate for GroveDB"
Expand Down
15 changes: 15 additions & 0 deletions grovedb-epoch-based-storage-flags/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "grovedb-epoch-based-storage-flags"
authors = ["Samuel Westrich <[email protected]>"]
description = "Epoch based storage flags for GroveDB"
version = "2.0.0"
edition = "2021"
license = "MIT"
repository = "https://github.com/dashpay/grovedb"

[dependencies]
thiserror = { version = "1.0.63" }
grovedb-costs = { version = "2.0.0", path = "../costs" }
intmap = { version = "2.0.0", features = ["serde"]}
integer-encoding = { version = "4.0.0" }
hex = { version = "0.4.3" }
45 changes: 45 additions & 0 deletions grovedb-epoch-based-storage-flags/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/// Storage flag errors
#[derive(Debug, thiserror::Error)]
pub enum StorageFlagsError {
/// Error
#[error("deserialize unknown storage flags type error: {0}")]
DeserializeUnknownStorageFlagsType(String),
/// Error
#[error("storage flags wrong size error: {0}")]
StorageFlagsWrongSize(String),
/// Error
#[error("removing at epoch with no associated storage error: {0}")]
RemovingAtEpochWithNoAssociatedStorage(String),
/// Error
#[error("storage flags overflow error: {0}")]
StorageFlagsOverflow(String),
/// Error
#[error("removing flags error: {0}")]
RemovingFlagsError(String),
/// Error
#[error("merging storage flags from different owners error: {0}")]
MergingStorageFlagsFromDifferentOwners(String),
/// Error
#[error("merging storage flags with different base epoch: {0}")]
MergingStorageFlagsWithDifferentBaseEpoch(String),
}

impl StorageFlagsError {
/// Gets a mutable reference to the inner string of the error variant
pub(crate) fn get_mut_info(&mut self) -> &mut String {
match self {
StorageFlagsError::DeserializeUnknownStorageFlagsType(ref mut msg)
| StorageFlagsError::StorageFlagsWrongSize(ref mut msg)
| StorageFlagsError::RemovingAtEpochWithNoAssociatedStorage(ref mut msg)
| StorageFlagsError::StorageFlagsOverflow(ref mut msg)
| StorageFlagsError::RemovingFlagsError(ref mut msg)
| StorageFlagsError::MergingStorageFlagsFromDifferentOwners(ref mut msg)
| StorageFlagsError::MergingStorageFlagsWithDifferentBaseEpoch(ref mut msg) => msg,
}
}

/// adds info to the storage flags error
pub(crate) fn add_info(&mut self, info: &str) {
self.get_mut_info().push_str(format!(": {}", info).as_str());
}
}
Loading

0 comments on commit 214c401

Please sign in to comment.