Skip to content

Commit

Permalink
fix some lints
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Sep 25, 2024
1 parent 8b49b0b commit 98fb3c7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion crates/exex/exex/src/wal/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use reth_primitives::BlockNumHash;
/// This cache is needed to avoid walking the WAL directory every time we want to find a
/// notification corresponding to a block.
#[derive(Debug)]
pub(super) struct BlockCache(BTreeMap<u64, VecDeque<CachedBlock>>);
pub struct BlockCache(BTreeMap<u64, VecDeque<CachedBlock>>);

impl BlockCache {
/// Creates a new instance of [`BlockCache`].
Expand Down
3 changes: 2 additions & 1 deletion crates/exex/exex/src/wal/entry.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use reth_exex_types::ExExNotification;
use serde::{Deserialize, Serialize};

/// A single entry in the WAL.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub(crate) struct WalEntry {
pub struct WalEntry {
pub(crate) target: NotificationCommitTarget,
pub(crate) notification: ExExNotification,
}
Expand Down
9 changes: 4 additions & 5 deletions crates/exex/exex/src/wal/mod.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#![allow(dead_code)]

mod cache;
use cache::BlockCache;
pub use cache::*;

mod entry;
pub(crate) use entry::NotificationCommitTarget;
use entry::WalEntry;
pub use entry::*;

mod storage;
use storage::Storage;
pub use storage::*;

use std::path::Path;

Expand Down Expand Up @@ -170,7 +169,7 @@ impl Wal {
// Remove notifications from the storage.
let removed_notifications = self
.storage
.take_notifications(remove_from_file_id..=remove_to_file_id)?
.take_entries(remove_from_file_id..=remove_to_file_id)?
.into_iter()
.map(|entry| entry.notification)
.collect::<Vec<_>>();
Expand Down
13 changes: 5 additions & 8 deletions crates/exex/exex/src/wal/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ use super::entry::WalEntry;
/// The underlying WAL storage backed by a directory of files.
///
/// Each notification is represented by a single file that contains a MessagePack-encoded
/// notification.
/// [`WalEntry`] struct.
#[derive(Debug)]
pub(super) struct Storage {
pub struct Storage {
/// The path to the WAL file.
path: PathBuf,
}
Expand Down Expand Up @@ -90,10 +90,7 @@ impl Storage {
/// # Returns
///
/// Entries that were removed.
pub(super) fn take_notifications(
&self,
range: RangeInclusive<u64>,
) -> eyre::Result<Vec<WalEntry>> {
pub(super) fn take_entries(&self, range: RangeInclusive<u64>) -> eyre::Result<Vec<WalEntry>> {
let entries = self.entries(range).collect::<eyre::Result<Vec<_>>>()?;

for (id, _) in &entries {
Expand Down Expand Up @@ -183,8 +180,8 @@ mod tests {
// Do a round trip serialization and deserialization
let file_id = 0;
storage.write_entry(file_id, entry.clone())?;
let deserialized_notification = storage.read_entry(file_id)?;
assert_eq!(deserialized_notification, entry);
let deserialized_entry = storage.read_entry(file_id)?;
assert_eq!(deserialized_entry, entry);

Ok(())
}
Expand Down

0 comments on commit 98fb3c7

Please sign in to comment.