Skip to content

Commit

Permalink
fix: just in time update (#270)
Browse files Browse the repository at this point in the history
* some refactoring

* tree to tree node

* removed just in time updates from commit time

* more work

* more work

* removed a comma

* added a callback method to be able to get the value defined costs

* more fixes

* grovedb working again

* fixed proof feature

* fixed bench

* clippy fixes

* fmt fixes

* updated to rc2

* updated caching system

* removed cache

* readded cache

* merge
  • Loading branch information
QuantumExplorer authored Sep 27, 2023
1 parent 75b4df1 commit 5bed4f5
Show file tree
Hide file tree
Showing 74 changed files with 3,189 additions and 2,196 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/grovedb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:

- name: Enable Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "false"

- run: cargo test --workspace --all-features

Expand All @@ -52,6 +54,8 @@ jobs:

- name: Enable Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "false"

- uses: actions-rs/clippy-check@v1
with:
Expand All @@ -78,6 +82,8 @@ jobs:

- name: Enable Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "false"

- run: exit `cargo +nightly fmt --check | wc -l`

Expand All @@ -100,6 +106,8 @@ jobs:

- name: Enable Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "false"

- run: cargo check

Expand Down
64 changes: 0 additions & 64 deletions .github/workflows/nodejs.yml

This file was deleted.

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-rc.1"
version = "1.0.0-rc.2"
edition = "2021"
license = "MIT"
description = "Costs extension crate for GroveDB"
Expand Down
9 changes: 2 additions & 7 deletions costs/src/storage_cost/removal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,17 @@ pub const UNKNOWN_EPOCH: u64 = u64::MAX;
pub type StorageRemovalPerEpochByIdentifier = BTreeMap<Identifier, IntMap<u32>>;

/// Removal bytes
#[derive(Debug, PartialEq, Clone, Eq)]
#[derive(Debug, PartialEq, Clone, Eq, Default)]
pub enum StorageRemovedBytes {
/// No storage removal
#[default]
NoStorageRemoval,
/// Basic storage removal
BasicStorageRemoval(u32),
/// Storage removal is given as sections
SectionedStorageRemoval(StorageRemovalPerEpochByIdentifier),
}

impl Default for StorageRemovedBytes {
fn default() -> Self {
NoStorageRemoval
}
}

impl Add for StorageRemovedBytes {
type Output = Self;

Expand Down
12 changes: 6 additions & 6 deletions grovedb/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "grovedb"
description = "Fully featured database using balanced hierarchical authenticated data structures"
version = "1.0.0-rc.1"
version = "1.0.0-rc.2"
authors = ["Samuel Westrich <[email protected]>", "Wisdom Ogwu <[email protected]", "Evgeny Fomin <[email protected]>"]
edition = "2021"
license = "MIT"
Expand All @@ -12,21 +12,21 @@ documentation = "https://docs.rs/grovedb"


[dependencies]
grovedb-merk = { version = "1.0.0-rc.1", path = "../merk", optional = true, default-features = false }
grovedb-merk = { version = "1.0.0-rc.2", path = "../merk", optional = true, default-features = false }
thiserror = { version = "1.0.37", optional = true }
tempfile = { version = "3.3.0", optional = true }
bincode = { version = "1.3.3", optional = true }
serde = { version = "1.0.149", optional = true }
grovedb-storage = { version = "1.0.0-rc.1", path = "../storage", optional = true }
grovedb-visualize = { version = "1.0.0-rc.1", path = "../visualize", optional = true }
grovedb-storage = { version = "1.0.0-rc.2", path = "../storage", optional = true }
grovedb-visualize = { version = "1.0.0-rc.2", path = "../visualize", optional = true }
hex = { version = "0.4.3", optional = true }
itertools = { version = "0.10.5", optional = true }
integer-encoding = { version = "3.0.4", optional = true }
grovedb-costs = { version = "1.0.0-rc.1", path = "../costs", optional = true }
grovedb-costs = { version = "1.0.0-rc.2", path = "../costs", optional = true }
nohash-hasher = { version = "0.2.0", optional = true }
indexmap = { version = "1.9.2", optional = true }
intmap = { version = "2.0.0", optional = true }
grovedb-path = { version = "1.0.0-rc.1", path = "../path" }
grovedb-path = { version = "1.0.0-rc.2", path = "../path" }

[dev-dependencies]
rand = "0.8.5"
Expand Down
12 changes: 6 additions & 6 deletions grovedb/src/batch/estimated_costs/average_case_costs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ impl<G, SR> TreeCache<G, SR> for AverageCaseTreeCacheKnownPaths {
self.paths.get(path).ok_or_else(|| {
let paths = self
.paths
.iter()
.map(|(k, _v)| k.0.iter().map(|k| hex::encode(k.as_slice())).join("/"))
.keys()
.map(|k| k.0.iter().map(|k| hex::encode(k.as_slice())).join("/"))
.join(" | ");
Error::PathNotFoundInCacheForEstimatedCosts(format!(
"required path {} not found in paths {}",
Expand All @@ -234,8 +234,8 @@ impl<G, SR> TreeCache<G, SR> for AverageCaseTreeCacheKnownPaths {
self.paths.get(path).ok_or_else(|| {
let paths = self
.paths
.iter()
.map(|(k, _v)| k.0.iter().map(|k| hex::encode(k.as_slice())).join("/"))
.keys()
.map(|k| k.0.iter().map(|k| hex::encode(k.as_slice())).join("/"))
.join(" | ");
Error::PathNotFoundInCacheForEstimatedCosts(format!(
"required path for estimated merk caching {} not found in paths {}",
Expand Down Expand Up @@ -576,7 +576,7 @@ mod tests {
seek_count: 5, // todo: why is this 5
storage_cost: StorageCost {
added_bytes: 115,
replaced_bytes: 106,
replaced_bytes: 75,
removed_bytes: NoStorageRemoval,
},
storage_loaded_bytes: 109,
Expand Down Expand Up @@ -723,7 +723,7 @@ mod tests {
seek_count: 41,
storage_cost: StorageCost {
added_bytes: 0,
replaced_bytes: 5625,
replaced_bytes: 5594,
removed_bytes: NoStorageRemoval,
},
storage_loaded_bytes: 7669,
Expand Down
Loading

0 comments on commit 5bed4f5

Please sign in to comment.