Fix logevent_id type.
GitOrigin-RevId: a609c2f25c1898defe031ce90c72957a031e3f65
This commit is contained in:
parent
22c9927314
commit
2a6eebec24
@ -359,7 +359,7 @@ TQueueBinlog<BinlogT>::TQueueBinlog() {
|
||||
diff_ = Clocks::system() - Time::now();
|
||||
}
|
||||
template <class BinlogT>
|
||||
int64 TQueueBinlog<BinlogT>::push(QueueId queue_id, const RawEvent &event) {
|
||||
uint64 TQueueBinlog<BinlogT>::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<BinlogT>::push(QueueId queue_id, const RawEvent &event) {
|
||||
}
|
||||
|
||||
template <class BinlogT>
|
||||
void TQueueBinlog<BinlogT>::pop(int64 logevent_id) {
|
||||
void TQueueBinlog<BinlogT>::pop(uint64 logevent_id) {
|
||||
binlog_->erase(logevent_id);
|
||||
}
|
||||
|
||||
@ -399,13 +399,13 @@ Status TQueueBinlog<BinlogT>::replay(const BinlogEvent &binlog_event, TQueue &q)
|
||||
template class TQueueBinlog<BinlogInterface>;
|
||||
template class TQueueBinlog<Binlog>;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -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 BinlogT>
|
||||
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<BinlogT> 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<int64, std::pair<QueueId, RawEvent>> events_;
|
||||
uint64 next_logevent_id_{1};
|
||||
std::map<uint64, std::pair<QueueId, RawEvent>> events_;
|
||||
};
|
||||
|
||||
} // namespace td
|
||||
|
Loading…
Reference in New Issue
Block a user