diff options
Diffstat (limited to 'src/mongo/s/dbclient_shard_resolver.h')
-rw-r--r-- | src/mongo/s/dbclient_shard_resolver.h | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/src/mongo/s/dbclient_shard_resolver.h b/src/mongo/s/dbclient_shard_resolver.h index fb7beb26ee5..076dd078562 100644 --- a/src/mongo/s/dbclient_shard_resolver.h +++ b/src/mongo/s/dbclient_shard_resolver.h @@ -32,42 +32,37 @@ namespace mongo { +/** + * ShardResolver based on the Shard and ReplicaSetMonitor caches. + * + * TODO: Currently it's possible for the shard resolver to be stale after we target and remove + * a shard. We need to figure out how to refresh. + */ +class DBClientShardResolver : public ShardResolver { +public: + DBClientShardResolver() {} + + virtual ~DBClientShardResolver() {} + /** - * ShardResolver based on the Shard and ReplicaSetMonitor caches. + * Returns the current host ConnectionString for a write to a shard. + * + * Note: Does *not* trigger a refresh of either the shard or replica set monitor caches, + * though refreshes may happen unexpectedly between calls. * - * TODO: Currently it's possible for the shard resolver to be stale after we target and remove - * a shard. We need to figure out how to refresh. + * Returns ShardNotFound if the shard name is unknown + * Returns ReplicaSetNotFound if the replica set is not being tracked + * Returns !OK with message if the shard host could not be found for other reasons. */ - class DBClientShardResolver : public ShardResolver { - public: + Status chooseWriteHost(const std::string& shardName, ConnectionString* shardHost) const; - DBClientShardResolver() { - } - - virtual ~DBClientShardResolver() { - } - - /** - * Returns the current host ConnectionString for a write to a shard. - * - * Note: Does *not* trigger a refresh of either the shard or replica set monitor caches, - * though refreshes may happen unexpectedly between calls. - * - * Returns ShardNotFound if the shard name is unknown - * Returns ReplicaSetNotFound if the replica set is not being tracked - * Returns !OK with message if the shard host could not be found for other reasons. - */ - Status chooseWriteHost( const std::string& shardName, ConnectionString* shardHost ) const; - - /** - * Resolves a replica set connection string to a master or returns an error. - * - * Returns HostNotFound if the master is not reachable - * Returns ReplicaSetNotFound if the replica set is not being tracked - */ - static Status findMaster(const ConnectionString& connString, - ConnectionString* resolvedHost); - - }; + /** + * Resolves a replica set connection string to a master or returns an error. + * + * Returns HostNotFound if the master is not reachable + * Returns ReplicaSetNotFound if the replica set is not being tracked + */ + static Status findMaster(const ConnectionString& connString, ConnectionString* resolvedHost); +}; -} // namespace mongo +} // namespace mongo |