From 27f328ad14b8fbc006c5c4103becd0f6a3aaaa5c Mon Sep 17 00:00:00 2001 From: Daniel Moody Date: Thu, 29 Jul 2021 15:28:20 -0500 Subject: SERVER-57446 fix clang-tidy header issues and add header-filter --- src/mongo/client/async_client.h | 5 ++--- src/mongo/client/dbclient_base.h | 8 ++++---- src/mongo/client/dbclient_mockcursor.h | 2 +- src/mongo/client/fetcher.h | 2 +- src/mongo/client/remote_command_targeter_mock.h | 2 +- src/mongo/client/replica_set_monitor.h | 2 +- src/mongo/client/scanning_replica_set_monitor_internal.h | 2 +- src/mongo/client/sdam/sdam_datatypes.h | 8 ++++---- src/mongo/client/sdam/server_description.h | 9 ++++----- src/mongo/client/sdam/server_description_builder.h | 12 ++++++------ src/mongo/client/sdam/server_selector.h | 8 ++++---- src/mongo/client/sdam/topology_listener.h | 9 ++++----- src/mongo/client/sdam/topology_listener_mock.h | 5 ++--- src/mongo/client/sdam/topology_state_machine.h | 2 +- src/mongo/client/server_discovery_monitor.h | 4 ++-- src/mongo/client/server_ping_monitor.h | 2 +- src/mongo/client/streamable_replica_set_monitor.h | 9 ++++----- 17 files changed, 43 insertions(+), 48 deletions(-) (limited to 'src/mongo/client') diff --git a/src/mongo/client/async_client.h b/src/mongo/client/async_client.h index f586335949b..d7a2402f11a 100644 --- a/src/mongo/client/async_client.h +++ b/src/mongo/client/async_client.h @@ -58,7 +58,7 @@ public: static Future connect( const HostAndPort& peer, transport::ConnectSSLMode sslMode, - ServiceContext* const context, + ServiceContext* context, transport::ReactorHandle reactor, Milliseconds timeout, std::shared_ptr transientSSLContext = nullptr); @@ -86,8 +86,7 @@ public: BSONObj specAuth, auth::SpeculativeAuthType speculativeAuthtype); - Future initWireVersion(const std::string& appName, - executor::NetworkConnectionHook* const hook); + Future initWireVersion(const std::string& appName, executor::NetworkConnectionHook* hook); void cancel(const BatonHandle& baton = nullptr); diff --git a/src/mongo/client/dbclient_base.h b/src/mongo/client/dbclient_base.h index 0a5ef5e347c..f29037b04c0 100644 --- a/src/mongo/client/dbclient_base.h +++ b/src/mongo/client/dbclient_base.h @@ -364,7 +364,7 @@ public: /** count number of objects in collection ns that match the query criteria specified throws UserAssertion if database returns an error */ - virtual long long count(const NamespaceStringOrUUID nsOrUuid, + virtual long long count(NamespaceStringOrUUID nsOrUuid, const BSONObj& query = BSONObj(), int options = 0, int limit = 0, @@ -450,8 +450,8 @@ public: * @param authorizedDatabases Only return the databases the user is authorized on */ std::vector getDatabaseInfos(const BSONObj& filter = BSONObj(), - const bool nameOnly = false, - const bool authorizedDatabases = false); + bool nameOnly = false, + bool authorizedDatabases = false); bool exists(const std::string& ns); @@ -792,7 +792,7 @@ protected: /** if the element contains a not primary error */ bool isNotPrimaryErrorString(const BSONElement& e); - BSONObj _countCmd(const NamespaceStringOrUUID nsOrUuid, + BSONObj _countCmd(NamespaceStringOrUUID nsOrUuid, const BSONObj& query, int options, int limit, diff --git a/src/mongo/client/dbclient_mockcursor.h b/src/mongo/client/dbclient_mockcursor.h index 11c9181e07c..1138ee41286 100644 --- a/src/mongo/client/dbclient_mockcursor.h +++ b/src/mongo/client/dbclient_mockcursor.h @@ -42,7 +42,7 @@ class DBClientMockCursor : public DBClientCursor { public: DBClientMockCursor(mongo::DBClientBase* client, const BSONArray& mockCollection, - const bool provideResumeToken = false, + bool provideResumeToken = false, unsigned long batchSize = 0); virtual ~DBClientMockCursor() {} diff --git a/src/mongo/client/fetcher.h b/src/mongo/client/fetcher.h index 6e2c4a825e8..de2fb7553e0 100644 --- a/src/mongo/client/fetcher.h +++ b/src/mongo/client/fetcher.h @@ -223,7 +223,7 @@ private: * * Note: Errors are ignored and no retry is done */ - void _sendKillCursors(const CursorId id, const NamespaceString& nss); + void _sendKillCursors(CursorId id, const NamespaceString& nss); /** * Returns whether the fetcher is in shutdown. diff --git a/src/mongo/client/remote_command_targeter_mock.h b/src/mongo/client/remote_command_targeter_mock.h index 49ae1302c63..108764b08a2 100644 --- a/src/mongo/client/remote_command_targeter_mock.h +++ b/src/mongo/client/remote_command_targeter_mock.h @@ -82,7 +82,7 @@ public: /** * Sets the return value for the next call to connectionString. */ - void setConnectionStringReturnValue(const ConnectionString returnValue); + void setConnectionStringReturnValue(ConnectionString returnValue); /** * Sets the return value for the next call to findHost. diff --git a/src/mongo/client/replica_set_monitor.h b/src/mongo/client/replica_set_monitor.h index 532ee1d520a..8c9cf1a8e68 100644 --- a/src/mongo/client/replica_set_monitor.h +++ b/src/mongo/client/replica_set_monitor.h @@ -99,7 +99,7 @@ public: static void shutdown(); protected: - explicit ReplicaSetMonitor(const std::function cleanupCallback); + explicit ReplicaSetMonitor(std::function cleanupCallback); private: /** diff --git a/src/mongo/client/scanning_replica_set_monitor_internal.h b/src/mongo/client/scanning_replica_set_monitor_internal.h index 4e3ec94df3b..9641143a3a3 100644 --- a/src/mongo/client/scanning_replica_set_monitor_internal.h +++ b/src/mongo/client/scanning_replica_set_monitor_internal.h @@ -107,7 +107,7 @@ public: void markFailed(const Status& status); - bool matches(const ReadPreference pref) const; + bool matches(ReadPreference pref) const; /** * Checks if the given tag matches the tag attached to this node. diff --git a/src/mongo/client/sdam/sdam_datatypes.h b/src/mongo/client/sdam/sdam_datatypes.h index 111f149d4f1..cf9a471079a 100644 --- a/src/mongo/client/sdam/sdam_datatypes.h +++ b/src/mongo/client/sdam/sdam_datatypes.h @@ -54,9 +54,9 @@ enum class TopologyType { kUnknown }; const std::vector allTopologyTypes(); -std::string toString(const TopologyType topologyType); +std::string toString(TopologyType topologyType); StatusWith parseTopologyType(StringData strTopologyType); -std::ostream& operator<<(std::ostream& os, const TopologyType topologyType); +std::ostream& operator<<(std::ostream& os, TopologyType topologyType); enum class ServerType { kStandalone, @@ -69,9 +69,9 @@ enum class ServerType { kUnknown }; const std::vector allServerTypes(); -std::string toString(const ServerType serverType); +std::string toString(ServerType serverType); StatusWith parseServerType(StringData strServerType); -std::ostream& operator<<(std::ostream& os, const ServerType serverType); +std::ostream& operator<<(std::ostream& os, ServerType serverType); using HelloRTT = Microseconds; diff --git a/src/mongo/client/sdam/server_description.h b/src/mongo/client/sdam/server_description.h index e9674cc1332..a8d5f256542 100644 --- a/src/mongo/client/sdam/server_description.h +++ b/src/mongo/client/sdam/server_description.h @@ -119,14 +119,13 @@ private: void parseTypeFromHelloReply(BSONObj helloReply); - void calculateRtt(const boost::optional currentRtt, - const boost::optional lastRtt); + void calculateRtt(boost::optional currentRtt, boost::optional lastRtt); void saveLastWriteInfo(BSONObj lastWriteBson); - void storeHostListIfPresent(const std::string key, - const BSONObj response, + void storeHostListIfPresent(std::string key, + BSONObj response, std::set& destination); - void saveHosts(const BSONObj response); + void saveHosts(BSONObj response); void saveTags(BSONObj tagsObj); void saveElectionId(BSONElement electionId); void saveTopologyVersion(BSONElement topologyVersionField); diff --git a/src/mongo/client/sdam/server_description_builder.h b/src/mongo/client/sdam/server_description_builder.h index b0e886d4e90..d1cd53a6f06 100644 --- a/src/mongo/client/sdam/server_description_builder.h +++ b/src/mongo/client/sdam/server_description_builder.h @@ -46,16 +46,16 @@ public: // server identity ServerDescriptionBuilder& withAddress(const HostAndPort& address); - ServerDescriptionBuilder& withType(const ServerType type); + ServerDescriptionBuilder& withType(ServerType type); ServerDescriptionBuilder& withMe(const HostAndPort& me); - ServerDescriptionBuilder& withTag(const std::string key, const std::string value); - ServerDescriptionBuilder& withSetName(const std::string setName); + ServerDescriptionBuilder& withTag(std::string key, std::string value); + ServerDescriptionBuilder& withSetName(std::string setName); // network attributes ServerDescriptionBuilder& withRtt(const HelloRTT& rtt); ServerDescriptionBuilder& withError(const std::string& error); ServerDescriptionBuilder& withLogicalSessionTimeoutMinutes( - const boost::optional logicalSessionTimeoutMinutes); + boost::optional logicalSessionTimeoutMinutes); // server capabilities ServerDescriptionBuilder& withMinWireVersion(int minVersion); @@ -63,7 +63,7 @@ public: // server 'time' ServerDescriptionBuilder& withLastWriteDate(const Date_t& lastWriteDate); - ServerDescriptionBuilder& withOpTime(const repl::OpTime opTime); + ServerDescriptionBuilder& withOpTime(repl::OpTime opTime); ServerDescriptionBuilder& withLastUpdateTime(const Date_t& lastUpdateTime); // topology membership @@ -71,7 +71,7 @@ public: ServerDescriptionBuilder& withHost(const HostAndPort& host); ServerDescriptionBuilder& withPassive(const HostAndPort& passive); ServerDescriptionBuilder& withArbiter(const HostAndPort& arbiter); - ServerDescriptionBuilder& withSetVersion(const int setVersion); + ServerDescriptionBuilder& withSetVersion(int setVersion); ServerDescriptionBuilder& withElectionId(const OID& electionId); ServerDescriptionBuilder& withTopologyVersion(TopologyVersion topologyVersion); diff --git a/src/mongo/client/sdam/server_selector.h b/src/mongo/client/sdam/server_selector.h index ed60e32cc34..65a1047fbdb 100644 --- a/src/mongo/client/sdam/server_selector.h +++ b/src/mongo/client/sdam/server_selector.h @@ -57,7 +57,7 @@ public: * ServerDescription(s). The server is selected randomly from those that match the criteria. */ virtual boost::optional selectServer( - const TopologyDescriptionPtr topologyDescription, + TopologyDescriptionPtr topologyDescription, const ReadPreferenceSetting& criteria, const std::vector& excludedHosts = std::vector()) = 0; @@ -70,12 +70,12 @@ public: explicit SdamServerSelector(const SdamConfiguration& config); boost::optional> selectServers( - const TopologyDescriptionPtr topologyDescription, + TopologyDescriptionPtr topologyDescription, const ReadPreferenceSetting& criteria, const std::vector& excludedHosts = std::vector()) override; boost::optional selectServer( - const TopologyDescriptionPtr topologyDescription, + TopologyDescriptionPtr topologyDescription, const ReadPreferenceSetting& criteria, const std::vector& excludedHosts = std::vector()) override; @@ -84,7 +84,7 @@ public: private: void _getCandidateServers(std::vector* result, - const TopologyDescriptionPtr topologyDescription, + TopologyDescriptionPtr topologyDescription, const ReadPreferenceSetting& criteria, const std::vector& excludedHosts); diff --git a/src/mongo/client/sdam/topology_listener.h b/src/mongo/client/sdam/topology_listener.h index 29b976cdf3f..f99ed84ba75 100644 --- a/src/mongo/client/sdam/topology_listener.h +++ b/src/mongo/client/sdam/topology_listener.h @@ -104,17 +104,16 @@ public: TopologyDescriptionPtr newDescription) override; virtual void onServerHandshakeCompleteEvent(HelloRTT duration, const HostAndPort& address, - const BSONObj reply = BSONObj()) override; + BSONObj reply = BSONObj()) override; void onServerHandshakeFailedEvent(const HostAndPort& address, const Status& status, - const BSONObj reply); + BSONObj reply); - void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, - const BSONObj reply) override; + void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, BSONObj reply) override; void onServerHeartbeatFailureEvent(Status errorStatus, const HostAndPort& hostAndPort, - const BSONObj reply) override; + BSONObj reply) override; void onServerPingFailedEvent(const HostAndPort& hostAndPort, const Status& status) override; void onServerPingSucceededEvent(HelloRTT duration, const HostAndPort& hostAndPort) override; diff --git a/src/mongo/client/sdam/topology_listener_mock.h b/src/mongo/client/sdam/topology_listener_mock.h index 051d56ee589..ad8db6f46da 100644 --- a/src/mongo/client/sdam/topology_listener_mock.h +++ b/src/mongo/client/sdam/topology_listener_mock.h @@ -40,12 +40,11 @@ public: TopologyListenerMock() = default; virtual ~TopologyListenerMock() = default; - void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, - const BSONObj reply) override; + void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, BSONObj reply) override; void onServerHeartbeatFailureEvent(Status errorStatus, const HostAndPort& hostAndPort, - const BSONObj reply) override; + BSONObj reply) override; /** * Returns true if _serverIsMasterReplies contains an element corresponding to hostAndPort. diff --git a/src/mongo/client/sdam/topology_state_machine.h b/src/mongo/client/sdam/topology_state_machine.h index 5c631123887..c946de9c0e3 100644 --- a/src/mongo/client/sdam/topology_state_machine.h +++ b/src/mongo/client/sdam/topology_state_machine.h @@ -89,7 +89,7 @@ private: ServerDescriptionPtr newServerDescription, bool newServer); void removeServerDescription(TopologyDescription& topologyDescription, - const HostAndPort serverAddress); + HostAndPort serverAddress); void modifyTopologyType(TopologyDescription& topologyDescription, TopologyType topologyType); void modifySetName(TopologyDescription& topologyDescription, diff --git a/src/mongo/client/server_discovery_monitor.h b/src/mongo/client/server_discovery_monitor.h index ff96724971f..93bcd4c53a8 100644 --- a/src/mongo/client/server_discovery_monitor.h +++ b/src/mongo/client/server_discovery_monitor.h @@ -85,8 +85,8 @@ private: // request. StatusWith _scheduleSingleHello(); - void _onHelloSuccess(const BSONObj bson); - void _onHelloFailure(const Status& status, const BSONObj bson); + void _onHelloSuccess(BSONObj bson); + void _onHelloFailure(const Status& status, BSONObj bson); Milliseconds _overrideRefreshPeriod(Milliseconds original); Milliseconds _currentRefreshPeriod(WithLock, bool scheduleImmediately); diff --git a/src/mongo/client/server_ping_monitor.h b/src/mongo/client/server_ping_monitor.h index 2713cb6ae99..b4667e85606 100644 --- a/src/mongo/client/server_ping_monitor.h +++ b/src/mongo/client/server_ping_monitor.h @@ -155,7 +155,7 @@ public: */ void onServerHandshakeCompleteEvent(sdam::HelloRTT durationMs, const HostAndPort& address, - const BSONObj reply = BSONObj()); + BSONObj reply = BSONObj()); /** * Drop corresponding SingleServerPingMonitors if the server is not included in the diff --git a/src/mongo/client/streamable_replica_set_monitor.h b/src/mongo/client/streamable_replica_set_monitor.h index cbd3ed2e874..8f16013daa3 100644 --- a/src/mongo/client/streamable_replica_set_monitor.h +++ b/src/mongo/client/streamable_replica_set_monitor.h @@ -236,16 +236,15 @@ private: void onTopologyDescriptionChangedEvent(sdam::TopologyDescriptionPtr previousDescription, sdam::TopologyDescriptionPtr newDescription) override; - void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, - const BSONObj reply) override; + void onServerHeartbeatSucceededEvent(const HostAndPort& hostAndPort, BSONObj reply) override; void onServerHandshakeFailedEvent(const HostAndPort& address, const Status& status, - const BSONObj reply) override; + BSONObj reply) override; void onServerHeartbeatFailureEvent(Status errorStatus, const HostAndPort& hostAndPort, - const BSONObj reply) override; + BSONObj reply) override; void onServerPingFailedEvent(const HostAndPort& hostAndPort, const Status& status) override; @@ -254,7 +253,7 @@ private: void onServerHandshakeCompleteEvent(sdam::HelloRTT durationMs, const HostAndPort& hostAndPort, - const BSONObj reply) override; + BSONObj reply) override; // Get a pointer to the current primary's ServerDescription // To ensure a consistent view of the Topology either _currentPrimary or _currentTopology should -- cgit v1.2.1