Skip to content

refactor: Remove slot mutex and simplfy per blob state #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 24 commits into
base: slim-down-state
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
77fbb05
First step for removing the slot mutex
rklaehn Jul 9, 2025
ae95f28
prepare BaoFileHandle to be the full state
rklaehn Jul 9, 2025
c786a04
Flatten the state we keep per active blob
rklaehn Jul 10, 2025
94df43f
Remove debug statements
rklaehn Jul 10, 2025
48ffd48
Remove unused code
rklaehn Jul 10, 2025
a540002
Remove more debug code
rklaehn Jul 10, 2025
6e237f8
instrument the per-hash tasks as well
rklaehn Jul 10, 2025
7857e38
Merge branch 'slim-down-state' into remove-slot-mutex
rklaehn Jul 11, 2025
f559598
Move things around in preparation for introducing traits
rklaehn Jul 11, 2025
bc6bc71
Group high level fns.
rklaehn Jul 11, 2025
632131f
Introduce traits to structure the API
rklaehn Jul 11, 2025
1665781
Merge branch 'slim-down-state' into remove-slot-mutex
rklaehn Jul 11, 2025
9a8547a
clippy
rklaehn Jul 11, 2025
e2b76fb
Merge branch 'slim-down-state' into remove-slot-mutex
rklaehn Jul 23, 2025
6d39d40
Merge branch 'slim-down-state' into remove-slot-mutex
rklaehn Jul 24, 2025
d8847ea
Add wait_idle api call.
rklaehn Jul 24, 2025
dcbd83b
Use the shiny new wait_idle in another racy test.
rklaehn Jul 24, 2025
1c62546
remove stray println!
rklaehn Jul 24, 2025
c79a21e
Add more detailed logging for the entty manager proptest
rklaehn Jul 25, 2025
71bf60b
clippy
rklaehn Jul 25, 2025
160cfca
Merge branch 'slim-down-state' into remove-slot-mutex
rklaehn Aug 5, 2025
dba9a4c
Merge branch 'slim-down-state' into remove-slot-mutex
rklaehn Aug 5, 2025
4a09c64
Merge branch 'slim-down-state' into remove-slot-mutex
rklaehn Aug 5, 2025
4529be6
Remove debug code
rklaehn Aug 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion src/api/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1064,8 +1064,15 @@ mod tests {
use testresult::TestResult;

use crate::{
api::blobs::Blobs,
protocol::{ChunkRangesSeq, GetRequest},
store::fs::{tests::INTERESTING_SIZES, FsStore},
store::{
fs::{
tests::{create_n0_bao, test_data, INTERESTING_SIZES},
FsStore,
},
mem::MemStore,
},
tests::{add_test_hash_seq, add_test_hash_seq_incomplete},
util::ChunkRangesExt,
};
Expand Down Expand Up @@ -1117,6 +1124,38 @@ mod tests {
Ok(())
}

async fn test_observe_partial(blobs: &Blobs) -> TestResult<()> {
let sizes = INTERESTING_SIZES;
for size in sizes {
let data = test_data(size);
let ranges = ChunkRanges::chunk(0);
let (hash, bao) = create_n0_bao(&data, &ranges)?;
blobs.import_bao_bytes(hash, ranges.clone(), bao).await?;
let bitfield = blobs.observe(hash).await?;
if size > 1024 {
assert_eq!(bitfield.ranges, ranges);
} else {
assert_eq!(bitfield.ranges, ChunkRanges::all());
}
}
Ok(())
}

#[tokio::test]
async fn test_observe_partial_mem() -> TestResult<()> {
let store = MemStore::new();
test_observe_partial(store.blobs()).await?;
Ok(())
}

#[tokio::test]
async fn test_observe_partial_fs() -> TestResult<()> {
let td = tempfile::tempdir()?;
let store = FsStore::load(td.path()).await?;
test_observe_partial(store.blobs()).await?;
Ok(())
}

#[tokio::test]
async fn test_local_info_hash_seq() -> TestResult<()> {
let sizes = INTERESTING_SIZES;
Expand Down
Loading
Loading