|
|
@ -1669,7 +1669,7 @@ Cache::calculateRoomReadStatus(const std::string &room_id) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void |
|
|
|
void |
|
|
|
Cache::updateState(const std::string &room, const mtx::responses::StateEvents &state) |
|
|
|
Cache::updateState(const std::string &room, const mtx::responses::StateEvents &state, bool wipe) |
|
|
|
{ |
|
|
|
{ |
|
|
|
auto txn = lmdb::txn::begin(env_); |
|
|
|
auto txn = lmdb::txn::begin(env_); |
|
|
|
auto statesdb = getStatesDb(txn, room); |
|
|
|
auto statesdb = getStatesDb(txn, room); |
|
|
@ -1677,6 +1677,12 @@ Cache::updateState(const std::string &room, const mtx::responses::StateEvents &s |
|
|
|
auto membersdb = getMembersDb(txn, room); |
|
|
|
auto membersdb = getMembersDb(txn, room); |
|
|
|
auto eventsDb = getEventsDb(txn, room); |
|
|
|
auto eventsDb = getEventsDb(txn, room); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (wipe) { |
|
|
|
|
|
|
|
membersdb.drop(txn); |
|
|
|
|
|
|
|
statesdb.drop(txn); |
|
|
|
|
|
|
|
stateskeydb.drop(txn); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
saveStateEvents(txn, statesdb, stateskeydb, membersdb, eventsDb, room, state.events); |
|
|
|
saveStateEvents(txn, statesdb, stateskeydb, membersdb, eventsDb, room, state.events); |
|
|
|
|
|
|
|
|
|
|
|
RoomInfo updatedInfo; |
|
|
|
RoomInfo updatedInfo; |
|
|
|