implement several broadband loops
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
59d5e3ebf1
commit
1d02851028
7 changed files with 47 additions and 22 deletions
|
@ -4,7 +4,11 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
|
||||
use conduit::{debug, err, implement, utils::IterStream, Result};
|
||||
use conduit::{
|
||||
debug, err, implement,
|
||||
utils::stream::{IterStream, WidebandExt},
|
||||
Result,
|
||||
};
|
||||
use futures::{FutureExt, StreamExt, TryFutureExt};
|
||||
use ruma::{
|
||||
state_res::{self, StateMap},
|
||||
|
@ -52,11 +56,11 @@ pub async fn resolve_state(
|
|||
let fork_states: Vec<StateMap<Arc<EventId>>> = fork_states
|
||||
.into_iter()
|
||||
.stream()
|
||||
.then(|fork_state| {
|
||||
.wide_then(|fork_state| {
|
||||
fork_state
|
||||
.into_iter()
|
||||
.stream()
|
||||
.filter_map(|(k, id)| {
|
||||
.wide_filter_map(|(k, id)| {
|
||||
self.services
|
||||
.short
|
||||
.get_statekey_from_short(k)
|
||||
|
@ -83,7 +87,7 @@ pub async fn resolve_state(
|
|||
let state_events: Vec<_> = state
|
||||
.iter()
|
||||
.stream()
|
||||
.then(|((event_type, state_key), event_id)| {
|
||||
.wide_then(|((event_type, state_key), event_id)| {
|
||||
self.services
|
||||
.short
|
||||
.get_or_create_shortstatekey(event_type, state_key)
|
||||
|
|
|
@ -4,7 +4,12 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
|
||||
use conduit::{debug, err, implement, result::LogErr, utils::IterStream, PduEvent, Result};
|
||||
use conduit::{
|
||||
debug, err, implement,
|
||||
result::LogErr,
|
||||
utils::stream::{BroadbandExt, IterStream},
|
||||
PduEvent, Result,
|
||||
};
|
||||
use futures::{FutureExt, StreamExt};
|
||||
use ruma::{
|
||||
state_res::{self, StateMap},
|
||||
|
@ -166,7 +171,7 @@ pub(super) async fn state_at_incoming_resolved(
|
|||
new_state
|
||||
.iter()
|
||||
.stream()
|
||||
.then(|((event_type, state_key), event_id)| {
|
||||
.broad_then(|((event_type, state_key), event_id)| {
|
||||
self.services
|
||||
.short
|
||||
.get_or_create_shortstatekey(event_type, state_key)
|
||||
|
|
|
@ -3,7 +3,10 @@ use std::{mem::size_of, sync::Arc};
|
|||
use arrayvec::ArrayVec;
|
||||
use conduit::{
|
||||
result::LogErr,
|
||||
utils::{stream::TryIgnore, u64_from_u8, ReadyExt},
|
||||
utils::{
|
||||
stream::{TryIgnore, WidebandExt},
|
||||
u64_from_u8, ReadyExt,
|
||||
},
|
||||
PduCount, PduEvent,
|
||||
};
|
||||
use database::Map;
|
||||
|
@ -67,7 +70,7 @@ impl Data {
|
|||
.ready_take_while(move |key| key.starts_with(&target.to_be_bytes()))
|
||||
.map(|to_from| u64_from_u8(&to_from[8..16]))
|
||||
.map(PduCount::from_unsigned)
|
||||
.filter_map(move |shorteventid| async move {
|
||||
.wide_filter_map(move |shorteventid| async move {
|
||||
let pdu_id: RawPduId = PduId {
|
||||
shortroomid,
|
||||
shorteventid,
|
||||
|
|
|
@ -2,7 +2,10 @@ use std::{collections::BTreeMap, sync::Arc};
|
|||
|
||||
use conduit::{
|
||||
err,
|
||||
utils::{stream::TryIgnore, ReadyExt},
|
||||
utils::{
|
||||
stream::{TryIgnore, WidebandExt},
|
||||
ReadyExt,
|
||||
},
|
||||
PduCount, PduEvent, PduId, RawPduId, Result,
|
||||
};
|
||||
use database::{Deserialized, Map};
|
||||
|
@ -143,7 +146,7 @@ impl Service {
|
|||
.ignore_err()
|
||||
.map(RawPduId::from)
|
||||
.ready_take_while(move |pdu_id| pdu_id.shortroomid() == shortroomid.to_be_bytes())
|
||||
.filter_map(move |pdu_id| async move {
|
||||
.wide_filter_map(move |pdu_id| async move {
|
||||
let mut pdu = self.services.timeline.get_pdu_from_id(&pdu_id).await.ok()?;
|
||||
let pdu_id: PduId = pdu_id.into();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue