run cargo fix for rust 2024 changes and rustfmt
Signed-off-by: June Clementine Strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
e97952b7f6
commit
a1e1f40ded
320 changed files with 2212 additions and 2039 deletions
|
@ -1,7 +1,7 @@
|
|||
use conduwuit::{debug, implement, trace, warn, Err, Result};
|
||||
use conduwuit::{Err, Result, debug, implement, trace, warn};
|
||||
use ruma::{
|
||||
events::{room::server_acl::RoomServerAclEventContent, StateEventType},
|
||||
RoomId, ServerName,
|
||||
events::{StateEventType, room::server_acl::RoomServerAclEventContent},
|
||||
};
|
||||
|
||||
/// Returns Ok if the acl allows the server
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
use std::{
|
||||
collections::{hash_map, BTreeMap, HashSet, VecDeque},
|
||||
collections::{BTreeMap, HashSet, VecDeque, hash_map},
|
||||
sync::Arc,
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
use conduwuit::{
|
||||
debug, debug_error, debug_warn, implement, pdu, trace,
|
||||
utils::continue_exponential_backoff_secs, warn, PduEvent,
|
||||
PduEvent, debug, debug_error, debug_warn, implement, pdu, trace,
|
||||
utils::continue_exponential_backoff_secs, warn,
|
||||
};
|
||||
use futures::TryFutureExt;
|
||||
use ruma::{
|
||||
api::federation::event::get_event, CanonicalJsonValue, OwnedEventId, RoomId, ServerName,
|
||||
CanonicalJsonValue, OwnedEventId, RoomId, ServerName, api::federation::event::get_event,
|
||||
};
|
||||
|
||||
use super::get_room_version_id;
|
||||
|
@ -138,12 +138,15 @@ pub(super) async fn fetch_and_handle_outliers<'a>(
|
|||
.and_then(CanonicalJsonValue::as_array)
|
||||
{
|
||||
for auth_event in auth_events {
|
||||
if let Ok(auth_event) =
|
||||
serde_json::from_value::<OwnedEventId>(auth_event.clone().into())
|
||||
{
|
||||
todo_auth_events.push_back(auth_event);
|
||||
} else {
|
||||
warn!("Auth event id is not valid");
|
||||
match serde_json::from_value::<OwnedEventId>(
|
||||
auth_event.clone().into(),
|
||||
) {
|
||||
| Ok(auth_event) => {
|
||||
todo_auth_events.push_back(auth_event);
|
||||
},
|
||||
| _ => {
|
||||
warn!("Auth event id is not valid");
|
||||
},
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -4,14 +4,13 @@ use std::{
|
|||
};
|
||||
|
||||
use conduwuit::{
|
||||
debug_warn, err, implement,
|
||||
PduEvent, Result, debug_warn, err, implement,
|
||||
state_res::{self},
|
||||
PduEvent, Result,
|
||||
};
|
||||
use futures::{future, FutureExt};
|
||||
use futures::{FutureExt, future};
|
||||
use ruma::{
|
||||
int, uint, CanonicalJsonValue, MilliSecondsSinceUnixEpoch, OwnedEventId, RoomId, ServerName,
|
||||
UInt,
|
||||
CanonicalJsonValue, MilliSecondsSinceUnixEpoch, OwnedEventId, RoomId, ServerName, UInt, int,
|
||||
uint,
|
||||
};
|
||||
|
||||
use super::check_room_id;
|
||||
|
@ -43,54 +42,59 @@ pub(super) async fn fetch_prev(
|
|||
while let Some(prev_event_id) = todo_outlier_stack.pop_front() {
|
||||
self.services.server.check_running()?;
|
||||
|
||||
if let Some((pdu, mut json_opt)) = self
|
||||
match self
|
||||
.fetch_and_handle_outliers(origin, &[prev_event_id.clone()], create_event, room_id)
|
||||
.boxed()
|
||||
.await
|
||||
.pop()
|
||||
{
|
||||
check_room_id(room_id, &pdu)?;
|
||||
| Some((pdu, mut json_opt)) => {
|
||||
check_room_id(room_id, &pdu)?;
|
||||
|
||||
let limit = self.services.server.config.max_fetch_prev_events;
|
||||
if amount > limit {
|
||||
debug_warn!("Max prev event limit reached! Limit: {limit}");
|
||||
graph.insert(prev_event_id.clone(), HashSet::new());
|
||||
continue;
|
||||
}
|
||||
|
||||
if json_opt.is_none() {
|
||||
json_opt = self
|
||||
.services
|
||||
.outlier
|
||||
.get_outlier_pdu_json(&prev_event_id)
|
||||
.await
|
||||
.ok();
|
||||
}
|
||||
|
||||
if let Some(json) = json_opt {
|
||||
if pdu.origin_server_ts > first_ts_in_room {
|
||||
amount = amount.saturating_add(1);
|
||||
for prev_prev in &pdu.prev_events {
|
||||
if !graph.contains_key(prev_prev) {
|
||||
todo_outlier_stack.push_back(prev_prev.clone());
|
||||
}
|
||||
}
|
||||
|
||||
graph
|
||||
.insert(prev_event_id.clone(), pdu.prev_events.iter().cloned().collect());
|
||||
} else {
|
||||
// Time based check failed
|
||||
let limit = self.services.server.config.max_fetch_prev_events;
|
||||
if amount > limit {
|
||||
debug_warn!("Max prev event limit reached! Limit: {limit}");
|
||||
graph.insert(prev_event_id.clone(), HashSet::new());
|
||||
continue;
|
||||
}
|
||||
|
||||
eventid_info.insert(prev_event_id.clone(), (pdu, json));
|
||||
} else {
|
||||
// Get json failed, so this was not fetched over federation
|
||||
if json_opt.is_none() {
|
||||
json_opt = self
|
||||
.services
|
||||
.outlier
|
||||
.get_outlier_pdu_json(&prev_event_id)
|
||||
.await
|
||||
.ok();
|
||||
}
|
||||
|
||||
if let Some(json) = json_opt {
|
||||
if pdu.origin_server_ts > first_ts_in_room {
|
||||
amount = amount.saturating_add(1);
|
||||
for prev_prev in &pdu.prev_events {
|
||||
if !graph.contains_key(prev_prev) {
|
||||
todo_outlier_stack.push_back(prev_prev.clone());
|
||||
}
|
||||
}
|
||||
|
||||
graph.insert(
|
||||
prev_event_id.clone(),
|
||||
pdu.prev_events.iter().cloned().collect(),
|
||||
);
|
||||
} else {
|
||||
// Time based check failed
|
||||
graph.insert(prev_event_id.clone(), HashSet::new());
|
||||
}
|
||||
|
||||
eventid_info.insert(prev_event_id.clone(), (pdu, json));
|
||||
} else {
|
||||
// Get json failed, so this was not fetched over federation
|
||||
graph.insert(prev_event_id.clone(), HashSet::new());
|
||||
}
|
||||
},
|
||||
| _ => {
|
||||
// Fetch and handle failed
|
||||
graph.insert(prev_event_id.clone(), HashSet::new());
|
||||
}
|
||||
} else {
|
||||
// Fetch and handle failed
|
||||
graph.insert(prev_event_id.clone(), HashSet::new());
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use std::collections::{hash_map, HashMap};
|
||||
use std::collections::{HashMap, hash_map};
|
||||
|
||||
use conduwuit::{debug, debug_warn, implement, Err, Error, PduEvent, Result};
|
||||
use conduwuit::{Err, Error, PduEvent, Result, debug, debug_warn, implement};
|
||||
use futures::FutureExt;
|
||||
use ruma::{
|
||||
api::federation::event::get_room_state_ids, events::StateEventType, EventId, OwnedEventId,
|
||||
RoomId, ServerName,
|
||||
EventId, OwnedEventId, RoomId, ServerName, api::federation::event::get_room_state_ids,
|
||||
events::StateEventType,
|
||||
};
|
||||
|
||||
use crate::rooms::short::ShortStateKey;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
use std::{
|
||||
collections::{hash_map, BTreeMap},
|
||||
collections::{BTreeMap, hash_map},
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
use conduwuit::{debug, debug::INFO_SPAN_LEVEL, err, implement, warn, Err, Result};
|
||||
use conduwuit::{Err, Result, debug, debug::INFO_SPAN_LEVEL, err, implement, warn};
|
||||
use futures::{
|
||||
future::{try_join5, OptionFuture},
|
||||
FutureExt,
|
||||
future::{OptionFuture, try_join5},
|
||||
};
|
||||
use ruma::{events::StateEventType, CanonicalJsonValue, EventId, RoomId, ServerName, UserId};
|
||||
use ruma::{CanonicalJsonValue, EventId, RoomId, ServerName, UserId, events::StateEventType};
|
||||
|
||||
use crate::rooms::timeline::RawPduId;
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
use std::{
|
||||
collections::{hash_map, BTreeMap, HashMap},
|
||||
collections::{BTreeMap, HashMap, hash_map},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use conduwuit::{
|
||||
debug, debug_info, err, implement, state_res, trace, warn, Err, Error, PduEvent, Result,
|
||||
Err, Error, PduEvent, Result, debug, debug_info, err, implement, state_res, trace, warn,
|
||||
};
|
||||
use futures::{future::ready, TryFutureExt};
|
||||
use futures::{TryFutureExt, future::ready};
|
||||
use ruma::{
|
||||
api::client::error::ErrorKind, events::StateEventType, CanonicalJsonObject,
|
||||
CanonicalJsonValue, EventId, RoomId, ServerName,
|
||||
CanonicalJsonObject, CanonicalJsonValue, EventId, RoomId, ServerName,
|
||||
api::client::error::ErrorKind, events::StateEventType,
|
||||
};
|
||||
|
||||
use super::{check_room_id, get_room_version_id, to_room_version};
|
||||
|
|
|
@ -5,8 +5,8 @@ use std::{
|
|||
};
|
||||
|
||||
use conduwuit::{
|
||||
debug, debug::INFO_SPAN_LEVEL, implement, utils::continue_exponential_backoff_secs, Err,
|
||||
PduEvent, Result,
|
||||
Err, PduEvent, Result, debug, debug::INFO_SPAN_LEVEL, implement,
|
||||
utils::continue_exponential_backoff_secs,
|
||||
};
|
||||
use ruma::{CanonicalJsonValue, EventId, OwnedEventId, RoomId, ServerName, UInt};
|
||||
|
||||
|
|
|
@ -18,16 +18,16 @@ use std::{
|
|||
};
|
||||
|
||||
use conduwuit::{
|
||||
utils::{MutexMap, TryFutureExtExt},
|
||||
Err, PduEvent, Result, RoomVersion, Server,
|
||||
utils::{MutexMap, TryFutureExtExt},
|
||||
};
|
||||
use futures::TryFutureExt;
|
||||
use ruma::{
|
||||
events::room::create::RoomCreateEventContent, OwnedEventId, OwnedRoomId, RoomId,
|
||||
RoomVersionId,
|
||||
OwnedEventId, OwnedRoomId, RoomId, RoomVersionId,
|
||||
events::room::create::RoomCreateEventContent,
|
||||
};
|
||||
|
||||
use crate::{globals, rooms, sending, server_keys, Dep};
|
||||
use crate::{Dep, globals, rooms, sending, server_keys};
|
||||
|
||||
pub struct Service {
|
||||
pub mutex_federation: RoomMutexMap,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use conduwuit::{err, implement, pdu::gen_event_id_canonical_json, result::FlatOk, Result};
|
||||
use conduwuit::{Result, err, implement, pdu::gen_event_id_canonical_json, result::FlatOk};
|
||||
use ruma::{CanonicalJsonObject, CanonicalJsonValue, OwnedEventId, OwnedRoomId};
|
||||
use serde_json::value::RawValue as RawJsonValue;
|
||||
|
||||
|
|
|
@ -5,13 +5,12 @@ use std::{
|
|||
};
|
||||
|
||||
use conduwuit::{
|
||||
err, implement,
|
||||
Error, Result, err, implement,
|
||||
state_res::{self, StateMap},
|
||||
trace,
|
||||
utils::stream::{automatic_width, IterStream, ReadyExt, TryWidebandExt, WidebandExt},
|
||||
Error, Result,
|
||||
utils::stream::{IterStream, ReadyExt, TryWidebandExt, WidebandExt, automatic_width},
|
||||
};
|
||||
use futures::{future::try_join, FutureExt, StreamExt, TryFutureExt, TryStreamExt};
|
||||
use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::try_join};
|
||||
use ruma::{OwnedEventId, RoomId, RoomVersionId};
|
||||
|
||||
use crate::rooms::state_compressor::CompressedState;
|
||||
|
@ -93,11 +92,7 @@ pub async fn resolve_state(
|
|||
let new_room_state: CompressedState = self
|
||||
.services
|
||||
.state_compressor
|
||||
.compress_state_events(
|
||||
state_events
|
||||
.iter()
|
||||
.map(|(ref ssk, eid)| (ssk, (*eid).borrow())),
|
||||
)
|
||||
.compress_state_events(state_events.iter().map(|(ssk, eid)| (ssk, (*eid).borrow())))
|
||||
.collect()
|
||||
.await;
|
||||
|
||||
|
|
|
@ -6,11 +6,10 @@ use std::{
|
|||
};
|
||||
|
||||
use conduwuit::{
|
||||
debug, err, implement, trace,
|
||||
PduEvent, Result, StateMap, debug, err, implement, trace,
|
||||
utils::stream::{BroadbandExt, IterStream, ReadyExt, TryBroadbandExt, TryWidebandExt},
|
||||
PduEvent, Result, StateMap,
|
||||
};
|
||||
use futures::{future::try_join, FutureExt, StreamExt, TryFutureExt, TryStreamExt};
|
||||
use futures::{FutureExt, StreamExt, TryFutureExt, TryStreamExt, future::try_join};
|
||||
use ruma::{OwnedEventId, RoomId, RoomVersionId};
|
||||
|
||||
use crate::rooms::short::ShortStateHash;
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
use std::{borrow::Borrow, collections::BTreeMap, iter::once, sync::Arc, time::Instant};
|
||||
|
||||
use conduwuit::{
|
||||
debug, debug_info, err, implement, state_res, trace,
|
||||
Err, EventTypeExt, PduEvent, Result, StateKey, debug, debug_info, err, implement, state_res,
|
||||
trace,
|
||||
utils::stream::{BroadbandExt, ReadyExt},
|
||||
warn, Err, EventTypeExt, PduEvent, Result, StateKey,
|
||||
warn,
|
||||
};
|
||||
use futures::{future::ready, FutureExt, StreamExt};
|
||||
use ruma::{events::StateEventType, CanonicalJsonValue, RoomId, ServerName};
|
||||
use futures::{FutureExt, StreamExt, future::ready};
|
||||
use ruma::{CanonicalJsonValue, RoomId, ServerName, events::StateEventType};
|
||||
|
||||
use super::{get_room_version_id, to_room_version};
|
||||
use crate::rooms::{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue