mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-20 17:59:50 +00:00
don't store receivedAt and source metadata
This commit is contained in:
@ -55,7 +55,7 @@ void cmd_import(const std::vector<std::string> &subArgs) {
|
||||
continue;
|
||||
}
|
||||
|
||||
writer.write({ std::move(evJson), EventSourceType::Import, "" });
|
||||
writer.write({ std::move(evJson), });
|
||||
writer.wait();
|
||||
}
|
||||
|
||||
|
@ -183,9 +183,9 @@ struct Router {
|
||||
|
||||
std::string okMsg;
|
||||
|
||||
auto res = pluginDown.acceptEvent(pluginDownCmd, evJson, hoytech::curr_time_us(), EventSourceType::Stream, url, okMsg);
|
||||
auto res = pluginDown.acceptEvent(pluginDownCmd, evJson, EventSourceType::Stream, url, okMsg);
|
||||
if (res == PluginEventSifterResult::Accept) {
|
||||
router->writer.write({ std::move(evJson), EventSourceType::Stream, url });
|
||||
router->writer.write({ std::move(evJson), });
|
||||
} else {
|
||||
if (okMsg.size()) LI << groupName << " / " << url << " : pluginDown blocked event " << evJson.at("id").get_string() << ": " << okMsg;
|
||||
}
|
||||
@ -206,7 +206,7 @@ struct Router {
|
||||
|
||||
std::string okMsg;
|
||||
|
||||
auto res = pluginUp.acceptEvent(pluginUpCmd, evJson, ev.receivedAt(), (EventSourceType)ev.sourceType(), ev.sourceInfo(), okMsg);
|
||||
auto res = pluginUp.acceptEvent(pluginUpCmd, evJson, EventSourceType::Stored, "", okMsg);
|
||||
if (res == PluginEventSifterResult::Accept) {
|
||||
for (auto &[url, c] : conns) {
|
||||
if (c.ws) c.ws->send(responseStr.data(), responseStr.size(), uWS::OpCode::TEXT, nullptr, nullptr, true);
|
||||
|
@ -67,10 +67,10 @@ void cmd_stream(const std::vector<std::string> &subArgs) {
|
||||
auto &evJson = origJson.at(2);
|
||||
|
||||
std::string okMsg;
|
||||
auto res = writePolicyPlugin.acceptEvent(cfg().relay__writePolicy__plugin, evJson, hoytech::curr_time_us(), EventSourceType::Stream, ws.remoteAddr, okMsg);
|
||||
auto res = writePolicyPlugin.acceptEvent(cfg().relay__writePolicy__plugin, evJson, EventSourceType::Stream, ws.remoteAddr, okMsg);
|
||||
if (res == PluginEventSifterResult::Accept) {
|
||||
downloadedIds.emplace(from_hex(evJson.at("id").get_string()));
|
||||
writer.write({ std::move(evJson), EventSourceType::Stream, url });
|
||||
writer.write({ std::move(evJson), });
|
||||
} else {
|
||||
if (okMsg.size()) LI << "[" << ws.remoteAddr << "] write policy blocked event " << evJson.at("id").get_string() << ": " << okMsg;
|
||||
}
|
||||
|
@ -168,9 +168,9 @@ void cmd_sync(const std::vector<std::string> &subArgs) {
|
||||
auto &evJson = msg.at(2);
|
||||
|
||||
std::string okMsg;
|
||||
auto res = writePolicyPlugin.acceptEvent(cfg().relay__writePolicy__plugin, evJson, hoytech::curr_time_us(), EventSourceType::Sync, ws.remoteAddr, okMsg);
|
||||
auto res = writePolicyPlugin.acceptEvent(cfg().relay__writePolicy__plugin, evJson, EventSourceType::Sync, ws.remoteAddr, okMsg);
|
||||
if (res == PluginEventSifterResult::Accept) {
|
||||
writer.write({ std::move(evJson), EventSourceType::Sync, url });
|
||||
writer.write({ std::move(evJson), });
|
||||
} else {
|
||||
if (okMsg.size()) LI << "[" << ws.remoteAddr << "] write policy blocked event " << evJson.at("id").get_string() << ": " << okMsg;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void RelayServer::ingesterProcessEvent(lmdb::txn &txn, uint64_t connId, std::str
|
||||
}
|
||||
}
|
||||
|
||||
output.emplace_back(MsgWriter{MsgWriter::AddEvent{connId, std::move(ipAddr), hoytech::curr_time_us(), std::move(packedStr), std::move(jsonStr)}});
|
||||
output.emplace_back(MsgWriter{MsgWriter::AddEvent{connId, std::move(ipAddr), std::move(packedStr), std::move(jsonStr)}});
|
||||
}
|
||||
|
||||
void RelayServer::ingesterProcessReq(lmdb::txn &txn, uint64_t connId, const tao::json::value &arr) {
|
||||
|
@ -65,7 +65,6 @@ struct MsgWriter : NonCopyable {
|
||||
struct AddEvent {
|
||||
uint64_t connId;
|
||||
std::string ipAddr;
|
||||
uint64_t receivedAt;
|
||||
std::string packedStr;
|
||||
std::string jsonStr;
|
||||
};
|
||||
|
@ -40,10 +40,10 @@ void RelayServer::runWriter(ThreadPool<MsgWriter>::Thread &thr) {
|
||||
tao::json::value evJson = tao::json::from_string(msg->jsonStr);
|
||||
EventSourceType sourceType = msg->ipAddr.size() == 4 ? EventSourceType::IP4 : EventSourceType::IP6;
|
||||
std::string okMsg;
|
||||
auto res = writePolicyPlugin.acceptEvent(cfg().relay__writePolicy__plugin, evJson, msg->receivedAt, sourceType, msg->ipAddr, okMsg);
|
||||
auto res = writePolicyPlugin.acceptEvent(cfg().relay__writePolicy__plugin, evJson, sourceType, msg->ipAddr, okMsg);
|
||||
|
||||
if (res == PluginEventSifterResult::Accept) {
|
||||
newEvents.emplace_back(std::move(msg->packedStr), std::move(msg->jsonStr), msg->receivedAt, sourceType, std::move(msg->ipAddr), msg);
|
||||
newEvents.emplace_back(std::move(msg->packedStr), std::move(msg->jsonStr), msg);
|
||||
} else {
|
||||
PackedEventView packed(msg->packedStr);
|
||||
auto eventIdHex = to_hex(packed.id());
|
||||
|
Reference in New Issue
Block a user