-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
69 changed files
with
8,627 additions
and
986 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
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
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,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" } |
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,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()); | ||
} | ||
} |
Oops, something went wrong.