From d772c17e31baf215abc6a5415f29358f4ee55c95 Mon Sep 17 00:00:00 2001 From: arulprakasan Date: Wed, 12 Nov 2025 17:00:36 +0000 Subject: [PATCH] Apache pulsar C++ client Transaction support header file --- lib/include/pulsar/Transaction.h | 33 ++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lib/include/pulsar/Transaction.h diff --git a/lib/include/pulsar/Transaction.h b/lib/include/pulsar/Transaction.h new file mode 100644 index 00000000..bde59e43 --- /dev/null +++ b/lib/include/pulsar/Transaction.h @@ -0,0 +1,33 @@ +#pragma once + +#include +#include + +namespace pulsar { + +class TxnID { + int64_t msb_; + int64_t lsb_; + +public: + TxnID() : msb_(0), lsb_(0) {} + TxnID(int64_t msb, int64_t lsb) : msb_(msb), lsb_(lsb) {} + + // Getters (Java-style, for compatibility with your test code) + int64_t mostSigBits() const { return msb_; } + int64_t leastSigBits() const { return lsb_; } + + // Equality check + bool operator==(const TxnID& other) const { + return msb_ == other.msb_ && lsb_ == other.lsb_; + } + + // For debugging + friend std::ostream& operator<<(std::ostream& os, const TxnID& txnId) { + os << txnId.msb_ << ":" << txnId.lsb_; + return os; + } +}; + +} // namespace pulsar +