Upgrade Ruma

This commit is contained in:
Jonas Platte 2021-11-26 20:36:40 +01:00
parent 1fc616320a
commit 892a0525f2
No known key found for this signature in database
GPG key ID: CC154DE0E30B7C67
25 changed files with 297 additions and 304 deletions

View file

@ -477,7 +477,8 @@ impl Database {
// Set room member count
for (roomid, _) in db.rooms.roomid_shortstatehash.iter() {
let room_id =
RoomId::try_from(utils::string_from_bytes(&roomid).unwrap()).unwrap();
Box::<RoomId>::try_from(utils::string_from_bytes(&roomid).unwrap())
.unwrap();
db.rooms.update_joined_count(&room_id, &db)?;
}
@ -489,7 +490,7 @@ impl Database {
if db.globals.database_version()? < 7 {
// Upgrade state store
let mut last_roomstates: HashMap<RoomId, u64> = HashMap::new();
let mut last_roomstates: HashMap<Box<RoomId>, u64> = HashMap::new();
let mut current_sstatehash: Option<u64> = None;
let mut current_room = None;
let mut current_state = HashSet::new();
@ -570,7 +571,7 @@ impl Database {
if let Some(current_sstatehash) = current_sstatehash {
handle_state(
current_sstatehash,
current_room.as_ref().unwrap(),
current_room.as_deref().unwrap(),
current_state,
&mut last_roomstates,
)?;
@ -587,7 +588,7 @@ impl Database {
.unwrap()
.unwrap();
let event_id =
EventId::try_from(utils::string_from_bytes(&event_id).unwrap())
Box::<EventId>::try_from(utils::string_from_bytes(&event_id).unwrap())
.unwrap();
let pdu = db.rooms.get_pdu(&event_id).unwrap().unwrap();
@ -604,7 +605,7 @@ impl Database {
if let Some(current_sstatehash) = current_sstatehash {
handle_state(
current_sstatehash,
current_room.as_ref().unwrap(),
current_room.as_deref().unwrap(),
current_state,
&mut last_roomstates,
)?;