diff options
Diffstat (limited to 'cpp/src/IceGrid/Database.h')
-rw-r--r-- | cpp/src/IceGrid/Database.h | 76 |
1 files changed, 41 insertions, 35 deletions
diff --git a/cpp/src/IceGrid/Database.h b/cpp/src/IceGrid/Database.h index 740705d054e..f2e7b92baa1 100644 --- a/cpp/src/IceGrid/Database.h +++ b/cpp/src/IceGrid/Database.h @@ -32,13 +32,51 @@ typedef IceUtil::Handle<NodeSessionI> NodeSessionIPtr; class Database : public IceUtil::Shared, public IceUtil::Mutex { + class ServerEntry : public IceUtil::Shared, public IceUtil::Monitor<IceUtil::Mutex> + { + public: + + ServerEntry(Database&, const ServerDescriptorPtr&); + + void sync(); + bool needsSync() const; + void update(const ServerDescriptorPtr&); + ServerDescriptorPtr getDescriptor(); + ServerPrx getProxy(); + AdapterPrx getAdapter(const std::string&); + bool canRemove(); + + private: + + ServerPrx sync(StringAdapterPrxDict& adapters); + + Database& _database; + ServerDescriptorPtr _loaded; + ServerDescriptorPtr _load; + ServerDescriptorPtr _destroy; + ServerPrx _proxy; + std::map<std::string, AdapterPrx> _adapters; + bool _synchronizing; + bool _failed; + }; + friend class ServerEntry; + friend struct AddComponent; + + typedef IceUtil::Handle<ServerEntry> ServerEntryPtr; + typedef std::vector<ServerEntryPtr> ServerEntrySeq; + public: - Database(const Ice::CommunicatorPtr&, const Ice::ObjectAdapterPtr&, const std::string&, int, const TraceLevelsPtr&); + Database(const Ice::ObjectAdapterPtr&, const std::string&, int, const TraceLevelsPtr&); virtual ~Database(); + void setRegistryObserver(const RegistryObserverPrx&); + void addApplicationDescriptor(const ApplicationDescriptorPtr&); - void updateApplicationDescriptor(const ApplicationDescriptorPtr&); + void updateApplicationDescriptor(const ApplicationUpdateDescriptor&); + void syncApplicationDescriptor(const ApplicationDescriptorPtr&); + void syncApplicationDescriptorNoSync(const ApplicationDescriptorPtr&, const ApplicationDescriptorPtr&, + ServerEntrySeq&); void removeApplicationDescriptor(const std::string&); ApplicationDescriptorPtr getApplicationDescriptor(const std::string&); Ice::StringSeq getAllApplications(const std::string& = std::string()); @@ -68,39 +106,6 @@ public: private: - class ServerEntry : public IceUtil::Shared, public IceUtil::Monitor<IceUtil::Mutex> - { - public: - - ServerEntry(Database&, const ServerDescriptorPtr&); - - void sync(); - bool needsSync() const; - void update(const ServerDescriptorPtr&); - ServerDescriptorPtr getDescriptor(); - ServerPrx getProxy(); - AdapterPrx getAdapter(const std::string&); - bool canRemove(); - - private: - - ServerPrx sync(StringAdapterPrxDict& adapters); - - Database& _database; - ServerDescriptorPtr _loaded; - ServerDescriptorPtr _load; - ServerDescriptorPtr _destroy; - ServerPrx _proxy; - std::map<std::string, AdapterPrx> _adapters; - bool _synchronizing; - bool _failed; - }; - friend class ServerEntry; - friend struct AddComponent; - - typedef IceUtil::Handle<ServerEntry> ServerEntryPtr; - typedef std::vector<ServerEntryPtr> ServerEntrySeq; - void addServers(const InstanceDescriptorSeq&, const std::set<std::string>&, ServerEntrySeq&); void updateServers(const ApplicationDescriptorPtr&, const ApplicationDescriptorPtr&, const std::set<std::string>&, ServerEntrySeq&); @@ -125,6 +130,7 @@ private: const std::string _envName; const int _nodeSessionTimeout; const TraceLevelsPtr _traceLevels; + RegistryObserverPrx _registryObserver; std::map<std::string, ServerEntryPtr> _servers; std::map<std::string, ServerEntryPtr> _serversByAdapterId; |