OpFlex Framework  1.7.0
PeerStatusListener.h
Go to the documentation of this file.
1 /* -*- C++ -*-; c-basic-offset: 4; indent-tabs-mode: nil */
6 /*
7  * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
8  *
9  * This program and the accompanying materials are made available under the
10  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
11  * and is available at http://www.eclipse.org/legal/epl-v10.html
12  */
13 
14 #pragma once
15 #ifndef OPFLEX_CORE_PEERSTATUSLISTENER_H
16 #define OPFLEX_CORE_PEERSTATUSLISTENER_H
17 
18 namespace opflex {
19 namespace ofcore {
20 
31 public:
35  virtual ~PeerStatusListener() {}
36 
41  enum PeerStatus {
53  CONNECTED = 2,
57  READY = 3,
61  CLOSING = 4
62  };
63 
72  virtual void peerStatusUpdated(const std::string& peerHostname,
73  int peerPort,
74  PeerStatus peerStatus) {}
75 
79  enum Health {
83  DOWN = 0,
87  DEGRADED = 1,
91  HEALTHY = 2
92  };
93 
100  virtual void healthUpdated(Health health) {}
101 };
102 
105 } /* namespace ofcore */
106 } /* namespace opflex */
107 
108 #endif /* OPFLEX_CORE_PEERSTATUSLISTENER_H */
The peer connection is closing.
Definition: PeerStatusListener.h:61
Health
Represents the overall health of the opflex connection pool.
Definition: PeerStatusListener.h:79
virtual void peerStatusUpdated(const std::string &peerHostname, int peerPort, PeerStatus peerStatus)
Called when the connection state changes for a given Opflex peer.
Definition: PeerStatusListener.h:72
virtual ~PeerStatusListener()
Destroy the peer status listener.
Definition: PeerStatusListener.h:35
The peer is connected and ready.
Definition: PeerStatusListener.h:57
At least one opflex peer is in a state other than READY.
Definition: PeerStatusListener.h:87
All opflex peers are connected and ready.
Definition: PeerStatusListener.h:91
There is no ready Opflex peer connection.
Definition: PeerStatusListener.h:83
PeerStatus
The status of a particular peer, which will be sent in the peer status update callback.
Definition: PeerStatusListener.h:41
The peer is connected but not yet ready.
Definition: PeerStatusListener.h:53
The peer is connecting.
Definition: PeerStatusListener.h:49
An interface for a listener that will get status update events for peer connection state...
Definition: PeerStatusListener.h:30
The peer is disconnected and not trying to connect.
Definition: PeerStatusListener.h:45
virtual void healthUpdated(Health health)
Called when the overall health of the opflex connection pool changes.
Definition: PeerStatusListener.h:100