// // Copyright (c) ZeroC, Inc. All rights reserved. // #ifndef ICE_GRID_NODE_I_H #define ICE_GRID_NODE_I_H #include #include #include #include #include #include namespace IceGrid { class Activator; class NodeSessionManager; class ServerCommand; class ServerI; class TraceLevels; class NodeI : public Node, public std::enable_shared_from_this { public: class Update final : public std::enable_shared_from_this { public: using UpdateFunction = std::function, std::function)>; Update(UpdateFunction, const std::shared_ptr&, const std::shared_ptr&); bool send(); private: UpdateFunction _func; std::shared_ptr _node; std::shared_ptr _observer; }; NodeI(const std::shared_ptr&, NodeSessionManager&, const std::shared_ptr&, const IceUtil::TimerPtr&, const std::shared_ptr&, const std::shared_ptr&, const std::string&, const std::shared_ptr&, const std::string&); void loadServerAsync(std::shared_ptr, std::string, std::function &, const AdapterPrxDict &, int, int)>, std::function, const Ice::Current &) override; void loadServerWithoutRestartAsync(std::shared_ptr, std::string, std::function&, const AdapterPrxDict&, int, int)>, std::function, const Ice::Current &) override; void destroyServerAsync(std::string, std::string, int, std::string, std::function, std::function, const Ice::Current&) override; void destroyServerWithoutRestartAsync(std::string, std::string, int, std::string, std::function, std::function, const ::Ice::Current& current) override; void registerWithReplica(std::shared_ptr, const Ice::Current&) override; void replicaInit(InternalRegistryPrxSeq, const Ice::Current&) override; void replicaAdded(std::shared_ptr, const Ice::Current&) override; void replicaRemoved(std::shared_ptr, const Ice::Current&) override; std::string getName(const Ice::Current&) const override; std::string getHostname(const Ice::Current&) const override; LoadInfo getLoad(const Ice::Current&) const override; int getProcessorSocketCount(const Ice::Current&) const override; void shutdown(const Ice::Current&) const override; long long getOffsetFromEnd(std::string, int, const Ice::Current&) const override; bool read(std::string, long long, int, long long&, Ice::StringSeq&, const Ice::Current&) const override; void shutdown(); IceUtil::TimerPtr getTimer() const; std::shared_ptr getCommunicator() const; std::shared_ptr getAdapter() const; std::shared_ptr getActivator() const; std::shared_ptr getTraceLevels() const; std::shared_ptr getUserAccountMapper() const; PlatformInfo& getPlatformInfo(); std::shared_ptr getFileCache() const; std::shared_ptr getProxy() const; const PropertyDescriptorSeq& getPropertiesOverride() const; const std::string& getInstanceName() const; std::string getOutputDir() const; bool getRedirectErrToOut() const; bool allowEndpointsOverride() const; std::shared_ptr registerWithRegistry(const std::shared_ptr&); void checkConsistency(const std::shared_ptr&); std::shared_ptr getMasterNodeSession() const; void addObserver(const std::shared_ptr&, const std::shared_ptr&); void removeObserver(const std::shared_ptr&); void observerUpdateServer(const ServerDynamicInfo&); void observerUpdateAdapter(const AdapterDynamicInfo&); void queueUpdate(const std::shared_ptr&, Update::UpdateFunction); void dequeueUpdate(const std::shared_ptr&, const std::shared_ptr&, bool); void addServer(const std::shared_ptr&, const std::string&); void removeServer(const std::shared_ptr&, const std::string&); Ice::Identity createServerIdentity(const std::string&) const; std::string getServerAdminCategory() const; bool canRemoveServerDirectory(const std::string&); private: std::vector> checkConsistencyNoSync(const Ice::StringSeq&); std::set> getApplicationServers(const std::string&) const; std::string getFilePath(const std::string&) const; void loadServer(std::shared_ptr, std::string, bool, std::function &, const AdapterPrxDict &, int, int)>&&, std::function&&, const Ice::Current&); void destroyServer(std::string, std::string, int, std::string, bool, std::function, std::function, const Ice::Current&); const std::shared_ptr _communicator; const std::shared_ptr _adapter; NodeSessionManager& _sessions; const std::shared_ptr _activator; const IceUtil::TimerPtr _timer; const std::shared_ptr _traceLevels; const std::string _name; const std::shared_ptr _proxy; const std::string _outputDir; const bool _redirectErrToOut; const bool _allowEndpointsOverride; const int _waitTime; const std::string _instanceName; const std::shared_ptr _userAccountMapper; PlatformInfo _platform; const std::string _dataDir; const std::string _serversDir; const std::string _tmpDir; const std::shared_ptr _fileCache; PropertyDescriptorSeq _propertiesOverride; unsigned long _serial; bool _consistencyCheckDone; std::mutex _observerMutex; std::map, std::shared_ptr> _observers; std::map _serversDynamicInfo; std::map _adaptersDynamicInfo; std::map, std::deque>> _observerUpdates; mutable std::mutex _serversMutex; std::map> > _serversByApplication; std::mutex _mutex; }; } #endif