Basic threading support
This commit is contained in:
parent
bffa0115d4
commit
88cbac1695
22 changed files with 240 additions and 163 deletions
|
|
@ -2229,7 +2229,7 @@ Cache::getTimelineMessages(lmdb::txn &txn, const std::string &room_id, uint64_t
|
|||
}
|
||||
|
||||
std::optional<mtx::events::collections::TimelineEvent>
|
||||
Cache::getEvent(const std::string &room_id, const std::string &event_id)
|
||||
Cache::getEvent(const std::string &room_id, std::string_view event_id)
|
||||
{
|
||||
auto txn = ro_txn(env_);
|
||||
auto eventsDb = getEventsDb(txn, room_id);
|
||||
|
|
@ -2555,30 +2555,6 @@ Cache::lastVisibleEvent(const std::string &room_id, std::string_view event_id)
|
|||
}
|
||||
}
|
||||
|
||||
std::optional<uint64_t>
|
||||
Cache::getArrivalIndex(const std::string &room_id, std::string_view event_id)
|
||||
{
|
||||
auto txn = ro_txn(env_);
|
||||
|
||||
lmdb::dbi orderDb;
|
||||
try {
|
||||
orderDb = getEventToOrderDb(txn, room_id);
|
||||
} catch (lmdb::runtime_error &e) {
|
||||
nhlog::db()->error(
|
||||
"Can't open db for room '{}', probably doesn't exist yet. ({})", room_id, e.what());
|
||||
return {};
|
||||
}
|
||||
|
||||
std::string_view val;
|
||||
|
||||
bool success = orderDb.get(txn, event_id, val);
|
||||
if (!success) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return lmdb::from_sv<uint64_t>(val);
|
||||
}
|
||||
|
||||
std::optional<std::string>
|
||||
Cache::getTimelineEventId(const std::string &room_id, uint64_t index)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue