diff options
author | Kim van der Riet <kpvdr@apache.org> | 2013-02-28 16:14:30 +0000 |
---|---|---|
committer | Kim van der Riet <kpvdr@apache.org> | 2013-02-28 16:14:30 +0000 |
commit | 9c73ef7a5ac10acd6a50d5d52bd721fc2faa5919 (patch) | |
tree | 2a890e1df09e5b896a9b4168a7b22648f559a1f2 /cpp/src/qpid/ha/Primary.h | |
parent | 172d9b2a16cfb817bbe632d050acba7e31401cd2 (diff) | |
download | qpid-python-asyncstore.tar.gz |
Update from trunk r1375509 through r1450773asyncstore
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/asyncstore@1451244 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/ha/Primary.h')
-rw-r--r-- | cpp/src/qpid/ha/Primary.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/cpp/src/qpid/ha/Primary.h b/cpp/src/qpid/ha/Primary.h index 26883f4416..ff85837882 100644 --- a/cpp/src/qpid/ha/Primary.h +++ b/cpp/src/qpid/ha/Primary.h @@ -24,6 +24,8 @@ #include "types.h" #include "BrokerInfo.h" +#include "ReplicationTest.h" +#include "Role.h" #include "qpid/sys/Mutex.h" #include <boost/shared_ptr.hpp> #include <boost/intrusive_ptr.hpp> @@ -48,6 +50,7 @@ class HaBroker; class ReplicatingSubscription; class RemoteBackup; class QueueGuard; +class Membership; /** * State associated with a primary broker: @@ -56,22 +59,30 @@ class QueueGuard; * * THREAD SAFE: called concurrently in arbitrary connection threads. */ -class Primary +class Primary : public Role { public: typedef boost::shared_ptr<broker::Queue> QueuePtr; + typedef boost::shared_ptr<broker::Exchange> ExchangePtr; static Primary* get() { return instance; } Primary(HaBroker& hb, const BrokerInfo::Set& expectedBackups); ~Primary(); + // Role implementation + std::string getLogPrefix() const { return logPrefix; } + Role* promote(); + void setBrokerUrl(const Url&) {} + void readyReplica(const ReplicatingSubscription&); void removeReplica(const std::string& q); // Called via ConfigurationObserver void queueCreate(const QueuePtr&); void queueDestroy(const QueuePtr&); + void exchangeCreate(const ExchangePtr&); + void exchangeDestroy(const ExchangePtr&); // Called via ConnectionObserver void opened(broker::Connection& connection); @@ -91,17 +102,19 @@ class Primary sys::Mutex lock; HaBroker& haBroker; + Membership& membership; std::string logPrefix; bool active; + ReplicationTest replicationTest; + /** * Set of expected backups that must be ready before we declare ourselves - * active + * active. These are backups that were known and ready before the primary + * crashed. As new primary we expect them to re-connect. */ BackupSet expectedBackups; /** - * Map of all the remote backups we know about: any expected backups plus - * all actual backups that have connected. We do not remove entries when a - * backup disconnects. @see Primary::closed() + * Map of all the expected backups plus all connected backups. */ BackupMap backups; boost::shared_ptr<broker::ConnectionObserver> connectionObserver; |