mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-21 18:15:24 +00:00
remove quadrable and yesstr
This commit is contained in:
21
src/events.h
21
src/events.h
@ -52,12 +52,6 @@ std::string_view decodeEventPayload(lmdb::txn &txn, Decompressor &decomp, std::s
|
||||
std::string_view getEventJson(lmdb::txn &txn, Decompressor &decomp, uint64_t levId);
|
||||
std::string_view getEventJson(lmdb::txn &txn, Decompressor &decomp, uint64_t levId, std::string_view eventPayload);
|
||||
|
||||
inline quadrable::Key flatEventToQuadrableKey(const NostrIndex::Event *flat) {
|
||||
uint64_t timestamp = flat->created_at();
|
||||
if (timestamp > MAX_TIMESTAMP) throw herr("timestamp is too large to encode in quadrable key");
|
||||
return quadrable::Key::fromIntegerAndHash(timestamp, sv(flat->id()).substr(0, 27));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -97,18 +91,25 @@ struct EventToWrite {
|
||||
EventSourceType sourceType;
|
||||
std::string sourceInfo;
|
||||
void *userData = nullptr;
|
||||
quadrable::Key quadKey;
|
||||
EventWriteStatus status = EventWriteStatus::Pending;
|
||||
uint64_t levId = 0;
|
||||
|
||||
EventToWrite() {}
|
||||
|
||||
EventToWrite(std::string flatStr, std::string jsonStr, uint64_t receivedAt, EventSourceType sourceType, std::string sourceInfo, void *userData = nullptr) : flatStr(flatStr), jsonStr(jsonStr), receivedAt(receivedAt), sourceType(sourceType), sourceInfo(sourceInfo), userData(userData) {
|
||||
}
|
||||
|
||||
std::string_view id() {
|
||||
const NostrIndex::Event *flat = flatbuffers::GetRoot<NostrIndex::Event>(flatStr.data());
|
||||
quadKey = flatEventToQuadrableKey(flat);
|
||||
return sv(flat->id());
|
||||
}
|
||||
|
||||
uint64_t createdAt() {
|
||||
const NostrIndex::Event *flat = flatbuffers::GetRoot<NostrIndex::Event>(flatStr.data());
|
||||
return flat->created_at();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void writeEvents(lmdb::txn &txn, quadrable::Quadrable &qdb, std::vector<EventToWrite> &evs, uint64_t logLevel = 1);
|
||||
void deleteEvent(lmdb::txn &txn, quadrable::Quadrable::UpdateSet &changes, defaultDb::environment::View_Event &ev);
|
||||
void writeEvents(lmdb::txn &txn, std::vector<EventToWrite> &evs, uint64_t logLevel = 1);
|
||||
void deleteEvent(lmdb::txn &txn, defaultDb::environment::View_Event &ev);
|
||||
|
Reference in New Issue
Block a user