Skip to content

Commit

Permalink
refactor!(base): rename StateStore::update_dependent_queued_request
Browse files Browse the repository at this point in the history
… to `mark_dependent_queued_requests_as_ready`
  • Loading branch information
bnjbvr committed Nov 18, 2024
1 parent dda252e commit 2b9a2a2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/matrix-sdk-base/src/store/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1452,7 +1452,7 @@ impl StateStoreIntegrationTests for DynStateStore {
// Update the event id.
let event_id = owned_event_id!("$1");
let num_updated = self
.update_dependent_queued_request(
.mark_dependent_queued_requests_as_ready(
room_id,
&txn0,
SentRequestKey::Event(event_id.clone()),
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-base/src/store/memory_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ impl StateStore for MemoryStore {
Ok(())
}

async fn update_dependent_queued_request(
async fn mark_dependent_queued_requests_as_ready(
&self,
room: &RoomId,
parent_txn_id: &TransactionId,
Expand Down
10 changes: 5 additions & 5 deletions crates/matrix-sdk-base/src/store/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,15 @@ pub trait StateStore: AsyncTraitDeps {
content: DependentQueuedRequestKind,
) -> Result<(), Self::Error>;

/// Update a set of dependent send queue requests with a key identifying the
/// homeserver's response, effectively marking them as ready.
/// Mark a set of dependent send queue requests as ready, using a key
/// identifying the homeserver's response.
///
/// ⚠ Beware! There's no verification applied that the parent key type is
/// compatible with the dependent event type. The invalid state may be
/// lazily filtered out in `load_dependent_queued_requests`.
///
/// Returns the number of updated requests.
async fn update_dependent_queued_request(
async fn mark_dependent_queued_requests_as_ready(
&self,
room_id: &RoomId,
parent_txn_id: &TransactionId,
Expand Down Expand Up @@ -707,14 +707,14 @@ impl<T: StateStore> StateStore for EraseStateStoreError<T> {
.map_err(Into::into)
}

async fn update_dependent_queued_request(
async fn mark_dependent_queued_requests_as_ready(
&self,
room_id: &RoomId,
parent_txn_id: &TransactionId,
sent_parent_key: SentRequestKey,
) -> Result<usize, Self::Error> {
self.0
.update_dependent_queued_request(room_id, parent_txn_id, sent_parent_key)
.mark_dependent_queued_requests_as_ready(room_id, parent_txn_id, sent_parent_key)
.await
.map_err(Into::into)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-indexeddb/src/state_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ impl_state_store!({
Ok(())
}

async fn update_dependent_queued_request(
async fn mark_dependent_queued_requests_as_ready(
&self,
room_id: &RoomId,
parent_txn_id: &TransactionId,
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk-sqlite/src/state_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ impl StateStore for SqliteStateStore {
.await
}

async fn update_dependent_queued_request(
async fn mark_dependent_queued_requests_as_ready(
&self,
room_id: &RoomId,
parent_txn_id: &TransactionId,
Expand Down
4 changes: 3 additions & 1 deletion crates/matrix-sdk/src/send_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,9 @@ impl QueueStorage {
let store = client.store();

// Update all dependent requests.
store.update_dependent_queued_request(&self.room_id, transaction_id, parent_key).await?;
store
.mark_dependent_queued_requests_as_ready(&self.room_id, transaction_id, parent_key)
.await?;

let removed = store.remove_send_queue_request(&self.room_id, transaction_id).await?;

Expand Down

0 comments on commit 2b9a2a2

Please sign in to comment.