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:
@@ -25,14 +25,12 @@ pub(crate) async fn get_room_state_route(
|
||||
.await?;
|
||||
|
||||
let shortstatehash = services
|
||||
.rooms
|
||||
.state_accessor
|
||||
.pdu_shortstatehash(&body.event_id)
|
||||
.await
|
||||
.map_err(|_| err!(Request(NotFound("PDU state not found."))))?;
|
||||
|
||||
let state_ids: Vec<OwnedEventId> = services
|
||||
.rooms
|
||||
.state_accessor
|
||||
.state_full_ids(shortstatehash)
|
||||
.map(at!(1))
|
||||
@@ -42,7 +40,7 @@ pub(crate) async fn get_room_state_route(
|
||||
let pdus = state_ids
|
||||
.iter()
|
||||
.try_stream()
|
||||
.and_then(|id| services.rooms.timeline.get_pdu_json(id))
|
||||
.and_then(|id| services.timeline.get_pdu_json(id))
|
||||
.and_then(|pdu| {
|
||||
services
|
||||
.sending
|
||||
@@ -53,10 +51,9 @@ pub(crate) async fn get_room_state_route(
|
||||
.await?;
|
||||
|
||||
let auth_chain = services
|
||||
.rooms
|
||||
.auth_chain
|
||||
.event_ids_iter(&body.room_id, once(body.event_id.borrow()))
|
||||
.and_then(async |id| services.rooms.timeline.get_pdu_json(&id).await)
|
||||
.and_then(async |id| services.timeline.get_pdu_json(&id).await)
|
||||
.and_then(|pdu| {
|
||||
services
|
||||
.sending
|
||||
|
||||
Reference in New Issue
Block a user