summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/repl_set_heartbeat_args_v1.cpp
diff options
context:
space:
mode:
authormatt dannenberg <matt.dannenberg@10gen.com>2015-04-23 09:28:22 -0400
committermatt dannenberg <matt.dannenberg@10gen.com>2015-04-23 09:28:22 -0400
commit623d5413c322136d75c43c8d48f58b19761b3709 (patch)
treeac726331f46b7c5b8e2c211836e295fd1ad938cc /src/mongo/db/repl/repl_set_heartbeat_args_v1.cpp
parent4fb40170f58ffab0c03404e8fe9214fe1f3c650c (diff)
downloadmongo-623d5413c322136d75c43c8d48f58b19761b3709.tar.gz
Revert "SERVER-18191 make new heartbeat args/response classes for the new election protocol"
This reverts commit 9a7bb551c0d01e53bfd3521d3862c73470c13db1.
Diffstat (limited to 'src/mongo/db/repl/repl_set_heartbeat_args_v1.cpp')
-rw-r--r--src/mongo/db/repl/repl_set_heartbeat_args_v1.cpp125
1 files changed, 0 insertions, 125 deletions
diff --git a/src/mongo/db/repl/repl_set_heartbeat_args_v1.cpp b/src/mongo/db/repl/repl_set_heartbeat_args_v1.cpp
deleted file mode 100644
index 5fbf6090ff8..00000000000
--- a/src/mongo/db/repl/repl_set_heartbeat_args_v1.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- * Copyright 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.
- */
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/repl/repl_set_heartbeat_args_v1.h"
-
-#include "mongo/bson/util/bson_check.h"
-#include "mongo/bson/util/bson_extract.h"
-#include "mongo/db/jsobj.h"
-
-namespace mongo {
-namespace repl {
-
-namespace {
-
- const std::string kConfigVersionFieldName = "configVersion";
- const std::string kProtocolVersionFieldName = "pv";
- const std::string kSenderIdFieldName = "fromId";
- const std::string kSetNameFieldName = "replSetHeartbeat";
- const std::string kTermFieldName = "term";
-
- const std::string kLegalHeartbeatFieldNames[] = {
- kProtocolVersionFieldName,
- kConfigVersionFieldName,
- kSenderIdFieldName,
- kSetNameFieldName,
- kTermFieldName
- };
-
-} // namespace
-
- Status ReplSetHeartbeatArgsV1::initialize(const BSONObj& argsObj) {
- Status status = bsonCheckOnlyHasFields("ReplSetHeartbeatArgs",
- argsObj,
- kLegalHeartbeatFieldNames);
- if (!status.isOK())
- return status;
-
- status = bsonExtractIntegerField(argsObj, kProtocolVersionFieldName, &_protocolVersion);
- if (!status.isOK())
- return status;
-
- status = bsonExtractIntegerField(argsObj, kConfigVersionFieldName, &_configVersion);
- if (!status.isOK())
- return status;
-
- status = bsonExtractIntegerField(argsObj, kSenderIdFieldName, &_senderId);
- if (!status.isOK())
- return status;
-
- status = bsonExtractIntegerField(argsObj, kTermFieldName, &_term);
- if (!status.isOK())
- return status;
-
- status = bsonExtractStringField(argsObj, kSetNameFieldName, &_setName);
- if (!status.isOK())
- return status;
-
- return Status::OK();
- }
-
- bool ReplSetHeartbeatArgsV1::isInitialized() const {
- return _configVersion != -1 && _protocolVersion != -1 &&
- _senderId != -1 && _term != -1 && !_setName.empty();
- }
-
- void ReplSetHeartbeatArgsV1::setConfigVersion(long long newVal) {
- _configVersion = newVal;
- }
-
- void ReplSetHeartbeatArgsV1::setProtocolVersion(long long newVal) {
- _protocolVersion = newVal;
- }
-
- void ReplSetHeartbeatArgsV1::setSenderId(long long newVal) {
- _senderId = newVal;
- }
-
- void ReplSetHeartbeatArgsV1::setSetName(std::string newVal) {
- _setName = newVal;
- }
-
- void ReplSetHeartbeatArgsV1::setTerm(long long newVal) {
- _term = newVal;
- }
-
- BSONObj ReplSetHeartbeatArgsV1::toBSON() const {
- invariant(isInitialized());
- BSONObjBuilder builder;
- builder.append(kSetNameFieldName, _setName);
- builder.appendIntOrLL(kProtocolVersionFieldName, _protocolVersion);
- builder.appendIntOrLL(kConfigVersionFieldName, _configVersion);
- builder.appendIntOrLL(kSenderIdFieldName, _senderId);
- builder.appendIntOrLL(kTermFieldName, _term);
- return builder.obj();
- }
-
-} // namespace repl
-} // namespace mongo