Skip to content

Commit

Permalink
refactor(common): builder::LinkedChunkBuilder::* becomes `lazy_load…
Browse files Browse the repository at this point in the history
…er::*`.

This patch renames the `builder` module to `lazy_loader`.
The `LinkedChunkBuilder`'s methods are now functions.
The `LinkedChunkBuilder` struct is removed. Finally,
`LinkedChunkBuilderError` is renamed `LazyLoaderError`.

The `LinkedChunkBuilderTest` struct is kept for the moment. It's going
to be replaced soon.
  • Loading branch information
Hywan committed Feb 19, 2025
1 parent 7a06bdb commit 3495cab
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 199 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use matrix_sdk_common::{
VerificationState,
},
linked_chunk::{
ChunkContent, ChunkIdentifier as CId, LinkedChunk, LinkedChunkBuilder,
LinkedChunkBuilderTest, Position, RawChunk, Update,
lazy_loader, ChunkContent, ChunkIdentifier as CId, LinkedChunk, LinkedChunkBuilderTest,
Position, RawChunk, Update,
},
};
use matrix_sdk_test::{event_factory::EventFactory, ALICE, DEFAULT_TEST_ROOM_ID};
Expand Down Expand Up @@ -448,7 +448,7 @@ impl EventCacheStoreIntegrationTests for DynEventCacheStore {

assert_eq!(chunk_identifier_generator.current(), 2);

let linked_chunk = LinkedChunkBuilder::from_last_chunk::<DEFAULT_CHUNK_CAPACITY, _, _>(
let linked_chunk = lazy_loader::from_last_chunk::<DEFAULT_CHUNK_CAPACITY, _, _>(
last_chunk,
chunk_identifier_generator,
)
Expand Down Expand Up @@ -483,8 +483,7 @@ impl EventCacheStoreIntegrationTests for DynEventCacheStore {
// Pretend it's the first chunk.
previous_chunk.previous = None;

let _ = LinkedChunkBuilder::insert_new_first_chunk(&mut linked_chunk, previous_chunk)
.unwrap();
let _ = lazy_loader::insert_new_first_chunk(&mut linked_chunk, previous_chunk).unwrap();

let mut rchunks = linked_chunk.rchunks();

Expand Down Expand Up @@ -519,8 +518,7 @@ impl EventCacheStoreIntegrationTests for DynEventCacheStore {
let previous_chunk =
self.load_previous_chunk(room_id, first_chunk).await.unwrap().unwrap();

let _ = LinkedChunkBuilder::insert_new_first_chunk(&mut linked_chunk, previous_chunk)
.unwrap();
let _ = lazy_loader::insert_new_first_chunk(&mut linked_chunk, previous_chunk).unwrap();

let mut rchunks = linked_chunk.rchunks();

Expand Down
Loading

0 comments on commit 3495cab

Please sign in to comment.