Skip to content

Commit

Permalink
fixup! LazyMap: allow writing without merkl or diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Jan 19, 2024
1 parent d3b4afc commit eea0a55
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions crates/storage/src/collections/lazy_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,25 +408,6 @@ where
Ok(previous)
}

/// Same as `LazyMap::insert` above but does not add the key-value to the
/// merkle tree or diffs
pub fn insert_storage_only<S>(
&self,
storage: &mut S,
key: K,
val: V,
) -> Result<Option<V>>
where
S: StorageRead + StorageWrite,
{
let previous = self.get(storage, &key)?;

let data_key = self.get_data_key(&key);
Self::write_key_val_storage_only(storage, &data_key, val)?;

Ok(previous)
}

/// Removes a key from the map if it's present, returning the value at the
/// key if the key was previously in the map.
pub fn remove<S>(&self, storage: &mut S, key: &K) -> Result<Option<V>>
Expand Down Expand Up @@ -554,16 +535,6 @@ where
) -> Result<()> {
storage.write(storage_key, val)
}

/// Write a value into storage without merklizing or adding the value to the
/// diffs
fn write_key_val_storage_only(
storage: &mut impl StorageWrite,
storage_key: &storage::Key,
val: V,
) -> Result<()> {
storage.write_without_merkldiffs(storage_key, val)
}
}

#[cfg(test)]
Expand Down

0 comments on commit eea0a55

Please sign in to comment.