Skip to content

Commit 7208efa

Browse files
committed
Restructure some stuff to reduce feature flags
1 parent b701107 commit 7208efa

File tree

12 files changed

+213
-193
lines changed

12 files changed

+213
-193
lines changed

src/api/blobs.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,16 @@ impl Blobs {
144144
/// clears the protections before.
145145
///
146146
/// Users should rely only on garbage collection for blob deletion.
147+
148+
#[allow(dead_code)]
147149
pub(crate) async fn delete_with_opts(&self, options: DeleteOptions) -> RequestResult<()> {
148150
trace!("{options:?}");
149151
self.client.rpc(options).await??;
150152
Ok(())
151153
}
152154

153155
/// See [`Self::delete_with_opts`].
156+
#[allow(dead_code)]
154157
pub(crate) async fn delete(
155158
&self,
156159
hashes: impl IntoIterator<Item = impl Into<Hash>>,
@@ -510,6 +513,7 @@ impl Blobs {
510513
}
511514
}
512515

516+
#[allow(dead_code)]
513517
pub(crate) async fn clear_protected(&self) -> RequestResult<()> {
514518
let msg = ClearProtectedRequest;
515519
self.client.rpc(msg).await??;

src/api/proto.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pub use bitfield::Bitfield;
4040

4141
use crate::{store::util::Tag, util::temp_tag::TempTag, BlobFormat, Hash, HashAndFormat};
4242

43+
#[allow(dead_code)]
4344
pub(crate) trait HashSpecific {
4445
fn hash(&self) -> Hash;
4546

src/api/proto/bitfield.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ impl<'de> Deserialize<'de> for Bitfield {
7070
}
7171

7272
impl Bitfield {
73+
#[cfg(feature = "fs-store")]
7374
pub(crate) fn new_unchecked(ranges: ChunkRanges, size: u64) -> Self {
7475
Self { ranges, size }
7576
}

src/store/fs.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,13 @@ use crate::{
121121
util::entity_manager::{self, ActiveEntityState},
122122
},
123123
util::{BaoTreeSender, FixedSize, MemOrFile, ValueOrPoisioned},
124-
Hash, IROH_BLOCK_SIZE,
124+
IROH_BLOCK_SIZE,
125125
},
126126
util::{
127127
channel::oneshot,
128128
temp_tag::{TagDrop, TempTag, TempTagScope, TempTags},
129129
},
130+
Hash,
130131
};
131132
mod bao_file;
132133
use bao_file::BaoFileHandle;
@@ -142,7 +143,7 @@ use options::Options;
142143
use tracing::Instrument;
143144
mod gc;
144145

145-
use super::HashAndFormat;
146+
use crate::HashAndFormat;
146147
use crate::api::{
147148
self,
148149
blobs::{AddProgressItem, ExportMode, ExportProgressItem},
@@ -1477,7 +1478,7 @@ pub mod tests {
14771478
api::blobs::Bitfield,
14781479
store::{
14791480
util::{read_checksummed, SliceInfoExt, Tag},
1480-
HashAndFormat, IROH_BLOCK_SIZE,
1481+
IROH_BLOCK_SIZE,
14811482
},
14821483
};
14831484

src/store/fs/bao_file.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ use crate::{
3535
read_checksummed_and_truncate, write_checksummed, FixedSize, MemOrFile,
3636
PartialMemStorage, DD,
3737
},
38-
Hash, IROH_BLOCK_SIZE,
38+
IROH_BLOCK_SIZE,
3939
},
40+
Hash,
4041
};
4142

4243
/// Storage for complete blobs. There is no longer any uncertainty about the

src/store/fs/meta.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ use crate::{
2626
CreateTagRequest, DeleteBlobsMsg, DeleteTagsRequest, ListBlobsMsg, ListRequest,
2727
ListTagsRequest, RenameTagRequest, SetTagRequest, ShutdownMsg, SyncDbMsg,
2828
},
29-
tags::TagInfo,
30-
},
31-
util::channel::oneshot,
29+
tags::TagInfo, Tag,
30+
}, util::channel::oneshot, Hash
3231
};
3332
mod proto;
3433
pub use proto::*;
@@ -43,7 +42,7 @@ use super::{
4342
util::PeekableReceiver,
4443
BaoFilePart,
4544
};
46-
use crate::store::{util::Tag, Hash, IROH_BLOCK_SIZE};
45+
use crate::store::IROH_BLOCK_SIZE;
4746

4847
/// Error type for message handler functions of the redb actor.
4948
///

src/store/fs/meta/tables.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
use redb::{ReadableTable, TableDefinition, TableError};
33

44
use super::EntryState;
5-
use crate::store::{fs::delete_set::FileTransaction, util::Tag, Hash, HashAndFormat};
5+
use crate::store::{fs::delete_set::FileTransaction};
6+
use crate::{Hash, HashAndFormat, api::Tag};
67

78
pub(super) const BLOBS_TABLE: TableDefinition<Hash, EntryState> = TableDefinition::new("blobs-0");
89

src/store/mem.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ use crate::{
5959
protocol::ChunkRangesExt,
6060
store::{
6161
util::{SizeInfo, SparseMemFile, Tag},
62-
HashAndFormat, IROH_BLOCK_SIZE,
62+
IROH_BLOCK_SIZE,
6363
},
64+
HashAndFormat,
6465
util::temp_tag::{TagDrop, TempTagScope, TempTags},
6566
BlobFormat, Hash,
6667
};

src/store/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,5 @@ pub mod readonly_mem;
1212
mod test;
1313
pub(crate) mod util;
1414

15-
use crate::hash::{Hash, HashAndFormat};
16-
1715
/// Block size used by iroh, 2^4*1024 = 16KiB
1816
pub const IROH_BLOCK_SIZE: BlockSize = BlockSize::from_chunk_log(4);

0 commit comments

Comments
 (0)