From 2a6eebec242401fc1b0ca571e46597b77f3004b7 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 11 Jun 2020 16:52:39 +0300 Subject: [PATCH] Fix logevent_id type. GitOrigin-RevId: a609c2f25c1898defe031ce90c72957a031e3f65 --- tddb/td/db/TQueue.cpp | 8 ++++---- tddb/td/db/TQueue.h | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tddb/td/db/TQueue.cpp b/tddb/td/db/TQueue.cpp index 40246be70..675618c5d 100644 --- a/tddb/td/db/TQueue.cpp +++ b/tddb/td/db/TQueue.cpp @@ -359,7 +359,7 @@ TQueueBinlog::TQueueBinlog() { diff_ = Clocks::system() - Time::now(); } template -int64 TQueueBinlog::push(QueueId queue_id, const RawEvent &event) { +uint64 TQueueBinlog::push(QueueId queue_id, const RawEvent &event) { TQueueLogEvent log_event; log_event.queue_id = queue_id; log_event.event_id = event.event_id.value(); @@ -375,7 +375,7 @@ int64 TQueueBinlog::push(QueueId queue_id, const RawEvent &event) { } template -void TQueueBinlog::pop(int64 logevent_id) { +void TQueueBinlog::pop(uint64 logevent_id) { binlog_->erase(logevent_id); } @@ -399,13 +399,13 @@ Status TQueueBinlog::replay(const BinlogEvent &binlog_event, TQueue &q) template class TQueueBinlog; template class TQueueBinlog; -int64 MemoryStorage::push(QueueId queue_id, const RawEvent &event) { +uint64 MemoryStorage::push(QueueId queue_id, const RawEvent &event) { auto logevent_id = event.logevent_id == 0 ? next_logevent_id_++ : event.logevent_id; events_[logevent_id] = std::make_pair(queue_id, event); return logevent_id; } -void MemoryStorage::pop(int64 logevent_id) { +void MemoryStorage::pop(uint64 logevent_id) { events_.erase(logevent_id); } diff --git a/tddb/td/db/TQueue.h b/tddb/td/db/TQueue.h index 12b7dac43..409835f35 100644 --- a/tddb/td/db/TQueue.h +++ b/tddb/td/db/TQueue.h @@ -47,7 +47,7 @@ class TQueue { double expires_at; }; struct RawEvent { - int64 logevent_id{0}; + uint64 logevent_id{0}; EventId event_id; string data; int64 extra{0}; @@ -60,8 +60,8 @@ class TQueue { using RawEvent = TQueue::RawEvent; virtual ~Callback() { } - virtual int64 push(QueueId queue_id, const RawEvent &event) = 0; - virtual void pop(int64 logevent_id) = 0; + virtual uint64 push(QueueId queue_id, const RawEvent &event) = 0; + virtual void pop(uint64 logevent_id) = 0; }; virtual ~TQueue() { @@ -97,8 +97,8 @@ template class TQueueBinlog : public TQueue::Callback { public: TQueueBinlog(); - int64 push(QueueId queue_id, const RawEvent &event) override; - void pop(int64 logevent_id) override; + uint64 push(QueueId queue_id, const RawEvent &event) override; + void pop(uint64 logevent_id) override; Status replay(const BinlogEvent &binlog_event, TQueue &q); void set_binlog(std::shared_ptr binlog) { @@ -113,13 +113,13 @@ class TQueueBinlog : public TQueue::Callback { class MemoryStorage : public TQueue::Callback { public: - int64 push(QueueId queue_id, const RawEvent &event) override; - void pop(int64 logevent_id) override; + uint64 push(QueueId queue_id, const RawEvent &event) override; + void pop(uint64 logevent_id) override; void replay(TQueue &q); private: - int64 next_logevent_id_{1}; - std::map> events_; + uint64 next_logevent_id_{1}; + std::map> events_; }; } // namespace td