diff options
author | matt dannenberg <matt.dannenberg@10gen.com> | 2015-07-15 08:21:17 -0400 |
---|---|---|
committer | matt dannenberg <matt.dannenberg@10gen.com> | 2015-07-19 12:31:08 -0400 |
commit | 3b758994b8922dc99aa891d0b6c5a5ddcbc91307 (patch) | |
tree | 999bc8eace91c2c4b55b00d08569d49665d408b2 /src/mongo/db/repl/read_concern_args.h | |
parent | 77fca2a0807644a093c08619ff8ac99f22516f25 (diff) | |
download | mongo-3b758994b8922dc99aa891d0b6c5a5ddcbc91307.tar.gz |
SERVER-19205 change all ReadAfterOpTime objects to be ReadConcern objects
Diffstat (limited to 'src/mongo/db/repl/read_concern_args.h')
-rw-r--r-- | src/mongo/db/repl/read_concern_args.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/src/mongo/db/repl/read_concern_args.h b/src/mongo/db/repl/read_concern_args.h new file mode 100644 index 00000000000..90d558b832f --- /dev/null +++ b/src/mongo/db/repl/read_concern_args.h @@ -0,0 +1,78 @@ +/** + * Copyright (C) 2015 MongoDB Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the GNU Affero General Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ + +#pragma once + +#include <string> + +#include "mongo/base/status.h" +#include "mongo/db/repl/optime.h" +#include "mongo/util/time_support.h" + +namespace mongo { + +class BSONObj; + +namespace repl { + +class ReadConcernArgs { +public: + static const std::string kReadConcernFieldName; + static const std::string kOpTermFieldName; + static const std::string kOpTimeFieldName; + static const std::string kOpTimestampFieldName; + static const std::string kLevelFieldName; + + enum class ReadConcernLevel { kLocalReadConcern, kMajorityReadConcern, kLinearizableReadConcern }; + + ReadConcernArgs(); + ReadConcernArgs(OpTime opTime, ReadConcernLevel level); + + /** + * Format: + * { + * find: “coll”, + * filter: <Query Object>, + * readConcern: { // optional + * level: "[majority|local|linearizable]", + * afterOpTime: { ts: <timestamp>, term: <NumberLong> }, + * } + * } + */ + Status initialize(const BSONObj& cmdObj); + + ReadConcernLevel getLevel() const; + const OpTime& getOpTime() const; + +private: + OpTime _opTime; + ReadConcernLevel _level; +}; + +} // namespace repl +} // namespace mongo |