diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-12-28 14:19:59 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2017-12-29 10:54:34 -0500 |
commit | 98f30b75b31c54464d5a907f435c15121a6c5353 (patch) | |
tree | 0a14dada17bce11bfe2bcdb9826302aedabf49c6 /src/mongo/s/ns_targeter.h | |
parent | 10e3ce2d905ca3afc1e5949da2daa3353740171a (diff) | |
download | mongo-98f30b75b31c54464d5a907f435c15121a6c5353.tar.gz |
SERVER-28992 Make the write commands targeter return actual ShardEndpoint(s)
... instead of populating arrays of pointers. This saves both on memory
allocations and makes the code simpler to follow.
Diffstat (limited to 'src/mongo/s/ns_targeter.h')
-rw-r--r-- | src/mongo/s/ns_targeter.h | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/mongo/s/ns_targeter.h b/src/mongo/s/ns_targeter.h index e3a554cd252..f915be42ec4 100644 --- a/src/mongo/s/ns_targeter.h +++ b/src/mongo/s/ns_targeter.h @@ -30,7 +30,7 @@ #include <vector> -#include "mongo/base/status.h" +#include "mongo/base/status_with.h" #include "mongo/bson/bsonobj.h" #include "mongo/db/namespace_string.h" #include "mongo/db/ops/write_ops.h" @@ -94,43 +94,39 @@ public: * * Returns !OK with message if document could not be targeted for other reasons. */ - virtual Status targetInsert(OperationContext* opCtx, - const BSONObj& doc, - ShardEndpoint** endpoint) const = 0; + virtual StatusWith<ShardEndpoint> targetInsert(OperationContext* opCtx, + const BSONObj& doc) const = 0; /** * Returns a vector of ShardEndpoints for a potentially multi-shard update. * * Returns OK and fills the endpoints; returns a status describing the error otherwise. */ - virtual Status targetUpdate(OperationContext* opCtx, - const write_ops::UpdateOpEntry& updateDoc, - std::vector<std::unique_ptr<ShardEndpoint>>* endpoints) const = 0; + virtual StatusWith<std::vector<ShardEndpoint>> targetUpdate( + OperationContext* opCtx, const write_ops::UpdateOpEntry& updateDoc) const = 0; /** * Returns a vector of ShardEndpoints for a potentially multi-shard delete. * * Returns OK and fills the endpoints; returns a status describing the error otherwise. */ - virtual Status targetDelete(OperationContext* opCtx, - const write_ops::DeleteOpEntry& deleteDoc, - std::vector<std::unique_ptr<ShardEndpoint>>* endpoints) const = 0; + virtual StatusWith<std::vector<ShardEndpoint>> targetDelete( + OperationContext* opCtx, const write_ops::DeleteOpEntry& deleteDoc) const = 0; /** * Returns a vector of ShardEndpoints for the entire collection. * * Returns !OK with message if the full collection could not be targeted. */ - virtual Status targetCollection( - std::vector<std::unique_ptr<ShardEndpoint>>* endpoints) const = 0; + virtual StatusWith<std::vector<ShardEndpoint>> targetCollection() const = 0; /** * Returns a vector of ShardEndpoints for all shards. * * Returns !OK with message if all shards could not be targeted. */ - virtual Status targetAllShards( - std::vector<std::unique_ptr<ShardEndpoint>>* endpoints) const = 0; + virtual StatusWith<std::vector<ShardEndpoint>> targetAllShards( + OperationContext* opCtx) const = 0; /** * Informs the targeter that a targeting failure occurred during one of the last targeting |