Code view:

A painting is a person's account of this edit as text, recorded independently of the node mapping - a rendering often has several equally defensible answers where the mapping has one. Deletions and insertions carry no position on the opposite side in a painting, so that panel draws no caret for them.

Before

…lines 1–41 unchanged (41 lines)
42 auto it = _serverHelloReplies.find(hostAndPort);
43 if (it != _serverHelloReplies.end()) {
44 it->second.emplace_back(Status::OK());
45 } else {
46 _serverHelloReplies.emplace(hostAndPort, std::vector<Status>{Status::OK()});
47 }
48}
49
50void TopologyListenerMock::onServerHeartbeatFailureEvent(Status errorStatus,
51 const HostAndPort& hostAndPort,
52 const BSONObj reply) {
53 stdx::lock_guard lk(_mutex);
54 // If the map already contains an element for hostAndPort, append to its already existing
55 // vector. Otherwise, create a new vector.
56 auto it = _serverHelloReplies.find(hostAndPort);
57 if (it != _serverHelloReplies.end()) {
58 it->second.emplace_back(errorStatus);
59 } else {
60 _serverHelloReplies.emplace(hostAndPort, std::vector<Status>{errorStatus});
61 }
62}
63
64bool TopologyListenerMock::hasHelloResponse(const HostAndPort& hostAndPort) {
65 stdx::lock_guard lock(_mutex);
66 return _hasHelloResponse(lock, hostAndPort);
67}
68
69bool TopologyListenerMock::_hasHelloResponse(WithLock, const HostAndPort& hostAndPort) {
…lines 70–126 unchanged (57 lines)

After

…lines 1–41 unchanged (41 lines)
42 auto it = _serverHelloReplies.find(hostAndPort);
43 if (it != _serverHelloReplies.end()) {
44 it->second.emplace_back(Status::OK());
45 } else {
46 _serverHelloReplies.emplace(hostAndPort, std::vector<Status>{Status::OK()});
47 }
48 ++_serverHeartbeatCounts.successes;
49}
50
51void TopologyListenerMock::onServerHeartbeatFailureEvent(Status errorStatus,
52 const HostAndPort& hostAndPort,
53 const BSONObj reply) {
54 stdx::lock_guard lk(_mutex);
55 // If the map already contains an element for hostAndPort, append to its already existing
56 // vector. Otherwise, create a new vector.
57 auto it = _serverHelloReplies.find(hostAndPort);
58 if (it != _serverHelloReplies.end()) {
59 it->second.emplace_back(errorStatus);
60 } else {
61 _serverHelloReplies.emplace(hostAndPort, std::vector<Status>{errorStatus});
62 }
63 ++_serverHeartbeatCounts.failures;
64}
65
66TopologyListenerMock::Counts TopologyListenerMock::serverHeartbeatCounts() const {
67 return _serverHeartbeatCounts;
68}
69
70bool TopologyListenerMock::hasHelloResponse(const HostAndPort& hostAndPort) {
71 stdx::lock_guard lock(_mutex);
72 return _hasHelloResponse(lock, hostAndPort);
73}
74
…lines 75–132 unchanged (58 lines)

Before

translation_unit
comment "/**\n * Copyright (C) 2020-present MongoDB, Inc.\n *\n * "...
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/client/sdam/topology_listener_mock.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/util/assert_util.h"
" "\""
preproc_include
#include "#include"
system_lib_string "<absl/container/node_hash_map.h>"
preproc_include
#include "#include"
system_lib_string "<absl/meta/type_traits.h>"
preproc_include
#include "#include"
system_lib_string "<boost/move/utility_core.hpp>"
namespace_definition
namespace "namespace"
nested_namespace_specifier
namespace_identifier "mongo"
:: "::"
namespace_identifier "sdam"
declaration_list
{ "{"
function_definition
primitive_type "void"
function_declarator (+21 nodes collapsed)
compound_statement
{ "{"
declaration
qualified_identifier
namespace_identifier "stdx"
:: "::"
type_identifier "lock_guard"
function_declarator
identifier "lk"
parameter_list
( "("
parameter_declaration
type_identifier "_mutex"
) ")"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
identifier "it"
= "="
call_expression
field_expression
identifier "_serverHelloReplies"
. "."
field_identifier "find"
argument_list
( "("
identifier "hostAndPort"
) ")"
; ";"
if_statement (+79 nodes collapsed)
} "}"
function_definition
primitive_type "void"
function_declarator (+25 nodes collapsed)
compound_statement
{ "{"
declaration
qualified_identifier
namespace_identifier "stdx"
:: "::"
type_identifier "lock_guard"
function_declarator
identifier "lk"
parameter_list
( "("
parameter_declaration
type_identifier "_mutex"
) ")"
; ";"
comment "// If the map already contains an element for hostAndPort, a"...
comment "// vector. Otherwise, create a new vector."
declaration
placeholder_type_specifier
auto "auto"
init_declarator
identifier "it"
= "="
call_expression
field_expression
identifier "_serverHelloReplies"
. "."
field_identifier "find"
argument_list
( "("
identifier "hostAndPort"
) ")"
; ";"
if_statement (+65 nodes collapsed)
} "}"
function_definition (+44 nodes collapsed)
function_definition (+45 nodes collapsed)
function_definition (+99 nodes collapsed)
function_definition (+124 nodes collapsed)
function_definition (+130 nodes collapsed)
function_definition (+44 nodes collapsed)
function_definition (+45 nodes collapsed)
function_definition (+105 nodes collapsed)
} "}"
comment "// namespace mongo::sdam"

After

translation_unit
comment "/**\n * Copyright (C) 2020-present MongoDB, Inc.\n *\n * "...
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/client/sdam/topology_listener_mock.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "mongo/util/assert_util.h"
" "\""
preproc_include
#include "#include"
system_lib_string "<absl/container/node_hash_map.h>"
preproc_include
#include "#include"
system_lib_string "<absl/meta/type_traits.h>"
preproc_include
#include "#include"
system_lib_string "<boost/move/utility_core.hpp>"
namespace_definition
namespace "namespace"
nested_namespace_specifier
namespace_identifier "mongo"
:: "::"
namespace_identifier "sdam"
declaration_list
{ "{"
function_definition
primitive_type "void"
function_declarator (+21 nodes collapsed)
compound_statement
{ "{"
declaration
qualified_identifier
namespace_identifier "stdx"
:: "::"
type_identifier "lock_guard"
function_declarator
identifier "lk"
parameter_list
( "("
parameter_declaration
type_identifier "_mutex"
) ")"
; ";"
declaration
placeholder_type_specifier
auto "auto"
init_declarator
identifier "it"
= "="
call_expression
field_expression
identifier "_serverHelloReplies"
. "."
field_identifier "find"
argument_list
( "("
identifier "hostAndPort"
) ")"
; ";"
if_statement (+79 nodes collapsed)
expression_statement
update_expression
++ "++"
field_expression
identifier "_serverHeartbeatCounts"
. "."
field_identifier "successes"
; ";"
} "}"
function_definition
primitive_type "void"
function_declarator (+25 nodes collapsed)
compound_statement
{ "{"
declaration
qualified_identifier
namespace_identifier "stdx"
:: "::"
type_identifier "lock_guard"
function_declarator
identifier "lk"
parameter_list
( "("
parameter_declaration
type_identifier "_mutex"
) ")"
; ";"
comment "// If the map already contains an element for hostAndPort, a"...
comment "// vector. Otherwise, create a new vector."
declaration
placeholder_type_specifier
auto "auto"
init_declarator
identifier "it"
= "="
call_expression
field_expression
identifier "_serverHelloReplies"
. "."
field_identifier "find"
argument_list
( "("
identifier "hostAndPort"
) ")"
; ";"
if_statement (+65 nodes collapsed)
expression_statement
update_expression
++ "++"
field_expression
identifier "_serverHeartbeatCounts"
. "."
field_identifier "failures"
; ";"
} "}"
function_definition
qualified_identifier
namespace_identifier "TopologyListenerMock"
:: "::"
type_identifier "Counts"
function_declarator
qualified_identifier
namespace_identifier "TopologyListenerMock"
:: "::"
identifier "serverHeartbeatCounts"
parameter_list
( "("
) ")"
type_qualifier
const "const"
compound_statement
{ "{"
return_statement
return "return"
identifier "_serverHeartbeatCounts"
; ";"
} "}"
function_definition (+44 nodes collapsed)
function_definition (+45 nodes collapsed)
function_definition (+99 nodes collapsed)
function_definition (+124 nodes collapsed)
function_definition (+130 nodes collapsed)
function_definition (+44 nodes collapsed)
function_definition (+45 nodes collapsed)
function_definition (+105 nodes collapsed)
} "}"
comment "// namespace mongo::sdam"