Services refactor

Replace structs of Dep<Service> with OnceServices, so each service has a Services reference

Remove service name => Service map

Flatten Services.rooms

Make reqwest Clients lazy initialized (client service)
This commit is contained in:
dasha_uwu
2025-08-22 20:15:54 +05:00
parent 26b3a84b88
commit b5890b9664
118 changed files with 457 additions and 1923 deletions

View File

@@ -17,12 +17,7 @@ pub(crate) async fn get_hierarchy_route(
State(services): State<crate::State>,
body: Ruma<get_hierarchy::v1::Request>,
) -> Result<get_hierarchy::v1::Response> {
if !services
.rooms
.metadata
.exists(&body.room_id)
.await
{
if !services.metadata.exists(&body.room_id).await {
return Err!(Request(NotFound("Room does not exist.")));
}
@@ -30,7 +25,6 @@ pub(crate) async fn get_hierarchy_route(
let suggested_only = body.suggested_only;
let ref identifier = Identifier::ServerName(body.origin());
match services
.rooms
.spaces
.get_summary_and_children_local(room_id, identifier)
.await?
@@ -47,7 +41,6 @@ pub(crate) async fn get_hierarchy_route(
.stream()
.broad_filter_map(async |(child, _via)| {
match services
.rooms
.spaces
.get_summary_and_children_local(&child, identifier)
.await