summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/NodeCache.h
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2005-07-08 13:47:30 +0000
committerBenoit Foucher <benoit@zeroc.com>2005-07-08 13:47:30 +0000
commit99894938dbde9a0bb10fc1998d9863cae52b8977 (patch)
tree5b68e52e9a62792f11d8a4e2c844d394cd39f496 /cpp/src/IceGrid/NodeCache.h
parentFixed Ice interoperability issue (diff)
downloadice-99894938dbde9a0bb10fc1998d9863cae52b8977.tar.bz2
ice-99894938dbde9a0bb10fc1998d9863cae52b8977.tar.xz
ice-99894938dbde9a0bb10fc1998d9863cae52b8977.zip
More adapter replication changes.
Diffstat (limited to 'cpp/src/IceGrid/NodeCache.h')
-rw-r--r--cpp/src/IceGrid/NodeCache.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/cpp/src/IceGrid/NodeCache.h b/cpp/src/IceGrid/NodeCache.h
new file mode 100644
index 00000000000..73543df8d1c
--- /dev/null
+++ b/cpp/src/IceGrid/NodeCache.h
@@ -0,0 +1,61 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 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 <IceUtil/Mutex.h>
+#include <IceUtil/Shared.h>
+#include <IceGrid/Cache.h>
+
+namespace IceGrid
+{
+
+class NodeCache;
+
+class NodeSessionI;
+typedef IceUtil::Handle<NodeSessionI> NodeSessionIPtr;
+
+class ServerEntry;
+typedef IceUtil::Handle<ServerEntry> ServerEntryPtr;
+
+class NodeEntry : public IceUtil::Shared, public IceUtil::Mutex
+{
+public:
+
+ NodeEntry(Cache<std::string, NodeEntry>&, const std::string&);
+
+ void addServer(const ServerEntryPtr&);
+ void removeServer(const ServerEntryPtr&);
+ void setSession(const NodeSessionIPtr&);
+
+ NodePrx getProxy() const;
+ Ice::StringSeq getServers() const;
+
+ bool canRemove();
+
+private:
+
+ Cache<std::string, NodeEntry>& _cache;
+ const std::string _name;
+ NodeSessionIPtr _session;
+ std::map<std::string, ServerEntryPtr> _servers;
+};
+typedef IceUtil::Handle<NodeEntry> NodeEntryPtr;
+
+class NodeCache : public CacheByString<NodeEntry>
+{
+public:
+
+ NodeEntryPtr get(const std::string&, bool = false) const;
+};
+
+};
+
+#endif