diff options
author | matt dannenberg <matt.dannenberg@10gen.com> | 2016-03-04 06:00:05 -0500 |
---|---|---|
committer | matt dannenberg <matt.dannenberg@10gen.com> | 2016-03-07 13:19:29 -0500 |
commit | 03eb4777de6cc9bade4041190b837b3c31a88e34 (patch) | |
tree | 8208f193b3d107362c98fbfbd036d829851437be /src/mongo/db/repl/oplog_entry.cpp | |
parent | b34164948c4727e1038cb76ce3783570c7f90d15 (diff) | |
download | mongo-03eb4777de6cc9bade4041190b837b3c31a88e34.tar.gz |
SERVER-22965 move OplogEntry into repl/oplog_entry.{cpp,h}
Diffstat (limited to 'src/mongo/db/repl/oplog_entry.cpp')
-rw-r--r-- | src/mongo/db/repl/oplog_entry.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/mongo/db/repl/oplog_entry.cpp b/src/mongo/db/repl/oplog_entry.cpp new file mode 100644 index 00000000000..1b612d6ca1a --- /dev/null +++ b/src/mongo/db/repl/oplog_entry.cpp @@ -0,0 +1,56 @@ +/** + * Copyright (C) 2016 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. + */ + +#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kReplication + +#include "mongo/platform/basic.h" + +#include "mongo/db/repl/oplog_entry.h" + +namespace mongo { +namespace repl { + +OplogEntry::OplogEntry(const BSONObj& rawInput) : raw(rawInput.getOwned()) { + for (auto elem : raw) { + const auto name = elem.fieldNameStringData(); + if (name == "ns") { + ns = elem.valuestrsafe(); + } else if (name == "op") { + opType = elem.valuestrsafe(); + } else if (name == "o2") { + o2 = elem; + } else if (name == "v") { + version = elem; + } else if (name == "o") { + o = elem; + } + } +} + +} // namespace repl +} // namespace mongo |