libbmq  a5f8a06ba1d16cb5a65643e1fa7f1a1d6aadef40
bmqa_manualhosthealthmonitor.h
Go to the documentation of this file.
1 // Copyright 2021-2023 Bloomberg Finance L.P.
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 // bmqa_manualhosthealthmonitor.h -*-C++-*-
17 #ifndef INCLUDED_BMQA_MANUALHOSTHEALTHMONITOR
18 #define INCLUDED_BMQA_MANUALHOSTHEALTHMONITOR
19 
29 
30 // BMQ
31 
33 #include <bmqt_hosthealthstate.h>
34 
35 // BDE
36 #include <bdlmt_signaler.h>
37 #include <bsl_memory.h>
38 #include <bsls_keyword.h>
39 
40 namespace BloombergLP {
41 
42 namespace bmqa {
43 
44 // =============================
45 // class ManualHostHealthMonitor
46 // =============================
47 
49  private:
50  // PRIVATE DATA
51  bsl::shared_ptr<bmqpi::HostHealthMonitor> d_impl_sp;
52 
53  public:
54  // CREATORS
55 
60  bslma::Allocator* allocator = 0);
61 
63  ~ManualHostHealthMonitor() BSLS_KEYWORD_OVERRIDE;
64 
65  // MANIPULATORS
66  bdlmt::SignalerConnection
67  observeHostHealth(const HostHealthChangeFn& cb) BSLS_KEYWORD_OVERRIDE;
68 
69  void setState(bmqt::HostHealthState::Enum newState);
70 
71  // ACCESSORS
72  bmqt::HostHealthState::Enum hostState() const BSLS_KEYWORD_OVERRIDE;
73 };
74 
75 } // close package namespace
76 } // close enterprise namespace
77 
78 #endif
Provide an interface for monitoring the health of the host.
Provide an enumeration for different host health states.
Definition: bmqa_manualhosthealthmonitor.h:48
void setState(bmqt::HostHealthState::Enum newState)
ManualHostHealthMonitor(bmqt::HostHealthState::Enum initialState, bslma::Allocator *allocator=0)
bdlmt::SignalerConnection observeHostHealth(const HostHealthChangeFn &cb) BSLS_KEYWORD_OVERRIDE
bmqt::HostHealthState::Enum hostState() const BSLS_KEYWORD_OVERRIDE
Queries the current health of the host.
~ManualHostHealthMonitor() BSLS_KEYWORD_OVERRIDE
Destructor.
A pure interface for monitoring the health of the host.
Definition: bmqpi_hosthealthmonitor.h:44
bsl::function< void(bmqt::HostHealthState::Enum)> HostHealthChangeFn
Definition: bmqpi_hosthealthmonitor.h:51
Definition: bmqa_abstractsession.h:42
Enum
Definition: bmqt_hosthealthstate.h:47