Skip to content

Commit

Permalink
chore: codefmt
Browse files Browse the repository at this point in the history
  • Loading branch information
KKould committed Dec 13, 2024
1 parent 297083c commit 18dbc07
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/compaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ where
option: Arc<DbOption<R>>,
version_set: VersionSet<R>,
manager: Arc<StoreManager>,
instance: Arc<RecordInstance>
instance: Arc<RecordInstance>,
) -> Self {
Compactor::<R> {
option,
Expand All @@ -78,7 +78,7 @@ where
&mut guard.mutable,
Mutable::new(&self.option, trigger_clone, self.manager.base_fs()).await?,
);
let (file_id, immutable) = mutable.into_immutable(&guard.record_instance).await?;
let (file_id, immutable) = mutable.into_immutable(&self.instance).await?;
guard.immutables.push((file_id, immutable));
} else if !is_manual {
return Ok(());
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,11 @@ where
Box::new(|_| None),
self.parquet_lru.clone(),
).take().await?;

while let Some(record) = scan.next().await.transpose()? {
if record.value().is_some() {
yield Ok(f(TransactionEntry::Stream(record)))
}
}
}
}
}
Expand Down Expand Up @@ -856,7 +856,7 @@ where
batch_size,
merge_stream,
self.projection_indices,
&self.instance,
self.instance,
))
}
}
Expand Down
9 changes: 2 additions & 7 deletions src/record/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,10 @@ impl RecordInstance {

pub fn dyn_columns(&self) -> &[Column] {
match self {
RecordInstance::Runtime(record) => {
record.columns()
}
RecordInstance::Normal => {
&[]
}
RecordInstance::Runtime(record) => record.columns(),
RecordInstance::Normal => &[],
}
}

}

pub trait Record: 'static + Sized + Decode + Debug + Send + Sync {
Expand Down
21 changes: 10 additions & 11 deletions src/serdes/bound.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::ops::Bound;

use fusio::{SeqRead, Write};

use crate::serdes::{Decode, Encode};

impl<T> Decode for Bound<T>
Expand All @@ -13,14 +15,10 @@ where
R: SeqRead,
{
Ok(match u8::decode(reader).await? {
0 => {
Bound::Included(T::decode(reader).await?)
},
1 => {
Bound::Excluded(T::decode(reader).await?)
},
0 => Bound::Included(T::decode(reader).await?),
1 => Bound::Excluded(T::decode(reader).await?),
2 => Bound::Unbounded,
_ => unreachable!()
_ => unreachable!(),
})
}
}
Expand Down Expand Up @@ -53,9 +51,10 @@ where
}

fn size(&self) -> usize {
size_of::<u8>() + match self {
Bound::Included(value) | Bound::Excluded(value) => value.size(),
Bound::Unbounded => 0,
}
size_of::<u8>()
+ match self {
Bound::Included(value) | Bound::Excluded(value) => value.size(),
Bound::Unbounded => 0,
}
}
}
2 changes: 1 addition & 1 deletion src/serdes/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
mod arc;
mod boolean;
mod bound;
#[cfg(feature = "bytes")]
mod bytes;
mod num;
pub(crate) mod option;
mod string;
mod vec;
mod bound;

use std::future::Future;

Expand Down
1 change: 1 addition & 0 deletions src/serdes/vec.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use fusio::{SeqRead, Write};

use crate::serdes::{Decode, Encode};

impl<T> Decode for Vec<T>
Expand Down
5 changes: 2 additions & 3 deletions src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ use parquet::arrow::ProjectionMask;

use crate::{
fs::manager::StoreManager,
record::Record,
record::{Record, RecordInstance},
stream,
stream::ScanStream,
timestamp::Timestamp,
version::{TransactionTs, VersionRef},
DbError, ParquetLru, Projection, Scan, Schema,
};
use crate::record::RecordInstance;

pub struct Snapshot<'s, R>
where
Expand Down Expand Up @@ -134,11 +133,11 @@ mod tests {
compaction::tests::build_version,
executor::tokio::TokioExecutor,
fs::manager::StoreManager,
record::RecordInstance,
tests::{build_db, build_schema},
version::TransactionTs,
DbOption,
};
use crate::record::RecordInstance;

#[tokio::test]
async fn snapshot_scan() {
Expand Down
3 changes: 1 addition & 2 deletions src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,13 @@ mod tests {
fs::manager::StoreManager,
record::{
runtime::{Column, Datatype, DynRecord},
ColumnDesc,
ColumnDesc, RecordInstance,
},
tests::{build_db, build_schema, Test},
transaction::CommitError,
version::TransactionTs,
DbOption, Projection, DB,
};
use crate::record::RecordInstance;

#[tokio::test]
async fn transaction_read_write() {
Expand Down
2 changes: 1 addition & 1 deletion tonbo_net_client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.protoc_arg("--experimental_allow_proto3_optional")
.compile_protos(&["src/proto/tonbo.proto"], &["src/proto"])?;
Ok(())
}
}
2 changes: 1 addition & 1 deletion tonbo_net_server/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.protoc_arg("--experimental_allow_proto3_optional")
.compile_protos(&["src/proto/tonbo.proto"], &["src/proto"])?;
Ok(())
}
}

0 comments on commit 18dbc07

Please sign in to comment.