diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-11-03 09:27:47 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-11-03 09:27:47 +0000 |
commit | e68a0e117ee67b3b0e3f64e14da73802e7877814 (patch) | |
tree | 62fc9806929cc447a694a1a5d094271766b998e4 /cpp/src/IceGrid/AdapterCache.h | |
parent | Added some IceVb stuff (diff) | |
download | ice-e68a0e117ee67b3b0e3f64e14da73802e7877814.tar.bz2 ice-e68a0e117ee67b3b0e3f64e14da73802e7877814.tar.xz ice-e68a0e117ee67b3b0e3f64e14da73802e7877814.zip |
Added ordered load balancing
Diffstat (limited to 'cpp/src/IceGrid/AdapterCache.h')
-rw-r--r-- | cpp/src/IceGrid/AdapterCache.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/cpp/src/IceGrid/AdapterCache.h b/cpp/src/IceGrid/AdapterCache.h index 94a19e1fe40..cec41f9214f 100644 --- a/cpp/src/IceGrid/AdapterCache.h +++ b/cpp/src/IceGrid/AdapterCache.h @@ -40,6 +40,8 @@ public: virtual AdapterInfoSeq getAdapterInfo() const = 0; virtual bool canRemove(); + + std::string getId() const; protected: @@ -52,7 +54,7 @@ class ServerAdapterEntry : public AdapterEntry { public: - ServerAdapterEntry(AdapterCache&, const std::string&, const std::string&, const ServerEntryPtr&); + ServerAdapterEntry(AdapterCache&, const std::string&, const std::string&, int, const ServerEntryPtr&); virtual std::vector<std::pair<std::string, AdapterPrx> > getProxies(int&, bool&); virtual float getLeastLoadedNodeLoad(LoadSample) const; @@ -61,12 +63,14 @@ public: virtual const std::string& getReplicaGroupId() const { return _replicaGroupId; } AdapterPrx getProxy(const std::string&, bool) const; - + int getPriority() const; + private: ServerEntryPtr getServer() const; const std::string _replicaGroupId; + const int _priority; const ServerEntryPtr _server; }; typedef IceUtil::Handle<ServerAdapterEntry> ServerAdapterEntryPtr; @@ -87,8 +91,6 @@ public: void update(const LoadBalancingPolicyPtr&); - typedef std::vector<std::pair<std::string, ServerAdapterEntryPtr> > ReplicaSeq; - private: const std::string _application; @@ -96,7 +98,7 @@ private: LoadBalancingPolicyPtr _loadBalancing; int _loadBalancingNReplicas; LoadSample _loadSample; - ReplicaSeq _replicas; + std::vector<ServerAdapterEntryPtr> _replicas; int _lastReplica; }; typedef IceUtil::Handle<ReplicaGroupEntry> ReplicaGroupEntryPtr; @@ -105,8 +107,8 @@ class AdapterCache : public CacheByString<AdapterEntry> { public: - ServerAdapterEntryPtr addServerAdapter(const std::string&, const std::string&, const ServerEntryPtr&); - ReplicaGroupEntryPtr addReplicaGroup(const std::string&, const std::string&, const LoadBalancingPolicyPtr&); + ServerAdapterEntryPtr addServerAdapter(const AdapterDescriptor&, const ServerEntryPtr&); + ReplicaGroupEntryPtr addReplicaGroup(const ReplicaGroupDescriptor&, const std::string&); AdapterEntryPtr get(const std::string&) const; ServerAdapterEntryPtr getServerAdapter(const std::string&) const; |