feat: bump to Rust edition 2024 (#132)

* feat: bump to Rust edition 2024

Signed-off-by: Alex Chi <iskyzh@gmail.com>

* allow deadcode

Signed-off-by: Alex Chi <iskyzh@gmail.com>

* fix deploy to pages

Signed-off-by: Alex Chi <iskyzh@gmail.com>

* fix fmt

Signed-off-by: Alex Chi <iskyzh@gmail.com>

* update actions

Signed-off-by: Alex Chi <iskyzh@gmail.com>

---------

Signed-off-by: Alex Chi <iskyzh@gmail.com>
This commit is contained in:
Alex Chi Z.
2025-03-09 16:11:52 -04:00
committed by GitHub
parent 662b1a855f
commit 1d9693c22f
38 changed files with 76 additions and 73 deletions

View File

@@ -28,10 +28,10 @@ pub use simple_leveled::{
};
pub use tiered::{TieredCompactionController, TieredCompactionOptions, TieredCompactionTask};
use crate::iterators::StorageIterator;
use crate::iterators::concat_iterator::SstConcatIterator;
use crate::iterators::merge_iterator::MergeIterator;
use crate::iterators::two_merge_iterator::TwoMergeIterator;
use crate::iterators::StorageIterator;
use crate::key::KeySlice;
use crate::lsm_storage::{LsmStorageInner, LsmStorageState};
use crate::manifest::ManifestRecord;

View File

@@ -13,8 +13,8 @@
// limitations under the License.
use std::cmp::{self};
use std::collections::binary_heap::PeekMut;
use std::collections::BinaryHeap;
use std::collections::binary_heap::PeekMut;
use anyhow::Result;

View File

@@ -25,9 +25,9 @@ pub struct TwoMergeIterator<A: StorageIterator, B: StorageIterator> {
}
impl<
A: 'static + StorageIterator,
B: 'static + for<'a> StorageIterator<KeyType<'a> = A::KeyType<'a>>,
> TwoMergeIterator<A, B>
A: 'static + StorageIterator,
B: 'static + for<'a> StorageIterator<KeyType<'a> = A::KeyType<'a>>,
> TwoMergeIterator<A, B>
{
fn choose_a(a: &A, b: &B) -> bool {
if !a.is_valid() {
@@ -59,9 +59,9 @@ impl<
}
impl<
A: 'static + StorageIterator,
B: 'static + for<'a> StorageIterator<KeyType<'a> = A::KeyType<'a>>,
> StorageIterator for TwoMergeIterator<A, B>
A: 'static + StorageIterator,
B: 'static + for<'a> StorageIterator<KeyType<'a> = A::KeyType<'a>>,
> StorageIterator for TwoMergeIterator<A, B>
{
type KeyType<'a> = A::KeyType<'a>;

View File

@@ -14,13 +14,13 @@
use std::ops::Bound;
use anyhow::{bail, Result};
use anyhow::{Result, bail};
use bytes::Bytes;
use crate::iterators::StorageIterator;
use crate::iterators::concat_iterator::SstConcatIterator;
use crate::iterators::merge_iterator::MergeIterator;
use crate::iterators::two_merge_iterator::TwoMergeIterator;
use crate::iterators::StorageIterator;
use crate::mem_table::MemTableIterator;
use crate::table::SsTableIterator;

View File

@@ -16,8 +16,8 @@ use std::collections::{BTreeSet, HashMap};
use std::fs::File;
use std::ops::Bound;
use std::path::{Path, PathBuf};
use std::sync::atomic::AtomicUsize;
use std::sync::Arc;
use std::sync::atomic::AtomicUsize;
use anyhow::{Context, Result};
use bytes::Bytes;
@@ -28,14 +28,14 @@ use crate::compact::{
CompactionController, CompactionOptions, LeveledCompactionController, LeveledCompactionOptions,
SimpleLeveledCompactionController, SimpleLeveledCompactionOptions, TieredCompactionController,
};
use crate::iterators::StorageIterator;
use crate::iterators::concat_iterator::SstConcatIterator;
use crate::iterators::merge_iterator::MergeIterator;
use crate::iterators::two_merge_iterator::TwoMergeIterator;
use crate::iterators::StorageIterator;
use crate::key::KeySlice;
use crate::lsm_iterator::{FusedIterator, LsmIterator};
use crate::manifest::{Manifest, ManifestRecord};
use crate::mem_table::{map_bound, MemTable};
use crate::mem_table::{MemTable, map_bound};
use crate::mvcc::LsmMvccInner;
use crate::table::{FileObject, SsTable, SsTableBuilder, SsTableIterator};

View File

@@ -17,7 +17,7 @@ use std::io::{Read, Write};
use std::path::Path;
use std::sync::Arc;
use anyhow::{bail, Context, Result};
use anyhow::{Context, Result, bail};
use bytes::{Buf, BufMut};
use parking_lot::{Mutex, MutexGuard};
use serde::{Deserialize, Serialize};

View File

@@ -14,13 +14,13 @@
use std::ops::Bound;
use std::path::Path;
use std::sync::atomic::AtomicUsize;
use std::sync::Arc;
use std::sync::atomic::AtomicUsize;
use anyhow::Result;
use bytes::Bytes;
use crossbeam_skiplist::map::Entry;
use crossbeam_skiplist::SkipMap;
use crossbeam_skiplist::map::Entry;
use ouroboros::self_referencing;
use crate::iterators::StorageIterator;

View File

@@ -20,7 +20,7 @@ use std::fs::File;
use std::path::Path;
use std::sync::Arc;
use anyhow::{anyhow, bail, Result};
use anyhow::{Result, anyhow, bail};
pub use builder::SsTableBuilder;
use bytes::{Buf, BufMut};
pub use iterator::SsTableIterator;

View File

@@ -14,7 +14,7 @@
// Copyright 2021 TiKV Project Authors. Licensed under Apache-2.0.
use anyhow::{bail, Result};
use anyhow::{Result, bail};
use bytes::{Buf, BufMut, Bytes, BytesMut};
/// Implements a bloom filter

View File

@@ -1,3 +1,5 @@
#![allow(dead_code)] // REMOVE THIS LINE once all modules are complete
// Copyright (c) 2022-2025 Alex Chi Z
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +19,7 @@ use std::{
time::Duration,
};
use anyhow::{bail, Result};
use anyhow::{Result, bail};
use bytes::Bytes;
use crate::{
@@ -25,7 +27,7 @@ use crate::{
CompactionOptions, LeveledCompactionOptions, SimpleLeveledCompactionOptions,
TieredCompactionOptions,
},
iterators::{merge_iterator::MergeIterator, StorageIterator},
iterators::{StorageIterator, merge_iterator::MergeIterator},
key::{KeySlice, TS_ENABLED},
lsm_storage::{BlockCache, LsmStorageInner, LsmStorageState, MiniLsm},
table::{SsTable, SsTableBuilder, SsTableIterator},
@@ -128,7 +130,6 @@ where
assert!(!iter.is_valid());
}
#[allow(dead_code)]
pub fn check_iter_result_by_key_and_ts<I>(iter: &mut I, expected: Vec<((Bytes, u64), Bytes)>)
where
I: for<'a> StorageIterator<KeyType<'a> = KeySlice<'a>>,
@@ -207,7 +208,6 @@ pub fn generate_sst(
builder.build(id, block_cache, path.as_ref()).unwrap()
}
#[allow(dead_code)]
pub fn generate_sst_with_ts(
id: usize,
path: impl AsRef<Path>,
@@ -290,7 +290,9 @@ pub fn compaction_bench(storage: Arc<MiniLsm>) {
storage.dump_structure();
println!("This test case does not guarantee your compaction algorithm produces a LSM state as expected. It only does minimal checks on the size of the levels. Please use the compaction simulator to check if the compaction is correctly going on.");
println!(
"This test case does not guarantee your compaction algorithm produces a LSM state as expected. It only does minimal checks on the size of the levels. Please use the compaction simulator to check if the compaction is correctly going on."
);
}
pub fn check_compaction_ratio(storage: Arc<MiniLsm>) {

View File

@@ -18,14 +18,14 @@ use bytes::Bytes;
use tempfile::tempdir;
use crate::{
iterators::{merge_iterator::MergeIterator, StorageIterator},
iterators::{StorageIterator, merge_iterator::MergeIterator},
lsm_iterator::FusedIterator,
lsm_storage::{LsmStorageInner, LsmStorageOptions},
mem_table::MemTable,
tests::harness::check_lsm_iter_result_by_key,
};
use super::harness::{check_iter_result_by_key, expect_iter_error, MockIterator};
use super::harness::{MockIterator, check_iter_result_by_key, expect_iter_error};
#[test]
fn test_task1_memtable_iter() {

View File

@@ -15,7 +15,7 @@
use std::sync::Arc;
use bytes::Bytes;
use tempfile::{tempdir, TempDir};
use tempfile::{TempDir, tempdir};
use crate::iterators::StorageIterator;
use crate::key::{KeySlice, KeyVec};

View File

@@ -15,7 +15,7 @@
use std::ops::Bound;
use std::sync::Arc;
use self::harness::{check_iter_result_by_key, MockIterator};
use self::harness::{MockIterator, check_iter_result_by_key};
use self::harness::{check_lsm_iter_result_by_key, generate_sst};
use bytes::Bytes;
use tempfile::tempdir;

View File

@@ -16,7 +16,7 @@ use tempfile::tempdir;
use crate::{
key::{KeySlice, TS_ENABLED},
table::{bloom::Bloom, FileObject, SsTable, SsTableBuilder},
table::{FileObject, SsTable, SsTableBuilder, bloom::Bloom},
};
fn key_of(idx: usize) -> Vec<u8> {

View File

@@ -21,7 +21,7 @@ use week2_day1::harness::construct_merge_iterator_over_storage;
use super::*;
use crate::{
iterators::{concat_iterator::SstConcatIterator, StorageIterator},
iterators::{StorageIterator, concat_iterator::SstConcatIterator},
key::{KeySlice, TS_ENABLED},
lsm_storage::{LsmStorageInner, LsmStorageOptions},
table::{SsTable, SsTableBuilder},

View File

@@ -18,7 +18,7 @@ use std::io::{BufWriter, Read, Write};
use std::path::Path;
use std::sync::Arc;
use anyhow::{bail, Context, Result};
use anyhow::{Context, Result, bail};
use bytes::{Buf, BufMut, Bytes};
use crossbeam_skiplist::SkipMap;
use parking_lot::Mutex;