summaryrefslogtreecommitdiff
path: root/src/mongo/rpc
diff options
context:
space:
mode:
authorMaria van Keulen <maria@mongodb.com>2017-03-07 12:00:08 -0500
committerMaria van Keulen <maria@mongodb.com>2017-03-07 12:00:08 -0500
commit589a5c169ced8f6e9ddcd3d182ae1b75db6b7d79 (patch)
treec7a090ffdd56a91ae677e2492c61b820af44f964 /src/mongo/rpc
parent3cba97198638df3750e3b455e2ad57af7ee536ae (diff)
downloadmongo-589a5c169ced8f6e9ddcd3d182ae1b75db6b7d79.tar.gz
SERVER-27938 Rename all OperationContext variables to opCtx
This commit is an automated rename of all whole word instances of txn, _txn, and txnPtr to opCtx, _opCtx, and opCtxPtr, respectively in all .cpp and .h files in src/mongo.
Diffstat (limited to 'src/mongo/rpc')
-rw-r--r--src/mongo/rpc/metadata.cpp16
-rw-r--r--src/mongo/rpc/metadata.h4
-rw-r--r--src/mongo/rpc/metadata/client_metadata_ismaster.cpp14
-rw-r--r--src/mongo/rpc/metadata/client_metadata_ismaster.h4
-rw-r--r--src/mongo/rpc/metadata/egress_metadata_hook_list.cpp4
-rw-r--r--src/mongo/rpc/metadata/egress_metadata_hook_list.h2
-rw-r--r--src/mongo/rpc/metadata/egress_metadata_hook_list_test.cpp4
-rw-r--r--src/mongo/rpc/metadata/metadata_hook.h5
-rw-r--r--src/mongo/rpc/protocol.h4
9 files changed, 30 insertions, 27 deletions
diff --git a/src/mongo/rpc/metadata.cpp b/src/mongo/rpc/metadata.cpp
index 00a9d58dc9f..00d3c01ae78 100644
--- a/src/mongo/rpc/metadata.cpp
+++ b/src/mongo/rpc/metadata.cpp
@@ -46,7 +46,7 @@ BSONObj makeEmptyMetadata() {
return BSONObj();
}
-Status readRequestMetadata(OperationContext* txn, const BSONObj& metadataObj) {
+Status readRequestMetadata(OperationContext* opCtx, const BSONObj& metadataObj) {
BSONElement ssmElem;
BSONElement auditElem;
BSONElement configSvrElem;
@@ -72,16 +72,16 @@ Status readRequestMetadata(OperationContext* txn, const BSONObj& metadataObj) {
if (!swServerSelectionMetadata.isOK()) {
return swServerSelectionMetadata.getStatus();
}
- ServerSelectionMetadata::get(txn) = std::move(swServerSelectionMetadata.getValue());
+ ServerSelectionMetadata::get(opCtx) = std::move(swServerSelectionMetadata.getValue());
auto swAuditMetadata = AuditMetadata::readFromMetadata(auditElem);
if (!swAuditMetadata.isOK()) {
return swAuditMetadata.getStatus();
}
- AuditMetadata::get(txn) = std::move(swAuditMetadata.getValue());
+ AuditMetadata::get(opCtx) = std::move(swAuditMetadata.getValue());
const auto statusClientMetadata =
- ClientMetadataIsMasterState::readFromMetadata(txn, clientElem);
+ ClientMetadataIsMasterState::readFromMetadata(opCtx, clientElem);
if (!statusClientMetadata.isOK()) {
return statusClientMetadata;
}
@@ -90,19 +90,19 @@ Status readRequestMetadata(OperationContext* txn, const BSONObj& metadataObj) {
if (!configServerMetadata.isOK()) {
return configServerMetadata.getStatus();
}
- ConfigServerMetadata::get(txn) = std::move(configServerMetadata.getValue());
+ ConfigServerMetadata::get(opCtx) = std::move(configServerMetadata.getValue());
auto trackingMetadata = TrackingMetadata::readFromMetadata(trackingElem);
if (!trackingMetadata.isOK()) {
return trackingMetadata.getStatus();
}
- TrackingMetadata::get(txn) = std::move(trackingMetadata.getValue());
+ TrackingMetadata::get(opCtx) = std::move(trackingMetadata.getValue());
return Status::OK();
}
-Status writeRequestMetadata(OperationContext* txn, BSONObjBuilder* metadataBob) {
- auto ssStatus = ServerSelectionMetadata::get(txn).writeToMetadata(metadataBob);
+Status writeRequestMetadata(OperationContext* opCtx, BSONObjBuilder* metadataBob) {
+ auto ssStatus = ServerSelectionMetadata::get(opCtx).writeToMetadata(metadataBob);
if (!ssStatus.isOK()) {
return ssStatus;
}
diff --git a/src/mongo/rpc/metadata.h b/src/mongo/rpc/metadata.h
index 9af7bfdfeb5..d8956de30f7 100644
--- a/src/mongo/rpc/metadata.h
+++ b/src/mongo/rpc/metadata.h
@@ -53,12 +53,12 @@ BSONObj makeEmptyMetadata();
/**
* Reads metadata from a metadata object and sets it on this OperationContext.
*/
-Status readRequestMetadata(OperationContext* txn, const BSONObj& metadataObj);
+Status readRequestMetadata(OperationContext* opCtx, const BSONObj& metadataObj);
/**
* Writes metadata from an OperationContext to a metadata object.
*/
-Status writeRequestMetadata(OperationContext* txn, BSONObjBuilder* metadataBob);
+Status writeRequestMetadata(OperationContext* opCtx, BSONObjBuilder* metadataBob);
/**
* A command object and a corresponding metadata object.
diff --git a/src/mongo/rpc/metadata/client_metadata_ismaster.cpp b/src/mongo/rpc/metadata/client_metadata_ismaster.cpp
index 234f61c78e8..3eb19853417 100644
--- a/src/mongo/rpc/metadata/client_metadata_ismaster.cpp
+++ b/src/mongo/rpc/metadata/client_metadata_ismaster.cpp
@@ -74,7 +74,8 @@ void ClientMetadataIsMasterState::setClientMetadata(
}
-Status ClientMetadataIsMasterState::readFromMetadata(OperationContext* txn, BSONElement& element) {
+Status ClientMetadataIsMasterState::readFromMetadata(OperationContext* opCtx,
+ BSONElement& element) {
if (element.eoo()) {
return Status::OK();
}
@@ -85,23 +86,24 @@ Status ClientMetadataIsMasterState::readFromMetadata(OperationContext* txn, BSON
return swParseClientMetadata.getStatus();
}
- auto& clientMetadataIsMasterState = ClientMetadataIsMasterState::get(txn->getClient());
+ auto& clientMetadataIsMasterState = ClientMetadataIsMasterState::get(opCtx->getClient());
- clientMetadataIsMasterState.setClientMetadata(txn->getClient(),
+ clientMetadataIsMasterState.setClientMetadata(opCtx->getClient(),
std::move(swParseClientMetadata.getValue()));
return Status::OK();
}
-void ClientMetadataIsMasterState::writeToMetadata(OperationContext* txn, BSONObjBuilder* builder) {
+void ClientMetadataIsMasterState::writeToMetadata(OperationContext* opCtx,
+ BSONObjBuilder* builder) {
// We may be asked to write metadata on background threads that are not associated with an
// operation context
- if (!txn) {
+ if (!opCtx) {
return;
}
const auto& clientMetadata =
- ClientMetadataIsMasterState::get(txn->getClient()).getClientMetadata();
+ ClientMetadataIsMasterState::get(opCtx->getClient()).getClientMetadata();
// Skip appending metadata if there is none
if (!clientMetadata || clientMetadata.get().getDocument().isEmpty()) {
diff --git a/src/mongo/rpc/metadata/client_metadata_ismaster.h b/src/mongo/rpc/metadata/client_metadata_ismaster.h
index 305018343d0..b4e38e7e430 100644
--- a/src/mongo/rpc/metadata/client_metadata_ismaster.h
+++ b/src/mongo/rpc/metadata/client_metadata_ismaster.h
@@ -79,7 +79,7 @@ public:
* Thread-Safety:
* None - must be only be read and written from the thread owning "Client".
*/
- static Status readFromMetadata(OperationContext* txn, BSONElement& elem);
+ static Status readFromMetadata(OperationContext* opCtx, BSONElement& elem);
/**
* Write the $client section to OP_Command's metadata if there is a non-empty client metadata
@@ -88,7 +88,7 @@ public:
* Thread-Safety:
* None - must be only be read and written from the thread owning "Client".
*/
- static void writeToMetadata(OperationContext* txn, BSONObjBuilder* builder);
+ static void writeToMetadata(OperationContext* opCtx, BSONObjBuilder* builder);
private:
// Optional client metadata document.
diff --git a/src/mongo/rpc/metadata/egress_metadata_hook_list.cpp b/src/mongo/rpc/metadata/egress_metadata_hook_list.cpp
index 70c90dde0cf..5e11c84eb60 100644
--- a/src/mongo/rpc/metadata/egress_metadata_hook_list.cpp
+++ b/src/mongo/rpc/metadata/egress_metadata_hook_list.cpp
@@ -40,11 +40,11 @@ void EgressMetadataHookList::addHook(std::unique_ptr<EgressMetadataHook>&& newHo
_hooks.emplace_back(std::forward<std::unique_ptr<EgressMetadataHook>>(newHook));
}
-Status EgressMetadataHookList::writeRequestMetadata(OperationContext* txn,
+Status EgressMetadataHookList::writeRequestMetadata(OperationContext* opCtx,
const HostAndPort& requestDestination,
BSONObjBuilder* metadataBob) {
for (auto&& hook : _hooks) {
- auto status = hook->writeRequestMetadata(txn, requestDestination, metadataBob);
+ auto status = hook->writeRequestMetadata(opCtx, requestDestination, metadataBob);
if (!status.isOK()) {
return status;
}
diff --git a/src/mongo/rpc/metadata/egress_metadata_hook_list.h b/src/mongo/rpc/metadata/egress_metadata_hook_list.h
index 7a3542c1084..54b03b80c5e 100644
--- a/src/mongo/rpc/metadata/egress_metadata_hook_list.h
+++ b/src/mongo/rpc/metadata/egress_metadata_hook_list.h
@@ -58,7 +58,7 @@ public:
* early if one of hooks returned a non OK status and return it. Note that metadataBob should
* not be used if Status is not OK as the contents can be partial.
*/
- Status writeRequestMetadata(OperationContext* txn,
+ Status writeRequestMetadata(OperationContext* opCtx,
const HostAndPort& requestDestination,
BSONObjBuilder* metadataBob) override;
diff --git a/src/mongo/rpc/metadata/egress_metadata_hook_list_test.cpp b/src/mongo/rpc/metadata/egress_metadata_hook_list_test.cpp
index a40fcdc57db..159a78412fb 100644
--- a/src/mongo/rpc/metadata/egress_metadata_hook_list_test.cpp
+++ b/src/mongo/rpc/metadata/egress_metadata_hook_list_test.cpp
@@ -51,7 +51,7 @@ class TestHook : public EgressMetadataHook {
public:
TestHook(string fieldName, ReadReplyArgs* arg) : _fieldName(fieldName), _arg(arg) {}
- Status writeRequestMetadata(OperationContext* txn,
+ Status writeRequestMetadata(OperationContext* opCtx,
const HostAndPort& requestDestination,
BSONObjBuilder* metadataBob) override {
metadataBob->append(_fieldName, requestDestination.toString());
@@ -74,7 +74,7 @@ class FixedStatusTestHook : public EgressMetadataHook {
public:
FixedStatusTestHook(Status status) : _toRet(status) {}
- Status writeRequestMetadata(OperationContext* txn,
+ Status writeRequestMetadata(OperationContext* opCtx,
const HostAndPort& requestDestination,
BSONObjBuilder* metadataBob) override {
return _toRet;
diff --git a/src/mongo/rpc/metadata/metadata_hook.h b/src/mongo/rpc/metadata/metadata_hook.h
index 2369fb8d47a..81f0001f548 100644
--- a/src/mongo/rpc/metadata/metadata_hook.h
+++ b/src/mongo/rpc/metadata/metadata_hook.h
@@ -54,10 +54,11 @@ public:
* Writes to an outgoing request metadata object. This method must not throw or block on
* database or network operations and can be called by multiple concurrent threads.
*
- * txn may be null as writeRequestMetadata may be called on ASIO background threads, and may not
+ * opCtx may be null as writeRequestMetadata may be called on ASIO background threads, and may
+ * not
* have an OperationContext as a result.
*/
- virtual Status writeRequestMetadata(OperationContext* txn,
+ virtual Status writeRequestMetadata(OperationContext* opCtx,
const HostAndPort& requestDestination,
BSONObjBuilder* metadataBob) = 0;
diff --git a/src/mongo/rpc/protocol.h b/src/mongo/rpc/protocol.h
index 6ac205ccc2f..50392fedcd0 100644
--- a/src/mongo/rpc/protocol.h
+++ b/src/mongo/rpc/protocol.h
@@ -81,12 +81,12 @@ const ProtocolSet kAll = kOpQueryOnly | kOpCommandOnly;
/**
* Returns the protocol used to initiate the current operation.
*/
-Protocol getOperationProtocol(OperationContext* txn);
+Protocol getOperationProtocol(OperationContext* opCtx);
/**
* Sets the protocol used to initiate the current operation.
*/
-void setOperationProtocol(OperationContext* txn, Protocol protocol);
+void setOperationProtocol(OperationContext* opCtx, Protocol protocol);
/**
* Returns the newest protocol supported by two parties.