pulsar-client-cpp
BatchMessageId.h
1 
19 #ifndef LIB_BATCHMESSAGEID_H_
20 #define LIB_BATCHMESSAGEID_H_
21 
22 #include <pulsar/MessageId.h>
23 #pragma GCC visibility push(default)
24 namespace pulsar {
25 class PulsarWrapper;
26 class BatchMessageId : public MessageId {
27  public:
28  BatchMessageId(int64_t ledgerId, int64_t entryId, int batchIndex = -1)
29  : MessageId(ledgerId, entryId),
30  batchIndex_(batchIndex) {
31  }
32 
34  : batchIndex_(-1) {
35  }
36  // These functions compare the message order as stored in bookkeeper
37  inline bool operator<(const BatchMessageId& mID) const;
38  inline bool operator<=(const BatchMessageId& mID) const;
39  protected:
40  friend class ConsumerImpl;
41  friend class Message;
42  friend class MessageImpl;
43  friend class PartitionedProducerImpl;
44  friend class PartitionedConsumerImpl;
45  friend class BatchAcknowledgementTracker;
46  friend class PulsarWrapper;
47  friend class PulsarFriend;
48  int64_t batchIndex_;
49 };
50 
51 bool BatchMessageId::operator<(const BatchMessageId& mID) const {
52  return (ledgerId_ < mID.ledgerId_) || (ledgerId_ == mID.ledgerId_ && entryId_ < mID.entryId_);
53 }
54 
55 bool BatchMessageId::operator<=(const BatchMessageId& mID) const {
56  return (ledgerId_ < mID.ledgerId_) || (ledgerId_ == mID.ledgerId_ && entryId_ <= mID.entryId_);
57 }
58 
59 }
60 #pragma GCC visibility pop
61 
62 #endif /* LIB_BATCHMESSAGEID_H_ */
Definition: Authentication.h:31
Definition: Message.h:42
Definition: BatchMessageId.h:26
Definition: MessageId.h:33