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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
// **********************************************************************
//
// Copyright (c) 2003-2009 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 TOPIC_MANAGER_I_H
#define TOPIC_MANAGER_I_H
#include <IceStorm/IceStorm.h>
#include <IceStorm/Replica.h>
#include <IceStorm/Election.h>
#include <IceUtil/RecMutex.h>
namespace IceStorm
{
//
// Forward declarations.
//
class Instance;
typedef IceUtil::Handle<Instance> InstancePtr;
class DatabaseCache;
typedef IceUtil::Handle<DatabaseCache> DatabaseCachePtr;
class TopicImpl;
typedef IceUtil::Handle<TopicImpl> TopicImplPtr;
//
// TopicManager implementation.
//
class TopicManagerImpl : public IceStormElection::Replica, public IceUtil::RecMutex
{
public:
TopicManagerImpl(const InstancePtr&);
~TopicManagerImpl();
// TopicManager methods.
TopicPrx create(const std::string&);
TopicPrx retrieve(const std::string&) const;
TopicDict retrieveAll() const;
// Observer methods.
void observerInit(const IceStormElection::LogUpdate&, const IceStormElection::TopicContentSeq&);
void observerCreateTopic(const IceStormElection::LogUpdate&, const std::string&);
void observerDestroyTopic(const IceStormElection::LogUpdate&, const std::string&);
void observerAddSubscriber(const IceStormElection::LogUpdate&, const std::string&,
const IceStorm::SubscriberRecord&);
void observerRemoveSubscriber(const IceStormElection::LogUpdate&, const std::string&, const Ice::IdentitySeq&);
// Sync methods.
void getContent(IceStormElection::LogUpdate&, IceStormElection::TopicContentSeq&);
// Replica methods.
virtual IceStormElection::LogUpdate getLastLogUpdate() const;
virtual void sync(const Ice::ObjectPrx&);
virtual void initMaster(const std::set<IceStormElection::GroupNodeInfo>&, const IceStormElection::LogUpdate&);
virtual Ice::ObjectPrx getObserver() const;
virtual Ice::ObjectPrx getSync() const;
void reap();
void shutdown();
Ice::ObjectPtr getServant() const;
private:
TopicPrx installTopic(const std::string&, const Ice::Identity&, bool,
const IceStorm::SubscriberRecordSeq& = IceStorm::SubscriberRecordSeq());
const InstancePtr _instance;
const DatabaseCachePtr _databaseCache;
std::map<std::string, TopicImplPtr> _topics;
Ice::ObjectPtr _managerImpl;
Ice::ObjectPtr _observerImpl;
Ice::ObjectPrx _observer;
Ice::ObjectPtr _syncImpl;
Ice::ObjectPrx _sync;
};
typedef IceUtil::Handle<TopicManagerImpl> TopicManagerImplPtr;
} // End namespace IceStorm
#endif
|