Make IFailureMonitor const-correct
This commit is contained in:
parent
8d9e7adac7
commit
84cce687da
|
@ -156,7 +156,7 @@ Future<Void> SimpleFailureMonitor::onStateChanged(Endpoint const& endpoint) {
|
||||||
return endpointKnownFailed.onChange(endpoint);
|
return endpointKnownFailed.onChange(endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
FailureStatus SimpleFailureMonitor::getState(Endpoint const& endpoint) {
|
FailureStatus SimpleFailureMonitor::getState(Endpoint const& endpoint) const {
|
||||||
if (failedEndpoints.count(endpoint))
|
if (failedEndpoints.count(endpoint))
|
||||||
return FailureStatus(true);
|
return FailureStatus(true);
|
||||||
else {
|
else {
|
||||||
|
@ -170,7 +170,7 @@ FailureStatus SimpleFailureMonitor::getState(Endpoint const& endpoint) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FailureStatus SimpleFailureMonitor::getState(NetworkAddress const& address) {
|
FailureStatus SimpleFailureMonitor::getState(NetworkAddress const& address) const {
|
||||||
auto a = addressStatus.find(address);
|
auto a = addressStatus.find(address);
|
||||||
if (a == addressStatus.end())
|
if (a == addressStatus.end())
|
||||||
return FailureStatus();
|
return FailureStatus();
|
||||||
|
@ -178,7 +178,7 @@ FailureStatus SimpleFailureMonitor::getState(NetworkAddress const& address) {
|
||||||
return a->second;
|
return a->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SimpleFailureMonitor::onlyEndpointFailed(Endpoint const& endpoint) {
|
bool SimpleFailureMonitor::onlyEndpointFailed(Endpoint const& endpoint) const {
|
||||||
if (!failedEndpoints.count(endpoint)) return false;
|
if (!failedEndpoints.count(endpoint)) return false;
|
||||||
auto a = addressStatus.find(endpoint.getPrimaryAddress());
|
auto a = addressStatus.find(endpoint.getPrimaryAddress());
|
||||||
if (a == addressStatus.end())
|
if (a == addressStatus.end())
|
||||||
|
@ -187,7 +187,7 @@ bool SimpleFailureMonitor::onlyEndpointFailed(Endpoint const& endpoint) {
|
||||||
return !a->second.failed;
|
return !a->second.failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SimpleFailureMonitor::permanentlyFailed(Endpoint const& endpoint) {
|
bool SimpleFailureMonitor::permanentlyFailed(Endpoint const& endpoint) const {
|
||||||
return failedEndpoints.count(endpoint);
|
return failedEndpoints.count(endpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,10 +87,10 @@ struct FailureStatus {
|
||||||
class IFailureMonitor {
|
class IFailureMonitor {
|
||||||
public:
|
public:
|
||||||
// Returns the currently known status for the endpoint
|
// Returns the currently known status for the endpoint
|
||||||
virtual FailureStatus getState(Endpoint const& endpoint) = 0;
|
virtual FailureStatus getState(Endpoint const& endpoint) const = 0;
|
||||||
|
|
||||||
// Returns the currently known status for the address
|
// Returns the currently known status for the address
|
||||||
virtual FailureStatus getState(NetworkAddress const& address) = 0;
|
virtual FailureStatus getState(NetworkAddress const& address) const = 0;
|
||||||
|
|
||||||
// Only use this function when the endpoint is known to be failed
|
// Only use this function when the endpoint is known to be failed
|
||||||
virtual void endpointNotFound(Endpoint const&) = 0;
|
virtual void endpointNotFound(Endpoint const&) = 0;
|
||||||
|
@ -102,10 +102,10 @@ public:
|
||||||
virtual Future<Void> onDisconnectOrFailure(Endpoint const& endpoint) = 0;
|
virtual Future<Void> onDisconnectOrFailure(Endpoint const& endpoint) = 0;
|
||||||
|
|
||||||
// Returns true if the endpoint is failed but the address of the endpoint is not failed.
|
// Returns true if the endpoint is failed but the address of the endpoint is not failed.
|
||||||
virtual bool onlyEndpointFailed(Endpoint const& endpoint) = 0;
|
virtual bool onlyEndpointFailed(Endpoint const& endpoint) const = 0;
|
||||||
|
|
||||||
// Returns true if the endpoint will never become available.
|
// Returns true if the endpoint will never become available.
|
||||||
virtual bool permanentlyFailed(Endpoint const& endpoint) = 0;
|
virtual bool permanentlyFailed(Endpoint const& endpoint) const = 0;
|
||||||
|
|
||||||
// Called by FlowTransport when a connection closes and a prior request or reply might be lost
|
// Called by FlowTransport when a connection closes and a prior request or reply might be lost
|
||||||
virtual void notifyDisconnect(NetworkAddress const&) = 0;
|
virtual void notifyDisconnect(NetworkAddress const&) = 0;
|
||||||
|
@ -140,14 +140,14 @@ public:
|
||||||
SimpleFailureMonitor();
|
SimpleFailureMonitor();
|
||||||
void setStatus(NetworkAddress const& address, FailureStatus const& status);
|
void setStatus(NetworkAddress const& address, FailureStatus const& status);
|
||||||
void endpointNotFound(Endpoint const&);
|
void endpointNotFound(Endpoint const&);
|
||||||
virtual void notifyDisconnect(NetworkAddress const&);
|
void notifyDisconnect(NetworkAddress const&) override;
|
||||||
|
|
||||||
virtual Future<Void> onStateChanged(Endpoint const& endpoint);
|
Future<Void> onStateChanged(Endpoint const& endpoint) override;
|
||||||
virtual FailureStatus getState(Endpoint const& endpoint);
|
FailureStatus getState(Endpoint const& endpoint) const override;
|
||||||
virtual FailureStatus getState(NetworkAddress const& address);
|
FailureStatus getState(NetworkAddress const& address) const override;
|
||||||
virtual Future<Void> onDisconnectOrFailure(Endpoint const& endpoint);
|
Future<Void> onDisconnectOrFailure(Endpoint const& endpoint) override;
|
||||||
virtual bool onlyEndpointFailed(Endpoint const& endpoint);
|
bool onlyEndpointFailed(Endpoint const& endpoint) const override;
|
||||||
virtual bool permanentlyFailed(Endpoint const& endpoint);
|
bool permanentlyFailed(Endpoint const& endpoint) const override;
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue