Skip to content
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

feat(base) Client-side sorting, prelude: Implement Client::rooms_stream #3068

Merged
merged 13 commits into from
Jun 19, 2024

Commits on Jun 17, 2024

  1. feat(base): Make Store::rooms observable.

    This patch updates `Store::rooms` from a
    `Arc<StdRwLock<BTreeMap<OwnedRoomId, Room>>>` to a
    `Arc<StdRwLock<Rooms>>` where `Rooms` is a new type that mimics a
    `BTreeMap` but that is observable. It uses an `ObservableVector`
    for saving us the costs of writing a new `ObservableMap` type in
    `eyeball-im`. It would have too much implications that are clearly
    not necessary. The major one being that an `ObservableMap` must emit
    `MapDiff`, but we expect `VectorDiff` everywhere in the SDK where rooms
    are observable. It would break too many API and too many projects.
    
    The benchmark is coming, but here are the results (for 10'000 rooms,
    extreme case):
    
    * `get_rooms` and `get_rooms_filtered` are twice faster (in practise, it
      means 650µs is saved per call),
    * `get_room` and `get_or_create_room` are 10% slower (in practise, it
      means 8-10ns is lost per call).
    
    Overall, I believe these results are acceptable, and even an improvement
    for the first one.
    Hywan committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    5870daf View commit details
    Browse the repository at this point in the history
  2. feat(base): Rename Rooms to generic ObservableMap + add tests.

    This patch rewrites `Rooms` to a generic `ObservableMap` struct. It also
    adds documentation and tests for this type.
    Hywan committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    a67e7f2 View commit details
    Browse the repository at this point in the history
  3. feat(base): Implement ObservableMap::stream.

    This patch basically implements `ObservableMap::stream` which returns a
    batched stream of the values.
    Hywan committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    6dac77f View commit details
    Browse the repository at this point in the history
  4. feat(base): Implement Store::rooms_stream.

    This patch implements a new `Store::rooms_stream` method that forwards
    the result of `ObservableMap::stream`.
    Hywan committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    11bced4 View commit details
    Browse the repository at this point in the history
  5. fix(base): Define matrix_sdk_base::latest_event also if `e2e-encryp…

    …tion` is enabled.
    
    Running `cargo test -p matrix-sdk-base --features e2e-encryption`
    makes the code to fail to compile because `crate::latest_event` isn't
    defined. And indeed, it must be defined if `experimental-sliding-sync`
    is enabled, but also if `e2e-encryption` is enabled.
    Hywan committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    fd4505b View commit details
    Browse the repository at this point in the history
  6. feat(base): Implement Client::rooms_stream.

    This patch implements `Client::rooms_stream`, which forwards the result
    of the recently added `Store::rooms_stream` method.
    Hywan committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    f9e8f11 View commit details
    Browse the repository at this point in the history
  7. test: Fix a compiler warning if e2e-encryption and `experimental-sl…

    …iding-sync` aren't enabled.
    Hywan committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    e028710 View commit details
    Browse the repository at this point in the history
  8. feat(sdk): Implement Client::rooms_stream.

    This patch implements `Client::rooms_stream` by forwarding the
    result of `matrix_sdk_base::Client::rooms_stream`, and mapping the
    `matrix_sdk_base::Room` to `matrix_sdk::Room`.
    Hywan committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    6e7f53d View commit details
    Browse the repository at this point in the history
  9. feat(base): Create an ObservableMap for wasm32-unknown-unknown.

    This patch creates an `ObservableMap` for `wasm32-unknown-unknown` which
    simply wraps a `BTreeMap`, and without the `stream` method. Indeed, the
    first implementation uses `eyeball_im::ObservableVector` which requires
    `Send` and `Sync` on its values, which cannot compile to Wasm.
    Hywan committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    e9121ab View commit details
    Browse the repository at this point in the history
  10. chore(base): Make Clippy happy.

    Hywan committed Jun 17, 2024
    Configuration menu
    Copy the full SHA
    01d6a9e View commit details
    Browse the repository at this point in the history

Commits on Jun 18, 2024

  1. Configuration menu
    Copy the full SHA
    dd2ef57 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1e639c4 View commit details
    Browse the repository at this point in the history
  3. test(sdk): Test Client::rooms_stream.

    This patch adds an integration test for `Client::rooms_stream`.
    Hywan committed Jun 18, 2024
    Configuration menu
    Copy the full SHA
    717c68d View commit details
    Browse the repository at this point in the history