summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/cluster/ExpiryPolicy.h
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2009-03-09 17:03:40 +0000
committerAlan Conway <aconway@apache.org>2009-03-09 17:03:40 +0000
commitfaae42761fe83f083d408d2b4f9e95b7c619122e (patch)
tree21013d3445ce52650c9c1a2e8859dd0d931b0f09 /cpp/src/qpid/cluster/ExpiryPolicy.h
parentbbbd455d8053d3fea713d8f04b0187ac73c72d83 (diff)
downloadqpid-python-faae42761fe83f083d408d2b4f9e95b7c619122e.tar.gz
Fix cluster TTL: replicte expiry information to newcomers.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@751760 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/ExpiryPolicy.h')
-rw-r--r--cpp/src/qpid/cluster/ExpiryPolicy.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/cpp/src/qpid/cluster/ExpiryPolicy.h b/cpp/src/qpid/cluster/ExpiryPolicy.h
index b58946b8f7..9f8b1a9236 100644
--- a/cpp/src/qpid/cluster/ExpiryPolicy.h
+++ b/cpp/src/qpid/cluster/ExpiryPolicy.h
@@ -27,11 +27,15 @@
#include "qpid/sys/Mutex.h"
#include <boost/function.hpp>
#include <boost/intrusive_ptr.hpp>
-#include <set>
+#include <boost/optional.hpp>
+#include <map>
namespace qpid {
-namespace broker { class Timer; }
+namespace broker {
+class Timer;
+class Message;
+}
namespace cluster {
class Multicaster;
@@ -54,16 +58,23 @@ class ExpiryPolicy : public broker::ExpiryPolicy
// Cluster delivers expiry notice.
void deliverExpire(uint64_t);
+ void setId(uint64_t id) { expiryId = id; }
+ uint64_t getId() const { return expiryId; }
+
+ boost::optional<uint64_t> getId(broker::Message&);
+
private:
- sys::Mutex lock;
- typedef std::set<uint64_t> IdSet;
+ typedef std::map<broker::Message*, uint64_t> MessageIdMap;
+ typedef std::map<uint64_t, broker::Message*> IdMessageMap;
struct Expired : public broker::ExpiryPolicy {
bool hasExpired(broker::Message&);
void willExpire(broker::Message&);
};
- IdSet expired;
+ MessageIdMap unexpiredByMessage;
+ IdMessageMap unexpiredById;
+ uint64_t expiryId;
boost::intrusive_ptr<Expired> expiredPolicy;
Multicaster& mcast;
MemberId memberId;