mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-07 07:27:45 -04:00
refactor(base): Renamed StateStore::list_dependend_send_queue_events to load_dependent_send_queue_events
This commit is contained in:
@@ -1369,7 +1369,7 @@ impl StateStoreIntegrationTests for DynStateStore {
|
||||
self.save_send_queue_event(room_id, txn0.clone(), event0).await.unwrap();
|
||||
|
||||
// No dependents, to start with.
|
||||
assert!(self.list_dependent_send_queue_events(room_id).await.unwrap().is_empty());
|
||||
assert!(self.load_dependent_send_queue_events(room_id).await.unwrap().is_empty());
|
||||
|
||||
// Save a redaction for that event.
|
||||
let child_txn = ChildTransactionId::new();
|
||||
@@ -1383,7 +1383,7 @@ impl StateStoreIntegrationTests for DynStateStore {
|
||||
.unwrap();
|
||||
|
||||
// It worked.
|
||||
let dependents = self.list_dependent_send_queue_events(room_id).await.unwrap();
|
||||
let dependents = self.load_dependent_send_queue_events(room_id).await.unwrap();
|
||||
assert_eq!(dependents.len(), 1);
|
||||
assert_eq!(dependents[0].parent_transaction_id, txn0);
|
||||
assert_eq!(dependents[0].own_transaction_id, child_txn);
|
||||
@@ -1397,7 +1397,7 @@ impl StateStoreIntegrationTests for DynStateStore {
|
||||
assert_eq!(num_updated, 1);
|
||||
|
||||
// It worked.
|
||||
let dependents = self.list_dependent_send_queue_events(room_id).await.unwrap();
|
||||
let dependents = self.load_dependent_send_queue_events(room_id).await.unwrap();
|
||||
assert_eq!(dependents.len(), 1);
|
||||
assert_eq!(dependents[0].parent_transaction_id, txn0);
|
||||
assert_eq!(dependents[0].own_transaction_id, child_txn);
|
||||
@@ -1412,7 +1412,7 @@ impl StateStoreIntegrationTests for DynStateStore {
|
||||
assert!(removed);
|
||||
|
||||
// It worked.
|
||||
assert!(self.list_dependent_send_queue_events(room_id).await.unwrap().is_empty());
|
||||
assert!(self.load_dependent_send_queue_events(room_id).await.unwrap().is_empty());
|
||||
|
||||
// Now, inserting a dependent event and removing the original send queue event
|
||||
// will NOT remove the dependent event.
|
||||
@@ -1430,7 +1430,7 @@ impl StateStoreIntegrationTests for DynStateStore {
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(self.list_dependent_send_queue_events(room_id).await.unwrap().len(), 1);
|
||||
assert_eq!(self.load_dependent_send_queue_events(room_id).await.unwrap().len(), 1);
|
||||
|
||||
self.save_dependent_send_queue_event(
|
||||
room_id,
|
||||
@@ -1445,14 +1445,14 @@ impl StateStoreIntegrationTests for DynStateStore {
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(self.list_dependent_send_queue_events(room_id).await.unwrap().len(), 2);
|
||||
assert_eq!(self.load_dependent_send_queue_events(room_id).await.unwrap().len(), 2);
|
||||
|
||||
// Remove event0 / txn0.
|
||||
let removed = self.remove_send_queue_event(room_id, &txn0).await.unwrap();
|
||||
assert!(removed);
|
||||
|
||||
// This has removed none of the dependent events.
|
||||
let dependents = self.list_dependent_send_queue_events(room_id).await.unwrap();
|
||||
let dependents = self.load_dependent_send_queue_events(room_id).await.unwrap();
|
||||
assert_eq!(dependents.len(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -949,7 +949,7 @@ impl StateStore for MemoryStore {
|
||||
///
|
||||
/// This returns absolutely all the dependent send queue events, whether
|
||||
/// they have an event id or not.
|
||||
async fn list_dependent_send_queue_events(
|
||||
async fn load_dependent_send_queue_events(
|
||||
&self,
|
||||
room: &RoomId,
|
||||
) -> Result<Vec<DependentQueuedEvent>, Self::Error> {
|
||||
|
||||
@@ -439,7 +439,7 @@ pub trait StateStore: AsyncTraitDeps {
|
||||
///
|
||||
/// This returns absolutely all the dependent send queue events, whether
|
||||
/// they have an event id or not. They must be returned in insertion order.
|
||||
async fn list_dependent_send_queue_events(
|
||||
async fn load_dependent_send_queue_events(
|
||||
&self,
|
||||
room: &RoomId,
|
||||
) -> Result<Vec<DependentQueuedEvent>, Self::Error>;
|
||||
@@ -710,11 +710,11 @@ impl<T: StateStore> StateStore for EraseStateStoreError<T> {
|
||||
self.0.remove_dependent_send_queue_event(room_id, own_txn_id).await.map_err(Into::into)
|
||||
}
|
||||
|
||||
async fn list_dependent_send_queue_events(
|
||||
async fn load_dependent_send_queue_events(
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
) -> Result<Vec<DependentQueuedEvent>, Self::Error> {
|
||||
self.0.list_dependent_send_queue_events(room_id).await.map_err(Into::into)
|
||||
self.0.load_dependent_send_queue_events(room_id).await.map_err(Into::into)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1618,7 +1618,7 @@ impl_state_store!({
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
async fn list_dependent_send_queue_events(
|
||||
async fn load_dependent_send_queue_events(
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
) -> Result<Vec<DependentQueuedEvent>> {
|
||||
|
||||
@@ -1896,7 +1896,7 @@ impl StateStore for SqliteStateStore {
|
||||
Ok(num_deleted > 0)
|
||||
}
|
||||
|
||||
async fn list_dependent_send_queue_events(
|
||||
async fn load_dependent_send_queue_events(
|
||||
&self,
|
||||
room_id: &RoomId,
|
||||
) -> Result<Vec<DependentQueuedEvent>> {
|
||||
|
||||
@@ -893,7 +893,7 @@ impl QueueStorage {
|
||||
});
|
||||
|
||||
let local_reactions = store
|
||||
.list_dependent_send_queue_events(&self.room_id)
|
||||
.load_dependent_send_queue_events(&self.room_id)
|
||||
.await?
|
||||
.into_iter()
|
||||
.filter_map(|dep| match dep.kind {
|
||||
@@ -1078,7 +1078,7 @@ impl QueueStorage {
|
||||
let store = client.store();
|
||||
|
||||
let dependent_events = store
|
||||
.list_dependent_send_queue_events(&self.room_id)
|
||||
.load_dependent_send_queue_events(&self.room_id)
|
||||
.await
|
||||
.map_err(RoomSendQueueStorageError::StorageError)?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user