mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-17 07:41:23 +01:00
remove commented-out code
This commit is contained in:
parent
d3b7eecaed
commit
0915aba44c
10 changed files with 0 additions and 81 deletions
|
|
@ -20,7 +20,6 @@ use tracing::{info, warn};
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct Claims {
|
struct Claims {
|
||||||
sub: String,
|
sub: String,
|
||||||
//exp: usize,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// # `GET /_matrix/client/r0/login`
|
/// # `GET /_matrix/client/r0/login`
|
||||||
|
|
|
||||||
|
|
@ -605,28 +605,6 @@ impl KeyValueDatabase {
|
||||||
states_parents,
|
states_parents,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
/*
|
|
||||||
let mut tmp = services().rooms.load_shortstatehash_info(¤t_sstatehash)?;
|
|
||||||
let state = tmp.pop().unwrap();
|
|
||||||
println!(
|
|
||||||
"{}\t{}{:?}: {:?} + {:?} - {:?}",
|
|
||||||
current_room,
|
|
||||||
" ".repeat(tmp.len()),
|
|
||||||
utils::u64_from_bytes(¤t_sstatehash).unwrap(),
|
|
||||||
tmp.last().map(|b| utils::u64_from_bytes(&b.0).unwrap()),
|
|
||||||
state
|
|
||||||
.2
|
|
||||||
.iter()
|
|
||||||
.map(|b| utils::u64_from_bytes(&b[size_of::<u64>()..]).unwrap())
|
|
||||||
.collect::<Vec<_>>(),
|
|
||||||
state
|
|
||||||
.3
|
|
||||||
.iter()
|
|
||||||
.map(|b| utils::u64_from_bytes(&b[size_of::<u64>()..]).unwrap())
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
|
|
||||||
Ok::<_, Error>(())
|
Ok::<_, Error>(())
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -195,8 +195,6 @@ impl SqliteTable {
|
||||||
|
|
||||||
let statement_ref = AliasableBox(statement);
|
let statement_ref = AliasableBox(statement);
|
||||||
|
|
||||||
//let name = self.name.clone();
|
|
||||||
|
|
||||||
let iterator = Box::new(
|
let iterator = Box::new(
|
||||||
statement
|
statement
|
||||||
.query_map([], |row| Ok((row.get_unwrap(0), row.get_unwrap(1))))
|
.query_map([], |row| Ok((row.get_unwrap(0), row.get_unwrap(1))))
|
||||||
|
|
@ -279,8 +277,6 @@ impl KvTree for SqliteTable {
|
||||||
let guard = self.engine.read_lock_iterator();
|
let guard = self.engine.read_lock_iterator();
|
||||||
let from = from.to_vec(); // TODO change interface?
|
let from = from.to_vec(); // TODO change interface?
|
||||||
|
|
||||||
//let name = self.name.clone();
|
|
||||||
|
|
||||||
if backwards {
|
if backwards {
|
||||||
let statement = Box::leak(Box::new(
|
let statement = Box::leak(Box::new(
|
||||||
guard
|
guard
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
mod account_data;
|
mod account_data;
|
||||||
//mod admin;
|
|
||||||
mod appservice;
|
mod appservice;
|
||||||
mod globals;
|
mod globals;
|
||||||
mod key_backups;
|
mod key_backups;
|
||||||
mod media;
|
mod media;
|
||||||
//mod pdu;
|
|
||||||
mod pusher;
|
mod pusher;
|
||||||
mod rooms;
|
mod rooms;
|
||||||
mod sending;
|
mod sending;
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,6 @@ fn routes(config: &Config) -> Router {
|
||||||
.ruma_route(client_server::get_key_changes_route)
|
.ruma_route(client_server::get_key_changes_route)
|
||||||
.ruma_route(client_server::get_pushers_route)
|
.ruma_route(client_server::get_pushers_route)
|
||||||
.ruma_route(client_server::set_pushers_route)
|
.ruma_route(client_server::set_pushers_route)
|
||||||
// .ruma_route(client_server::third_party_route)
|
|
||||||
.ruma_route(client_server::upgrade_room_route)
|
.ruma_route(client_server::upgrade_room_route)
|
||||||
.ruma_route(client_server::get_threads_route)
|
.ruma_route(client_server::get_threads_route)
|
||||||
.ruma_route(client_server::get_relating_events_with_rel_type_and_event_type_route)
|
.ruma_route(client_server::get_relating_events_with_rel_type_and_event_type_route)
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,6 @@ impl Service {
|
||||||
async fn handler(&self) {
|
async fn handler(&self) {
|
||||||
let mut receiver = self.receiver.lock().await;
|
let mut receiver = self.receiver.lock().await;
|
||||||
// TODO: Use futures when we have long admin commands
|
// TODO: Use futures when we have long admin commands
|
||||||
//let mut futures = FuturesUnordered::new();
|
|
||||||
|
|
||||||
let grapevine_user = UserId::parse(format!(
|
let grapevine_user = UserId::parse(format!(
|
||||||
"@{}:{}",
|
"@{}:{}",
|
||||||
|
|
|
||||||
|
|
@ -327,13 +327,6 @@ impl PduEvent {
|
||||||
|
|
||||||
pdu_json.remove("event_id");
|
pdu_json.remove("event_id");
|
||||||
|
|
||||||
// TODO: another option would be to convert it to a canonical string to validate size
|
|
||||||
// and return a Result<Raw<...>>
|
|
||||||
// serde_json::from_str::<Raw<_>>(
|
|
||||||
// ruma::serde::to_canonical_json_string(pdu_json).expect("CanonicalJson is valid serde_json::Value"),
|
|
||||||
// )
|
|
||||||
// .expect("Raw::from_value always works")
|
|
||||||
|
|
||||||
to_raw_value(&pdu_json).expect("CanonicalJson is valid serde_json::Value")
|
to_raw_value(&pdu_json).expect("CanonicalJson is valid serde_json::Value")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,9 +72,6 @@ impl Service {
|
||||||
|
|
||||||
let reqwest_request = reqwest::Request::try_from(http_request)?;
|
let reqwest_request = reqwest::Request::try_from(http_request)?;
|
||||||
|
|
||||||
// TODO: we could keep this very short and let expo backoff do it's thing...
|
|
||||||
//*reqwest_request.timeout_mut() = Some(Duration::from_secs(5));
|
|
||||||
|
|
||||||
let url = reqwest_request.url().clone();
|
let url = reqwest_request.url().clone();
|
||||||
let response = services()
|
let response = services()
|
||||||
.globals
|
.globals
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ use tracing::{debug, error, warn};
|
||||||
use crate::{services, Error, PduEvent, Result};
|
use crate::{services, Error, PduEvent, Result};
|
||||||
|
|
||||||
pub(crate) enum CachedJoinRule {
|
pub(crate) enum CachedJoinRule {
|
||||||
//Simplified(SpaceRoomJoinRule),
|
|
||||||
Full(JoinRule),
|
Full(JoinRule),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,9 +86,6 @@ impl Service {
|
||||||
{
|
{
|
||||||
if let Some(cached) = cached {
|
if let Some(cached) = cached {
|
||||||
let allowed = match &cached.join_rule {
|
let allowed = match &cached.join_rule {
|
||||||
//CachedJoinRule::Simplified(s) => {
|
|
||||||
//self.handle_simplified_join_rule(s, sender_user, ¤t_room)?
|
|
||||||
//}
|
|
||||||
CachedJoinRule::Full(f) => {
|
CachedJoinRule::Full(f) => {
|
||||||
self.handle_join_rule(f, sender_user, ¤t_room)?
|
self.handle_join_rule(f, sender_user, ¤t_room)?
|
||||||
}
|
}
|
||||||
|
|
@ -275,19 +271,6 @@ impl Service {
|
||||||
join_rule: CachedJoinRule::Full(join_rule),
|
join_rule: CachedJoinRule::Full(join_rule),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
/* TODO:
|
|
||||||
for child in response.children {
|
|
||||||
roomid_spacechunk_cache.insert(
|
|
||||||
current_room.clone(),
|
|
||||||
CachedSpaceChunk {
|
|
||||||
chunk: child.chunk,
|
|
||||||
children,
|
|
||||||
join_rule,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
} else {
|
} else {
|
||||||
self.roomid_spacechunk_cache
|
self.roomid_spacechunk_cache
|
||||||
.lock()
|
.lock()
|
||||||
|
|
|
||||||
|
|
@ -114,29 +114,6 @@ impl Service {
|
||||||
self.db.get_pdu_count(event_id)
|
self.db.get_pdu_count(event_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Is this the same as the function above?
|
|
||||||
/*
|
|
||||||
#[tracing::instrument(skip(self))]
|
|
||||||
pub(crate) fn latest_pdu_count(&self, room_id: &RoomId) -> Result<u64> {
|
|
||||||
let prefix = self
|
|
||||||
.get_shortroomid(room_id)?
|
|
||||||
.expect("room exists")
|
|
||||||
.to_be_bytes()
|
|
||||||
.to_vec();
|
|
||||||
|
|
||||||
let mut last_possible_key = prefix.clone();
|
|
||||||
last_possible_key.extend_from_slice(&u64::MAX.to_be_bytes());
|
|
||||||
|
|
||||||
self.pduid_pdu
|
|
||||||
.iter_from(&last_possible_key, true)
|
|
||||||
.take_while(move |(k, _)| k.starts_with(&prefix))
|
|
||||||
.next()
|
|
||||||
.map(|b| self.pdu_count(&b.0))
|
|
||||||
.transpose()
|
|
||||||
.map(|op| op.unwrap_or_default())
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/// Returns the json of a pdu.
|
/// Returns the json of a pdu.
|
||||||
pub(crate) fn get_pdu_json(&self, event_id: &EventId) -> Result<Option<CanonicalJsonObject>> {
|
pub(crate) fn get_pdu_json(&self, event_id: &EventId) -> Result<Option<CanonicalJsonObject>> {
|
||||||
self.db.get_pdu_json(event_id)
|
self.db.get_pdu_json(event_id)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue