diff options
Diffstat (limited to 'src/mongo/s/write_ops/batched_request_metadata.h')
-rw-r--r-- | src/mongo/s/write_ops/batched_request_metadata.h | 109 |
1 files changed, 54 insertions, 55 deletions
diff --git a/src/mongo/s/write_ops/batched_request_metadata.h b/src/mongo/s/write_ops/batched_request_metadata.h index afe639adfaa..6e31cb60713 100644 --- a/src/mongo/s/write_ops/batched_request_metadata.h +++ b/src/mongo/s/write_ops/batched_request_metadata.h @@ -36,59 +36,58 @@ #include "mongo/s/chunk_version.h" namespace mongo { - class BatchedRequestMetadata : public BSONSerializable { - MONGO_DISALLOW_COPYING(BatchedRequestMetadata); - public: - - static const BSONField<std::string> shardName; - static const BSONField<ChunkVersion> shardVersion; - static const BSONField<long long> session; - - BatchedRequestMetadata(); - virtual ~BatchedRequestMetadata(); - - // - // bson serializable interface implementation - // - - virtual bool isValid(std::string* errMsg) const; - virtual BSONObj toBSON() const; - virtual bool parseBSON(const BSONObj& source, std::string* errMsg); - virtual void clear(); - virtual std::string toString() const; - - void cloneTo(BatchedRequestMetadata* other) const; - - // - // individual field accessors - // - - void setShardName(StringData shardName); - void unsetShardName(); - bool isShardNameSet() const; - const std::string& getShardName() const; - - void setShardVersion(const ChunkVersion& shardVersion); - void unsetShardVersion(); - bool isShardVersionSet() const; - const ChunkVersion& getShardVersion() const; - - void setSession(long long session); - void unsetSession(); - bool isSessionSet() const; - long long getSession() const; - - private: - - // (O) shard name we're sending this batch to - std::string _shardName; - bool _isShardNameSet; - - // (O) version for this collection on a given shard - std::unique_ptr<ChunkVersion> _shardVersion; - - // (O) session number the inserts belong to - long long _session; - bool _isSessionSet; - }; +class BatchedRequestMetadata : public BSONSerializable { + MONGO_DISALLOW_COPYING(BatchedRequestMetadata); + +public: + static const BSONField<std::string> shardName; + static const BSONField<ChunkVersion> shardVersion; + static const BSONField<long long> session; + + BatchedRequestMetadata(); + virtual ~BatchedRequestMetadata(); + + // + // bson serializable interface implementation + // + + virtual bool isValid(std::string* errMsg) const; + virtual BSONObj toBSON() const; + virtual bool parseBSON(const BSONObj& source, std::string* errMsg); + virtual void clear(); + virtual std::string toString() const; + + void cloneTo(BatchedRequestMetadata* other) const; + + // + // individual field accessors + // + + void setShardName(StringData shardName); + void unsetShardName(); + bool isShardNameSet() const; + const std::string& getShardName() const; + + void setShardVersion(const ChunkVersion& shardVersion); + void unsetShardVersion(); + bool isShardVersionSet() const; + const ChunkVersion& getShardVersion() const; + + void setSession(long long session); + void unsetSession(); + bool isSessionSet() const; + long long getSession() const; + +private: + // (O) shard name we're sending this batch to + std::string _shardName; + bool _isShardNameSet; + + // (O) version for this collection on a given shard + std::unique_ptr<ChunkVersion> _shardVersion; + + // (O) session number the inserts belong to + long long _session; + bool _isSessionSet; +}; } |