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