matrix-org / matrix-org/matrix-rust-sdk

Generic API guarantee that events are available after being sent

Open
#1,026 13 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description

**Is your feature request related to a problem? Please describe.**
Currently when sending events using `Client::send`, they are not part of the store immediately, but instead need a sync to happen for them to become available. From the consumer perspective this is inconsistent behavior, as `send`ing an event gives me an event id, which I can't retrieve from the store directly after sending using methods like `get_state_event` / `get_state_event_static`. It requires in depth knowledge about Matrix and the SDK to achieve the expected result, which is waiting for the store to sync the expected event before being able to retrieve it.

This is basically the same issue as https://github.com/matrix-org/matrix-rust-sdk/issues/267 – which was partly solved by https://github.com/matrix-org/matrix-rust-sdk/pull/868, and will see some refactoring in https://github.com/matrix-org/matrix-rust-sdk/pull/1022 – but from the generic event sending perspective.

**Describe the solution you'd like**
Some generic way where the SDK API has the guarantee that an event will be available after I created it. So, calling `Client::send` and after it `Client::get_state_event` for the event that was sent should do the expected thing, instead of just "failing" (event not being available).

**Describe alternatives you've considered**
The alternative is leaving it up to the consumer to handle those cases, which is already the case. It however is a complex thing to solve, and solving it upstream in the SDK seems like the right thing to do either way.

Contributor guide

Open the contributing guide

Research direction

Read Client::send and the get_state_event/get_state_event_static paths, then review issue #267 and PRs #868 and #1022 for existing synchronization behavior. Done means a caller can send an event and immediately retrieve it from the store through the generic API without consumer-side sync handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.