blob: c0c90e9b5ebd075e8d5b835e95bad088613d9ccd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
#ifndef ICE_GRID_REPLICACACHE_H
#define ICE_GRID_REPLICACACHE_H
#include <IceGrid/Cache.h>
#include <IceGrid/Internal.h>
#include <IceStorm/IceStorm.h>
namespace IceGrid
{
class ReplicaCache;
class ReplicaSessionI;
class ReplicaEntry final
{
public:
ReplicaEntry(const std::string&, const std::shared_ptr<ReplicaSessionI>&);
bool canRemove() const { return true; }
const std::shared_ptr<ReplicaSessionI>& getSession() const;
std::shared_ptr<InternalReplicaInfo> getInfo() const;
std::shared_ptr<InternalRegistryPrx> getProxy() const;
std::shared_ptr<Ice::ObjectPrx> getAdminProxy() const;
private:
const std::string _name;
const std::shared_ptr<ReplicaSessionI> _session;
};
class ReplicaCache final : public CacheByString<ReplicaEntry>
{
public:
ReplicaCache(const std::shared_ptr<Ice::Communicator>&, const std::shared_ptr<IceStorm::TopicManagerPrx>&);
std::shared_ptr<ReplicaEntry> add(const std::string&, const std::shared_ptr<ReplicaSessionI>&);
std::shared_ptr<ReplicaEntry> remove(const std::string&, bool);
std::shared_ptr<ReplicaEntry> get(const std::string&) const;
void subscribe(const std::shared_ptr<ReplicaObserverPrx>&);
void unsubscribe(const std::shared_ptr<ReplicaObserverPrx>&);
std::shared_ptr<Ice::ObjectPrx> getEndpoints(const std::string&, const std::shared_ptr<Ice::ObjectPrx>&) const;
void setInternalRegistry(const std::shared_ptr<InternalRegistryPrx>&);
std::shared_ptr<InternalRegistryPrx> getInternalRegistry() const;
private:
const std::shared_ptr<Ice::Communicator> _communicator;
const std::shared_ptr<IceStorm::TopicPrx> _topic;
const std::shared_ptr<ReplicaObserverPrx> _observers;
std::shared_ptr<InternalRegistryPrx> _self; // This replica internal registry proxy.
};
};
#endif
|