Skip to content

Commit d045be1

Browse files
committed
refactor
1 parent b4d7fdd commit d045be1

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/blob_tree/mod.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ pub use gc::{FragmentationEntry, FragmentationMap};
1111

1212
use crate::{
1313
coding::Decode,
14-
file::{fsync_directory, BLOBS_FOLDER},
1514
iter_guard::{IterGuard, IterGuardImpl},
1615
r#abstract::{AbstractTree, RangeItem},
1716
table::Table,
@@ -23,9 +22,8 @@ use crate::{
2322
};
2423
use handle::BlobIndirection;
2524
use std::{
26-
io::Cursor,
2725
ops::RangeBounds,
28-
path::PathBuf,
26+
path::{Path, PathBuf},
2927
sync::{Arc, MutexGuard},
3028
};
3129

@@ -66,7 +64,7 @@ impl IterGuard for Guard {
6664
let kv = self.kv?;
6765

6866
if kv.key.value_type.is_indirection() {
69-
let mut cursor = Cursor::new(kv.value);
67+
let mut cursor = std::io::Cursor::new(kv.value);
7068
Ok(BlobIndirection::decode_from(&mut cursor)?.size)
7169
} else {
7270
#[expect(clippy::cast_possible_truncation, reason = "values are u32 max length")]
@@ -88,14 +86,14 @@ impl IterGuard for Guard {
8886

8987
fn resolve_value_handle(
9088
tree_id: TreeId,
91-
blobs_folder: &std::path::Path,
92-
cache: &Arc<Cache>,
93-
descriptor_table: &Arc<DescriptorTable>,
89+
blobs_folder: &Path,
90+
cache: &Cache,
91+
descriptor_table: &DescriptorTable,
9492
version: &Version,
9593
item: InternalValue,
9694
) -> RangeItem {
9795
if item.key.value_type.is_indirection() {
98-
let mut cursor = Cursor::new(item.value);
96+
let mut cursor = std::io::Cursor::new(item.value);
9997
let vptr = BlobIndirection::decode_from(&mut cursor)?;
10098

10199
// Resolve indirection using value log
@@ -143,6 +141,8 @@ pub struct BlobTree {
143141

144142
impl BlobTree {
145143
pub(crate) fn open(config: Config) -> crate::Result<Self> {
144+
use crate::file::{fsync_directory, BLOBS_FOLDER};
145+
146146
let index = crate::Tree::open(config)?;
147147

148148
let blobs_folder = index.config.path.join(BLOBS_FOLDER);
@@ -297,7 +297,7 @@ impl AbstractTree for BlobTree {
297297
};
298298

299299
Ok(Some(if item.key.value_type.is_indirection() {
300-
let mut cursor = Cursor::new(item.value);
300+
let mut cursor = std::io::Cursor::new(item.value);
301301
let vptr = BlobIndirection::decode_from(&mut cursor)?;
302302
vptr.size
303303
} else {
@@ -336,7 +336,10 @@ impl AbstractTree for BlobTree {
336336
&self,
337337
stream: impl Iterator<Item = crate::Result<InternalValue>>,
338338
) -> crate::Result<Option<(Vec<Table>, Option<Vec<BlobFile>>)>> {
339-
use crate::{coding::Encode, file::TABLES_FOLDER, table::multi_writer::MultiWriter};
339+
use crate::{
340+
coding::Encode, file::BLOBS_FOLDER, file::TABLES_FOLDER,
341+
table::multi_writer::MultiWriter,
342+
};
340343

341344
let start = std::time::Instant::now();
342345

0 commit comments

Comments
 (0)