// ********************************************************************** // // Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** #ifndef ICE_GRID_NODECACHE_H #define ICE_GRID_NODECACHE_H #include #include #include #include namespace IceGrid { class NodeCache; class NodeSessionI; typedef IceUtil::Handle NodeSessionIPtr; class ServerEntry; typedef IceUtil::Handle ServerEntryPtr; class NodeEntry : public IceUtil::Shared, public IceUtil::Mutex { public: NodeEntry(Cache&, const std::string&); void addDescriptor(const std::string&, const NodeDescriptor&); void removeDescriptor(const std::string&); void addServer(const ServerEntryPtr&); void removeServer(const ServerEntryPtr&); void setSession(const NodeSessionIPtr&); NodePrx getProxy() const; NodeInfo getInfo() const; Ice::StringSeq getServers() const; LoadInfo getLoadInfoAndLoadFactor(const std::string&, float&) const; bool canRemove(); void loadServer(const ServerEntryPtr&, const ServerInfo&); void destroyServer(const ServerEntryPtr&, const std::string&); ServerInfo getServerInfo(const ServerInfo&); private: ServerDescriptorPtr getServerDescriptor(const ServerInfo&); Cache& _cache; const std::string _name; NodeSessionIPtr _session; std::map _servers; std::map _descriptors; }; typedef IceUtil::Handle NodeEntryPtr; class NodeCache : public CacheByString { public: NodeCache(int); void destroy(); NodeEntryPtr get(const std::string&, bool = false) const; int getSessionTimeout() { return _sessionTimeout; } private: const int _sessionTimeout; }; }; #endif