summaryrefslogtreecommitdiff
path: root/src/mongo/shell/bridge.js
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2016-05-28 17:55:12 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2016-05-28 17:55:12 -0400
commit6dcdd23dd37ef12c87e71cf59ef01cd82432efe0 (patch)
treec8cfb5acb62c80f375bc37e7d4350382deea6a37 /src/mongo/shell/bridge.js
parentd4ac5673ea3f6cef4ce9dbcec90e31813997a528 (diff)
downloadmongo-6dcdd23dd37ef12c87e71cf59ef01cd82432efe0.tar.gz
SERVER-23971 Clang-Format code
Diffstat (limited to 'src/mongo/shell/bridge.js')
-rw-r--r--src/mongo/shell/bridge.js95
1 files changed, 46 insertions, 49 deletions
diff --git a/src/mongo/shell/bridge.js b/src/mongo/shell/bridge.js
index 7f621f14a52..74e6e674d71 100644
--- a/src/mongo/shell/bridge.js
+++ b/src/mongo/shell/bridge.js
@@ -36,7 +36,11 @@ function MongoBridge(options) {
// Start the mongobridge on port 'this.port' routing network traffic to 'this.dest'.
var args = ['mongobridge', '--port', this.port, '--dest', this.dest];
- var keysToSkip = ['dest', 'hostName', 'port', ];
+ var keysToSkip = [
+ 'dest',
+ 'hostName',
+ 'port',
+ ];
// Append any command line arguments that are optional for mongobridge.
Object.keys(options).forEach(function(key) {
@@ -95,14 +99,12 @@ function MongoBridge(options) {
// connection object that is equivalent to its 'host' property. Certain functions in
// ReplSetTest and ShardingTest use the 'name' property instead of the 'host' property, so
// we define it here for consistency.
- Object.defineProperty(userConn,
- 'name',
- {
- enumerable: true,
- get: function() {
- return this.host;
- },
- });
+ Object.defineProperty(userConn, 'name', {
+ enumerable: true,
+ get: function() {
+ return this.host;
+ },
+ });
controlConn = new Mongo(hostName + ':' + this.port);
};
@@ -229,12 +231,10 @@ function MongoBridge(options) {
bridges.forEach(throwErrorIfNotMongoBridgeInstance);
bridges.forEach(bridge => {
- var res = runBridgeCommand(controlConn,
- 'delayMessagesFrom',
- {
- host: bridge.dest,
- delay: delay,
- });
+ var res = runBridgeCommand(controlConn, 'delayMessagesFrom', {
+ host: bridge.dest,
+ delay: delay,
+ });
assert.commandWorked(res,
'failed to configure the mongobridge listening on port ' +
this.port + ' to delay messages from ' + bridge.dest + ' by ' +
@@ -256,12 +256,10 @@ function MongoBridge(options) {
bridges.forEach(throwErrorIfNotMongoBridgeInstance);
bridges.forEach(bridge => {
- var res = runBridgeCommand(controlConn,
- 'discardMessagesFrom',
- {
- host: bridge.dest,
- loss: lossProbability,
- });
+ var res = runBridgeCommand(controlConn, 'discardMessagesFrom', {
+ host: bridge.dest,
+ loss: lossProbability,
+ });
assert.commandWorked(res,
'failed to configure the mongobridge listening on port ' +
this.port + ' to discard messages from ' + bridge.dest +
@@ -272,32 +270,31 @@ function MongoBridge(options) {
// Use a Proxy to "extend" the underlying connection object. The C++ functions, e.g.
// runCommand(), require that they are called on the Mongo instance itself and so typical
// prototypical inheritance isn't possible.
- return new Proxy(this,
- {
- get: function get(target, property, receiver) {
- // If the property is defined on the MongoBridge instance itself, then
- // return it.
- // Otherwise, get the value of the property from the Mongo instance.
- if (target.hasOwnProperty(property)) {
- return target[property];
- }
- var value = userConn[property];
- if (typeof value === 'function') {
- return value.bind(userConn);
- }
- return value;
- },
-
- set: function set(target, property, value, receiver) {
- // Delegate setting the value of any property to the Mongo instance so
- // that it can be
- // accessed in functions acting on the Mongo instance directly instead of
- // this Proxy.
- // For example, the "slaveOk" property needs to be set on the Mongo
- // instance in order
- // for the query options bit to be set correctly.
- userConn[property] = value;
- return true;
- },
- });
+ return new Proxy(this, {
+ get: function get(target, property, receiver) {
+ // If the property is defined on the MongoBridge instance itself, then
+ // return it.
+ // Otherwise, get the value of the property from the Mongo instance.
+ if (target.hasOwnProperty(property)) {
+ return target[property];
+ }
+ var value = userConn[property];
+ if (typeof value === 'function') {
+ return value.bind(userConn);
+ }
+ return value;
+ },
+
+ set: function set(target, property, value, receiver) {
+ // Delegate setting the value of any property to the Mongo instance so
+ // that it can be
+ // accessed in functions acting on the Mongo instance directly instead of
+ // this Proxy.
+ // For example, the "slaveOk" property needs to be set on the Mongo
+ // instance in order
+ // for the query options bit to be set correctly.
+ userConn[property] = value;
+ return true;
+ },
+ });
}