Instance.h
Go to the documentation of this file.
1 // **********************************************************************
2 //
3 // Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
4 //
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
7 //
8 // **********************************************************************
9 
10 #ifndef INSTANCE_H
11 #define INSTANCE_H
12 
13 #include <Ice/CommunicatorF.h>
14 #include <Ice/ObjectAdapterF.h>
15 #include <Ice/PropertiesF.h>
16 #include <IceUtil/Time.h>
17 #include <IceStorm/Election.h>
19 #include <IceStorm/Util.h>
20 
21 namespace IceUtil
22 {
23 
24  class Timer;
26 
27 }
28 
29 namespace IceStormElection
30 {
31 
32  class Observers;
34 
35  class NodeI;
37 
38 }
39 
40 namespace IceStorm
41 {
42 
43  class TraceLevels;
45 
46  class TopicReaper : public IceUtil::Shared, private IceUtil::Mutex
47  {
48  public:
49 
50  void add(const std::string&);
51  std::vector<std::string> consumeReapedTopics();
52 
53  private:
54 
55  std::vector<std::string> _topics;
56  };
58 
59  class Instance : public IceUtil::Shared
60  {
61  public:
62 
64  {
67  };
68 
69  Instance(const std::string&, const std::string&, const Ice::CommunicatorPtr&, const Ice::ObjectAdapterPtr&,
71 
73 
74  std::string instanceName() const;
75  std::string serviceName() const;
86  IceUtil::TimerPtr timer() const;
87  Ice::ObjectPrx topicReplicaProxy() const;
88  Ice::ObjectPrx publisherReplicaProxy() const;
91 
94  int sendTimeout() const;
95  int sendQueueSizeMax() const;
97 
98  void shutdown();
99  virtual void destroy();
100 
101  private:
102 
103  const std::string _instanceName;
104  const std::string _serviceName;
105  const Ice::CommunicatorPtr _communicator;
106  const Ice::ObjectAdapterPtr _publishAdapter;
107  const Ice::ObjectAdapterPtr _topicAdapter;
108  const Ice::ObjectAdapterPtr _nodeAdapter;
109  const IceStormElection::NodePrx _nodeProxy;
110  const TraceLevelsPtr _traceLevels;
111  const IceUtil::Time _discardInterval;
112  const IceUtil::Time _flushInterval;
113  const int _sendTimeout;
114  const int _sendQueueSizeMax;
115  const SendQueueSizeMaxPolicy _sendQueueSizeMaxPolicy;
116  const Ice::ObjectPrx _topicReplicaProxy;
117  const Ice::ObjectPrx _publisherReplicaProxy;
118  const TopicReaperPtr _topicReaper;
121  IceUtil::TimerPtr _batchFlusher;
122  IceUtil::TimerPtr _timer;
124 
125  };
127 
130 
132  {
133  public:
134 
135  PersistentInstance(const std::string&, const std::string&, const Ice::CommunicatorPtr&,
137  const IceStormElection::NodePrx& = 0);
138 
139  const IceDB::Env& dbEnv() const
140  {
141  return _dbEnv;
142  }
143  LLUMap lluMap() const
144  {
145  return _lluMap;
146  }
148  {
149  return _subscriberMap;
150  }
151 
152  virtual void destroy();
153 
154  private:
155 
156  IceUtilInternal::FileLock _dbLock;
157  IceDB::Env _dbEnv;
158  LLUMap _lluMap;
159  SubscriberMap _subscriberMap;
160  };
162 
163 } // End namespace IceStorm
164 
165 #endif
Instrumentation.h
IceStorm::Instance::nodeAdapter
Ice::ObjectAdapterPtr nodeAdapter() const
Definition: Instance.cpp:220
IceStorm
Definition: DBTypes.ice:22
IceStorm::Instance::topicAdapter
Ice::ObjectAdapterPtr topicAdapter() const
Definition: Instance.cpp:214
IceStorm::PersistentInstance::lluMap
LLUMap lluMap() const
Definition: Instance.h:143
IceStormElection::ObserversPtr
IceUtil::Handle< Observers > ObserversPtr
Definition: Instance.h:32
IceStorm::Instance::node
IceStormElection::NodeIPtr node() const
Definition: Instance.cpp:232
IceStorm::Instance::DropEvents
@ DropEvents
Definition: Instance.h:66
IceStormElection::NodeIPtr
IceUtil::Handle< NodeI > NodeIPtr
Definition: Instance.h:35
IceStorm::Instance::traceLevels
TraceLevelsPtr traceLevels() const
Definition: Instance.cpp:244
IceStorm::Instance::sendQueueSizeMax
int sendQueueSizeMax() const
Definition: Instance.cpp:304
IceStorm::Instance::setNode
void setNode(const IceStormElection::NodeIPtr &)
Definition: Instance.cpp:178
IceStormElection::NodePrx
::IceInternal::ProxyHandle< ::IceProxy::IceStormElection::Node > NodePrx
Definition: Election.h:804
IceStorm::Instance::Instance
Instance(const std::string &, const std::string &, const Ice::CommunicatorPtr &, const Ice::ObjectAdapterPtr &, const Ice::ObjectAdapterPtr &, const Ice::ObjectAdapterPtr &=0, const IceStormElection::NodePrx &=0)
Definition: Instance.cpp:92
IceStormElection::Observers
Definition: Observers.h:33
IceStorm::TopicReaper::consumeReapedTopics
std::vector< std::string > consumeReapedTopics()
Definition: Instance.cpp:40
IceStorm::Instance::communicator
Ice::CommunicatorPtr communicator() const
Definition: Instance.cpp:196
IceStorm::Instance::publishAdapter
Ice::ObjectAdapterPtr publishAdapter() const
Definition: Instance.cpp:208
IceStorm::Instance::destroy
virtual void destroy()
Definition: Instance.cpp:335
IceStorm::TraceLevelsPtr
IceUtil::Handle< TraceLevels > TraceLevelsPtr
Definition: Instance.h:43
IceUtil
Definition: Instance.h:21
IceStorm::Instance::topicReaper
TopicReaperPtr topicReaper() const
Definition: Instance.cpp:280
Timer
Definition: timer.hpp:58
Util.h
IceInternal::Handle< ::Ice::Communicator >
IceStorm::Instance::flushInterval
IceUtil::Time flushInterval() const
Definition: Instance.cpp:292
IceStorm::Instance
Definition: Instance.h:59
IceStorm::Instance::serviceName
std::string serviceName() const
Definition: Instance.cpp:190
IceStorm::Instance::nodeProxy
IceStormElection::NodePrx nodeProxy() const
Definition: Instance.cpp:238
IceDB::Env
Definition: IceDB.h:150
IceStormElection
Definition: DBTypes.ice:17
IceStorm::TopicReaperPtr
IceUtil::Handle< TopicReaper > TopicReaperPtr
Definition: Instance.h:57
IceStorm::Instance::properties
Ice::PropertiesPtr properties() const
Definition: Instance.cpp:202
IceStorm::PersistentInstance::subscriberMap
SubscriberMap subscriberMap() const
Definition: Instance.h:147
IceStorm::TopicReaper::add
void add(const std::string &)
Definition: Instance.cpp:33
IceStorm::Instance::instanceName
std::string instanceName() const
Definition: Instance.cpp:184
IceStormElection::NodeI
Definition: NodeI.h:27
IceStorm::TopicReaper
Definition: Instance.h:46
IceDB::ReadWriteCursor
Definition: IceDB.h:448
IceStorm::PersistentInstance::dbEnv
const IceDB::Env & dbEnv() const
Definition: Instance.h:139
IceStorm::InstancePtr
IceUtil::Handle< Instance > InstancePtr
Definition: Instance.h:126
IceStorm::Instance::publisherReplicaProxy
Ice::ObjectPrx publisherReplicaProxy() const
Definition: Instance.cpp:268
IceStorm::Instance::SendQueueSizeMaxPolicy
SendQueueSizeMaxPolicy
Definition: Instance.h:63
IceStorm::Instance::RemoveSubscriber
@ RemoveSubscriber
Definition: Instance.h:65
IceDB::Dbi< std::string, IceStormElection::LogUpdate, IceDB::IceContext, Ice::OutputStream >
armarx::armem::Time
armarx::core::time::DateTime Time
Definition: forward_declarations.h:13
IceStorm::Instance::observer
IceStorm::Instrumentation::TopicManagerObserverPtr observer() const
Definition: Instance.cpp:274
IceStorm::SubscriberMapRWCursor
IceDB::ReadWriteCursor< SubscriberRecordKey, SubscriberRecord, IceDB::IceContext, Ice::OutputStream > SubscriberMapRWCursor
Definition: Instance.h:129
IceStorm::PersistentInstance
Definition: Instance.h:131
IceStorm::TraceLevels
Definition: TraceLevels.h:21
IceStorm::Instance::sendQueueSizeMaxPolicy
SendQueueSizeMaxPolicy sendQueueSizeMaxPolicy() const
Definition: Instance.cpp:310
IceStorm::Instance::shutdown
void shutdown()
Definition: Instance.cpp:316
IceStorm::Instance::sendTimeout
int sendTimeout() const
Definition: Instance.cpp:298
IceStorm::Instance::discardInterval
IceUtil::Time discardInterval() const
Definition: Instance.cpp:286
Election.h
IceUtil::Handle< Timer >
IceStorm::Instance::observers
IceStormElection::ObserversPtr observers() const
Definition: Instance.cpp:226
IceStorm::Instance::timer
IceUtil::TimerPtr timer() const
Definition: Instance.cpp:256
armarx::Mutex
boost::mutex Mutex
Definition: Synchronization.h:131
IceStorm::PersistentInstance::destroy
virtual void destroy()
Definition: Instance.cpp:84
IceStorm::PersistentInstancePtr
IceUtil::Handle< PersistentInstance > PersistentInstancePtr
Definition: Instance.h:161
IceUtil::TimerPtr
IceUtil::Handle< Timer > TimerPtr
Definition: Instance.h:24
IceStorm::PersistentInstance::PersistentInstance
PersistentInstance(const std::string &, const std::string &, const Ice::CommunicatorPtr &, const Ice::ObjectAdapterPtr &, const Ice::ObjectAdapterPtr &, const Ice::ObjectAdapterPtr &=0, const IceStormElection::NodePrx &=0)
Definition: Instance.cpp:48
IceStorm::Instance::topicReplicaProxy
Ice::ObjectPrx topicReplicaProxy() const
Definition: Instance.cpp:262
IceStorm::Instance::batchFlusher
IceUtil::TimerPtr batchFlusher() const
Definition: Instance.cpp:250