diff --git a/fdbrpc/FailureMonitor.actor.cpp b/fdbrpc/FailureMonitor.actor.cpp index ceb709a6c7..36600a44f6 100644 --- a/fdbrpc/FailureMonitor.actor.cpp +++ b/fdbrpc/FailureMonitor.actor.cpp @@ -156,7 +156,7 @@ Future SimpleFailureMonitor::onStateChanged(Endpoint const& endpoint) { return endpointKnownFailed.onChange(endpoint); } -FailureStatus SimpleFailureMonitor::getState(Endpoint const& endpoint) { +FailureStatus SimpleFailureMonitor::getState(Endpoint const& endpoint) const { if (failedEndpoints.count(endpoint)) return FailureStatus(true); 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); if (a == addressStatus.end()) return FailureStatus(); @@ -178,7 +178,7 @@ FailureStatus SimpleFailureMonitor::getState(NetworkAddress const& address) { return a->second; } -bool SimpleFailureMonitor::onlyEndpointFailed(Endpoint const& endpoint) { +bool SimpleFailureMonitor::onlyEndpointFailed(Endpoint const& endpoint) const { if (!failedEndpoints.count(endpoint)) return false; auto a = addressStatus.find(endpoint.getPrimaryAddress()); if (a == addressStatus.end()) @@ -187,7 +187,7 @@ bool SimpleFailureMonitor::onlyEndpointFailed(Endpoint const& endpoint) { return !a->second.failed; } -bool SimpleFailureMonitor::permanentlyFailed(Endpoint const& endpoint) { +bool SimpleFailureMonitor::permanentlyFailed(Endpoint const& endpoint) const { return failedEndpoints.count(endpoint); } diff --git a/fdbrpc/FailureMonitor.h b/fdbrpc/FailureMonitor.h index 434f0f9a91..f31b7a2d84 100644 --- a/fdbrpc/FailureMonitor.h +++ b/fdbrpc/FailureMonitor.h @@ -87,10 +87,10 @@ struct FailureStatus { class IFailureMonitor { public: // 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 - 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 virtual void endpointNotFound(Endpoint const&) = 0; @@ -102,10 +102,10 @@ public: virtual Future onDisconnectOrFailure(Endpoint const& endpoint) = 0; // 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. - 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 virtual void notifyDisconnect(NetworkAddress const&) = 0; @@ -140,14 +140,14 @@ public: SimpleFailureMonitor(); void setStatus(NetworkAddress const& address, FailureStatus const& status); void endpointNotFound(Endpoint const&); - virtual void notifyDisconnect(NetworkAddress const&); + void notifyDisconnect(NetworkAddress const&) override; - virtual Future onStateChanged(Endpoint const& endpoint); - virtual FailureStatus getState(Endpoint const& endpoint); - virtual FailureStatus getState(NetworkAddress const& address); - virtual Future onDisconnectOrFailure(Endpoint const& endpoint); - virtual bool onlyEndpointFailed(Endpoint const& endpoint); - virtual bool permanentlyFailed(Endpoint const& endpoint); + Future onStateChanged(Endpoint const& endpoint) override; + FailureStatus getState(Endpoint const& endpoint) const override; + FailureStatus getState(NetworkAddress const& address) const override; + Future onDisconnectOrFailure(Endpoint const& endpoint) override; + bool onlyEndpointFailed(Endpoint const& endpoint) const override; + bool permanentlyFailed(Endpoint const& endpoint) const override; void reset();