don't use flatbuffers for Event index table (make it opaque)

This commit is contained in:
Doug Hoyte
2024-08-30 17:39:16 -04:00
parent 391f632b73
commit 47c26cc887
10 changed files with 13 additions and 15 deletions

View File

@ -193,7 +193,7 @@ struct Router {
void outgoingEvent(lmdb::txn &txn, defaultDb::environment::View_Event &ev, std::string &responseStr, tao::json::value &evJson) {
if (dir == "down") return;
if (!filterCompiled.doesMatch(PackedEventView(ev.packed()))) return;
if (!filterCompiled.doesMatch(PackedEventView(ev.buf))) return;
if (responseStr.size() == 0) {
auto evStr = getEventJson(txn, router->decomp, ev.primaryKeyId);

View File

@ -101,7 +101,7 @@ void cmd_stream(const std::vector<std::string> &subArgs) {
env.foreach_Event(txn, [&](auto &ev){
currEventId = ev.primaryKeyId;
auto id = std::string(PackedEventView(ev.packed()).id());
auto id = std::string(PackedEventView(ev.buf).id());
if (downloadedIds.find(id) != downloadedIds.end()) {
downloadedIds.erase(id);
return true;

View File

@ -72,7 +72,7 @@ void cmd_sync(const std::vector<std::string> &subArgs) {
for (auto levId : levIds) {
auto ev = lookupEventByLevId(txn, levId);
PackedEventView packed(ev.packed());
PackedEventView packed(ev.buf);
ne.addItem(packed.created_at(), packed.id().substr(0, ne.idSize));
}

View File

@ -91,7 +91,7 @@ void RelayServer::runCron() {
if (expiration == 1) { // Ephemeral event
auto view = env.lookup_Event(txn, levId);
if (!view) throw herr("missing event from index, corrupt DB?");
uint64_t created = PackedEventView(view->packed()).created_at();
uint64_t created = PackedEventView(view->buf).created_at();
if (created <= ephemeralCutoff) {
numEphemeral++;

View File

@ -100,7 +100,7 @@ void RelayServer::runNegentropy(ThreadPool<MsgNegentropy>::Thread &thr) {
for (auto levId : view->levIds) {
try {
auto ev = lookupEventByLevId(txn, levId);
auto packed = PackedEventView(ev.packed());
auto packed = PackedEventView(ev.buf);
view->ne.addItem(packed.created_at(), packed.id().substr(0, view->ne.idSize));
} catch (std::exception &) {
// levId was deleted when query was paused

View File

@ -31,7 +31,7 @@ void RelayServer::runReqMonitor(ThreadPool<MsgReqMonitor>::Thread &thr) {
auto connId = msg->sub.connId;
env.foreach_Event(txn, [&](auto &ev){
if (msg->sub.filterGroup.doesMatch(PackedEventView(ev.packed()))) {
if (msg->sub.filterGroup.doesMatch(PackedEventView(ev.buf))) {
sendEvent(connId, msg->sub.subId, getEventJson(txn, decomp, ev.primaryKeyId));
}