diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index dc9dc65b3..5c3b13913 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -163,7 +163,7 @@ jobs: - name: Run C++ Unit Tests run: | cd ${{ github.workspace }}/build/blazingmq - ctest -E mwcsys_executil.t --output-on-failure + ctest -E bmqsys_executil.t --output-on-failure unit_tests_python: name: UT [python] diff --git a/.github/workflows/sanitizers/build_sanitizer.sh b/.github/workflows/sanitizers/build_sanitizer.sh index 435c38dac..fd52eb193 100755 --- a/.github/workflows/sanitizers/build_sanitizer.sh +++ b/.github/workflows/sanitizers/build_sanitizer.sh @@ -283,5 +283,5 @@ mkscript "${SANITIZER_ENV} \${@}" "${DIR_BUILD_BMQ}/run-env.sh" # 'run-unittests.sh' runs all instrumented unit-tests. CMD="cd $(realpath "${DIR_BUILD_BMQ}") && " -CMD+="./run-env.sh ctest -E mwcsys_executil.t --output-on-failure" +CMD+="./run-env.sh ctest -E bmqsys_executil.t --output-on-failure" mkscript "${CMD}" "${DIR_BUILD_BMQ}/run-unittests.sh" diff --git a/CMakeLists.txt b/CMakeLists.txt index ce0cedd06..b67307397 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,7 +93,7 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") endif() # This repo contains the canonical source of multiple, independently released, -# UORs (mwc, bmq, bmqbrkr, bmqbrkrcfg, bmqtool). When releasing a UOR, that +# UORs (bmq, bmqbrkr, bmqbrkrcfg, bmqtool). When releasing a UOR, that # specific target is selected through injection of the 'INSTALL_TARGETS' # variable. Many static analysis tool leverage the generated # 'compile_commands.json' in order to know which sources to work with. @@ -104,8 +104,8 @@ endif() # that we will only add targets to the intended ones, based on what is # currently being built. We will set a "BMQ_TARGET__NEEDED" value to # YES/NO. -# - if INSTALL_TARGETS is empty, this means we are not doing a DPKG build, but -# just a normal developer build, therefore include all targets +# - if INSTALL_TARGETS is empty, this means we are not doing an integration +# build, but just a normal developer build, therefore include all targets # - otherwise, selectively enable targets based on what is being built if (NOT DEFINED INSTALL_TARGETS) @@ -114,7 +114,6 @@ if (NOT DEFINED INSTALL_TARGETS) set(BMQ_TARGET_BMQBRKRCFG_NEEDED YES) set(BMQ_TARGET_BMQTOOL_NEEDED YES) set(BMQ_TARGET_BMQSTORAGETOOL_NEEDED YES) - set(BMQ_TARGET_MWC_NEEDED YES) set(BMQ_TARGET_BMQ_NEEDED YES) set(BMQ_TARGET_MQB_NEEDED YES) set(BMQ_TARGET_E_BMQBRKR_NEEDED YES) @@ -137,13 +136,11 @@ else() set(BMQ_TARGET_BMQBRKRCFG_NEEDED NO) set(BMQ_TARGET_BMQTOOL_NEEDED NO) set(BMQ_TARGET_BMQSTORAGETOOL_NEEDED NO) - set(BMQ_TARGET_MWC_NEEDED NO) set(BMQ_TARGET_BMQ_NEEDED NO) set(BMQ_TARGET_MQB_NEEDED NO) set(BMQ_TARGET_TUTORIAL_NEEDED NO) set(BMQ_TARGET_PROMETHEUS_NEEDED NO) - bbproject_check_install_target("mwc" installMWC) bbproject_check_install_target("bmq" installBMQ) bbproject_check_install_target("mqb" installMQB) bbproject_check_install_target("bmqbrkrcfg" installBMQBRKRCFG) @@ -151,12 +148,6 @@ else() bbproject_check_install_target("bmqstoragetool" installBMQSTORAGETOOL) bbproject_check_install_target("prometheus" installPROMETHEUS) - # NOTE: All targets should get 'mwc' from DPKG, except for the 'mwc' release - # itself (and the development work). - if (installMWC) - set(BMQ_TARGET_MWC_NEEDED YES) - endif() - if (installBMQ) set(BMQ_TARGET_BMQ_NEEDED YES) endif() @@ -190,23 +181,12 @@ else() endif() if (installPROMETHEUS) - set(BMQ_TARGET_MWC_NEEDED YES) set(BMQ_TARGET_BMQ_NEEDED YES) set(BMQ_TARGET_MQB_NEEDED YES) set(BMQ_TARGET_PROMETHEUS_NEEDED YES) endif() endif() -# TBD: TEMPORARY >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -if (NOT installBMQ) - # Enable MSG GroupId public APIs ONLY if not doing a DPKG build (i.e., a - # release) of libbmq; until the feature is fully implemented. - add_definitions("-DBMQ_ENABLE_MSG_GROUPID") -else() - message(STATUS "Message GroupId APIs *NOT* exposed!") -endif() -# TBD: TEMPORARY <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< - # ----------------------------------------------------------------------------- # PROJECTS # ----------------------------------------------------------------------------- diff --git a/Doxyfile b/Doxyfile index f63649e2e..353c6e02b 100644 --- a/Doxyfile +++ b/Doxyfile @@ -989,7 +989,8 @@ INPUT_FILE_ENCODING = FILE_PATTERNS = *.c \ *.cpp \ *.h \ - *.md + *.md \ + *.dox # The RECURSIVE tag can be used to specify whether or not subdirectories should # be searched for input files as well. diff --git a/bin/build-darwin.sh b/bin/build-darwin.sh index 2a837ca64..a088e4d5f 100755 --- a/bin/build-darwin.sh +++ b/bin/build-darwin.sh @@ -45,7 +45,7 @@ if [ ! -d "${DIR_THIRDPARTY}/bde" ]; then git clone --depth 1 --branch 4.8.0.0 https://github.com/bloomberg/bde.git "${DIR_THIRDPARTY}/bde" fi if [ ! -d "${DIR_THIRDPARTY}/ntf-core" ]; then - git clone --depth 1 --branch latest https://github.com/bloomberg/ntf-core.git "${DIR_THIRDPARTY}/ntf-core" + git clone --depth 1 --branch 2.4.2 https://github.com/bloomberg/ntf-core.git "${DIR_THIRDPARTY}/ntf-core" fi diff --git a/bin/build-ubuntu.sh b/bin/build-ubuntu.sh index b2f013908..35933b3a2 100755 --- a/bin/build-ubuntu.sh +++ b/bin/build-ubuntu.sh @@ -87,7 +87,7 @@ if [ ! -d "${DIR_THIRDPARTY}/bde" ]; then git clone --depth 1 --branch 4.8.0.0 https://github.com/bloomberg/bde.git "${DIR_THIRDPARTY}/bde" fi if [ ! -d "${DIR_THIRDPARTY}/ntf-core" ]; then - git clone --depth 1 --branch latest https://github.com/bloomberg/ntf-core.git "${DIR_THIRDPARTY}/ntf-core" + git clone --depth 1 --branch 2.4.2 https://github.com/bloomberg/ntf-core.git "${DIR_THIRDPARTY}/ntf-core" fi # prometheus-cpp and its dependency for the plugin if [ "${BUILD_PROMETHEUS}" == true ]; then diff --git a/docs/Gemfile b/docs/Gemfile index c23ba0286..c3bfb65c2 100644 --- a/docs/Gemfile +++ b/docs/Gemfile @@ -4,7 +4,7 @@ source 'https://rubygems.org' # gem "rails" -gem "jekyll", "~> 4.2.2" +gem "jekyll", "~> 4.3.3" gem "jekyll-seo-tag" gem "jekyll-github-metadata" gem "webrick" diff --git a/docs/docs/architecture/network_transport.md b/docs/docs/architecture/network_transport.md index e2ab236d3..871b9ec13 100644 --- a/docs/docs/architecture/network_transport.md +++ b/docs/docs/architecture/network_transport.md @@ -57,7 +57,7 @@ single socket to many thousands of simultaneous sockets."* ### Transport Abstraction In its implementation, BlazingMQ abstracts the transport by using -[`mwcio`](https://github.com/bloomberg/blazingmq/blob/main/src/groups/mwc/mwcio/mwcio_channel.h) +[`bmqio`](https://github.com/bloomberg/blazingmq/blob/main/src/groups/bmq/bmqio/bmqio_channel.h) interface, which enables BlazingMQ to plug in any implementation which conforms to it. In fact, BlazingMQ was using a legacy network transport library instead of NTF some time back. We have also experimented with plugging in diff --git a/docs/docs/features/subscriptions.md b/docs/docs/features/subscriptions.md index 6a39b7372..1b9a0802a 100644 --- a/docs/docs/features/subscriptions.md +++ b/docs/docs/features/subscriptions.md @@ -5,7 +5,7 @@ parent: Features nav_order: 3 --- -# Subscriptions (aka Topic-based Routing) +# Subscriptions {: .no_toc } * toc @@ -13,38 +13,47 @@ nav_order: 3 ## Introduction -Subscriptions provide consumer applications a powerful mechanism to express -interest in receiving only those messages which satisfy criteria specified by -them. In the absence of subscriptions, a consumer attached to a queue can -receive any and all messages posted on the queue, and should be in a position -to process all of them. In other words, the queue is viewed as a logical -stream of homogeneous data. While this may work in some or most cases, there -are scenarios where this restriction prevents a more flexible or natural -arrangement of consumer applications. For example, some users may prefer one -set of consumers to handle messages of a certain type, and another set of -consumers to handle messages of a certain other type. This is where -subscriptions come in -- they enable consumer applications to "subscribe" to -messages of a certain type, thereby *logically* converting a queue into a -stream of heterogeneous data. +Subscriptions provide consumer applications a powerful mechanism to only +receive the messages from a queue that match a specified expression. +In essence, subscriptions allow the user to achieve topic-based message +filtering and/or message routing. + +In the absence of subscriptions, a consumer attached to a queue can receive +and should be able to process any and all messages posted on the queue. In +other words, the queue is viewed as a logical stream of homogeneous data. +While this may work in some or most cases, there are scenarios where this +is limiting. + +For example, a user may prefer one set of consumers to handle messages of a +certain type, and another set of consumers to handle messages of a certain +other type. Or, a user may have a queue of messages that should all be +processed by some consumer applications, but certain applications may only be +interested in a certain subset of messages and want to ignore messages of a +certain type. This is where subscriptions come in -- they enable consumer +applications to "subscribe" to messages of a certain type and enable users +to filter out messages for certain applications but not others, thereby +*logically* converting a queue into a stream of heterogeneous data. Concretely speaking, producer applications can put any interesting message attributes in the *message properties* section of the message (*message properties* are a list of key/value pairs that a producer can associate with a -message), and consumers can specify filters using one or more *message -properties*. For example, if a message contains these three properties: +message), and consumers can request BlazingMQ to filter messages using one or +more of those *message properties*. + +For example, if a message contains these three properties: - `CustomerId = 1234` - `DestinationId = "ABC"` - `OrderType = EXPRESS` -A consumer can provide a filter ("subscription expression") like so when -attaching to a queue: +A consumer can provide a filter ("subscription expression") like so to "match" +the above message: - `CustomerId == 1234 && OrderType == EXPRESS` -In this case, a message having three properties as shown above will be routed -to the consumer with above filter (note that if a property is not specified by -the consumer, it is considered to be a wildcard). +In this case, a message having the properties as shown above will be routed +to the consumer with the above filter (note that if a property is not specified +in the subscription expression, it is considered to be a wildcard). Similarly, users can spin up any number of consumers, each with different filters. Users have to ensure that every message can be processed by at least @@ -58,6 +67,66 @@ reader is familiar with various routing strategies (aka 'queue modes') as well as general BlazingMQ terminology like *PUT*, *PUSH*, *ACK*, *CONFIRM* messages, etc. +### Subscription Types + +BlazingMQ provides two types of subscriptions: + +- Application Subscriptions (message filtering) +- Consumer Subscriptions (message routing) + +Users can leverage either or both types of subscriptions to achieve the desired +behavior. The two types of subscriptions are described below. + +#### Application Subscriptions + +Application Subscriptions provide the ability to filter out messages from an +application's queue in the BlazingMQ broker. + +When a message is produced to a queue, BlazingMQ will evaluate all Application +Subscriptions and _auto-confirm_ the message on behalf of an application if +the message does not match the application's subscription expression. Since +BlazingMQ only routes unconfirmed messages to consumers, consumers will only +receive messages that match the configured Application Subscription. + +Application Subscriptions are specified in the domain's configuration: + +* Application Subscriptions are configured and evaluated per-*AppId* for fanout +queues. + - Note the BlazingMQ broker will still store each message until it is + confirmed by all *AppIds*, either via auto-confirm or a consumer. +* Application Subscriptions are configured with an empty *AppId* (i.e. +`appId=""`) for priority and broadcast queues. Auto-confirms apply to all +consumers of these queues. + +#### Consumer Subscriptions + +Consumer subscriptions allow each consumer instance to express the messages +it is capable of processing when it attaches to the queue. This allows users +to define the subset of consumers that BlazingMQ can route any given message +to. + +When a message is produced to a queue, BlazingMQ will evaluate all Application +Subscriptions (as described above), and then evaluate Consumer Subscriptions +to determine which consumers are capable of processing the message. Then, all +standard routing logic (i.e. consumer priorities, round-robin, respecting +`maxUnconfirmed*` configurations) is used to deliver the message to a consumer. + +Notes: + +- BlazingMQ will only route a message to a consumer if the message matches that +consumer's subscription. If a consumer has no subscription, BlazingMQ can route +any message to it. + +- If there is no matching consumer subscription for a message, the message will +remain in the queue, unconfirmed, until a consumer configures a subscription +matching the message. The message will count against the configured +queue/domain quota limits until it is confirmed or expires due to TTL. + +- Each consumer instance can specify a different subscription. + +- Users have to ensure that every message can be processed by at least +one consumer. + ### Background {:.no_toc} @@ -110,6 +179,11 @@ matching subscription(s). Here’s how subscriptions work at a high level: - Producers add any ‘interesting’ attributes of the message in its *message properties*. +- Users specify one or more Application Subscriptions in the domain configuration + for one or more *AppIds*. Each *AppId* can have one or more boolean expression + containing one or more message properties. If there is no subscription for an + *AppId*, the application will receive all messages. + - Consumers specify one or more boolean expressions when opening the queue. Each expression can contain one or more message properties. As an example, an expression can look like: @@ -147,18 +221,25 @@ matching subscription(s). Here’s how subscriptions work at a high level: - Existing APIs will continue to work and consumer applications which do not use subscriptions will not need to make any changes. -- In the BlazingMQ back-end, upon the arrival of a new message, BlazingMQ - primary node will try to match the message with a subscription and route the - message to the consumer with that subscription. See *Implementation Details* +- In the BlazingMQ back-end, upon the arrival of a new message, the BlazingMQ + primary node will first check each Application Subscription. The message + will be auto-confirmed for each application that does not have a matching + subscription. If there is a matching Application Subscription, Blazing will + then try to match the message with a consumer's subscription and route the + message to the corresponding consumer instance. See *Implementation Details* section below for more info. +- Multiple expressions can be provided when using Application and/or Consumer + Subscriptions. The BlazingMQ primary node will check if a message matches + each provided expression, resulting in an implicit "OR" between expressions. + ### Implementation Details {:.no_toc} The *Design* section above gives a high level overview of the feature. There are, however, some additional details which are worth specifying. -1. **Overlapping Subscriptions**: in case if consumers specify overlapping +1. **Overlapping Consumer Subscriptions**: if consumers specify overlapping subscriptions (e.g., `CustomerId == 0` and `CustomerId >= 0` ), BlazingMQ will not make any attempt to merge those subscriptions, and the two subscriptions will be treated independently of each other. **NOTE**: While @@ -235,6 +316,7 @@ manipulation, as a tiny subset of the C programming language. - Spaces, tabs and line feeds are ignored - The language has three types: integer, string, and boolean - The final result of an expression must be a boolean +- Limited to 128 characters in length ### Identifiers {:.no_toc} diff --git a/etc/cmake/BMQPlugins.cmake b/etc/cmake/BMQPlugins.cmake index 223b9f6cc..8bb120192 100644 --- a/etc/cmake/BMQPlugins.cmake +++ b/etc/cmake/BMQPlugins.cmake @@ -38,7 +38,7 @@ function(bmq_add_plugin name) # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # Configure link-time options. # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - _bmq_add_include_paths(${name} DEPS mqb bmq mwc) + _bmq_add_include_paths(${name} DEPS mqb bmq) target_link_libraries(${name} PRIVATE ${${name}_DEPENDS}) # include( BMQTest ) diff --git a/src/applications/bmqbrkr/bmqbrkr.m.cpp b/src/applications/bmqbrkr/bmqbrkr.m.cpp index 78df264f6..50ba62474 100644 --- a/src/applications/bmqbrkr/bmqbrkr.m.cpp +++ b/src/applications/bmqbrkr/bmqbrkr.m.cpp @@ -26,11 +26,11 @@ #include #include -// MWC -#include -#include -#include -#include +// BMQ +#include +#include +#include +#include // BDE #include @@ -165,7 +165,7 @@ static void bmqAssertHandler(const char* comment, const char* file, int line) file = "(* Empty File Name *)"; } - mwcu::MemOutStream stackTrace; + bmqu::MemOutStream stackTrace; balst::StackTracePrintUtil::printStackTrace(stackTrace); stackTrace << bsl::ends; @@ -265,7 +265,7 @@ static int getConfig(bsl::ostream& errorDescription, bsl::cout << "Reading broker configuration from " << configFilename << "\n"; bsl::ifstream configStream(configFilename.c_str()); - mwcu::MemOutStream configParameters; + bmqu::MemOutStream configParameters; configParameters << configStream.rdbuf(); taskEnv->d_configJson = configParameters.str(); @@ -318,7 +318,7 @@ static void onProcessedAdminCommand(const bsl::string& prefix, int rc, const bsl::string& results) { - const bsls::Types::Int64 end = mwcsys::Time::highResolutionTimer(); + const bsls::Types::Int64 end = bmqsys::Time::highResolutionTimer(); if (rc != 0) { BALL_LOG_ERROR << "Error processing command [rc: " << rc << "] " @@ -329,7 +329,7 @@ static void onProcessedAdminCommand(const bsl::string& prefix, else { BALL_LOG_INFO << "Command '" << prefix << " " << command << "' processed successfully in " - << mwcu::PrintUtil::prettyTimeInterval(end - start) + << bmqu::PrintUtil::prettyTimeInterval(end - start) << ":\n" << results; } @@ -356,7 +356,7 @@ static void onMTrap(TaskEnvironment* taskEnv, return; // RETURN } else if (bdlb::String::areEqualCaseless(prefix, "CMD")) { - const bsls::Types::Int64 start = mwcsys::Time::highResolutionTimer(); + const bsls::Types::Int64 start = bmqsys::Time::highResolutionTimer(); taskEnv->d_app.object().enqueueCommand( "MTRAP", cmd, @@ -391,7 +391,7 @@ static int initializeTask(bsl::ostream& errorDescription, new (taskEnv->d_task.buffer()) m_bmqbrkr::Task(taskEnv->d_bmqPrefix, taskEnv->d_config.taskConfig()); - mwcu::MemOutStream localError; + bmqu::MemOutStream localError; const int rc = taskEnv->d_task.object().initialize(localError); if (rc != 0) { errorDescription << "Failed to initialize task " @@ -417,9 +417,9 @@ static int initializeTask(bsl::ostream& errorDescription, const bsl::string pidFile = taskEnv->d_bmqPrefix + "/bmqbrkr.pid"; bsl::ofstream pidFd(pidFile.c_str()); if (!pidFd) { - MWCTSK_ALARMLOG_ALARM("STARTUP") + BMQTSK_ALARMLOG_ALARM("STARTUP") << "Failed to create pid file [" << pidFile << "]." - << " This is not fatal." << MWCTSK_ALARMLOG_END; + << " This is not fatal." << BMQTSK_ALARMLOG_END; } else { pidFd << bdls::ProcessUtil::getProcessId() << "\n"; @@ -537,7 +537,7 @@ static void updateHistFile(const TaskEnvironment* taskEnv) } // Generate the new entry - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << bdlt::CurrentTime::utc() << "|" << taskEnv->d_config.appConfig().brokerVersion() << "|" << taskEnv->d_config.appConfig().configVersion() << "|" @@ -548,9 +548,9 @@ static void updateHistFile(const TaskEnvironment* taskEnv) // Write back all entries to file bsl::ofstream output(histFile.c_str()); if (!output) { - MWCTSK_ALARMLOG_ALARM("STARTUP") + BMQTSK_ALARMLOG_ALARM("STARTUP") << "Failed to create vers file [" << histFile << "]. " - << "This is not fatal." << MWCTSK_ALARMLOG_END; + << "This is not fatal." << BMQTSK_ALARMLOG_END; } else { for (bsl::list::const_iterator it = entries.begin(); @@ -570,7 +570,7 @@ static int run(bsl::ostream& errorDescription, TaskEnvironment* taskEnv, bool wait = true) { // Start the application - mwcu::MemOutStream localError; + bmqu::MemOutStream localError; int rc = taskEnv->d_app.object().start(localError); if (rc != 0) { @@ -697,7 +697,7 @@ int main(int argc, const char* argv[]) taskEnv.d_bmqPrefix = (prefixEnvVar != 0 ? prefixEnvVar : "./"); taskEnv.d_instanceId = instanceId; - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; rc = getConfig(errorDescription, &taskEnv, configDir); if (rc != 0) { @@ -752,9 +752,9 @@ int main(int argc, const char* argv[]) // Run rc = run(errorDescription, &taskEnv); if (rc != 0) { - MWCTSK_ALARMLOG_PANIC("STARTUP") + BMQTSK_ALARMLOG_PANIC("STARTUP") << "(" << rc << "): " << errorDescription.str() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; shutdownApplication(&taskEnv); shutdownTask(&taskEnv); return mqbu::ExitCode::e_RUN; // RETURN diff --git a/src/applications/bmqbrkr/bmqbrkrscm_versiontag.h b/src/applications/bmqbrkr/bmqbrkrscm_versiontag.h index 1d9f01875..cfde74754 100644 --- a/src/applications/bmqbrkr/bmqbrkrscm_versiontag.h +++ b/src/applications/bmqbrkr/bmqbrkrscm_versiontag.h @@ -57,7 +57,7 @@ #define BMQBRKR_VERSION_PATCH 99 // BMQBRKR patch level -#define BMQBRKR_MAKE_VERSION(major, minor) ((major)*10000 + (minor)*100) +#define BMQBRKR_MAKE_VERSION(major, minor) ((major) * 10000 + (minor) * 100) // Construct a composite version number in the range [ 0 .. 999900 ] from // the specified 'major' and 'minor' version numbers. The resulting value, // when expressed as a 6-digit decimal string, has "00" as the two @@ -73,7 +73,7 @@ // and 'minor' are integral values in the range '[ 0 .. 99 ]'. #define BMQBRKR_MAKE_EXT_VERSION(major, minor, patch) \ - ((major)*10000 + (minor)*100 + (patch)) + ((major) * 10000 + (minor) * 100 + (patch)) // Similar to BMQBRKR_MAKE_VERSION(), but include the patch number as well. #define BMQBRKR_VERSION \ diff --git a/src/applications/bmqbrkr/m_bmqbrkr_task.cpp b/src/applications/bmqbrkr/m_bmqbrkr_task.cpp index 8e60c9ed0..ea8fb712f 100644 --- a/src/applications/bmqbrkr/m_bmqbrkr_task.cpp +++ b/src/applications/bmqbrkr/m_bmqbrkr_task.cpp @@ -19,14 +19,14 @@ // MQB #include -// MWC -#include -#include -#include -#include -#include -#include -#include +// BMQ +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -63,27 +63,27 @@ void onAllocationLimit(bsls::Types::Uint64 limit) // here. bdlma::LocalSequentialAllocator<2048> localAllocator; - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); - os << "Memory allocation limit of " << mwcu::PrintUtil::prettyBytes(limit) + os << "Memory allocation limit of " << bmqu::PrintUtil::prettyBytes(limit) << " has been reached."; - mwcst::StatContext* sc = mwcma::CountingAllocatorUtil::globalStatContext(); + bmqst::StatContext* sc = bmqma::CountingAllocatorUtil::globalStatContext(); sc->snapshot(); // Snapshot to ensure we'll print the latest values // The 'sc' is the top stat context, we need access to its only child, // corresponding to the top level CountingAllocator in order to print it. BSLS_ASSERT_SAFE(sc->numSubcontexts() == 1); - const mwcst::StatContext& context = *(sc->subcontextIterator()); + const bmqst::StatContext& context = *(sc->subcontextIterator()); // Print all allocations from this top allocator and its children - mwcma::CountingAllocatorUtil::printAllocations(os, context); + bmqma::CountingAllocatorUtil::printAllocations(os, context); os << "\nThe broker will now gracefully shutdown!"; // Log a PANIC alarm BALL_LOG_SET_CATEGORY("BMQBRKR.TASK"); - MWCTSK_ALARMLOG_PANIC("MEMORY_LIMIT") << os.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_PANIC("MEMORY_LIMIT") << os.str() << BMQTSK_ALARMLOG_END; // Initiate a graceful shutdown of the broker mqbu::ExitUtil::shutdown(mqbu::ExitCode::e_MEMORY_LIMIT); @@ -106,9 +106,9 @@ Task_AllocatorManager::Task_AllocatorManager(mqbcfg::AllocatorType::Value type) case mqbcfg::AllocatorType::NEWDELETE: { d_statContext_p = 0; - new (d_store.buffer()) mwcma::CountingAllocatorStore( + new (d_store.buffer()) bmqma::CountingAllocatorStore( &(bslma::NewDeleteAllocator::singleton())); - d_store_p = reinterpret_cast( + d_store_p = reinterpret_cast( d_store.buffer()); bsl::cout << "\n" @@ -122,8 +122,8 @@ Task_AllocatorManager::Task_AllocatorManager(mqbcfg::AllocatorType::Value type) d_statContext_p = 0; new (d_store.buffer()) - mwcma::CountingAllocatorStore(&d_stackTraceTestAllocator); - d_store_p = reinterpret_cast( + bmqma::CountingAllocatorStore(&d_stackTraceTestAllocator); + d_store_p = reinterpret_cast( d_store.buffer()); d_stackTraceTestAllocator.setName("BMQBRKR"); d_stackTraceTestAllocator.setFailureHandler( @@ -137,12 +137,12 @@ Task_AllocatorManager::Task_AllocatorManager(mqbcfg::AllocatorType::Value type) << bsl::flush; } break; case mqbcfg::AllocatorType::COUNTING: { - mwcma::CountingAllocatorUtil::initGlobalAllocators( - mwcst::StatContextConfiguration("task"), + bmqma::CountingAllocatorUtil::initGlobalAllocators( + bmqst::StatContextConfiguration("task"), "allocators"); - d_statContext_p = mwcma::CountingAllocatorUtil::globalStatContext(); - d_store_p = &mwcma::CountingAllocatorUtil::topAllocatorStore(); + d_statContext_p = bmqma::CountingAllocatorUtil::globalStatContext(); + d_store_p = &bmqma::CountingAllocatorUtil::topAllocatorStore(); } break; default: { bsl::cerr << "PANIC [STARTUP] Invalid allocator type '" << type << "'" @@ -158,7 +158,7 @@ Task_AllocatorManager::~Task_AllocatorManager() if (d_type == mqbcfg::AllocatorType::NEWDELETE) { // Properly destroy the object buffer object. d_store.object() - .mwcma::CountingAllocatorStore ::~CountingAllocatorStore(); + .bmqma::CountingAllocatorStore ::~CountingAllocatorStore(); } else if (d_type == mqbcfg::AllocatorType::STACKTRACETEST) { // Ensure no memory leak @@ -179,7 +179,7 @@ Task_AllocatorManager::~Task_AllocatorManager() // Properly destroy the object buffer object. d_store.object() - .mwcma::CountingAllocatorStore ::~CountingAllocatorStore(); + .bmqma::CountingAllocatorStore ::~CountingAllocatorStore(); } } @@ -193,7 +193,7 @@ int Task::onControlMessage(const bsl::string& message) // Intercept the M-Trap to set the name of this PIPE CONTROL CHANNEL thread if (bdlb::String::areEqualCaseless(message, k_MTRAP_SET_THREADNAME)) { - mwcsys::ThreadUtil::setCurrentThreadName("bmqPipeCtrl"); + bmqsys::ThreadUtil::setCurrentThreadName("bmqPipeCtrl"); return 0; // RETURN } @@ -211,7 +211,7 @@ void Task::onLogCommand(const bsl::string& prefix, bsl::istream& input) // executes on the PIPE CONTROL CHANNEL thread bsl::string cmd; - mwcu::MemOutStream ss; + bmqu::MemOutStream ss; bsl::getline(input, cmd); cmd.erase(0, 1); // cmd starts by a space, remove it @@ -269,7 +269,7 @@ int Task::initialize(bsl::ostream& errorDescription) }; int rc = rc_SUCCESS; - mwcu::MemOutStream localError; + bmqu::MemOutStream localError; // --------- // Scheduler @@ -279,16 +279,16 @@ int Task::initialize(bsl::ostream& errorDescription) return rc_SCHEDULER_START_FAILED; // RETURN } - if (mwcsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { + if (bmqsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { d_scheduler.scheduleEvent( bsls::TimeInterval(0, 0), // now - bdlf::BindUtil::bind(&mwcsys::ThreadUtil::setCurrentThreadName, + bdlf::BindUtil::bind(&bmqsys::ThreadUtil::setCurrentThreadName, "bmqSchedTask")); } // ------------- // LogController - mwctsk::LogControllerConfig logConfig; + bmqtsk::LogControllerConfig logConfig; rc = logConfig.fromObj(localError, d_config.logController()); if (rc != 0) { d_scheduler.stop(); @@ -314,12 +314,12 @@ int Task::initialize(bsl::ostream& errorDescription) } else { BALL_LOG_INFO << "Memory allocation limit set to " - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( d_config.allocationLimit()); - mwcma::CountingAllocator* topAllocator = - dynamic_cast( - mwcma::CountingAllocatorUtil::topAllocatorStore() + bmqma::CountingAllocator* topAllocator = + dynamic_cast( + bmqma::CountingAllocatorUtil::topAllocatorStore() .baseAllocator()); BSLS_ASSERT_OPT(topAllocator); @@ -344,7 +344,7 @@ int Task::initialize(bsl::ostream& errorDescription) return rc_CONTROLCHANNEL_START_FAILED; // RETURN } - if (mwcsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { + if (bmqsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { bdls::PipeUtil::send(pipePath, bsl::string(k_MTRAP_SET_THREADNAME) + "\n"); } diff --git a/src/applications/bmqbrkr/m_bmqbrkr_task.h b/src/applications/bmqbrkr/m_bmqbrkr_task.h index 419657c8e..0cb6b0214 100644 --- a/src/applications/bmqbrkr/m_bmqbrkr_task.h +++ b/src/applications/bmqbrkr/m_bmqbrkr_task.h @@ -24,7 +24,7 @@ // m_bmqbrkr::Task_AllocatorManager: guard-like mechanism to manage allocator // //@SEE_ALSO: -// mwctsk::LogController: BALL logging management +// bmqtsk::LogController: BALL logging management // //@DESCRIPTION: 'm_bmqbrkr::Task_AllocatorManager' is an internal mechanism // allowing to setup different kind of allocators to use through the entire @@ -32,7 +32,7 @@ // infrastructure for a task, controlling the following aspects of it: //: o *memory*: memory allocators are managed using the //: 'm_bmqbrkr::Task_AllocatorManager' component, -//: o *logging*: an 'mwctsk::LogController' is used to initialize and +//: o *logging*: an 'bmqtsk::LogController' is used to initialize and //: configure logging to file and console, //: o *control channel command*: a 'balb::PipeControlChannel' component is used //: to create a pipe allowing to send IPC command (called M-Trap) to the task @@ -42,7 +42,7 @@ // The following allocator models are supported: //: o *NEWDELETE*: using 'bslma:NewDeleteAllocator' //: o *STACKTRACETEST*: using 'balst::StackTraceTestAllocator' -//: o *COUNTING*: using 'mwcma::CountingAllocator' +//: o *COUNTING*: using 'bmqma::CountingAllocator' // Note that when using the 'COUNTING' allocator, the 'default' and 'global' // allocators are changed to be counting allocators too. // @@ -61,9 +61,9 @@ // responsible for ensuring that the supplied name is unique on a given system; // otherwise, 'initialize' will fail. -// MWC -#include -#include +// BMQ +#include +#include // MQB #include @@ -87,7 +87,7 @@ namespace BloombergLP { namespace bdld { class Datum; } -namespace mwcst { +namespace bmqst { class StatContext; } @@ -104,7 +104,7 @@ class Task_AllocatorManager { mqbcfg::AllocatorType::Value d_type; // Type of allocator in use. - bsls::ObjectBuffer d_store; + bsls::ObjectBuffer d_store; // Allocator store, to dispence allocators // based on the configured type; used if // type is 'e_NEWDELETE' or @@ -114,11 +114,11 @@ class Task_AllocatorManager { // The stack trace test allocator, if type // is 'e_STACKTRACETEST'. - mwcma::CountingAllocatorStore* d_store_p; + bmqma::CountingAllocatorStore* d_store_p; // Raw pointer to the allocator store to // use; regardless of the configured type. - mwcst::StatContext* d_statContext_p; + bmqst::StatContext* d_statContext_p; // The StatContext of the counting // allocators, if type is 'e_COUNTING', or // null otherwise. @@ -149,11 +149,11 @@ class Task_AllocatorManager { /// Return the stat context keeping track of the allocations, if this /// object has been initialized with the `COUNTING` allocator, or null /// otherwise. - mwcst::StatContext* statContext(); + bmqst::StatContext* statContext(); /// Return a reference offering modifiable access to the allocator store /// to use. - mwcma::CountingAllocatorStore& store(); + bmqma::CountingAllocatorStore& store(); // ACCESSORS @@ -202,7 +202,7 @@ class Task { bdlmt::EventScheduler d_scheduler; // EventScheduler - mwctsk::LogController d_logController; + bmqtsk::LogController d_logController; // Log controller for log file and console // observer @@ -279,15 +279,15 @@ class Task { /// Return the stat context keeping track of the allocations, if this /// object has been initialized with the `COUNTING` allocator, or null /// otherwise. - mwcst::StatContext* allocatorStatContext(); + bmqst::StatContext* allocatorStatContext(); /// Return a reference offering modifiable access to the allocator store /// to use. - mwcma::CountingAllocatorStore& allocatorStore(); + bmqma::CountingAllocatorStore& allocatorStore(); /// Return a reference offering modifiable access to the log controller /// object used by this task. - mwctsk::LogController& logController(); + bmqtsk::LogController& logController(); /// Return a pointer to the event scheduler. bdlmt::EventScheduler* scheduler(); @@ -307,12 +307,12 @@ class Task { // class Task_AllocatorManager // --------------------------- -inline mwcst::StatContext* Task_AllocatorManager::statContext() +inline bmqst::StatContext* Task_AllocatorManager::statContext() { return d_statContext_p; } -inline mwcma::CountingAllocatorStore& Task_AllocatorManager::store() +inline bmqma::CountingAllocatorStore& Task_AllocatorManager::store() { // PRECONDITIONS BSLS_ASSERT_OPT(d_store_p); @@ -329,17 +329,17 @@ inline mqbcfg::AllocatorType::Value Task_AllocatorManager::type() const // class Task // ---------- -inline mwcst::StatContext* Task::allocatorStatContext() +inline bmqst::StatContext* Task::allocatorStatContext() { return d_allocatorManager.statContext(); } -inline mwcma::CountingAllocatorStore& Task::allocatorStore() +inline bmqma::CountingAllocatorStore& Task::allocatorStore() { return d_allocatorManager.store(); } -inline mwctsk::LogController& Task::logController() +inline bmqtsk::LogController& Task::logController() { return d_logController; } diff --git a/src/applications/bmqbrkr/package/bmqbrkr.dep b/src/applications/bmqbrkr/package/bmqbrkr.dep index 8e1bf4ca8..963508dc0 100644 --- a/src/applications/bmqbrkr/package/bmqbrkr.dep +++ b/src/applications/bmqbrkr/package/bmqbrkr.dep @@ -3,7 +3,6 @@ bmq # TBD: Should not be needed, but for now is required in order for plugins to # build (doesn't seem like the mqb -> bmq dependency is being transitively # transferred to the plugins build mechanism). -mwc bal bdl bsl diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_commandprocessorfactory.t.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_commandprocessorfactory.t.cpp index 839713771..f819858cc 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_commandprocessorfactory.t.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_commandprocessorfactory.t.cpp @@ -19,7 +19,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -40,7 +40,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // Empty parameters CommandLineArguments arguments(s_allocator_p); Parameters params(arguments, s_allocator_p); @@ -62,7 +62,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -74,5 +74,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_filemanager.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_filemanager.cpp index 1e3040168..5d9df5cca 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_filemanager.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_filemanager.cpp @@ -26,8 +26,8 @@ #include #include -// MWC -#include +// BMQ +#include // BDE #include @@ -80,7 +80,7 @@ FileManagerImpl::FileManagerImpl(const bsl::string& journalFile, : d_journalFile(journalFile, allocator) , d_dataFile(dataFile, allocator) { - mwcu::MemOutStream ss(allocator); + bmqu::MemOutStream ss(allocator); if ((!d_journalFile.path().empty() && !d_journalFile.resetIterator(ss)) || (!d_dataFile.path().empty() && !d_dataFile.resetIterator(ss))) { throw bsl::runtime_error(ss.str()); // THROW @@ -129,8 +129,10 @@ QueueMap FileManagerImpl::buildQueueMap(const bsl::string& cslFile, cslFile.c_str()); bsl::string pattern(alloc); bsl::string location(alloc); - BSLS_ASSERT(bdls::PathUtil::getBasename(&pattern, cslFile) == 0); - BSLS_ASSERT(bdls::PathUtil::getDirname(&location, cslFile) == 0); + int rc = bdls::PathUtil::getBasename(&pattern, cslFile); + BSLS_ASSERT(rc == 0); + rc = bdls::PathUtil::getDirname(&location, cslFile); + BSLS_ASSERT(rc == 0); ledgerConfig.setLocation(location) .setPattern(pattern) .setMaxLogSize(fileSize) @@ -145,7 +147,10 @@ QueueMap FileManagerImpl::buildQueueMap(const bsl::string& cslFile, // Create and open the ledger mqbsl::Ledger ledger(ledgerConfig, alloc); - BSLS_ASSERT(ledger.open(mqbsi::Ledger::e_READ_ONLY) == 0); + rc = ledger.open(mqbsi::Ledger::e_READ_ONLY); + BSLS_ASSERT(rc == 0); + (void)rc; // Compiler happiness + // Set guard to close the ledger bdlb::ScopeExitAny guard(bdlf::BindUtil::bind(closeLedger, &ledger)); @@ -237,7 +242,7 @@ bool FileManagerImpl::FileHandler::resetIterator( bsl::ostream& errorDescription) { // 1) Open - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc = mqbs::FileSystemUtil::open( &d_mfd, d_path.c_str(), diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.h b/src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.h index d5e884157..c0084be13 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.h +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.h @@ -28,7 +28,7 @@ #include // GMOCK -// If mwcst_testhelper.h was defined before gtest.h, preserve macroses values. +// If bmqst_testhelper.h was defined before gtest.h, preserve macroses values. // If not, undefine values from gtest.h. #pragma push_macro("ASSERT_EQ") #pragma push_macro("ASSERT_NE") diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.cpp index 0a13b5124..efdd5c4af 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.cpp @@ -27,11 +27,11 @@ #include #include -// MWC -#include -#include -#include -#include +// BMQ +#include +#include +#include +#include namespace BloombergLP { namespace m_bmqstoragetool { diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.t.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.t.cpp index f4ead5f62..d05da9b5a 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.t.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.t.cpp @@ -24,8 +24,8 @@ #include #include -// MWC -#include +// BMQ +#include // BDE #include @@ -33,7 +33,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -176,10 +176,10 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // Simulate journal file - const size_t k_NUM_RECORDS = 15; + const size_t k_NUM_RECORDS = 15; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); journalFile.addAllTypesRecords(&records); @@ -192,7 +192,7 @@ static void test1_breathingTest() s_allocator_p); // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -201,10 +201,10 @@ static void test1_breathingTest() searchProcessor->process(); // Prepare expected output with list of message GUIDs in Journal file - mwcu::MemOutStream expectedStream(s_allocator_p); + bmqu::MemOutStream expectedStream(s_allocator_p); bsl::list::const_iterator recordIter = records.begin(); - bsl::size_t foundMessagesCount = 0; + bsl::size_t foundMessagesCount = 0; for (; recordIter != records.end(); ++recordIter) { RecordType::Enum rtype = recordIter->first; if (rtype == RecordType::e_MESSAGE) { @@ -231,10 +231,10 @@ static void test2_searchGuidTest() // JournalFileProcessor::process() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SEARCH GUID"); + bmqtst::TestHelper::printTestName("SEARCH GUID"); // Simulate journal file - const size_t k_NUM_RECORDS = 15; + const size_t k_NUM_RECORDS = 15; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); journalFile.addAllTypesRecords(&records); @@ -242,10 +242,10 @@ static void test2_searchGuidTest() // Prepare parameters Parameters params(s_allocator_p); // Get list of message GUIDs for searching - bsl::vector& searchGuids = params.d_guid; + bsl::vector& searchGuids = params.d_guid; bsl::list::const_iterator recordIter = records.begin(); - bsl::size_t msgCnt = 0; + bsl::size_t msgCnt = 0; for (; recordIter != records.end(); ++recordIter) { RecordType::Enum rtype = recordIter->first; if (rtype == RecordType::e_MESSAGE) { @@ -253,7 +253,7 @@ static void test2_searchGuidTest() continue; // Skip odd messages for test purposes const MessageRecord& msg = *reinterpret_cast( recordIter->second.buffer()); - mwcu::MemOutStream ss(s_allocator_p); + bmqu::MemOutStream ss(s_allocator_p); ss << msg.messageGUID(); searchGuids.push_back(bsl::string(ss.str(), s_allocator_p)); } @@ -264,7 +264,7 @@ static void test2_searchGuidTest() s_allocator_p); // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -273,7 +273,7 @@ static void test2_searchGuidTest() searchProcessor->process(); // Prepare expected output - mwcu::MemOutStream expectedStream(s_allocator_p); + bmqu::MemOutStream expectedStream(s_allocator_p); bsl::vector::const_iterator guidIt = searchGuids.cbegin(); for (; guidIt != searchGuids.cend(); ++guidIt) { expectedStream << (*guidIt) << bsl::endl; @@ -295,10 +295,10 @@ static void test3_searchNonExistingGuidTest() // JournalFileProcessor::process() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SEARCH NON EXISTING GUID"); + bmqtst::TestHelper::printTestName("SEARCH NON EXISTING GUID"); // Simulate journal file - const size_t k_NUM_RECORDS = 15; + const size_t k_NUM_RECORDS = 15; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); journalFile.addAllTypesRecords(&records); @@ -310,7 +310,7 @@ static void test3_searchNonExistingGuidTest() bmqt::MessageGUID guid; for (int i = 0; i < 2; ++i) { mqbu::MessageGUIDUtil::generateGUID(&guid); - mwcu::MemOutStream ss(s_allocator_p); + bmqu::MemOutStream ss(s_allocator_p); ss << guid; searchGuids.push_back(bsl::string(ss.str(), s_allocator_p)); } @@ -321,7 +321,7 @@ static void test3_searchNonExistingGuidTest() s_allocator_p); // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -330,7 +330,7 @@ static void test3_searchNonExistingGuidTest() searchProcessor->process(); // Prepare expected output - mwcu::MemOutStream expectedStream(s_allocator_p); + bmqu::MemOutStream expectedStream(s_allocator_p); expectedStream << "No message GUID found." << bsl::endl; expectedStream << bsl::endl @@ -353,10 +353,10 @@ static void test4_searchExistingAndNonExistingGuidTest() // JournalFileProcessor::process() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SEARCH EXISTING AND NON EXISTING GUID"); + bmqtst::TestHelper::printTestName("SEARCH EXISTING AND NON EXISTING GUID"); // Simulate journal file - const size_t k_NUM_RECORDS = 15; + const size_t k_NUM_RECORDS = 15; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); journalFile.addAllTypesRecords(&records); @@ -370,7 +370,7 @@ static void test4_searchExistingAndNonExistingGuidTest() // Get two existing message GUIDs bsl::list::const_iterator recordIter = records.begin(); - size_t msgCnt = 0; + size_t msgCnt = 0; for (; recordIter != records.end(); ++recordIter) { RecordType::Enum rtype = recordIter->first; if (rtype == RecordType::e_MESSAGE) { @@ -378,7 +378,7 @@ static void test4_searchExistingAndNonExistingGuidTest() break; // Take two GUIDs const MessageRecord& msg = *reinterpret_cast( recordIter->second.buffer()); - mwcu::MemOutStream ss(s_allocator_p); + bmqu::MemOutStream ss(s_allocator_p); ss << msg.messageGUID(); searchGuids.push_back(bsl::string(ss.str(), s_allocator_p)); } @@ -388,7 +388,7 @@ static void test4_searchExistingAndNonExistingGuidTest() bmqt::MessageGUID guid; for (int i = 0; i < 2; ++i) { mqbu::MessageGUIDUtil::generateGUID(&guid); - mwcu::MemOutStream ss(s_allocator_p); + bmqu::MemOutStream ss(s_allocator_p); ss << guid; searchGuids.push_back(bsl::string(ss.str(), s_allocator_p)); } @@ -399,7 +399,7 @@ static void test4_searchExistingAndNonExistingGuidTest() s_allocator_p); // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -408,7 +408,7 @@ static void test4_searchExistingAndNonExistingGuidTest() searchProcessor->process(); // Prepare expected output - mwcu::MemOutStream expectedStream(s_allocator_p); + bmqu::MemOutStream expectedStream(s_allocator_p); expectedStream << searchGuids[0] << bsl::endl << searchGuids[1] << bsl::endl; expectedStream << "2 message GUID(s) found." << bsl::endl; @@ -431,10 +431,10 @@ static void test5_searchOutstandingMessagesTest() // JournalFileProcessor::process() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SEARCH OUTSTANDING MESSAGES TEST"); + bmqtst::TestHelper::printTestName("SEARCH OUTSTANDING MESSAGES TEST"); // Simulate journal file - const size_t k_NUM_RECORDS = 15; + const size_t k_NUM_RECORDS = 15; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); JournalFile::GuidVectorType outstandingGUIDS(s_allocator_p); @@ -452,7 +452,7 @@ static void test5_searchOutstandingMessagesTest() s_allocator_p); // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -461,7 +461,7 @@ static void test5_searchOutstandingMessagesTest() searchProcessor->process(); // Prepare expected output - mwcu::MemOutStream expectedStream(s_allocator_p); + bmqu::MemOutStream expectedStream(s_allocator_p); JournalFile::GuidVectorType::const_iterator guidIt = outstandingGUIDS.cbegin(); for (; guidIt != outstandingGUIDS.cend(); ++guidIt) { @@ -492,10 +492,10 @@ static void test6_searchConfirmedMessagesTest() // JournalFileProcessor::process() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SEARCH CONFIRMED MESSAGES TEST"); + bmqtst::TestHelper::printTestName("SEARCH CONFIRMED MESSAGES TEST"); // Simulate journal file - const size_t k_NUM_RECORDS = 15; + const size_t k_NUM_RECORDS = 15; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); JournalFile::GuidVectorType confirmedGUIDS(s_allocator_p); @@ -513,7 +513,7 @@ static void test6_searchConfirmedMessagesTest() s_allocator_p); // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -522,7 +522,7 @@ static void test6_searchConfirmedMessagesTest() searchProcessor->process(); // Prepare expected output - mwcu::MemOutStream expectedStream(s_allocator_p); + bmqu::MemOutStream expectedStream(s_allocator_p); JournalFile::GuidVectorType::const_iterator guidIt = confirmedGUIDS.cbegin(); for (; guidIt != confirmedGUIDS.cend(); ++guidIt) { @@ -553,13 +553,13 @@ static void test7_searchPartiallyConfirmedMessagesTest() // JournalFileProcessor::process() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "SEARCH PARTIALLY CONFIRMED MESSAGES TEST"); // Simulate journal file // k_NUM_RECORDS must be multiple 3 plus one to cover all combinations // (confirmed, deleted, not confirmed) - const size_t k_NUM_RECORDS = 16; + const size_t k_NUM_RECORDS = 16; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); JournalFile::GuidVectorType partiallyConfirmedGUIDS(s_allocator_p); @@ -576,7 +576,7 @@ static void test7_searchPartiallyConfirmedMessagesTest() s_allocator_p); // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -585,7 +585,7 @@ static void test7_searchPartiallyConfirmedMessagesTest() searchProcessor->process(); // Prepare expected output - mwcu::MemOutStream expectedStream(s_allocator_p); + bmqu::MemOutStream expectedStream(s_allocator_p); JournalFile::GuidVectorType::const_iterator guidIt = partiallyConfirmedGUIDS.cbegin(); for (; guidIt != partiallyConfirmedGUIDS.cend(); ++guidIt) { @@ -616,14 +616,14 @@ static void test8_searchMessagesByQueueKeyTest() // JournalFileProcessor::process() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SEARCH MESSAGES BY QUEUE KEY TEST"); + bmqtst::TestHelper::printTestName("SEARCH MESSAGES BY QUEUE KEY TEST"); // Simulate journal file - const size_t k_NUM_RECORDS = 15; + const size_t k_NUM_RECORDS = 15; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); - const char* queueKey1 = "ABCDE12345"; - const char* queueKey2 = "12345ABCDE"; + const char* queueKey1 = "ABCDE12345"; + const char* queueKey2 = "12345ABCDE"; JournalFile::GuidVectorType queueKey1GUIDS(s_allocator_p); journalFile.addJournalRecordsWithTwoQueueKeys(&records, &queueKey1GUIDS, @@ -639,7 +639,7 @@ static void test8_searchMessagesByQueueKeyTest() s_allocator_p); // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -648,7 +648,7 @@ static void test8_searchMessagesByQueueKeyTest() searchProcessor->process(); // Prepare expected output - mwcu::MemOutStream expectedStream(s_allocator_p); + bmqu::MemOutStream expectedStream(s_allocator_p); JournalFile::GuidVectorType::const_iterator guidIt = queueKey1GUIDS.cbegin(); for (; guidIt != queueKey1GUIDS.cend(); ++guidIt) { @@ -673,14 +673,14 @@ static void test9_searchMessagesByQueueNameTest() // JournalFileProcessor::process() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SEARCH MESSAGES BY QUEUE NAME TEST"); + bmqtst::TestHelper::printTestName("SEARCH MESSAGES BY QUEUE NAME TEST"); // Simulate journal file - const size_t k_NUM_RECORDS = 15; + const size_t k_NUM_RECORDS = 15; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); - const char* queueKey1 = "ABCDE12345"; - const char* queueKey2 = "12345ABCDE"; + const char* queueKey1 = "ABCDE12345"; + const char* queueKey2 = "12345ABCDE"; JournalFile::GuidVectorType queueKey1GUIDS(s_allocator_p); journalFile.addJournalRecordsWithTwoQueueKeys(&records, &queueKey1GUIDS, @@ -706,7 +706,7 @@ static void test9_searchMessagesByQueueNameTest() s_allocator_p); // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -715,7 +715,7 @@ static void test9_searchMessagesByQueueNameTest() searchProcessor->process(); // Prepare expected output - mwcu::MemOutStream expectedStream(s_allocator_p); + bmqu::MemOutStream expectedStream(s_allocator_p); JournalFile::GuidVectorType::const_iterator guidIt = queueKey1GUIDS.cbegin(); for (; guidIt != queueKey1GUIDS.cend(); ++guidIt) { @@ -740,15 +740,15 @@ static void test10_searchMessagesByQueueNameAndQueueKeyTest() // JournalFileProcessor::process() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "SEARCH MESSAGES BY QUEUE NAME AND QUEUE KEY TEST"); // Simulate journal file - const size_t k_NUM_RECORDS = 15; + const size_t k_NUM_RECORDS = 15; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); - const char* queueKey1 = "ABCDE12345"; - const char* queueKey2 = "12345ABCDE"; + const char* queueKey1 = "ABCDE12345"; + const char* queueKey2 = "12345ABCDE"; JournalFile::GuidVectorType queueKey1GUIDS(s_allocator_p); journalFile.addJournalRecordsWithTwoQueueKeys(&records, &queueKey1GUIDS, @@ -777,7 +777,7 @@ static void test10_searchMessagesByQueueNameAndQueueKeyTest() s_allocator_p); // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -786,7 +786,7 @@ static void test10_searchMessagesByQueueNameAndQueueKeyTest() searchProcessor->process(); // Prepare expected output - mwcu::MemOutStream expectedStream(s_allocator_p); + bmqu::MemOutStream expectedStream(s_allocator_p); JournalFile::GuidVectorType::const_iterator guidIt = queueKey1GUIDS.cbegin(); for (; guidIt != queueKey1GUIDS.cend(); ++guidIt) { @@ -810,10 +810,10 @@ static void test11_searchMessagesByTimestamp() // JournalFileProcessor::process() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SEARCH MESSAGES BY TIMESTAMP TEST"); + bmqtst::TestHelper::printTestName("SEARCH MESSAGES BY TIMESTAMP TEST"); // Simulate journal file - const size_t k_NUM_RECORDS = 50; + const size_t k_NUM_RECORDS = 50; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); journalFile.addAllTypesRecords(&records); @@ -831,11 +831,11 @@ static void test11_searchMessagesByTimestamp() // Get GUIDs of messages with matching timestamps and prepare expected // output - mwcu::MemOutStream expectedStream(s_allocator_p); + bmqu::MemOutStream expectedStream(s_allocator_p); bsl::list::const_iterator recordIter = records.begin(); - bsl::size_t msgCnt = 0; + bsl::size_t msgCnt = 0; for (; recordIter != records.end(); ++recordIter) { RecordType::Enum rtype = recordIter->first; if (rtype == RecordType::e_MESSAGE) { @@ -851,7 +851,7 @@ static void test11_searchMessagesByTimestamp() expectedStream << msgCnt << " message GUID(s) found." << bsl::endl; // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -873,7 +873,7 @@ static void test12_printMessagesDetailsTest() // JournalFileProcessor::process() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PRINT MESSAGE DETAILS TEST"); + bmqtst::TestHelper::printTestName("PRINT MESSAGE DETAILS TEST"); #if defined(BSLS_PLATFORM_OS_SOLARIS) s_ignoreCheckDefAlloc = true; @@ -882,7 +882,7 @@ static void test12_printMessagesDetailsTest() #endif // Simulate journal file - const size_t k_NUM_RECORDS = 15; + const size_t k_NUM_RECORDS = 15; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); JournalFile::GuidVectorType confirmedGUIDS(s_allocator_p); @@ -900,7 +900,7 @@ static void test12_printMessagesDetailsTest() s_allocator_p); // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -922,7 +922,7 @@ static void test12_printMessagesDetailsTest() startIdx = foundIdx + bsl::strlen(messageRecordCaption); // Check GUID - mwcu::MemOutStream ss(s_allocator_p); + bmqu::MemOutStream ss(s_allocator_p); outputGuidString(ss, confirmedGUIDS.at(i)); bsl::string guidStr(ss.str(), s_allocator_p); foundIdx = resultString.find(guidStr, startIdx); @@ -960,7 +960,7 @@ static void test13_searchMessagesWithPayloadDumpTest() // JournalFileProcessor::process() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "SEARCH MESSAGES WITH PAYLOAD DUMP TEST"); // Simulate data file @@ -1030,7 +1030,7 @@ static void test13_searchMessagesWithPayloadDumpTest() .WillRepeatedly(testing::Return(&dataIt)); // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -1055,7 +1055,7 @@ static void test13_searchMessagesWithPayloadDumpTest() for (unsigned int i = 0; i < k_NUM_MSGS; i++) { // Check GUID bmqt::MessageGUID guid = confirmedGUIDS.at(i); - mwcu::MemOutStream ss(s_allocator_p); + bmqu::MemOutStream ss(s_allocator_p); outputGuidString(ss, guid); bsl::string guidStr(ss.str(), s_allocator_p); size_t foundIdx = resultString.find(guidStr, startIdx); @@ -1088,10 +1088,10 @@ static void test14_summaryTest() // JournalFileProcessor::process() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("OUTPUT SUMMARY TEST"); + bmqtst::TestHelper::printTestName("OUTPUT SUMMARY TEST"); // Simulate journal file - const size_t k_NUM_RECORDS = 15; + const size_t k_NUM_RECORDS = 15; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); JournalFile::GuidVectorType partiallyConfirmedGUIDS(s_allocator_p); @@ -1108,7 +1108,7 @@ static void test14_summaryTest() s_allocator_p); // Run search - mwcu::MemOutStream resultStream(s_allocator_p); + bmqu::MemOutStream resultStream(s_allocator_p); bslma::ManagedPtr searchProcessor = CommandProcessorFactory::createCommandProcessor(¶ms, fileManager, @@ -1117,7 +1117,7 @@ static void test14_summaryTest() searchProcessor->process(); // Prepare expected output - mwcu::MemOutStream expectedStream(s_allocator_p); + bmqu::MemOutStream expectedStream(s_allocator_p); expectedStream << "5 message(s) found.\nNumber of confirmed messages: 3\nNumber of " "partially confirmed messages: 2\n" @@ -1139,10 +1139,10 @@ static void test15_timestampSearchTest() // m_bmqstoragetool::moveToLowerBound() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("TIMESTAMP SEARCH TEST"); + bmqtst::TestHelper::printTestName("TIMESTAMP SEARCH TEST"); // Simulate journal file - const size_t k_NUM_RECORDS = 50; + const size_t k_NUM_RECORDS = 50; JournalFile::RecordsListType records(s_allocator_p); JournalFile journalFile(k_NUM_RECORDS, s_allocator_p); journalFile.addAllTypesRecords(&records); @@ -1257,7 +1257,7 @@ static void test15_timestampSearchTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -1282,5 +1282,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_messagedetails.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_messagedetails.cpp index ba4b566f4..4491f2369 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_messagedetails.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_messagedetails.cpp @@ -21,9 +21,9 @@ // MQB #include -// MWC -#include -#include +// BMQ +#include +#include namespace BloombergLP { namespace m_bmqstoragetool { @@ -75,7 +75,7 @@ void printRecord(bsl::ostream& stream, fields.push_back("GUID"); fields.push_back("Crc32c"); - mwcu::AlignedPrinter printer(stream, &fields); + bmqu::AlignedPrinter printer(stream, &fields); printer << rec.header().primaryLeaseId() << rec.header().sequenceNumber(); bsls::Types::Uint64 epochValue = rec.header().timestamp(); @@ -88,7 +88,7 @@ void printRecord(bsl::ostream& stream, printer << datetime; } - mwcu::MemOutStream fileKeyStr(allocator), queueKeyStr(allocator); + bmqu::MemOutStream fileKeyStr(allocator), queueKeyStr(allocator); fileKeyStr << rec.fileKey(); queueKeyStr << rec.queueKey(); @@ -146,7 +146,7 @@ void printRecord(bsl::ostream& stream, fields.push_back("AppId"); fields.push_back("GUID"); - mwcu::MemOutStream queueKeyStr(allocator), appKeyStr(allocator); + bmqu::MemOutStream queueKeyStr(allocator), appKeyStr(allocator); queueKeyStr << rec.queueKey(); if (rec.appKey().isNull()) { @@ -165,7 +165,7 @@ void printRecord(bsl::ostream& stream, } } - mwcu::AlignedPrinter printer(stream, &fields); + bmqu::AlignedPrinter printer(stream, &fields); printer << rec.header().primaryLeaseId() << rec.header().sequenceNumber(); bsls::Types::Uint64 epochValue = rec.header().timestamp(); @@ -207,10 +207,10 @@ void printRecord(bsl::ostream& stream, fields.push_back("DeletionFlag"); fields.push_back("GUID"); - mwcu::MemOutStream queueKeyStr(allocator); + bmqu::MemOutStream queueKeyStr(allocator); queueKeyStr << rec.queueKey(); - mwcu::AlignedPrinter printer(stream, &fields); + bmqu::AlignedPrinter printer(stream, &fields); printer << rec.header().primaryLeaseId() << rec.header().sequenceNumber(); bsls::Types::Uint64 epochValue = rec.header().timestamp(); @@ -275,7 +275,7 @@ void MessageDetails::print(bsl::ostream& os, const QueueMap& queueMap) const bmqp_ctrlmsg::QueueInfo* queueInfo_p = queueInfoPresent ? &queueInfo : 0; // Print message record - mwcu::MemOutStream ss(d_allocator_p); + bmqu::MemOutStream ss(d_allocator_p); ss << "MESSAGE Record, index: " << d_messageRecord.d_recordIndex << ", offset: " << d_messageRecord.d_recordOffset; bsl::string delimiter(ss.length(), '=', d_allocator_p); diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_parameters.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_parameters.cpp index e7a8d6790..79c7e3028 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_parameters.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_parameters.cpp @@ -27,8 +27,8 @@ #include #include -// MWC -#include +// BMQ +#include // BDE #include @@ -96,7 +96,7 @@ CommandLineArguments::CommandLineArguments(bslma::Allocator* allocator) bool CommandLineArguments::validate(bsl::string* error) { - mwcu::MemOutStream ss; + bmqu::MemOutStream ss; if (d_journalPath.empty() && d_journalFile.empty()) { ss << "Neither journal path nor journal file are specified\n"; @@ -247,7 +247,7 @@ Parameters::Parameters(const CommandLineArguments& arguments, void Parameters::validateQueueNames(bslma::Allocator* allocator) const { // Validate given queue names agains existing in csl file - mwcu::MemOutStream ss(allocator); + bmqu::MemOutStream ss(allocator); mqbu::StorageKey key; bsl::vector::const_iterator it = d_queueName.cbegin(); for (; it != d_queueName.cend(); ++it) { diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_parameters.h b/src/applications/bmqstoragetool/m_bmqstoragetool_parameters.h index 25b6217c9..25ba703c0 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_parameters.h +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_parameters.h @@ -34,8 +34,8 @@ #include #include -// MWC -#include +// BMQ +#include // BDE #include diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_payloaddumper.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_payloaddumper.cpp index 7b34e0ee8..abb197b90 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_payloaddumper.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_payloaddumper.cpp @@ -19,8 +19,8 @@ // MQB #include -// MWC -#include +// BMQ +#include namespace BloombergLP { namespace m_bmqstoragetool { @@ -63,9 +63,9 @@ void PayloadDumper::outputPayload(bsls::Types::Uint64 messageOffsetDwords) } } - mwcu::MemOutStream dataHeaderOsstr(d_allocator_p); - mwcu::MemOutStream optionsOsstr(d_allocator_p); - mwcu::MemOutStream propsOsstr(d_allocator_p); + bmqu::MemOutStream dataHeaderOsstr(d_allocator_p); + bmqu::MemOutStream optionsOsstr(d_allocator_p); + bmqu::MemOutStream propsOsstr(d_allocator_p); dataHeaderOsstr << it->dataHeader(); @@ -100,7 +100,7 @@ void PayloadDumper::outputPayload(bsls::Types::Uint64 messageOffsetDwords) } // Payload - mwcu::MemOutStream payloadOsstr(d_allocator_p); + bmqu::MemOutStream payloadOsstr(d_allocator_p); unsigned int minLen = d_dumpLimit > 0 ? bsl::min(appDataLen, d_dumpLimit) : appDataLen; payloadOsstr << "First " << minLen << " bytes of payload:" << '\n'; diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_searchresult.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_searchresult.cpp index 5a1452f7e..ce7b98bac 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_searchresult.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_searchresult.cpp @@ -20,9 +20,9 @@ #include #include -// MWC -#include -#include +// BMQ +#include +#include // BDE #include @@ -78,7 +78,7 @@ void printJournalFileMeta(bsl::ostream& ostream, fields.push_back("SyncPoint DataFileOffset (DWORDS)"); fields.push_back("SyncPoint QlistFileOffset (WORDS)"); - mwcu::AlignedPrinter printer(ostream, &fields); + bmqu::AlignedPrinter printer(ostream, &fields); bsls::Types::Uint64 lastRecPos = journalFile_p->lastRecordPosition(); printer << lastRecPos; if (0 == lastRecPos) { diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_searchresultfactory.t.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_searchresultfactory.t.cpp index 2099ab4fe..91cd63194 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_searchresultfactory.t.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_searchresultfactory.t.cpp @@ -19,7 +19,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -41,7 +41,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // Empty parameters CommandLineArguments arguments(s_allocator_p); Parameters params(arguments, s_allocator_p); @@ -63,7 +63,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -74,5 +74,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/applications/bmqstoragetool/package/bmqstoragetool.dep b/src/applications/bmqstoragetool/package/bmqstoragetool.dep index a1562dc40..b7ccdfa7f 100644 --- a/src/applications/bmqstoragetool/package/bmqstoragetool.dep +++ b/src/applications/bmqstoragetool/package/bmqstoragetool.dep @@ -1,8 +1,6 @@ bal bdl +bmq bsl mqb -mwc -mqb -mqbs gmock diff --git a/src/applications/bmqtool/bmqtool.m.cpp b/src/applications/bmqtool/bmqtool.m.cpp index e048be880..122df768a 100644 --- a/src/applications/bmqtool/bmqtool.m.cpp +++ b/src/applications/bmqtool/bmqtool.m.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include // BDE #include @@ -360,7 +360,7 @@ static bool parseArgs(Parameters* parameters, int argc, const char* argv[]) // as an initial generator for the profile JSON to feed in to the // '--profile' argument. - mwcu::MemOutStream os; + bmqu::MemOutStream os; baljsn::Encoder encoder; baljsn::EncoderOptions options; diff --git a/src/applications/bmqtool/m_bmqtool_application.cpp b/src/applications/bmqtool/m_bmqtool_application.cpp index a462b675d..4b27be27b 100644 --- a/src/applications/bmqtool/m_bmqtool_application.cpp +++ b/src/applications/bmqtool/m_bmqtool_application.cpp @@ -35,14 +35,14 @@ #include #include -// MWC -#include -#include -#include -#include +// BMQ +#include +#include +#include +#include -// MWC -#include +// BMQ +#include // BDE #include @@ -140,7 +140,7 @@ void Application::tearDownLog() ball::LoggerManager::shutDownSingleton(); } -bsl::shared_ptr +bsl::shared_ptr Application::createStatContext(int historySize, bslma::Allocator* allocator) { // message: value is data bytes; increments is number of messages @@ -148,12 +148,12 @@ Application::createStatContext(int historySize, bslma::Allocator* allocator) // events // latency: discrete value with nanoseconds of latency reported for each // message (only used in consumer mode) - mwcst::StatContextConfiguration config("bmqtool", allocator); + bmqst::StatContextConfiguration config("bmqtool", allocator); config.isTable(true); config.value("message", historySize) .value("event", historySize) - .value("latency", mwcst::StatValue::e_DISCRETE, historySize); - return bsl::make_shared(config, allocator); + .value("latency", bmqst::StatValue::e_DISCRETE, historySize); + return bsl::make_shared(config, allocator); } void Application::snapshotStats() @@ -219,28 +219,28 @@ void Application::printStats(int interval) const printStatHeader(); // Gather metrics - const mwcst::StatValue& msg = d_statContext_sp->value( - mwcst::StatContext::e_DIRECT_VALUE, + const bmqst::StatValue& msg = d_statContext_sp->value( + bmqst::StatContext::e_DIRECT_VALUE, k_STAT_MSG); - const mwcst::StatValue& evt = d_statContext_sp->value( - mwcst::StatContext::e_DIRECT_VALUE, + const bmqst::StatValue& evt = d_statContext_sp->value( + bmqst::StatContext::e_DIRECT_VALUE, k_STAT_EVT); - mwcst::StatValue::SnapshotLocation t0(0, 0); - mwcst::StatValue::SnapshotLocation t1(0, interval); + bmqst::StatValue::SnapshotLocation t0(0, 0); + bmqst::StatValue::SnapshotLocation t1(0, interval); - double msgBytesRate = mwcst::StatUtil::ratePerSecond(msg, t0, t1); - double msgRate = mwcst::StatUtil::incrementsPerSecond(msg, t0, t1); - bsls::Types::Int64 msgDelta = mwcst::StatUtil::incrementsDifference(msg, + double msgBytesRate = bmqst::StatUtil::ratePerSecond(msg, t0, t1); + double msgRate = bmqst::StatUtil::incrementsPerSecond(msg, t0, t1); + bsls::Types::Int64 msgDelta = bmqst::StatUtil::incrementsDifference(msg, t0, t1); - double evtBytesRate = mwcst::StatUtil::ratePerSecond(evt, t0, t1); - double evtRate = mwcst::StatUtil::incrementsPerSecond(evt, t0, t1); - bsls::Types::Int64 evtDelta = mwcst::StatUtil::incrementsDifference(evt, + double evtBytesRate = bmqst::StatUtil::ratePerSecond(evt, t0, t1); + double evtRate = bmqst::StatUtil::incrementsPerSecond(evt, t0, t1); + bsls::Types::Int64 evtDelta = bmqst::StatUtil::incrementsDifference(evt, t0, t1); - mwcu::MemOutStream ss; + bmqu::MemOutStream ss; if (bmqt::QueueFlagsUtil::isReader(d_parameters_p->queueFlags())) { ss << "consumed "; } @@ -253,48 +253,48 @@ void Application::printStats(int interval) const // Msg { - mwcu::OutStreamFormatSaver streamFmtSaver(ss); + bmqu::OutStreamFormatSaver streamFmtSaver(ss); ss << "|" << bsl::setw(14) - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(msgRate)) - << " |" << bsl::setw(14) << mwcu::PrintUtil::prettyNumber(msgDelta) + << " |" << bsl::setw(14) << bmqu::PrintUtil::prettyNumber(msgDelta) << " |" << bsl::setw(14) - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( static_cast(msgBytesRate)); } // Event { - mwcu::OutStreamFormatSaver streamFmtSaver(ss); + bmqu::OutStreamFormatSaver streamFmtSaver(ss); ss << " ||" << bsl::setw(14) - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(evtRate)) - << " |" << bsl::setw(14) << mwcu::PrintUtil::prettyNumber(evtDelta) + << " |" << bsl::setw(14) << bmqu::PrintUtil::prettyNumber(evtDelta) << " |" << bsl::setw(14) - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( static_cast(evtBytesRate)); } // Latency if (bmqt::QueueFlagsUtil::isReader(d_parameters_p->queueFlags()) && d_parameters_p->latency() != ParametersLatency::e_NONE) { - const mwcst::StatValue& latency = d_statContext_sp->value( - mwcst::StatContext::e_DIRECT_VALUE, + const bmqst::StatValue& latency = d_statContext_sp->value( + bmqst::StatContext::e_DIRECT_VALUE, k_STAT_LAT); - bsls::Types::Int64 latencyMin = mwcst::StatUtil::rangeMin(latency, + bsls::Types::Int64 latencyMin = bmqst::StatUtil::rangeMin(latency, t0, t1); bsls::Types::Int64 latencyAvg = static_cast( - mwcst::StatUtil::averagePerEvent(latency, t0, t1)); - bsls::Types::Int64 latencyMax = mwcst::StatUtil::rangeMax(latency, + bmqst::StatUtil::averagePerEvent(latency, t0, t1)); + bsls::Types::Int64 latencyMax = bmqst::StatUtil::rangeMax(latency, t0, t1); - mwcu::OutStreamFormatSaver streamFmtSaver(ss); + bmqu::OutStreamFormatSaver streamFmtSaver(ss); ss << " ||" << bsl::setw(14) - << mwcu::PrintUtil::prettyTimeInterval(latencyMin) << " < " - << bsl::setw(14) << mwcu::PrintUtil::prettyTimeInterval(latencyAvg) + << bmqu::PrintUtil::prettyTimeInterval(latencyMin) << " < " + << bsl::setw(14) << bmqu::PrintUtil::prettyTimeInterval(latencyAvg) << " < " << bsl::setw(14) - << mwcu::PrintUtil::prettyTimeInterval(latencyMax); + << bmqu::PrintUtil::prettyTimeInterval(latencyMax); } bsl::cout << ss.str() << bsl::endl; @@ -304,21 +304,21 @@ void Application::printFinalStats() { d_statContext_sp->snapshot(); - mwcst::StatValue::SnapshotLocation loc(0, 0); + bmqst::StatValue::SnapshotLocation loc(0, 0); - const mwcst::StatValue& msg = d_statContext_sp->value( - mwcst::StatContext::e_DIRECT_VALUE, + const bmqst::StatValue& msg = d_statContext_sp->value( + bmqst::StatContext::e_DIRECT_VALUE, k_STAT_MSG); - const mwcst::StatValue& evt = d_statContext_sp->value( - mwcst::StatContext::e_DIRECT_VALUE, + const bmqst::StatValue& evt = d_statContext_sp->value( + bmqst::StatContext::e_DIRECT_VALUE, k_STAT_EVT); - bsls::Types::Int64 nbMsg = mwcst::StatUtil::increments(msg, loc); - bsls::Types::Int64 msgBytes = mwcst::StatUtil::value(msg, loc); - bsls::Types::Int64 nbEvt = mwcst::StatUtil::increments(evt, loc); - bsls::Types::Int64 evtBytes = mwcst::StatUtil::value(evt, loc); + bsls::Types::Int64 nbMsg = bmqst::StatUtil::increments(msg, loc); + bsls::Types::Int64 msgBytes = bmqst::StatUtil::value(msg, loc); + bsls::Types::Int64 nbEvt = bmqst::StatUtil::increments(evt, loc); + bsls::Types::Int64 evtBytes = bmqst::StatUtil::value(evt, loc); - mwcu::MemOutStream ss; + bmqu::MemOutStream ss; if (bmqt::QueueFlagsUtil::isReader(d_parameters_p->queueFlags())) { ss << "consumed "; } @@ -329,10 +329,10 @@ void Application::printFinalStats() BSLS_ASSERT_OPT(false && "Neither writer nor reader flags are set"); } - ss << mwcu::PrintUtil::prettyNumber(nbMsg) << " messages [" - << mwcu::PrintUtil::prettyBytes(msgBytes) << "] in " - << mwcu::PrintUtil::prettyNumber(nbEvt) << " events [" - << mwcu::PrintUtil::prettyBytes(evtBytes) << "]"; + ss << bmqu::PrintUtil::prettyNumber(nbMsg) << " messages [" + << bmqu::PrintUtil::prettyBytes(msgBytes) << "] in " + << bmqu::PrintUtil::prettyNumber(nbEvt) << " events [" + << bmqu::PrintUtil::prettyBytes(evtBytes) << "]"; if (msgBytes != 0) { double protocol = (evtBytes - msgBytes) * 100.0 / evtBytes; @@ -342,15 +342,15 @@ void Application::printFinalStats() // Latency if (bmqt::QueueFlagsUtil::isReader(d_parameters_p->queueFlags()) && d_parameters_p->latency() != ParametersLatency::e_NONE) { - const mwcst::StatValue& latency = d_statContext_sp->value( - mwcst::StatContext::e_DIRECT_VALUE, + const bmqst::StatValue& latency = d_statContext_sp->value( + bmqst::StatContext::e_DIRECT_VALUE, k_STAT_LAT); - bsls::Types::Int64 latencyMin = mwcst::StatUtil::absoluteMin(latency); - bsls::Types::Int64 latencyMax = mwcst::StatUtil::absoluteMax(latency); + bsls::Types::Int64 latencyMin = bmqst::StatUtil::absoluteMin(latency); + bsls::Types::Int64 latencyMax = bmqst::StatUtil::absoluteMax(latency); ss << " ~ latency { " - << mwcu::PrintUtil::prettyTimeInterval(latencyMin) << " < " - << mwcu::PrintUtil::prettyTimeInterval(latencyMax) << " }"; + << bmqu::PrintUtil::prettyTimeInterval(latencyMin) << " < " + << bmqu::PrintUtil::prettyTimeInterval(latencyMax) << " }"; } bsl::cout << "\n" @@ -430,23 +430,23 @@ void Application::generateLatencyReport() // 4. Print summary stats to stdout bsl::cout << " Population size.: " << dataSet.size() << "\n" - << " min.............: " << mwcu::PrintUtil::prettyTimeInterval(min) + << " min.............: " << bmqu::PrintUtil::prettyTimeInterval(min) << "\n" - << " avg.............: " << mwcu::PrintUtil::prettyTimeInterval(avg) + << " avg.............: " << bmqu::PrintUtil::prettyTimeInterval(avg) << "\n" - << " max.............: " << mwcu::PrintUtil::prettyTimeInterval(max) + << " max.............: " << bmqu::PrintUtil::prettyTimeInterval(max) << "\n" << " median..........: " - << mwcu::PrintUtil::prettyTimeInterval(median) << "\n" - << " 95Percentile....: " << mwcu::PrintUtil::prettyTimeInterval(p95) + << bmqu::PrintUtil::prettyTimeInterval(median) << "\n" + << " 95Percentile....: " << bmqu::PrintUtil::prettyTimeInterval(p95) << "\n" - << " 96Percentile....: " << mwcu::PrintUtil::prettyTimeInterval(p96) + << " 96Percentile....: " << bmqu::PrintUtil::prettyTimeInterval(p96) << "\n" - << " 97Percentile....: " << mwcu::PrintUtil::prettyTimeInterval(p97) + << " 97Percentile....: " << bmqu::PrintUtil::prettyTimeInterval(p97) << "\n" - << " 98Percentile....: " << mwcu::PrintUtil::prettyTimeInterval(p98) + << " 98Percentile....: " << bmqu::PrintUtil::prettyTimeInterval(p98) << "\n" - << " 99Percentile....: " << mwcu::PrintUtil::prettyTimeInterval(p99) + << " 99Percentile....: " << bmqu::PrintUtil::prettyTimeInterval(p99) << "\n" << bsl::endl; @@ -704,10 +704,10 @@ void Application::onMessageEvent(const bmqa::MessageEvent& event) if (d_parameters_p->latency() != ParametersLatency::e_NONE) { bdlb::BigEndianInt64 time; - int rc = mwcu::BlobUtil::readNBytes( + int rc = bmqu::BlobUtil::readNBytes( reinterpret_cast(&time), blob, - mwcu::BlobPosition(0, 0), + bmqu::BlobPosition(0, 0), sizeof(bdlb::BigEndianInt64)); BSLS_ASSERT_SAFE(rc == 0); (void)rc; diff --git a/src/applications/bmqtool/m_bmqtool_application.h b/src/applications/bmqtool/m_bmqtool_application.h index 0f497a5fe..8b105a3af 100644 --- a/src/applications/bmqtool/m_bmqtool_application.h +++ b/src/applications/bmqtool/m_bmqtool_application.h @@ -40,9 +40,9 @@ #include #include -// MWC -#include -#include +// BMQ +#include +#include // BDE #include @@ -76,7 +76,7 @@ namespace m_bmqtool { class Application : public bmqa::SessionEventHandler { private: // CLASS METHODS - static bsl::shared_ptr + static bsl::shared_ptr createStatContext(int historySize, bslma::Allocator* allocator); // DATA @@ -98,7 +98,7 @@ class Application : public bmqa::SessionEventHandler { bmqa::QueueId d_queueId; // Queue to send/receive messages - bsl::shared_ptr d_statContext_sp; + bsl::shared_ptr d_statContext_sp; // StatContext for msg/event stats bdlmt::EventScheduler d_scheduler; @@ -115,7 +115,7 @@ class Application : public bmqa::SessionEventHandler { ball::MultiplexObserver d_multiplexObserver; - mwctsk::ConsoleObserver d_consoleObserver; + bmqtsk::ConsoleObserver d_consoleObserver; bslma::ManagedPtr d_session_mp; // Session with the BlazingMQ broker. diff --git a/src/applications/bmqtool/m_bmqtool_filelogger.cpp b/src/applications/bmqtool/m_bmqtool_filelogger.cpp index db62282b8..c819a790f 100644 --- a/src/applications/bmqtool/m_bmqtool_filelogger.cpp +++ b/src/applications/bmqtool/m_bmqtool_filelogger.cpp @@ -23,8 +23,8 @@ #include #include -// MWC -#include +// BMQ +#include // BDE #include @@ -102,7 +102,7 @@ static void printSingleLine(LogRecord& record, const bdlbb::Blob& blob) { for (int i = 0; i < blob.numDataBuffers(); ++i) { record << bslstl::StringRef(blob.buffer(i).data(), - mwcu::BlobUtil::bufferSize(blob, i)); + bmqu::BlobUtil::bufferSize(blob, i)); } } diff --git a/src/applications/bmqtool/m_bmqtool_inpututil.cpp b/src/applications/bmqtool/m_bmqtool_inpututil.cpp index b528fc3cf..455fc6891 100644 --- a/src/applications/bmqtool/m_bmqtool_inpututil.cpp +++ b/src/applications/bmqtool/m_bmqtool_inpututil.cpp @@ -17,7 +17,7 @@ #include // BMQ -#include +#include // BDE #include @@ -59,7 +59,7 @@ void InputUtil::preprocessInput(bsl::string* verb, BSLS_ASSERT_SAFE(verb); BSLS_ASSERT_SAFE(output); - mwcu::MemOutStream oss; + bmqu::MemOutStream oss; bool isKey = true, isFirstKey = true, isVerb = true; diff --git a/src/applications/bmqtool/m_bmqtool_inpututil.t.cpp b/src/applications/bmqtool/m_bmqtool_inpututil.t.cpp index 60f1d81b6..f52c32057 100644 --- a/src/applications/bmqtool/m_bmqtool_inpututil.t.cpp +++ b/src/applications/bmqtool/m_bmqtool_inpututil.t.cpp @@ -19,9 +19,9 @@ // BMQ #include -// MWC -#include -#include +// BMQ +#include +#include // BDE #include @@ -29,7 +29,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -55,7 +55,7 @@ static void test1_decodeHexDumpTest() // decodeHexDump // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("DECODEHEXDUMP TEST"); + bmqtst::TestHelper::printTestName("DECODEHEXDUMP TEST"); struct Test { int d_line; @@ -103,8 +103,8 @@ static void test1_decodeHexDumpTest() bsl::istringstream input(bsl::string(test.d_hexdumpStr, s_allocator_p), s_allocator_p); - mwcu::MemOutStream output(s_allocator_p); - mwcu::MemOutStream error(s_allocator_p); + bmqu::MemOutStream output(s_allocator_p); + bmqu::MemOutStream error(s_allocator_p); const bool rc = InputUtil::decodeHexDump(&output, &error, input, s_allocator_p); // Check rc @@ -131,7 +131,7 @@ static void test2_loadMessageFromFileTest() // loadMessageFromFile // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LOADMESSAGEFROMFILE TEST"); + bmqtst::TestHelper::printTestName("LOADMESSAGEFROMFILE TEST"); struct Test { int d_line; @@ -251,8 +251,8 @@ static void test2_loadMessageFromFileTest() // Check wrong file path { - mwcu::MemOutStream stream(s_allocator_p); - mwcu::MemOutStream error(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream error(s_allocator_p); const bool rc = InputUtil::loadMessageFromFile(&stream, &stream, &error, @@ -267,7 +267,7 @@ static void test2_loadMessageFromFileTest() const Test& test = k_DATA[idx]; // Create temp file and write content - mwcu::TempFile tempFile(s_allocator_p); + bmqu::TempFile tempFile(s_allocator_p); const bsl::string filePath = tempFile.path(); { bsl::ofstream ofs(filePath.c_str()); @@ -275,9 +275,9 @@ static void test2_loadMessageFromFileTest() ofs << test.d_fileContent; } - mwcu::MemOutStream payload(s_allocator_p); + bmqu::MemOutStream payload(s_allocator_p); bsl::ostringstream properties(s_allocator_p); - mwcu::MemOutStream error(s_allocator_p); + bmqu::MemOutStream error(s_allocator_p); const bool rc = InputUtil::loadMessageFromFile(&payload, &properties, &error, @@ -306,7 +306,7 @@ static void test2_loadMessageFromFileTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -318,9 +318,9 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); // Check for default allocator is explicitly disabled as // 'bmqa::MessageProperties' or one of its data members may allocate - // temporaries with default allocator. The same for 'mwcu::TempFile'. + // temporaries with default allocator. The same for 'bmqu::TempFile'. } diff --git a/src/applications/bmqtool/m_bmqtool_interactive.cpp b/src/applications/bmqtool/m_bmqtool_interactive.cpp index 61c365baa..8a706ddc8 100644 --- a/src/applications/bmqtool/m_bmqtool_interactive.cpp +++ b/src/applications/bmqtool/m_bmqtool_interactive.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include // BDE #include @@ -59,7 +59,7 @@ void printMessage(bsl::ostream& out, int index, const bmqa::Message& message) bdlbb::Blob blob; message.getData(&blob); bdlbb::BlobUtilAsciiDumper dumpy(&blob); - mwcu::MemOutStream ss; + bmqu::MemOutStream ss; ss << dumpy; bslstl::StringRef blobBegin(ss.str().data(), @@ -247,7 +247,7 @@ void Interactive::processCommand(const OpenQueueCommand& command) } // Parse and validate FLAGS - mwcu::MemOutStream error; + bmqu::MemOutStream error; bsls::Types::Uint64 flags = 0; rc = bmqt::QueueFlagsUtil::fromString(error, &flags, command.flags()); if (rc != 0) { @@ -782,9 +782,9 @@ void Interactive::processCommand(const LoadPostCommand& command) } // Load message content from the file - mwcu::MemOutStream payloadStream; - mwcu::MemOutStream propertiesStream; - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream payloadStream; + bmqu::MemOutStream propertiesStream; + bmqu::MemOutStream errorDescription; if (!InputUtil::loadMessageFromFile(&payloadStream, &propertiesStream, &errorDescription, diff --git a/src/applications/bmqtool/m_bmqtool_interactive.h b/src/applications/bmqtool/m_bmqtool_interactive.h index 2b5e5442e..4a58916d3 100644 --- a/src/applications/bmqtool/m_bmqtool_interactive.h +++ b/src/applications/bmqtool/m_bmqtool_interactive.h @@ -36,8 +36,8 @@ #include #include -// MWC -#include +// BMQ +#include // BDE #include @@ -73,7 +73,7 @@ class Interactive { // PRIVATE TYPES /// Must be ordered by msgGUID to have them oldest first when iterating - typedef mwcc::OrderedHashMap > MessagesMap; diff --git a/src/applications/bmqtool/m_bmqtool_parameters.cpp b/src/applications/bmqtool/m_bmqtool_parameters.cpp index 9397d3e40..d8ab2e5b6 100644 --- a/src/applications/bmqtool/m_bmqtool_parameters.cpp +++ b/src/applications/bmqtool/m_bmqtool_parameters.cpp @@ -18,8 +18,8 @@ // BMQ #include -#include -#include +#include +#include // BDE #include @@ -279,7 +279,7 @@ Parameters::print(bsl::ostream& stream, int level, int spacesPerLevel) const printer.printAttribute("qlistFilePath", qlistFilePath()); printer.printAttribute("journalFilePath", journalFilePath()); printer.printAttribute("dataFilePath", dataFilePath()); - mwcu::MemOutStream flagsOs; + bmqu::MemOutStream flagsOs; bmqt::QueueFlagsUtil::prettyPrint(flagsOs, d_queueFlags); flagsOs << " (" << d_queueFlags << ")" << bsl::ends; printer.printAttribute("queueFlags", flagsOs.str()); @@ -327,7 +327,7 @@ bool Parameters::from(bsl::ostream& stream, // Convert queueFlags string to int, and validate it bsls::Types::Uint64 flags; - mwcu::MemOutStream errStream; + bmqu::MemOutStream errStream; if (bmqt::QueueFlagsUtil::fromString(errStream, &flags, params.queueFlags()) != 0) { @@ -415,7 +415,7 @@ void Parameters::dump(bsl::ostream& stream) bool Parameters::validate(bsl::string* error) { - mwcu::MemOutStream ss; + bmqu::MemOutStream ss; if (d_queueFlags == 0 && d_mode != ParametersMode::e_CLI && d_mode != ParametersMode::e_STORAGE && diff --git a/src/applications/bmqtool/m_bmqtool_parameters.h b/src/applications/bmqtool/m_bmqtool_parameters.h index d9f69ae39..9e0e5ddde 100644 --- a/src/applications/bmqtool/m_bmqtool_parameters.h +++ b/src/applications/bmqtool/m_bmqtool_parameters.h @@ -40,8 +40,8 @@ // MQB #include -// MWC -#include +// BMQ +#include namespace BloombergLP { @@ -527,13 +527,13 @@ inline Parameters& Parameters::setStoragePath(const bsl::string& value) d_dataFilePath.assign(substr); d_dataFilePath.append(dataExt); } - else if (mwcu::StringUtil::endsWith(value, qlistExt)) { + else if (bmqu::StringUtil::endsWith(value, qlistExt)) { d_qlistFilePath = value; } - else if (mwcu::StringUtil::endsWith(value, journalExt)) { + else if (bmqu::StringUtil::endsWith(value, journalExt)) { d_journalFilePath = value; } - else if (mwcu::StringUtil::endsWith(value, dataExt)) { + else if (bmqu::StringUtil::endsWith(value, dataExt)) { d_dataFilePath = value; } } diff --git a/src/applications/bmqtool/m_bmqtool_poster.cpp b/src/applications/bmqtool/m_bmqtool_poster.cpp index 0752d9a8c..3ccd6bd3b 100644 --- a/src/applications/bmqtool/m_bmqtool_poster.cpp +++ b/src/applications/bmqtool/m_bmqtool_poster.cpp @@ -42,7 +42,7 @@ PostingContext::PostingContext( Parameters* parameters, const bmqa::QueueId& queueId, FileLogger* fileLogger, - mwcst::StatContext* statContext, + bmqst::StatContext* statContext, bdlbb::PooledBlobBufferFactory* bufferFactory, bdlbb::PooledBlobBufferFactory* timeBufferFactory, bslma::Allocator* allocator) @@ -225,7 +225,7 @@ void PostingContext::postNext() } Poster::Poster(FileLogger* fileLogger, - mwcst::StatContext* statContext, + bmqst::StatContext* statContext, bslma::Allocator* allocator) : d_allocator_p(bslma::Default::allocator(allocator)) , d_bufferFactory(4096, d_allocator_p) diff --git a/src/applications/bmqtool/m_bmqtool_poster.h b/src/applications/bmqtool/m_bmqtool_poster.h index 473306a27..ced036fc1 100644 --- a/src/applications/bmqtool/m_bmqtool_poster.h +++ b/src/applications/bmqtool/m_bmqtool_poster.h @@ -37,7 +37,7 @@ // BMQ #include #include -#include +#include // BDE #include @@ -73,7 +73,7 @@ class PostingContext { // Where to log posted messages. // Held, not owned. - mwcst::StatContext* d_statContext_p; + bmqst::StatContext* d_statContext_p; // StatContext for msg/event stats. // Held, not owned @@ -106,7 +106,7 @@ class PostingContext { Parameters* parameters, const bmqa::QueueId& queueId, FileLogger* fileLogger, - mwcst::StatContext* statContext, + bmqst::StatContext* statContext, bdlbb::PooledBlobBufferFactory* bufferFactory, bdlbb::PooledBlobBufferFactory* timeBufferFactory, bslma::Allocator* allocator); @@ -148,7 +148,7 @@ class Poster { // blob of the published message, to // hold the timestamp information - mwcst::StatContext* d_statContext; + bmqst::StatContext* d_statContext; // StatContext for msg/event stats. // Held, not owned @@ -160,7 +160,7 @@ class Poster { public: // CREATORS Poster(FileLogger* fileLogger, - mwcst::StatContext* statContext, + bmqst::StatContext* statContext, bslma::Allocator* allocator); // MANIPULATORS diff --git a/src/applications/bmqtool/m_bmqtool_storageinspector.cpp b/src/applications/bmqtool/m_bmqtool_storageinspector.cpp index 88c16da88..50696fd24 100644 --- a/src/applications/bmqtool/m_bmqtool_storageinspector.cpp +++ b/src/applications/bmqtool/m_bmqtool_storageinspector.cpp @@ -30,11 +30,11 @@ #include #include -// MWC -#include -#include -#include -#include +// BMQ +#include +#include +#include +#include // BDE #include @@ -89,7 +89,7 @@ bool resetIterator(mqbs::MappedFileDescriptor* mfd, } // 1) Open - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc = mqbs::FileSystemUtil::open( mfd, filename, @@ -226,7 +226,7 @@ void iterateNextPosition(CHOICE& choice, iter->flipDirection(); } - mwcu::MemOutStream oss; + bmqu::MemOutStream oss; while (skip > 0) { if (iter->hasRecordSizeRemaining() == false) { if (verbose) { @@ -360,7 +360,7 @@ void StorageInspector::processCommand(const OpenStorageCommand& command) << d_journalFile << "] Qlist file: [" << d_qlistFile << "]"; } - else if (mwcu::StringUtil::endsWith( + else if (bmqu::StringUtil::endsWith( path, mqbs::FileStoreProtocol::k_DATA_FILE_EXTENSION)) { if (!resetIterator(&d_dataFd, &d_dataFileIter, path.c_str())) { @@ -369,7 +369,7 @@ void StorageInspector::processCommand(const OpenStorageCommand& command) d_dataFile = path; } - else if (mwcu::StringUtil::endsWith( + else if (bmqu::StringUtil::endsWith( path, mqbs::FileStoreProtocol::k_JOURNAL_FILE_EXTENSION)) { if (!resetIterator(&d_journalFd, &d_journalFileIter, path.c_str())) { @@ -378,7 +378,7 @@ void StorageInspector::processCommand(const OpenStorageCommand& command) d_journalFile = path; } - else if (mwcu::StringUtil::endsWith( + else if (bmqu::StringUtil::endsWith( path, mqbs::FileStoreProtocol::k_QLIST_FILE_EXTENSION)) { if (!resetIterator(&d_qlistFd, &d_qlistFileIter, path.c_str())) { @@ -474,7 +474,7 @@ void StorageInspector::processCommand( fields.push_back("SyncPoint DataFileOffset (DWORDS)"); fields.push_back("SyncPoint QlistFileOffset (WORDS)"); - mwcu::AlignedPrinter printer(BALL_LOG_OUTPUT_STREAM, &fields); + bmqu::AlignedPrinter printer(BALL_LOG_OUTPUT_STREAM, &fields); bsls::Types::Uint64 lastRecPos = d_journalFileIter.lastRecordPosition(); printer << lastRecPos; @@ -578,7 +578,7 @@ void StorageInspector::processCommand( fields.push_back("QueueKey"); fields.push_back("Number of AppIds"); - mwcu::AlignedPrinter printer(BALL_LOG_OUTPUT_STREAM, &fields); + bmqu::AlignedPrinter printer(BALL_LOG_OUTPUT_STREAM, &fields); printer << cit->first << qr.d_queueKey << qr.d_appIds.size(); // 'printer' not to be used beyond this point @@ -592,7 +592,7 @@ void StorageInspector::processCommand( f.push_back("AppKey"); const int indent = 8; - mwcu::AlignedPrinter p(BALL_LOG_OUTPUT_STREAM, &f, indent); + bmqu::AlignedPrinter p(BALL_LOG_OUTPUT_STREAM, &f, indent); p << ar.d_appId << ar.d_appKey; } diff --git a/src/applications/bmqtool/package/bmqtool.dep b/src/applications/bmqtool/package/bmqtool.dep index d7b499bf0..48f92b69c 100644 --- a/src/applications/bmqtool/package/bmqtool.dep +++ b/src/applications/bmqtool/package/bmqtool.dep @@ -1,5 +1,4 @@ mqb bmq -mwc bdl bsl diff --git a/src/groups/CMakeLists.txt b/src/groups/CMakeLists.txt index be9ff6a99..e638bc0da 100644 --- a/src/groups/CMakeLists.txt +++ b/src/groups/CMakeLists.txt @@ -1,6 +1,5 @@ # groups # ------ -add_subdirectory(mwc) add_subdirectory(bmq) add_subdirectory(mqb) diff --git a/src/groups/bmq/CMakeLists.txt b/src/groups/bmq/CMakeLists.txt index 2eb7ff081..6e3ea38bb 100644 --- a/src/groups/bmq/CMakeLists.txt +++ b/src/groups/bmq/CMakeLists.txt @@ -26,9 +26,34 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|(Apple)?Clang") set_property(SOURCE "bmqp/test/bmqp_messageproperties.t.cpp" APPEND PROPERTY COMPILE_FLAGS "-Wno-self-assign-overloaded") + + set_property(SOURCE "bmqc/bmqc_array.t.cpp" + APPEND + PROPERTY COMPILE_FLAGS "-Wno-self-assign-overloaded") + set_property(SOURCE "bmqc/bmqc_monitoredqueue.cpp" + APPEND + PROPERTY COMPILE_FLAGS "-Wno-unused-macros") + set_property(SOURCE "bmqu/bmqu_weakmemfn.t.cpp" + APPEND + PROPERTY COMPILE_FLAGS "-Wno-ignored-qualifiers") endif() -set(BMQ_PRIVATE_PACKAGES bmqimp bmqp bmqeval) +set(BMQ_PRIVATE_PACKAGES + bmqimp + bmqp + bmqeval + bmqc + bmqex + bmqio + bmqma + bmqst + bmqstm + bmqsys + bmqt + bmqtsk + bmqtst + bmqu +) target_bmq_style_uor( bmq PRIVATE_PACKAGES ${BMQ_PRIVATE_PACKAGES} ) if(CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin") @@ -73,7 +98,7 @@ target_sources(bmqeval-iface ${BISON_SimpleEvaluatorParser_OUTPUTS} ${FLEX_SimpleEvaluatorScanner_OUTPUTS}) -target_include_directories(bmqeval-iface PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${FLEX_INCLUDE_DIRS}) +target_include_directories(bmqeval-iface SYSTEM PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${FLEX_INCLUDE_DIRS}) target_include_directories(bmqeval_simpleevaluator.t PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/src/groups/bmq/bmqa/README.md b/src/groups/bmq/bmqa/README.dox similarity index 96% rename from src/groups/bmq/bmqa/README.md rename to src/groups/bmq/bmqa/README.dox index 5dfe3dfa7..f5bd5ad46 100644 --- a/src/groups/bmq/bmqa/README.md +++ b/src/groups/bmq/bmqa/README.dox @@ -1,6 +1,8 @@ +/** @dir bmqa @brief The `BMQA` (BlazingMQ API) package provides applications a public API The `bmqa` package provides the public API of the BlazingMQ SDK for applications to use. +*/ diff --git a/src/groups/bmq/bmqa/bmqa_abstractsession.t.cpp b/src/groups/bmq/bmqa/bmqa_abstractsession.t.cpp index 934ae3efc..84d416755 100644 --- a/src/groups/bmq/bmqa/bmqa_abstractsession.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_abstractsession.t.cpp @@ -21,7 +21,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -296,7 +296,7 @@ static void test1_breathingTest() // 'markDone' methods of AbstractSession may sometimes return a // memory-aware object without utilizing the parameter allocator. - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Creating a concrete object"); bmqa::AbstractSession concreteObj; @@ -614,7 +614,7 @@ static void test2_instanceInvariants() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -626,5 +626,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqa/bmqa_closequeuestatus.cpp b/src/groups/bmq/bmqa/bmqa_closequeuestatus.cpp index 480d40290..08e93faf4 100644 --- a/src/groups/bmq/bmqa/bmqa_closequeuestatus.cpp +++ b/src/groups/bmq/bmqa/bmqa_closequeuestatus.cpp @@ -17,8 +17,8 @@ #include #include -// MWC -#include + +#include // BDE #include @@ -38,7 +38,7 @@ bsl::ostream& CloseQueueStatus::print(bsl::ostream& stream, bslim::Printer printer(&stream, level, spacesPerLevel); printer.start(); printer.printAttribute("queueId", queueId()); - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << result() << " (" << static_cast(result()) << ")"; printer.printAttribute("result", out.str()); if (!errorDescription().empty()) { diff --git a/src/groups/bmq/bmqa/bmqa_closequeuestatus.h b/src/groups/bmq/bmqa/bmqa_closequeuestatus.h index dad7cbe8a..ed4f4f396 100644 --- a/src/groups/bmq/bmqa/bmqa_closequeuestatus.h +++ b/src/groups/bmq/bmqa/bmqa_closequeuestatus.h @@ -62,18 +62,15 @@ namespace bmqa { class CloseQueueStatus { private: // DATA + + /// QueueId associated with the open queue operation QueueId d_queueId; - // queueId associated with the open - // queue operation + /// Result code of the operation (success, failure) bmqt::CloseQueueResult::Enum d_result; - // Result code of the operation - // (success, failure) + /// Optional string with a human readable description of the error, if any bsl::string d_errorDescription; - // Optional string with a human - // readable description of the error, - // if any public: // TRAITS diff --git a/src/groups/bmq/bmqa/bmqa_closequeuestatus.t.cpp b/src/groups/bmq/bmqa/bmqa_closequeuestatus.t.cpp index 8f6fa0b5f..fe20d2321 100644 --- a/src/groups/bmq/bmqa/bmqa_closequeuestatus.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_closequeuestatus.t.cpp @@ -22,15 +22,14 @@ #include #include -// MWC -#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -52,7 +51,7 @@ static void test1_breathingTest() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Default Constructor"); { @@ -152,7 +151,7 @@ static void test2_comparison() // const bmqa::CloseQueueStatus& rhs); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("COMPARISON"); + bmqtst::TestHelper::printTestName("COMPARISON"); PV("Equality"); { @@ -221,7 +220,7 @@ static void test3_print() // Can't check the default allocator: 'bmqa::OpenQueueResult::print' and // operator '<<' temporarily allocate a string using the default allocator. - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); const bmqt::CorrelationId correlationId(2); bmqa::QueueId queueId = bmqa::QueueId(correlationId, s_allocator_p); @@ -245,7 +244,7 @@ static void test3_print() " result = \"TIMEOUT (-2)\"" " errorDescription = \"ERROR\" ]"; - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); // operator<< out << obj; @@ -264,7 +263,7 @@ static void test3_print() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); @@ -281,5 +280,5 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqa/bmqa_configurequeuestatus.cpp b/src/groups/bmq/bmqa/bmqa_configurequeuestatus.cpp index 5f8d3067a..edc9a11ec 100644 --- a/src/groups/bmq/bmqa/bmqa_configurequeuestatus.cpp +++ b/src/groups/bmq/bmqa/bmqa_configurequeuestatus.cpp @@ -17,8 +17,8 @@ #include #include -// MWC -#include + +#include // BDE #include @@ -38,7 +38,7 @@ bsl::ostream& ConfigureQueueStatus::print(bsl::ostream& stream, bslim::Printer printer(&stream, level, spacesPerLevel); printer.start(); printer.printAttribute("queueId", queueId()); - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << result() << " (" << static_cast(result()) << ")"; printer.printAttribute("result", out.str()); if (!errorDescription().empty()) { diff --git a/src/groups/bmq/bmqa/bmqa_configurequeuestatus.h b/src/groups/bmq/bmqa/bmqa_configurequeuestatus.h index f236fe884..e00db146d 100644 --- a/src/groups/bmq/bmqa/bmqa_configurequeuestatus.h +++ b/src/groups/bmq/bmqa/bmqa_configurequeuestatus.h @@ -61,18 +61,15 @@ namespace bmqa { class ConfigureQueueStatus { private: // DATA + + /// QueueId associated with the open queue operation QueueId d_queueId; - // queueId associated with the open - // queue operation + /// Status code of the operation (success, failure) bmqt::ConfigureQueueResult::Enum d_result; - // Status code of the operation - // (success, failure) + /// Optional string with a human readable description of the error, if any bsl::string d_errorDescription; - // Optional string with a human - // readable description of the error, - // if any public: // TRAITS diff --git a/src/groups/bmq/bmqa/bmqa_configurequeuestatus.t.cpp b/src/groups/bmq/bmqa/bmqa_configurequeuestatus.t.cpp index ea5e2fdb3..34add1a91 100644 --- a/src/groups/bmq/bmqa/bmqa_configurequeuestatus.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_configurequeuestatus.t.cpp @@ -22,15 +22,14 @@ #include #include -// MWC -#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -52,7 +51,7 @@ static void test1_breathingTest() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Default Constructor"); { @@ -152,7 +151,7 @@ static void test2_comparison() // const bmqa::ConfigureQueueStatus& rhs); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("COMPARISON"); + bmqtst::TestHelper::printTestName("COMPARISON"); PV("Equality"); { @@ -221,7 +220,7 @@ static void test3_print() // Can't check the default allocator: 'bmqa::OpenQueueResult::print' and // operator '<<' temporarily allocate a string using the default allocator. - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); const bmqt::CorrelationId correlationId(2); bmqa::QueueId queueId = bmqa::QueueId(correlationId, s_allocator_p); @@ -245,7 +244,7 @@ static void test3_print() " result = \"TIMEOUT (-2)\"" " errorDescription = \"ERROR\" ]"; - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); // operator<< out << obj; @@ -264,7 +263,7 @@ static void test3_print() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); @@ -281,5 +280,5 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqa/bmqa_event.t.cpp b/src/groups/bmq/bmqa/bmqa_event.t.cpp index b48f91cad..81b07bdc8 100644 --- a/src/groups/bmq/bmqa/bmqa_event.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_event.t.cpp @@ -24,7 +24,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -59,7 +59,7 @@ static bmqa::Event convertEvent(const bsl::shared_ptr& event) static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); { PV("Creating a default uninitialized event"); @@ -104,7 +104,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -115,5 +115,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqa/bmqa_message.cpp b/src/groups/bmq/bmqa/bmqa_message.cpp index dc3bac2a9..355055e5a 100644 --- a/src/groups/bmq/bmqa/bmqa_message.cpp +++ b/src/groups/bmq/bmqa/bmqa_message.cpp @@ -29,9 +29,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -584,9 +583,9 @@ Message::print(bsl::ostream& stream, int level, int spacesPerLevel) const // NOTE: since we know the size, the `defaultAllocator` will // never be used here. - mwcu::MemOutStream os(k_MAX_BYTES_DUMP, &lsa); + bmqu::MemOutStream os(k_MAX_BYTES_DUMP, &lsa); - os << mwcu::BlobStartHexDumper(&blob, k_MAX_BYTES_DUMP); + os << bmqu::BlobStartHexDumper(&blob, k_MAX_BYTES_DUMP); stream << "\n" << os.str(); } else if (rawEvent.isAckEvent()) { diff --git a/src/groups/bmq/bmqa/bmqa_message.h b/src/groups/bmq/bmqa/bmqa_message.h index c48718132..42481b1f5 100644 --- a/src/groups/bmq/bmqa/bmqa_message.h +++ b/src/groups/bmq/bmqa/bmqa_message.h @@ -101,30 +101,25 @@ class MessageProperties; /// `bmqa::MessageIterator.nextMessage()`. struct MessageImpl { // PUBLIC DATA + + /// Pointer to the Event this message is associated with bmqimp::Event* d_event_p; - // Pointer to the Event this message is - // associated with + /// May point to a bmqimp::Event (in case this Message is a clone) bsl::shared_ptr d_clonedEvent_sp; - // May point to a bmqimp::Event (in case - // this Message is a clone) + /// QueueId this message is associated with bmqa::QueueId d_queueId; - // QueueId this message is associated - // with + /// CorrelationId this message is associated with bmqt::CorrelationId d_correlationId; - // CorrelationId this message is - // associated with + /// SubscriptionHandle this message is associated with bmqt::SubscriptionHandle d_subscriptionHandle; - // SubscriptionHandle this message is - // associated with #ifdef BMQ_ENABLE_MSG_GROUPID + /// Optional GroupId this message is associated with bsl::string d_groupId; - // Optional Group Id this message is - // associated with #endif }; @@ -136,11 +131,12 @@ struct MessageImpl { class MessageConfirmationCookie { private: // DATA + + /// QueueID associated to this cookie bmqa::QueueId d_queueId; - // QueueID associated to this cookie + /// GUID associated to this cookie bmqt::MessageGUID d_guid; - // GUID associated to this cookie public: // CREATORS diff --git a/src/groups/bmq/bmqa/bmqa_message.t.cpp b/src/groups/bmq/bmqa/bmqa_message.t.cpp index a9ffe5cf9..9446eb0c9 100644 --- a/src/groups/bmq/bmqa/bmqa_message.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_message.t.cpp @@ -17,7 +17,7 @@ #include // TEST DRIVER -#include +#include // BDE #include @@ -103,7 +103,7 @@ static void test1_messageOnStackIsInvalid() // QueueId is instantiated and that uses the default allocator to // allocate memory for an automatically generated CorrelationId. - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Default constructor - uninitialized"); @@ -336,7 +336,7 @@ static void test3_messageProperties() ASSERT_EQ(y, out3.getPropertyAsString("y")); ASSERT_EQ(0, out3.setPropertyAsString("y", mod)); - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); out3.print(os, 0, -1); PV(os.str()); @@ -387,7 +387,7 @@ static void test4_subscriptionHandle() // QueueId is instantiated and that uses the default allocator to // allocate memory for an automatically generated CorrelationId. - mwctst::TestHelper::printTestName("SUBSCRIPTION HANDLE ACCESSOR TEST"); + bmqtst::TestHelper::printTestName("SUBSCRIPTION HANDLE ACCESSOR TEST"); // Initialize Crc32c bmqp::Crc32c::initialize(); @@ -599,7 +599,7 @@ static void test4_subscriptionHandle() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); switch (_testCase) { case 0: @@ -614,5 +614,5 @@ int main(int argc, char* argv[]) } bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqa/bmqa_messageevent.t.cpp b/src/groups/bmq/bmqa/bmqa_messageevent.t.cpp index d214467d8..ec0730013 100644 --- a/src/groups/bmq/bmqa/bmqa_messageevent.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_messageevent.t.cpp @@ -34,7 +34,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -146,7 +146,7 @@ appendMessage(size_t iteration, static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bmqa::MessageEvent obj; } @@ -158,7 +158,7 @@ static void test2_ackMesageIteratorTest() // QueueId is instantiated and that uses the default allocator to // allocate memory for an automatically generated CorrelationId. - mwctst::TestHelper::printTestName("ACK MESAGE ITERATOR TEST"); + bmqtst::TestHelper::printTestName("ACK MESAGE ITERATOR TEST"); PV("Creating an event with a few messages"); @@ -212,7 +212,7 @@ static void test3_putMessageIteratorTest() // QueueId is instantiated and that uses the default allocator to // allocate memory for an automatically generated CorrelationId. - mwctst::TestHelper::printTestName("PUT MESAGE ITERATOR TEST"); + bmqtst::TestHelper::printTestName("PUT MESAGE ITERATOR TEST"); // Initialize Crc32c bmqp::Crc32c::initialize(); @@ -279,7 +279,7 @@ static void test3_putMessageIteratorTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); // Temporary workaround to suppress the 'unused operator // NestedTraitDeclaration' warning/error generated by clang. TBD: figure @@ -305,5 +305,5 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqa/bmqa_messageeventbuilder.h b/src/groups/bmq/bmqa/bmqa_messageeventbuilder.h index c9cc54073..57c85aa41 100644 --- a/src/groups/bmq/bmqa/bmqa_messageeventbuilder.h +++ b/src/groups/bmq/bmqa/bmqa_messageeventbuilder.h @@ -284,30 +284,31 @@ namespace bmqa { /// to expose them publicly). struct MessageEventBuilderImpl { // PUBLIC DATA - MessageEvent d_msgEvent; // This is needed so that 'getMessageEvent()' can - // return a const ref. - Message d_msg; // This is needed so that 'startMessage()' can - // return a ref. + /// This is needed so that `getMessageEvent()` can return a const ref. + MessageEvent d_msgEvent; + + /// This is needed so that `startMessage()` can return a ref. + Message d_msg; - bsl::shared_ptr d_guidGenerator_sp; // GUID generator object. + bsl::shared_ptr d_guidGenerator_sp; - int d_messageCountFinal; // The final number of messages in the current 'd_msgEvent' cached on // switching this MessageEvent from WRITE to READ mode. // This cached value exists because we are not able to access the // underlying PutEventBuilder once downgraded to READ. // CONTRACT: the stored value is correct every moment when in READ mode, // and the value is not guaranteed to be correct when in WRITE mode. + int d_messageCountFinal; - int d_messageEventSizeFinal; // The final message event size of the current 'd_msgEvent' cached on // switching this MessageEvent from WRITE to READ mode. // This cached value exists because we are not able to access the // underlying PutEventBuilder once downgraded to READ. // CONTRACT: the stored value is correct every moment when in READ mode, // and the value is not guaranteed to be correct when in WRITE mode. + int d_messageEventSizeFinal; }; // ========================= diff --git a/src/groups/bmq/bmqa/bmqa_messageeventbuilder.t.cpp b/src/groups/bmq/bmqa/bmqa_messageeventbuilder.t.cpp index 3516c266c..90a91e979 100644 --- a/src/groups/bmq/bmqa/bmqa_messageeventbuilder.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_messageeventbuilder.t.cpp @@ -21,7 +21,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -38,7 +38,7 @@ static void test1_breathingTest() // QueueId is instantiated and that uses the default allocator to // allocate memory for an automatically generated CorrelationId. - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bmqa::MessageEventBuilder obj; } @@ -50,7 +50,7 @@ static void test2_testMessageEventSizeCount() // QueueId is instantiated and that uses the default allocator to // allocate memory for an automatically generated CorrelationId. - mwctst::TestHelper::printTestName("MESSAGE EVENT SIZE AND COUNT TEST"); + bmqtst::TestHelper::printTestName("MESSAGE EVENT SIZE AND COUNT TEST"); // Stage 1: preparation // Start a session and open a queue @@ -164,7 +164,7 @@ static void test2_testMessageEventSizeCount() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -176,5 +176,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqa/bmqa_messageiterator.h b/src/groups/bmq/bmqa/bmqa_messageiterator.h index 111322601..2c8c7f940 100644 --- a/src/groups/bmq/bmqa/bmqa_messageiterator.h +++ b/src/groups/bmq/bmqa/bmqa_messageiterator.h @@ -64,18 +64,18 @@ namespace bmqa { /// without publicly exposing private members. struct MessageIteratorImpl { // PUBLIC DATA - bmqimp::Event* d_event_p; // Raw pointer to the event - bmqa::Message d_message; // A 'Message', representing a view to the - // current message pointing at by this iterator. - // This is so that 'message' can return a 'const - // Message&' to clearly indicate the lifetime of - // the Message, and so that we only create one - // such object per MessageIterator. + /// Raw pointer to the event + bmqimp::Event* d_event_p; + /// A `Message`, representing a view to the current message pointing at by + /// this iterator. This is so that `message` can return a 'const Message&' + /// to clearly indicate the lifetime of the Message, and so that we only + /// create one such object per MessageIterator. + bmqa::Message d_message; + + /// Position of `d_message` in the underlying message event. int d_messageIndex; - // Position of 'd_message' in the underlying - // message event. }; // ===================== diff --git a/src/groups/bmq/bmqa/bmqa_messageproperties.h b/src/groups/bmq/bmqa/bmqa_messageproperties.h index e61c929dc..71571c17b 100644 --- a/src/groups/bmq/bmqa/bmqa_messageproperties.h +++ b/src/groups/bmq/bmqa/bmqa_messageproperties.h @@ -96,9 +96,9 @@ class MessageProperties { private: // PRIVATE CONSTANTS - // Constant representing the maximum size of a - // `bmqp::MessageProperties` object, so that the below AlignedBuffer - // is big enough. + /// Constant representing the maximum size of a + /// `bmqp::MessageProperties` object, so that the below AlignedBuffer + /// is big enough. static const int k_MAX_SIZEOF_BMQP_MESSAGEPROPERTIES = 184; // PRIVATE TYPES @@ -107,18 +107,15 @@ class MessageProperties { private: // DATA + + /// Pointer to the implementation object in `d_buffer`, providing a + /// shortcut type safe cast to that object. This variable *must* *be* the + /// first member of this class, as other components in bmqa package may + /// reinterpret_cast to that variable. mutable bmqp::MessageProperties* d_impl_p; - // Pointer to the implementation object - // in 'd_buffer', providing a shortcut - // type safe cast to that object. This - // variable *must* *be* the first - // member of this class, as other - // components in bmqa package may - // reinterpret_cast to that variable. + /// Buffer containing the implementation object, maximally aligned. ImplBuffer d_buffer; - // Buffer containing the implementation - // object, maximally aligned. bslma::Allocator* d_allocator_p; @@ -128,21 +125,20 @@ class MessageProperties { /// Maximum number of properties that can appear in a `bmqa::Message`. static const int k_MAX_NUM_PROPERTIES = 255; + /// Maximum length of all the properties (including their names, values + /// and the wire protocol overhead). Note that this value is just under + /// 64 MB. static const int k_MAX_PROPERTIES_AREA_LENGTH = (64 * 1024 * 1024) - 8; - // Maximum length of all the properties (including their names, values - // and the wire protocol overhead). Note that this value is just under - // 64 MB. /// Maximum length of a property name. static const int k_MAX_PROPERTY_NAME_LENGTH = 4095; - static const int k_MAX_PROPERTY_VALUE_LENGTH = - 67104745; // ~64 MB - // Maximum length of a property value. Note that this value - // is just under 64 MB. Also note that this value is - // calculated assuming that there is only one property and - // property's name has maximum allowable length, and also - // takes into consideration the protocol overhead. + /// ~64 MB + /// Maximum length of a property value. Note that this value is just under + /// 64 MB. Also note that this value is calculated assuming that there is + /// only one property and property's name has maximum allowable length, and + /// also takes into consideration the protocol overhead. + static const int k_MAX_PROPERTY_VALUE_LENGTH = 67104745; public: // TRAITS diff --git a/src/groups/bmq/bmqa/bmqa_mocksession.cpp b/src/groups/bmq/bmqa/bmqa_mocksession.cpp index 02d462d72..80f57c810 100644 --- a/src/groups/bmq/bmqa/bmqa_mocksession.cpp +++ b/src/groups/bmq/bmqa/bmqa_mocksession.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -35,13 +36,10 @@ #include #include #include +#include #include #include - -// MWC -#include -#include -#include +#include // BDE #include @@ -64,7 +62,7 @@ namespace { const char k_LOG_CATEGORY[] = "BMQA.MOCKSESSION"; /// Two key hash map of uri and correlationIds to QueueId. -typedef mwcc::TwoKeyHashMap, @@ -92,8 +90,7 @@ bdlbb::BlobBufferFactory* g_bufferFactory_p = 0; // static variable 'g_guidGenerator_sp' with Clang-specific attribute. [[clang::no_destroy]] #endif -bsl::shared_ptr - g_guidGenerator_sp; +bsl::shared_ptr g_guidGenerator_sp; // First call to 'initialize' allocates a MessageGUIDGenerator created on // heap and managed by this 'g_BufferFactory_sp' till destroyed. @@ -632,7 +629,7 @@ void MockSession::initialize(bslma::Allocator* allocator) g_alloc_p = bslma::Default::globalAllocator(allocator); - mwcsys::Time::initialize(g_alloc_p); + bmqsys::Time::initialize(g_alloc_p); bmqp::Crc32c::initialize(); bmqp::ProtocolUtil::initialize(g_alloc_p); bmqt::UriParser::initialize(g_alloc_p); @@ -655,7 +652,7 @@ void MockSession::shutdown() bmqt::UriParser::shutdown(); bmqp::ProtocolUtil::shutdown(); - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); g_alloc_p->deleteObject(g_bufferFactory_p); g_guidGenerator_sp.reset(); } @@ -740,8 +737,8 @@ const char* MockSession::toAscii(const Method method) void MockSession::initializeStats() { - mwcst::StatValue::SnapshotLocation start; - mwcst::StatValue::SnapshotLocation end; + bmqst::StatValue::SnapshotLocation start; + bmqst::StatValue::SnapshotLocation end; start.setLevel(0).setIndex(0); end.setLevel(0).setIndex(1); bmqimp::QueueStatsUtil::initializeStats(d_queuesStats_sp.get(), @@ -893,7 +890,7 @@ void MockSession::processIfPushEvent(const Event& event) void MockSession::assertWrongCall(const Method method) const { - mwcu::MemOutStream mos(d_allocator_p); + bmqu::MemOutStream mos(d_allocator_p); mos << "No expected calls but received call to '" << MockSession::toAscii(method) << "'" << bsl::ends; d_failureCb(mos.str().data(), "", 0); @@ -902,7 +899,7 @@ void MockSession::assertWrongCall(const Method method) const void MockSession::assertWrongCall(const Method method, const Call& expectedCall) const { - mwcu::MemOutStream mos(d_allocator_p); + bmqu::MemOutStream mos(d_allocator_p); mos << "Expected call to '" << expectedCall.methodName() << "' but got '" << MockSession::toAscii(method) << "' (" << expectedCall.d_file << ':' << expectedCall.d_line << ')' << bsl::ends; @@ -916,7 +913,7 @@ void MockSession::assertWrongArg(const T& expected, const char* arg, const Call& call) const { - mwcu::MemOutStream mos(d_allocator_p); + bmqu::MemOutStream mos(d_allocator_p); mos << "Bad value for argument '" << arg << "' in call to '" << toAscii(method) << "': expected '" << expected << "', got '" << actual << "'"; @@ -959,24 +956,24 @@ MockSession::MockSession(const bmqt::SessionOptions& options, bdlf::PlaceHolders::_2, bdlf::PlaceHolders::_3)) , d_lastQueueId(0) -, d_corrIdContainer_sp(new (*bslma::Default::allocator(allocator)) +, d_corrIdContainer_sp(new(*bslma::Default::allocator(allocator)) bmqimp::MessageCorrelationIdContainer( bslma::Default::allocator(allocator)), bslma::Default::allocator(allocator)) , d_postedEvents(bslma::Default::allocator(allocator)) -, d_rootStatContext(mwcst::StatContextConfiguration("MockSession", allocator), +, d_rootStatContext(bmqst::StatContextConfiguration("MockSession", allocator), allocator) -, d_queuesStats_sp(new (*bslma::Default::allocator(allocator)) +, d_queuesStats_sp(new(*bslma::Default::allocator(allocator)) bmqimp::Stat(bslma::Default::allocator(allocator)), bslma::Default::allocator(allocator)) , d_sessionOptions(options, allocator) , d_allocator_p(bslma::Default::allocator(allocator)) { - BSLMF_ASSERT(k_MAX_SIZEOF_MWCC_TWOKEYHASHMAP >= + BSLMF_ASSERT(k_MAX_SIZEOF_BMQC_TWOKEYHASHMAP >= sizeof(UriCorrIdToQueueMap)); // Compile-time assert to keep the hardcoded value of size of an object of - // type 'mwcc::TwoKeyHashMap' in sync with its actual size. We need to - // hard code the size in 'bmqa_mocksession.h' because none of the 'mwc' + // type 'bmqc::TwoKeyHashMap' in sync with its actual size. We need to + // hard code the size in 'bmqa_mocksession.h' because none of the 'bmqc' // headers can be included in 'bmqa' headers. Note that we don't check // exact size, but 'enough' size, see comment of the constant in header. @@ -1002,14 +999,14 @@ MockSession::MockSession(bslma::ManagedPtr eventHandler, bdlf::PlaceHolders::_2, bdlf::PlaceHolders::_3)) , d_lastQueueId(0) -, d_corrIdContainer_sp(new (*bslma::Default::allocator(allocator)) +, d_corrIdContainer_sp(new(*bslma::Default::allocator(allocator)) bmqimp::MessageCorrelationIdContainer( bslma::Default::allocator(allocator)), bslma::Default::allocator(allocator)) , d_postedEvents(bslma::Default::allocator(allocator)) -, d_rootStatContext(mwcst::StatContextConfiguration("MockSession", allocator), +, d_rootStatContext(bmqst::StatContextConfiguration("MockSession", allocator), allocator) -, d_queuesStats_sp(new (*bslma::Default::allocator(allocator)) +, d_queuesStats_sp(new(*bslma::Default::allocator(allocator)) bmqimp::Stat(bslma::Default::allocator(allocator)), bslma::Default::allocator(allocator)) , d_sessionOptions(options, allocator) @@ -1025,7 +1022,7 @@ MockSession::MockSession(bslma::ManagedPtr eventHandler, MockSession::~MockSession() { if (!d_calls.empty()) { - mwcu::MemOutStream stream(d_allocator_p); + bmqu::MemOutStream stream(d_allocator_p); stream << "Expected calls ["; CallQueue::iterator cit = d_calls.begin(); @@ -1042,7 +1039,7 @@ MockSession::~MockSession() uriCorrIdToQueues(d_twoKeyHashMapBuffer).clear(); uriCorrIdToQueues(d_twoKeyHashMapBuffer) - .mwcc::TwoKeyHashMap< + .bmqc::TwoKeyHashMap< bmqt::Uri, bmqt::CorrelationId, QueueId, diff --git a/src/groups/bmq/bmqa/bmqa_mocksession.h b/src/groups/bmq/bmqa/bmqa_mocksession.h index ca11b53d4..d4d095dc8 100644 --- a/src/groups/bmq/bmqa/bmqa_mocksession.h +++ b/src/groups/bmq/bmqa/bmqa_mocksession.h @@ -548,13 +548,10 @@ #include #include #include // for 'bmqa::SessionEventHandler' - +#include #include #include -// MWC -#include - // BDE #include #include @@ -607,13 +604,14 @@ class ConfirmEventBuilder; struct MockSessionUtil { private: // PRIVATE TYPES + + /// Event impl shared pointer to access + /// the pimpl of `bmqa::Event`. typedef bsl::shared_ptr EventImplSp; - // Event impl shared pointer to access - // the pimpl of 'bmqa::Event'. + /// Queue impl shared pointer to access + /// the pimpl of `bmqa::QueueId`. typedef bsl::shared_ptr QueueImplSp; - // Queue impl shared pointer to access - // the pimpl of 'bmqa::QueueId'. public: // PUBLIC TYPES @@ -621,16 +619,18 @@ struct MockSessionUtil { /// Struct representing parameters for an ack message. struct AckParams { // PUBLIC DATA - bmqt::AckResult::Enum d_status; // Status code + /// Status code + bmqt::AckResult::Enum d_status; + + /// CorrelationId bmqt::CorrelationId d_correlationId; - // Correlation id - bmqt::MessageGUID d_guid; // Message GUID of confirmed message + /// Message GUID of confirmed message + bmqt::MessageGUID d_guid; + /// QueueId for message being referred to QueueId d_queueId; - // Queue id for message being referred - // to // CREATORS @@ -647,14 +647,18 @@ struct MockSessionUtil { /// Struct representing parameters for a push message. struct PushMessageParams { // PUBLIC DATA - bdlbb::Blob d_payload; // Payload of message - QueueId d_queueId; // Queue Id for this message + /// Payload of message + bdlbb::Blob d_payload; + + /// QueueId for this message + QueueId d_queueId; - bmqt::MessageGUID d_guid; // GUID for message + /// GUID for message + bmqt::MessageGUID d_guid; - MessageProperties d_properties; // Optionally specified properties for - // message + /// Optionally specified properties for message + MessageProperties d_properties; // CREATORS @@ -784,16 +788,16 @@ class MockSession : public AbstractSession { private: // CONSTANTS - // Constant representing the maximum size of a `mwcc::TwoKeyHashMap` - // object, so that the below AlignedBuffer is big enough. No `mwc` - // headers can be included in `bmq` public headers, to prevent build - // time dependency. - static const int k_MAX_SIZEOF_MWCC_TWOKEYHASHMAP = 256; + /// Constant representing the maximum size of a `bmqc::TwoKeyHashMap` + /// object, so that the below AlignedBuffer is big enough. No `bmqc` + /// headers can be included in `bmq` public headers, to prevent build + /// time dependency. + static const int k_MAX_SIZEOF_BMQC_TWOKEYHASHMAP = 256; // PRIVATE TYPES /// Aligned buffer holding the two key hash map - typedef bsls::AlignedBuffer + typedef bsls::AlignedBuffer TwoKeyHashMapBuffer; /// Cast for bmqimp::Queue to access internal data @@ -815,25 +819,26 @@ class MockSession : public AbstractSession { /// operation executed with a user-specified callback struct Job { // PUBLIC DATA + + /// Signature of a `void` callback method CallbackFn d_callback; - // Signature of a 'void' callback method + /// Queue associated with this job QueueImplSp d_queue; - // Queue associated with this job + /// Type of queue event associated with this job (OPEN, CONFIGURE, or + /// CLOSE) bmqt::SessionEventType::Enum d_type; - // Type of queue event associated with - // this job (OPEN,CONFIGURE, or CLOSE) + /// Status of the queue operation int d_status; - // Status of the queue operation }; typedef bdlb::Variant EventOrJob; + /// Enumeration for the methods in the `MockSession` protocol. Each + /// enum value corresponds to a method. enum Method { - // Enumeration for the methods in the 'MockSession' protocol. Each - // enum value corresponds to a method. e_START, e_START_ASYNC, e_STOP, @@ -859,78 +864,71 @@ class MockSession : public AbstractSession { struct Call { // PUBLIC TYPES - typedef bsl::vector EventsAndJobs; // Vector of events + + /// Vector of events + typedef bsl::vector EventsAndJobs; // PUBLIC DATA + + /// Value to be returned on call int d_rc; - // Value to be returned on call + /// The type of method Method d_method; - // The type of method + /// Line number int d_line; - // Line number + /// File bsl::string d_file; - // File + /// Uri associated with this call bmqt::Uri d_uri; - // Uri associated with this call + /// Flags associated with this call bsls::Types::Uint64 d_flags; - // Flags associated with this call + /// QueueOptions associated with this call bmqt::QueueOptions d_queueOptions; - // QueueOptions associated with this - // call + /// Timeout interval associated with this call bsls::TimeInterval d_timeout; - // Timeout interval associated with - // this call + /// Callback to be invoked upon emission of an async openQueue (if + /// callback was provided) OpenQueueCallback d_openQueueCallback; - // Callback to be invoked upon emission - // of an async openQueue (if callback - // was provided) + /// Callback to be invoked upon emission of an async configureQueue (if + /// callback was provided) ConfigureQueueCallback d_configureQueueCallback; - // Callback to be invoked upon emission - // of an async configureQueue (if - // callback was provided) + /// Callback to be invoked upon emission of an async closeQueue (if + /// callback was provided) CloseQueueCallback d_closeQueueCallback; - // Callback to be invoked upon emission - // of an async closeQueue (if callback - // was provided) + /// The result of an open queue operation bmqa::OpenQueueStatus d_openQueueResult; - // The result of an open queue - // operation + /// The result of a configure queue operation bmqa::ConfigureQueueStatus d_configureQueueResult; - // The result of a configure queue - // operation + /// The result of a close queue operation bmqa::CloseQueueStatus d_closeQueueResult; - // The result of a close queue - // operation + /// Events to be emitted on this call EventsAndJobs d_emittedEvents; - // Events to be emitted on this call + /// Event to be returned on this call Event d_returnEvent; - // Event to be returned on this call + /// MessageEvent associated with this call MessageEvent d_messageEvent; - // MessageEvent associated with this - // call + /// MessageConfirmationCookie associated with this call MessageConfirmationCookie d_cookie; - // MessageConfirmationCookie associated - // with this call + /// Allocator bslma::Allocator* d_allocator_p; - // Allocator // TRAITS BSLMF_NESTED_TRAIT_DECLARATION(Call, bslma::UsesBslmaAllocator) @@ -1006,56 +1004,52 @@ class MockSession : public AbstractSession { typedef bsl::deque PostedEvents; // DATA + + /// Buffer factory bdlbb::PooledBlobBufferFactory d_blobBufferFactory; - // Buffer factory + /// Event handler (set only in asynchronous mode) bslma::ManagedPtr d_eventHandler_mp; - // Event handler (set only in - // asynchronous mode) + /// sequence of method calls that are expected mutable CallQueue d_calls; - // sequence of method calls that are - // expected + /// events waiting to be emitted mutable bsl::deque d_eventsAndJobs; - // events waiting to be emitted + /// GUIDS of unconfirmed messages bsl::unordered_set d_unconfirmedGUIDs; - // GUIDS of unconfirmed messages + /// Aligned buffer of two key hash map uri, corrid to queues TwoKeyHashMapBuffer d_twoKeyHashMapBuffer; - // Aligned buffer of two key hash map - // uri, corrid to queues + /// Currently installed failure callback that is invoked if methods are + /// called incorrectly or out of order. FailureCb d_failureCb; - // Currently installed failure callback - // that is invoked if methods are - // called incorrectly or out of order. + /// QueueId int d_lastQueueId; - // QueueId + /// Mock correlationId container CorrelationIdContainerSp d_corrIdContainer_sp; - // Mock correlationId container + /// Queue of posted events PostedEvents d_postedEvents; - // Queue of posted events + /// protects all public methods mutable bslmt::Mutex d_mutex; - // protects all public methods - mwcst::StatContext d_rootStatContext; - // Top level stat context for this - // mocked Session. + /// Top level stat context for this mocked Session. + bmqst::StatContext d_rootStatContext; + /// Stats for all queues StatImplSp d_queuesStats_sp; - // Stats for all queues + /// Session Options for current session bmqt::SessionOptions d_sessionOptions; - // Session Options for current session + /// Allocator bslma::Allocator* d_allocator_p; - // Allocator private: // PRIVATE CLASS METHODS diff --git a/src/groups/bmq/bmqa/bmqa_mocksession.t.cpp b/src/groups/bmq/bmqa/bmqa_mocksession.t.cpp index 3d38655b4..ddffcffc9 100644 --- a/src/groups/bmq/bmqa/bmqa_mocksession.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_mocksession.t.cpp @@ -26,8 +26,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -40,11 +39,10 @@ #include #include -// MWC -#include +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -68,8 +66,7 @@ using namespace bsl; /// Mapping class. Will be partially specialized below. template -struct ResultRegistry { -}; +struct ResultRegistry {}; /// Partial specialization for mapping to `bmqa::OpenQueueStatus`. template <> @@ -151,8 +148,8 @@ struct EventHandler : public bmqa::SessionEventHandler { // opted to just compare the streams of the two messageEvents which is // markedly a weak test, but serves us well enough for basic testing. - mwcu::MemOutStream lstr(s_allocator_p); - mwcu::MemOutStream rstr(s_allocator_p); + bmqu::MemOutStream lstr(s_allocator_p); + bmqu::MemOutStream rstr(s_allocator_p); lhs.print(lstr); rhs.print(rstr); @@ -267,7 +264,7 @@ static void test1_staticMethods() { bmqp::ProtocolUtil::initialize(); - mwctst::TestHelper::printTestName("STATIC METHODS"); + bmqtst::TestHelper::printTestName("STATIC METHODS"); bdlbb::PooledBlobBufferFactory bufferFactory(4 * 1024, s_allocator_p); @@ -398,7 +395,7 @@ static void test1_staticMethods() static void test2_call() { - mwctst::TestHelper::printTestName("CALL"); + bmqtst::TestHelper::printTestName("CALL"); bsl::shared_ptr mockSession_sp; @@ -456,7 +453,7 @@ static void test2_call() static void test3_queueManagement() { - mwctst::TestHelper::printTestName("QUEUE MANAGEMENT"); + bmqtst::TestHelper::printTestName("QUEUE MANAGEMENT"); EventHandler eventHandler(s_allocator_p); @@ -700,7 +697,7 @@ static void test3_queueManagement() static void test4_queueManagementSync() { - mwctst::TestHelper::printTestName("QUEUE MANAGEMENT SYNC MODE"); + bmqtst::TestHelper::printTestName("QUEUE MANAGEMENT SYNC MODE"); bmqa::MockSession mockSession(bmqt::SessionOptions(s_allocator_p), s_allocator_p); @@ -790,7 +787,7 @@ static void test4_queueManagementSync() static void test5_confirmingMessages() { - mwctst::TestHelper::printTestName("CONSUME AND CONFIRM"); + bmqtst::TestHelper::printTestName("CONSUME AND CONFIRM"); EventHandler eventHandler(s_allocator_p); @@ -961,7 +958,7 @@ static void test5_confirmingMessages() static void test6_runThrough() { - mwctst::TestHelper::printTestName("RUN THROUGH"); + bmqtst::TestHelper::printTestName("RUN THROUGH"); EventHandler eventHandler(s_allocator_p); @@ -1216,7 +1213,7 @@ static void test6_runThrough() static void test7_postAndAccess() { - mwctst::TestHelper::printTestName("POST AND ACCESS"); + bmqtst::TestHelper::printTestName("POST AND ACCESS"); EventHandler eventHandler(s_allocator_p); @@ -1336,7 +1333,7 @@ static void test7_postAndAccess() static void test8_postBlockedToSuspendedQueue() { - mwctst::TestHelper::printTestName("POST BLOCKED TO SUSPENDED QUEUE"); + bmqtst::TestHelper::printTestName("POST BLOCKED TO SUSPENDED QUEUE"); EventHandler eventHandler(s_allocator_p); @@ -1393,7 +1390,7 @@ static void test8_postBlockedToSuspendedQueue() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); @@ -1415,5 +1412,5 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_DEFAULT); + TEST_EPILOG(bmqtst::TestHelper::e_DEFAULT); } diff --git a/src/groups/bmq/bmqa/bmqa_openqueuestatus.cpp b/src/groups/bmq/bmqa/bmqa_openqueuestatus.cpp index 24d660135..314f5b826 100644 --- a/src/groups/bmq/bmqa/bmqa_openqueuestatus.cpp +++ b/src/groups/bmq/bmqa/bmqa_openqueuestatus.cpp @@ -17,8 +17,8 @@ #include #include -// MWC -#include + +#include // BDE #include @@ -38,7 +38,7 @@ bsl::ostream& OpenQueueStatus::print(bsl::ostream& stream, bslim::Printer printer(&stream, level, spacesPerLevel); printer.start(); printer.printAttribute("queueId", queueId()); - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << result() << " (" << static_cast(result()) << ")"; printer.printAttribute("result", out.str()); if (!errorDescription().empty()) { diff --git a/src/groups/bmq/bmqa/bmqa_openqueuestatus.h b/src/groups/bmq/bmqa/bmqa_openqueuestatus.h index 70c8eeba5..7e658e468 100644 --- a/src/groups/bmq/bmqa/bmqa_openqueuestatus.h +++ b/src/groups/bmq/bmqa/bmqa_openqueuestatus.h @@ -62,18 +62,15 @@ namespace bmqa { class OpenQueueStatus { private: // DATA + + /// QueueId associated with the open queue operation QueueId d_queueId; - // queueId associated with the open - // queue operation + /// Result code of the operation (success, failure) bmqt::OpenQueueResult::Enum d_result; - // Result code of the operation - // (success, failure) + /// Optional string with a human readable description of the error, if any bsl::string d_errorDescription; - // Optional string with a human - // readable description of the error, - // if any public: // TRAITS @@ -81,9 +78,9 @@ class OpenQueueStatus { // TYPES - // Use of an `UnspecifiedBool` to prevent implicit conversions to - // integral values, and comparisons between different classes which - // have boolean operators. + /// Use of an `UnspecifiedBool` to prevent implicit conversions to + /// integral values, and comparisons between different classes which + /// have boolean operators. typedef bsls::UnspecifiedBool::BoolType BoolType; // CREATORS diff --git a/src/groups/bmq/bmqa/bmqa_openqueuestatus.t.cpp b/src/groups/bmq/bmqa/bmqa_openqueuestatus.t.cpp index 59da26ec2..207cb0fff 100644 --- a/src/groups/bmq/bmqa/bmqa_openqueuestatus.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_openqueuestatus.t.cpp @@ -23,15 +23,14 @@ #include #include -// MWC -#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -53,7 +52,7 @@ static void test1_breathingTest() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Default Constructor"); { @@ -153,7 +152,7 @@ static void test2_comparison() // const bmqa::OpenQueueStatus& rhs); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("COMPARISON"); + bmqtst::TestHelper::printTestName("COMPARISON"); PV("Equality"); { @@ -222,7 +221,7 @@ static void test3_print() // Can't check the default allocator: 'bmqa::OpenQueueStatus::print' and // operator '<<' temporarily allocate a string using the default allocator. - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); const bmqt::CorrelationId correlationId(2); bmqa::QueueId queueId = bmqa::QueueId(correlationId, s_allocator_p); @@ -246,7 +245,7 @@ static void test3_print() " result = \"SUCCESS (0)\"" " errorDescription = \"ERROR\" ]"; - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); // operator<< out << obj; @@ -265,7 +264,7 @@ static void test3_print() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); @@ -282,5 +281,5 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqa/bmqa_queueid.t.cpp b/src/groups/bmq/bmqa/bmqa_queueid.t.cpp index a44b0e484..24c8514a0 100644 --- a/src/groups/bmq/bmqa/bmqa_queueid.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_queueid.t.cpp @@ -31,7 +31,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -53,7 +53,7 @@ static void test1_breathingTest() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); const bmqt::QueueOptions k_NULL_OPTIONS( bmqt::QueueOptions() @@ -192,7 +192,7 @@ static void test2_comparison() // bool operator!=(const bmqa::QueueId& lhs, const bmqa::QueueId& rhs); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("COMPARISON"); + bmqtst::TestHelper::printTestName("COMPARISON"); PV("Inequality"); { @@ -227,7 +227,7 @@ static void test2_comparison() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -239,5 +239,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_ALLOC); } diff --git a/src/groups/bmq/bmqa/bmqa_session.cpp b/src/groups/bmq/bmqa/bmqa_session.cpp index b4c5ad896..46b95f64c 100644 --- a/src/groups/bmq/bmqa/bmqa_session.cpp +++ b/src/groups/bmq/bmqa/bmqa_session.cpp @@ -36,8 +36,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -207,7 +206,7 @@ struct SessionUtil { const CALLBACK& callback); static bmqt::OpenQueueResult::Enum - validateAndSetOpenQueueParameters(mwcu::MemOutStream* errorDescription, + validateAndSetOpenQueueParameters(bmqu::MemOutStream* errorDescription, QueueId* queueId, SessionImpl* sessionImpl, const bmqt::Uri& uri, @@ -217,14 +216,14 @@ struct SessionUtil { static bmqt::ConfigureQueueResult::Enum validateAndSetConfigureQueueParameters( - mwcu::MemOutStream* errorDescription, + bmqu::MemOutStream* errorDescription, const QueueId* queueId, const SessionImpl* sessionImpl, const bmqt::QueueOptions& options, const bsls::TimeInterval& timeout); static bmqt::CloseQueueResult::Enum - validateAndSetCloseQueueParameters(mwcu::MemOutStream* errorDescription, + validateAndSetCloseQueueParameters(bmqu::MemOutStream* errorDescription, const QueueId* queueId, const SessionImpl* sessionImpl, const bsls::TimeInterval& timeout); @@ -447,7 +446,7 @@ void SessionUtil::operationResultCallbackWrapper( } bmqt::OpenQueueResult::Enum SessionUtil::validateAndSetOpenQueueParameters( - mwcu::MemOutStream* errorDescription, + bmqu::MemOutStream* errorDescription, QueueId* queueId, SessionImpl* sessionImpl, const bmqt::Uri& uri, @@ -499,7 +498,7 @@ bmqt::OpenQueueResult::Enum SessionUtil::validateAndSetOpenQueueParameters( // Validate the queue flags bdlma::LocalSequentialAllocator<1024> localAllocator( sessionImpl->d_allocator_p); - mwcu::MemOutStream error(&localAllocator); + bmqu::MemOutStream error(&localAllocator); if (!bmqt::QueueFlagsUtil::isValid(error, flags)) { (*errorDescription) << "Invalid openQueue flags: '" << error.str() << "'"; @@ -527,7 +526,7 @@ bmqt::OpenQueueResult::Enum SessionUtil::validateAndSetOpenQueueParameters( bmqt::QueueOptions optionsCopy(options, sessionImpl->d_allocator_p); if (isReader) { // Validate Queue Options - mwcu::MemOutStream errorDesc(sessionImpl->d_allocator_p); + bmqu::MemOutStream errorDesc(sessionImpl->d_allocator_p); int rc = validateQueueOptions(errorDesc, optionsCopy); if (rc) { (*errorDescription) << "Invalid argument - " << errorDesc.str(); @@ -550,7 +549,7 @@ bmqt::OpenQueueResult::Enum SessionUtil::validateAndSetOpenQueueParameters( bmqt::ConfigureQueueResult::Enum SessionUtil::validateAndSetConfigureQueueParameters( - mwcu::MemOutStream* errorDescription, + bmqu::MemOutStream* errorDescription, const QueueId* queueId, const SessionImpl* sessionImpl, const bmqt::QueueOptions& options, @@ -586,7 +585,7 @@ SessionUtil::validateAndSetConfigureQueueParameters( } // Validate Options - mwcu::MemOutStream errorDesc(sessionImpl->d_allocator_p); + bmqu::MemOutStream errorDesc(sessionImpl->d_allocator_p); int rc = validateQueueOptions(errorDesc, options); if (rc) { (*errorDescription) << "Invalid argument - " << errorDesc.str(); @@ -597,7 +596,7 @@ SessionUtil::validateAndSetConfigureQueueParameters( } bmqt::CloseQueueResult::Enum SessionUtil::validateAndSetCloseQueueParameters( - mwcu::MemOutStream* errorDescription, + bmqu::MemOutStream* errorDescription, const QueueId* queueId, const SessionImpl* sessionImpl, const bsls::TimeInterval& timeout) @@ -910,7 +909,7 @@ int Session::openQueue(QueueId* queueId, const bsls::TimeInterval& timeout) { // Validate parameters - mwcu::MemOutStream error; + bmqu::MemOutStream error; bmqt::OpenQueueResult::Enum validationRc = SessionUtil::validateAndSetOpenQueueParameters(&error, queueId, @@ -951,7 +950,7 @@ OpenQueueStatus Session::openQueueSync(QueueId* queueId, const bsls::TimeInterval& timeout) { // Validate parameters - mwcu::MemOutStream error; + bmqu::MemOutStream error; bmqt::OpenQueueResult::Enum validationRc = SessionUtil::validateAndSetOpenQueueParameters(&error, queueId, @@ -1012,7 +1011,7 @@ int Session::openQueueAsync(QueueId* queueId, const bsls::TimeInterval& timeout) { // Validate parameters - mwcu::MemOutStream error; + bmqu::MemOutStream error; bmqt::OpenQueueResult::Enum validationRc = SessionUtil::validateAndSetOpenQueueParameters(&error, queueId, @@ -1067,7 +1066,7 @@ void Session::openQueueAsync(bmqa::QueueId* queueId, callback); // Validate parameters - mwcu::MemOutStream error; + bmqu::MemOutStream error; bmqt::OpenQueueResult::Enum validationRc = SessionUtil::validateAndSetOpenQueueParameters(&error, queueId, @@ -1110,7 +1109,7 @@ int Session::configureQueue(QueueId* queueId, const bsls::TimeInterval& timeout) { // Validate parameters - mwcu::MemOutStream error; + bmqu::MemOutStream error; bmqt::ConfigureQueueResult::Enum validationRc = SessionUtil::validateAndSetConfigureQueueParameters(&error, queueId, @@ -1151,7 +1150,7 @@ Session::configureQueueSync(QueueId* queueId, const bsls::TimeInterval& timeout) { // Validate parameters - mwcu::MemOutStream error; + bmqu::MemOutStream error; bmqt::ConfigureQueueResult::Enum validationRc = SessionUtil::validateAndSetConfigureQueueParameters(&error, queueId, @@ -1202,7 +1201,7 @@ int Session::configureQueueAsync(QueueId* queueId, const bsls::TimeInterval& timeout) { // Validate parameters - mwcu::MemOutStream error; + bmqu::MemOutStream error; bmqt::ConfigureQueueResult::Enum validationRc = SessionUtil::validateAndSetConfigureQueueParameters(&error, queueId, @@ -1256,7 +1255,7 @@ void Session::configureQueueAsync(QueueId* queueId, callback); // Validate parameters - mwcu::MemOutStream error; + bmqu::MemOutStream error; bmqt::ConfigureQueueResult::Enum validationRc = SessionUtil::validateAndSetConfigureQueueParameters(&error, queueId, @@ -1295,7 +1294,7 @@ void Session::configureQueueAsync(QueueId* queueId, int Session::closeQueue(QueueId* queueId, const bsls::TimeInterval& timeout) { // Validate parameters - mwcu::MemOutStream error; + bmqu::MemOutStream error; bmqt::CloseQueueResult::Enum validationRc = SessionUtil::validateAndSetCloseQueueParameters(&error, queueId, @@ -1329,7 +1328,7 @@ CloseQueueStatus Session::closeQueueSync(QueueId* queueId, const bsls::TimeInterval& timeout) { // Validate parameters - mwcu::MemOutStream error; + bmqu::MemOutStream error; bmqt::CloseQueueResult::Enum validationRc = SessionUtil::validateAndSetCloseQueueParameters(&error, queueId, @@ -1382,7 +1381,7 @@ int Session::closeQueueAsync(QueueId* queueId, const bsls::TimeInterval& timeout) { // Validate parameters - mwcu::MemOutStream error; + bmqu::MemOutStream error; bmqt::CloseQueueResult::Enum validationRc = SessionUtil::validateAndSetCloseQueueParameters(&error, queueId, @@ -1430,7 +1429,7 @@ void Session::closeQueueAsync(QueueId* queueId, callback); // Validate parameters - mwcu::MemOutStream error; + bmqu::MemOutStream error; bmqt::CloseQueueResult::Enum validationRc = SessionUtil::validateAndSetCloseQueueParameters(&error, queueId, diff --git a/src/groups/bmq/bmqa/bmqa_session.h b/src/groups/bmq/bmqa/bmqa_session.h index 604edeec5..6e1423b1e 100644 --- a/src/groups/bmq/bmqa/bmqa_session.h +++ b/src/groups/bmq/bmqa/bmqa_session.h @@ -636,23 +636,21 @@ class SessionEventHandler { /// Care should be taken though since `Session` is a polymorphic class. struct SessionImpl { // PUBLIC DATA + + /// The allocator to use bslma::Allocator* d_allocator_p; - // The allocator to use + /// Session options as provided by the application. bmqt::SessionOptions d_sessionOptions; - // Session options as provided by - // the application. + /// Event handler, if any, to use for notifying application of events. bslma::ManagedPtr d_eventHandler_mp; - // Event handler, if any, to use - // for notifying application of - // events. + /// GUID generator object. bsl::shared_ptr d_guidGenerator_sp; - // GUID generator object. + /// The application object. bslma::ManagedPtr d_application_mp; - // The application object. private: // NOT IMPLEMENTED diff --git a/src/groups/bmq/bmqa/bmqa_sessionevent.t.cpp b/src/groups/bmq/bmqa/bmqa_sessionevent.t.cpp index 71252a701..da35781b8 100644 --- a/src/groups/bmq/bmqa/bmqa_sessionevent.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_sessionevent.t.cpp @@ -17,7 +17,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -29,7 +29,7 @@ using namespace bsl; static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bmqa::SessionEvent obj; } @@ -40,7 +40,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -51,5 +51,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqa/package/bmqa.dep b/src/groups/bmq/bmqa/package/bmqa.dep index 13dfef46c..4e584d89b 100644 --- a/src/groups/bmq/bmqa/package/bmqa.dep +++ b/src/groups/bmq/bmqa/package/bmqa.dep @@ -1,5 +1,9 @@ +bmqc bmqimp bmqp bmqpi -bmqt bmqscm +bmqst +bmqsys +bmqt +bmqu diff --git a/src/groups/mwc/mwcc/mwcc_array.cpp b/src/groups/bmq/bmqc/bmqc_array.cpp similarity index 84% rename from src/groups/mwc/mwcc/mwcc_array.cpp rename to src/groups/bmq/bmqc/bmqc_array.cpp index c9403f60c..cc9b54772 100644 --- a/src/groups/mwc/mwcc/mwcc_array.cpp +++ b/src/groups/bmq/bmqc/bmqc_array.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_array.cpp -*-C++-*- -#include +// bmqc_array.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcc { +namespace bmqc { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcc/mwcc_array.h b/src/groups/bmq/bmqc/bmqc_array.h similarity index 98% rename from src/groups/mwc/mwcc/mwcc_array.h rename to src/groups/bmq/bmqc/bmqc_array.h index b4326272c..c9c588146 100644 --- a/src/groups/mwc/mwcc/mwcc_array.h +++ b/src/groups/bmq/bmqc/bmqc_array.h @@ -13,19 +13,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_array.h -*-C++-*- -#ifndef INCLUDED_MWCC_ARRAY -#define INCLUDED_MWCC_ARRAY +// bmqc_array.h -*-C++-*- +#ifndef INCLUDED_BMQC_ARRAY +#define INCLUDED_BMQC_ARRAY //@PURPOSE: Provide a hybrid of static and dynamic array. // //@CLASSES: -// mwcc::ArraySpan: Non-owning view over an array. -// mwcc::Array: Hybrid of static and dynamic array. +// bmqc::ArraySpan: Non-owning view over an array. +// bmqc::Array: Hybrid of static and dynamic array. // //@SEE_ALSO: bsl::vector // -//@DESCRIPTION: 'mwcc::Array' provides a container which can be seen as a +//@DESCRIPTION: 'bmqc::Array' provides a container which can be seen as a // hybrid of static and dynamic array (aka, 'vector'). User can declare length // of the 'static part' of the array at compile time, and array can grow // dynamically at runtime if required. An advantage of this hybrid approach is @@ -49,8 +49,6 @@ //: o Documentation //: o Tests (including perf/bench) -// MWC - // BDE #include #include @@ -67,7 +65,7 @@ namespace BloombergLP { -namespace mwcc { +namespace bmqc { // FORWARD DECLARATION template diff --git a/src/groups/mwc/mwcc/mwcc_array.t.cpp b/src/groups/bmq/bmqc/bmqc_array.t.cpp similarity index 95% rename from src/groups/mwc/mwcc/mwcc_array.t.cpp rename to src/groups/bmq/bmqc/bmqc_array.t.cpp index 72ec8c991..8678d20d4 100644 --- a/src/groups/mwc/mwcc/mwcc_array.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_array.t.cpp @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_array.t.cpp -*-C++-*- -#include +// bmqc_array.t.cpp -*-C++-*- +#include // BDE #include @@ -30,7 +30,7 @@ #include // TEST DRIVER -#include +#include #ifdef BSLS_PLATFORM_OS_LINUX // BENCHMARK @@ -113,10 +113,10 @@ bool operator<(const TestType& lhs, const TestType& rhs) int TestType::s_numAliveInstances(0); // NOTE: Throughout this test driver, we only instantiate the following -// 'mwcc::Array' of templated type 'TestType' and size 'k_STATIC_LEN' to +// 'bmqc::Array' of templated type 'TestType' and size 'k_STATIC_LEN' to // assist in providing meaningful coverage report. const int k_STATIC_LEN = 10; -typedef mwcc::Array ObjType; +typedef bmqc::Array ObjType; } // close unnamed namespace @@ -135,7 +135,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { PV("Basic accessors and manipulators"); @@ -457,7 +457,7 @@ static void test2_outOfBoundValidation() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("OUT OF BOUND VALIDATION"); + bmqtst::TestHelper::printTestName("OUT OF BOUND VALIDATION"); { PV("front, back and []"); @@ -497,7 +497,7 @@ static void test3_noMemoryAllocation() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("NO MEMORY ALLOCATION"); + bmqtst::TestHelper::printTestName("NO MEMORY ALLOCATION"); bslma::TestAllocator ta("testAlloc"); @@ -526,7 +526,7 @@ static void test4_reserve() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("RESERVE"); + bmqtst::TestHelper::printTestName("RESERVE"); bslma::TestAllocator ta("testAlloc"); @@ -553,7 +553,7 @@ static void test5_resize() // guarantees as well as memory allocation. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("RESIZE"); + bmqtst::TestHelper::printTestName("RESIZE"); bslma::TestAllocator ta("testAlloc"); @@ -579,7 +579,7 @@ static void test5_resize() ASSERT_EQ_D(i, obj[i].valueAsInt(), 1); } - // k_FULL_LENGTH exercises both static and dynamic parts of 'mwcc_array'. + // k_FULL_LENGTH exercises both static and dynamic parts of 'bmqc_array'. const size_t k_FULL_LEN = 2 * k_STATIC_LEN; // 3) Resize to twice the static length @@ -624,7 +624,7 @@ static void test6_assign() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ASSIGN"); + bmqtst::TestHelper::printTestName("ASSIGN"); bslma::TestAllocator ta("testAlloc"); @@ -657,7 +657,7 @@ static void test7_algorithms() // after invoking std algos on a populated array. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ALGORITHMS"); + bmqtst::TestHelper::printTestName("ALGORITHMS"); { PV("SORT"); @@ -688,7 +688,7 @@ static void test8_allocatorProp() // allocator. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ALLOCPROP"); + bmqtst::TestHelper::printTestName("ALLOCPROP"); { PV("ALLOC.UNAWARE"); @@ -706,7 +706,7 @@ static void test8_allocatorProp() bslma::TestAllocator ta; - mwcc::Array obj(&ta); + bmqc::Array obj(&ta); obj.push_back("foo"); ASSERT_EQ(true, obj.back().get_allocator().mechanism() == &ta); @@ -722,12 +722,12 @@ static void test9_copyAssignDifferentStaticLength() // for arrays of different static lengths. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("COPYASSIGNDIFFLEN"); + bmqtst::TestHelper::printTestName("COPYASSIGNDIFFLEN"); { bslma::TestAllocator ta; - mwcc::Array rhs(&ta); + bmqc::Array rhs(&ta); rhs.resize(2, TestType(42)); @@ -751,7 +751,7 @@ static void test9_copyAssignDifferentStaticLength() { bslma::TestAllocator ta; - mwcc::Array rhs(&ta); + bmqc::Array rhs(&ta); rhs.resize(2, TestType(42)); @@ -777,7 +777,7 @@ static void test9_copyAssignDifferentStaticLength() { bslma::TestAllocator ta; - mwcc::Array rhs(&ta); + bmqc::Array rhs(&ta); rhs.resize(2, TestType(42)); @@ -801,7 +801,7 @@ static void test9_copyAssignDifferentStaticLength() { bslma::TestAllocator ta; - mwcc::Array rhs(&ta); + bmqc::Array rhs(&ta); rhs.resize(2, TestType(42)); @@ -836,7 +836,7 @@ static void test10_pushBackSelfRef() // memory deallocation before copying the passed argument. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PUSHBACKSELFREF"); + bmqtst::TestHelper::printTestName("PUSHBACKSELFREF"); { const int k_SIZE = k_STATIC_LEN * 2; @@ -858,7 +858,7 @@ using namespace BloombergLP; static void VectorIteration_GoogleBenchmark(benchmark::State& state) { bslma::TestAllocator ta; - mwcc::Array vec(&ta); + bmqc::Array vec(&ta); vec.resize(state.range(0), 42); for (auto _ : state) { @@ -870,7 +870,7 @@ static void VectorIteration_GoogleBenchmark(benchmark::State& state) static void VectorFindLarge_GoogleBenchmark(benchmark::State& state) { bslma::TestAllocator ta; - mwcc::Array vec(&ta); + bmqc::Array vec(&ta); vec.resize(state.range(0), 42); @@ -883,7 +883,7 @@ static void VectorPushBack_GoogleBenchmark(benchmark::State& state) { bslma::TestAllocator ta; for (auto _ : state) { - mwcc::Array vec(&ta); + bmqc::Array vec(&ta); for (int i = 0; i < state.range(0); ++i) { vec.push_back(42); } @@ -897,7 +897,7 @@ static void VectorAssign_GoogleBenchmark(benchmark::State& state) data.resize(state.range(0), 42); - mwcc::Array vec(&ta); + bmqc::Array vec(&ta); for (auto _ : state) { vec.assign(data.begin(), data.end()); } @@ -911,7 +911,7 @@ static void VectorAssign_GoogleBenchmark(benchmark::State& state) int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: case 10: test10_pushBackSelfRef(); break; @@ -942,5 +942,5 @@ int main(int argc, char* argv[]) s_testStatus = -1; } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcc/mwcc_monitoredqueue.cpp b/src/groups/bmq/bmqc/bmqc_monitoredqueue.cpp similarity index 83% rename from src/groups/mwc/mwcc/mwcc_monitoredqueue.cpp rename to src/groups/bmq/bmqc/bmqc_monitoredqueue.cpp index 5cdfd30cb..54743ce2d 100644 --- a/src/groups/mwc/mwcc/mwcc_monitoredqueue.cpp +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue.cpp @@ -13,29 +13,28 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_monitoredqueue.cpp -*-C++-*- +// bmqc_monitoredqueue.cpp -*-C++-*- // Include guards in cpp needed by Sun compiler. -#include +#include // See {internal-ticket D19728733} -#ifndef INCLUDED_MWCC_MONITOREDQUEUE_CPP -#define INCLUDED_MWCC_MONITOREDQUEUE_CPP +#ifndef INCLUDED_BMQC_MONITOREDQUEUE_CPP +#define INCLUDED_BMQC_MONITOREDQUEUE_CPP -#include +#include -// MWC -#include -#include +#include +#include // BDE #include #include namespace BloombergLP { -namespace mwcc { +namespace bmqc { namespace { -const char k_LOG_CATEGORY[] = "MWCC.MONITOREDQUEUE"; +const char k_LOG_CATEGORY[] = "BMQC.MONITOREDQUEUE"; } // close unnamed namespace // -------------------------- @@ -89,12 +88,12 @@ void MonitoredQueueUtil::stateLogCallback(const bsl::string& queueName, { BALL_LOG_SET_CATEGORY(k_LOG_CATEGORY); - mwcu::MemOutStream buffer; + bmqu::MemOutStream buffer; buffer << queueName << " [Watermarks: low=" - << mwcu::PrintUtil::prettyNumber(lowWatermark) - << ", high=" << mwcu::PrintUtil::prettyNumber(highWatermark) - << ", high2=" << mwcu::PrintUtil::prettyNumber(highWatermark2) - << ", limit=" << mwcu::PrintUtil::prettyNumber(queueSize) << "]"; + << bmqu::PrintUtil::prettyNumber(lowWatermark) + << ", high=" << bmqu::PrintUtil::prettyNumber(highWatermark) + << ", high2=" << bmqu::PrintUtil::prettyNumber(highWatermark2) + << ", limit=" << bmqu::PrintUtil::prettyNumber(queueSize) << "]"; switch (state) { case MonitoredQueueState::e_NORMAL: { @@ -108,7 +107,7 @@ void MonitoredQueueUtil::stateLogCallback(const bsl::string& queueName, BALL_LOG_WARN << warningString << " " << buffer.str() << " has reached its high-watermark2"; } break; - case mwcc::MonitoredQueueState::e_QUEUE_FILLED: { + case bmqc::MonitoredQueueState::e_QUEUE_FILLED: { BALL_LOG_ERROR << warningString << " " << buffer.str() << " is full"; } break; default: { diff --git a/src/groups/mwc/mwcc/mwcc_monitoredqueue.h b/src/groups/bmq/bmqc/bmqc_monitoredqueue.h similarity index 96% rename from src/groups/mwc/mwcc/mwcc_monitoredqueue.h rename to src/groups/bmq/bmqc/bmqc_monitoredqueue.h index f979ecae0..472a3f84e 100644 --- a/src/groups/mwc/mwcc/mwcc_monitoredqueue.h +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue.h @@ -13,26 +13,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_monitoredqueue.h -*-C++-*- -#ifndef INCLUDED_MWCC_MONITOREDQUEUE -#define INCLUDED_MWCC_MONITOREDQUEUE +// bmqc_monitoredqueue.h -*-C++-*- +#ifndef INCLUDED_BMQC_MONITOREDQUEUE +#define INCLUDED_BMQC_MONITOREDQUEUE //@PURPOSE: Provide a queue that monitors its load. // //@CLASSES: -// mwcc::MonitoredQueueState: Queue's monitor state enum -// mwcc::MonitoredQueue: A queue that monitors its load -// mwcc::MonitoredQueueUtil: Monitored queue utilities +// bmqc::MonitoredQueueState: Queue's monitor state enum +// bmqc::MonitoredQueue: A queue that monitors its load +// bmqc::MonitoredQueueUtil: Monitored queue utilities // //@SEE_ALSO: bdlcc_fixedqueue, bdlcc_singleconsumerqueue, // bdlcc_singleproducerqueue // //@DESCRIPTION: This component defines a mechanism, -// 'mwcc::MonitoredQueue', which is a simple wrapper around a Queue type that +// 'bmqc::MonitoredQueue', which is a simple wrapper around a Queue type that // monitors its size and alarms (once) when its size crosses into low // watermark, high watermark, and high watermark2. The state of the mechanism -// is represented with the 'mwcc::MonitoredQueueState' enum. It additionally -// defines a utility struct, 'mwcc::MonitoredQueueUtil', providing utility +// is represented with the 'bmqc::MonitoredQueueState' enum. It additionally +// defines a utility struct, 'bmqc::MonitoredQueueUtil', providing utility // functions associated with MonitoredQueues. // // The following parameters are used to configure this component's watermarks @@ -64,9 +64,7 @@ ///--------------------- // Wherever this component supports timed operations, specifically in // 'timedPopFront()', the specified timeout is an absolute offset which matches -// the epoch used in 'mwcsys::Time::nowMonotonicTime()'. - -// MWC +// the epoch used in 'bmqsys::Time::nowMonotonicTime()'. // BDE #include @@ -91,13 +89,13 @@ namespace BloombergLP { -namespace mwcc { +namespace bmqc { // ========================== // struct MonitoredQueueState // ========================== -/// This struct defines the type of state that a `mwcc::MonitoredQueue` +/// This struct defines the type of state that a `bmqc::MonitoredQueue` /// can be in. struct MonitoredQueueState { // TYPES @@ -231,7 +229,7 @@ class MonitoredQueue { // CREATORS - /// Create a `mwcc::MonitoredQueue` object with capacity for the + /// Create a `bmqc::MonitoredQueue` object with capacity for the /// specified `initialCapacity` number of elements and the optionally /// specified `supportTimedOperations` flag indicating if this queue /// supports timed operations (false by default). Use the optionally @@ -369,7 +367,7 @@ struct MonitoredQueueUtil { bsls::Types::Int64 highWatermark, bsls::Types::Int64 highWatermark2, bsls::Types::Int64 queueSize, - mwcc::MonitoredQueueState::Enum state); + bmqc::MonitoredQueueState::Enum state); }; // ============================================================================ @@ -777,10 +775,10 @@ MonitoredQueue::state() const // ------------------------------- // FREE OPERATORS -inline bsl::ostream& mwcc::operator<<(bsl::ostream& stream, - mwcc::MonitoredQueueState::Enum value) +inline bsl::ostream& bmqc::operator<<(bsl::ostream& stream, + bmqc::MonitoredQueueState::Enum value) { - return mwcc::MonitoredQueueState::print(stream, value, 0, -1); + return bmqc::MonitoredQueueState::print(stream, value, 0, -1); } } // Close enterprise namespace diff --git a/src/groups/mwc/mwcc/mwcc_monitoredqueue.t.cpp b/src/groups/bmq/bmqc/bmqc_monitoredqueue.t.cpp similarity index 86% rename from src/groups/mwc/mwcc/mwcc_monitoredqueue.t.cpp rename to src/groups/bmq/bmqc/bmqc_monitoredqueue.t.cpp index 7b625c197..f85a3b0de 100644 --- a/src/groups/mwc/mwcc/mwcc_monitoredqueue.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue.t.cpp @@ -13,12 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_monitoredqueue.t.cpp -*-C++-*- -#include +// bmqc_monitoredqueue.t.cpp -*-C++-*- +#include -// MWC -#include -#include +#include +#include // BDE #include @@ -37,7 +36,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -62,7 +61,7 @@ static void test1_MonitoredQueueState_toAscii() // 'MonitoredQueueState::toAscii' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("MONITORED QUEUE STATE " + bmqtst::TestHelper::printTestName("MONITORED QUEUE STATE " "- TO ASCII"); struct Test { @@ -85,8 +84,8 @@ static void test1_MonitoredQueueState_toAscii() << ") == " << test.d_expected); bsl::string ascii(s_allocator_p); - ascii = mwcc::MonitoredQueueState::toAscii( - mwcc::MonitoredQueueState::Enum(test.d_value)); + ascii = bmqc::MonitoredQueueState::toAscii( + bmqc::MonitoredQueueState::Enum(test.d_value)); ASSERT_EQ_D(test.d_line, ascii, test.d_expected); } @@ -112,7 +111,7 @@ static void test2_MonitoredQueueState_print() // operator<<(bsl::ostream&, MonitoredQueueState::Enum) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("MONITORED QUEUE STATE - PRINT"); + bmqtst::TestHelper::printTestName("MONITORED QUEUE STATE - PRINT"); struct Test { int d_line; @@ -134,12 +133,12 @@ static void test2_MonitoredQueueState_print() << ") == " << test.d_expected); // 1. - mwcu::MemOutStream out(s_allocator_p); - mwcc::MonitoredQueueState::Enum obj( - static_cast(test.d_value)); + bmqu::MemOutStream out(s_allocator_p); + bmqc::MonitoredQueueState::Enum obj( + static_cast(test.d_value)); // print - mwcc::MonitoredQueueState::print(out, obj, 0, 0); + bmqc::MonitoredQueueState::print(out, obj, 0, 0); PVV(test.d_line << ": '" << out.str()); @@ -157,7 +156,7 @@ static void test2_MonitoredQueueState_print() // 2. 'badbit' set out.reset(); out.setstate(bsl::ios_base::badbit); - mwcc::MonitoredQueueState::print(out, obj, 0, -1); + bmqc::MonitoredQueueState::print(out, obj, 0, -1); ASSERT_EQ_D(test.d_line, out.str(), ""); } @@ -169,7 +168,7 @@ static void test2_MonitoredQueueState_print() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -181,5 +180,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccfixedqueue.cpp b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccfixedqueue.cpp similarity index 82% rename from src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccfixedqueue.cpp rename to src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccfixedqueue.cpp index 0b3fa9099..494dbe56b 100644 --- a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccfixedqueue.cpp +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccfixedqueue.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_monitoredqueue_bdlccfixedqueue.cpp -*-C++-*- -#include +// bmqc_monitoredqueue_bdlccfixedqueue.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcc { +namespace bmqc { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccfixedqueue.h b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccfixedqueue.h similarity index 90% rename from src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccfixedqueue.h rename to src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccfixedqueue.h index f28c77e01..29fd2730c 100644 --- a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccfixedqueue.h +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccfixedqueue.h @@ -13,24 +13,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_monitoredqueue_bdlccfixedqueue.h -*-C++-*- -#ifndef INCLUDED_MWCC_MONITOREDQUEUE_BDLCCFIXEDQUEUE -#define INCLUDED_MWCC_MONITOREDQUEUE_BDLCCFIXEDQUEUE +// bmqc_monitoredqueue_bdlccfixedqueue.h -*-C++-*- +#ifndef INCLUDED_BMQC_MONITOREDQUEUE_BDLCCFIXEDQUEUE +#define INCLUDED_BMQC_MONITOREDQUEUE_BDLCCFIXEDQUEUE //@PURPOSE: Provide 'MonitoredQueueTraits' for 'bdlcc::FixedQueue'. // //@CLASSES: // MonitoredQueueTraits: specialization for 'bdlcc::FixedQueue' // -//@SEE_ALSO: mwcc_monitoredqueue, bdlcc_fixedqueue +//@SEE_ALSO: bmqc_monitoredqueue, bdlcc_fixedqueue // //@DESCRIPTION: This component defines a partial specialization of -// 'mwcc::MonitoredQueueTraits' that interfaces 'mwcc::MonitoredFixedQueue' +// 'bmqc::MonitoredQueueTraits' that interfaces 'bmqc::MonitoredFixedQueue' // with 'bdlcc::FixedQueue' -// MWC - -#include +#include // BDE #include @@ -38,14 +36,14 @@ namespace BloombergLP { -namespace mwcc { +namespace bmqc { // ========================================================= // struct MonitoredQueueTraits< bdlcc::FixedQueue > // ========================================================= /// This specialization provides the types and functions necessary to -/// interface a `mwcc::MonitoredQueue` with a `bdlcc::FixedQueue`. +/// interface a `bmqc::MonitoredQueue` with a `bdlcc::FixedQueue`. template struct MonitoredQueueTraits > { // PUBLIC TYPES diff --git a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccfixedqueue.t.cpp b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccfixedqueue.t.cpp similarity index 94% rename from src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccfixedqueue.t.cpp rename to src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccfixedqueue.t.cpp index 675b00762..3482ec895 100644 --- a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccfixedqueue.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccfixedqueue.t.cpp @@ -13,12 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_monitoredqueue_bdlccfixedqueue.t.cpp -*-C++-*- -#include +// bmqc_monitoredqueue_bdlccfixedqueue.t.cpp -*-C++-*- +#include -// MWC -#include -#include +#include +#include // BDE #include @@ -37,7 +36,7 @@ #include // TEST DRIVER -#include +#include // BENCHMARKING LIBRARY #ifdef BSLS_PLATFORM_OS_LINUX @@ -72,7 +71,7 @@ struct PerformanceTestObject { typedef bdlcc::ObjectPool PerformanceTestObjectPool; -typedef mwcc::MonitoredQueue > +typedef bmqc::MonitoredQueue > PerformanceTestObjectQueue; template @@ -114,8 +113,8 @@ static void printProcessedItems(int numItems, bsls::Types::Int64 elapsedTime) numItems / numSeconds); bsl::cout << "Processed " << numItems << " items in " - << mwcu::PrintUtil::prettyTimeInterval(elapsedTime) << ". " - << mwcu::PrintUtil::prettyNumber(itemsPerSec) << "/s" + << bmqu::PrintUtil::prettyTimeInterval(elapsedTime) << ". " + << bmqu::PrintUtil::prettyNumber(itemsPerSec) << "/s" << bsl::endl; } @@ -124,7 +123,7 @@ static void printProcessedItems(int numItems, bsls::Types::Int64 elapsedTime) // Check that all member functions can be instantiated. namespace BloombergLP { -namespace mwcc { +namespace bmqc { template class MonitoredQueue >; @@ -153,7 +152,7 @@ static void test1_MonitoredQueue_breathingTest() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("MONITORED QUEUE - BREATHING TEST"); + bmqtst::TestHelper::printTestName("MONITORED QUEUE - BREATHING TEST"); // CONSTRAINS const int k_QUEUE_SIZE = 10; @@ -164,13 +163,13 @@ static void test1_MonitoredQueue_breathingTest() { PV("Constructor without 'timedOpertions' flag"); - mwcc::MonitoredQueue > queue(k_QUEUE_SIZE, + bmqc::MonitoredQueue > queue(k_QUEUE_SIZE, s_allocator_p); ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); ASSERT_EQ(queue.numElements(), 0); ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), mwcc::MonitoredQueueState::e_NORMAL); + ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); queue.setWatermarks(k_LOW_WATERMARK, k_HIGH_WATERMARK, @@ -179,7 +178,7 @@ static void test1_MonitoredQueue_breathingTest() ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); ASSERT_EQ(queue.numElements(), 0); ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), mwcc::MonitoredQueueState::e_NORMAL); + ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); ASSERT_EQ(queue.lowWatermark(), k_LOW_WATERMARK); ASSERT_EQ(queue.highWatermark(), k_HIGH_WATERMARK); @@ -199,8 +198,8 @@ static void test1_MonitoredQueue_breathingTest() int item = -1; // Disabled because failure is reported for the "wrong" component :-| - // Failure in component mwcc_monitoredqueue but expected component - // mwcc_monitoredqueue_bdlccfixedqueue + // Failure in component bmqc_monitoredqueue but expected component + // bmqc_monitoredqueue_bdlccfixedqueue // // Verify timed popFront is undefined // // int item = -1; @@ -228,7 +227,7 @@ static void test1_MonitoredQueue_breathingTest() { PV("Constructor with 'timedOperations' flag"); - mwcc::MonitoredQueue > queue( + bmqc::MonitoredQueue > queue( k_QUEUE_SIZE, true, // supportTimedOperations s_allocator_p); @@ -236,7 +235,7 @@ static void test1_MonitoredQueue_breathingTest() ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); ASSERT_EQ(queue.numElements(), 0); ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), mwcc::MonitoredQueueState::e_NORMAL); + ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); queue.setWatermarks(k_LOW_WATERMARK, k_HIGH_WATERMARK, @@ -245,7 +244,7 @@ static void test1_MonitoredQueue_breathingTest() ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); ASSERT_EQ(queue.numElements(), 0); ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), mwcc::MonitoredQueueState::e_NORMAL); + ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); ASSERT_EQ(queue.lowWatermark(), k_LOW_WATERMARK); ASSERT_EQ(queue.highWatermark(), k_HIGH_WATERMARK); @@ -301,7 +300,7 @@ static void test2_MonitoredQueue_reset() // reset // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("MONITORED QUEUE - RESET"); + bmqtst::TestHelper::printTestName("MONITORED QUEUE - RESET"); // CONSTRAINS const int k_QUEUE_SIZE = 10; @@ -309,7 +308,7 @@ static void test2_MonitoredQueue_reset() const int k_HIGH_WATERMARK = 6; const int k_HIGH_WATERMARK2 = 9; - mwcc::MonitoredQueue > queue(k_QUEUE_SIZE, + bmqc::MonitoredQueue > queue(k_QUEUE_SIZE, s_allocator_p); queue.setWatermarks(k_LOW_WATERMARK, k_HIGH_WATERMARK, k_HIGH_WATERMARK2); @@ -330,7 +329,7 @@ static void test2_MonitoredQueue_reset() ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); ASSERT_EQ(queue.numElements(), k_QUEUE_SIZE); ASSERT_EQ(queue.isEmpty(), false); - ASSERT_EQ(queue.state(), mwcc::MonitoredQueueState::e_QUEUE_FILLED); + ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_QUEUE_FILLED); // 2. Reset the queue and verify that items were removed and state is reset // to an empty queue. @@ -339,7 +338,7 @@ static void test2_MonitoredQueue_reset() ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); ASSERT_EQ(queue.numElements(), 0); ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), mwcc::MonitoredQueueState::e_NORMAL); + ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); } BSLA_MAYBE_UNUSED @@ -362,7 +361,7 @@ static void testN1_MonitoredQueue_performance() { s_ignoreCheckDefAlloc = true; - mwctst::TestHelper::printTestName("MONITORED QUEUE " + bmqtst::TestHelper::printTestName("MONITORED QUEUE " "- PERFORMANCE TEST"); // CONSTANTS @@ -568,7 +567,7 @@ testN1_MonitoredQueue_performance_GoogleBenchmark(benchmark::State& state) { s_ignoreCheckDefAlloc = true; - mwctst::TestHelper::printTestName("MONITORED QUEUE " + bmqtst::TestHelper::printTestName("MONITORED QUEUE " "- PERFORMANCE TEST"); // CONSTANTS @@ -629,7 +628,7 @@ static void testN1_MonitoredQueueThreaded_performance_GoogleBenchmark( { s_ignoreCheckDefAlloc = true; - mwctst::TestHelper::printTestName("MONITORED QUEUE " + bmqtst::TestHelper::printTestName("MONITORED QUEUE " "- PERFORMANCE TEST"); // CONSTANTS @@ -809,7 +808,7 @@ static void testN1_bdlccFixedQueueThreaded_performance_GoogleBenchmark( int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -837,7 +836,7 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } // ---------------------------------------------------------------------------- diff --git a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleconsumerqueue.cpp b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleconsumerqueue.cpp similarity index 81% rename from src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleconsumerqueue.cpp rename to src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleconsumerqueue.cpp index 40ebe52ba..8e0a18f68 100644 --- a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleconsumerqueue.cpp +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleconsumerqueue.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_monitoredqueue_bdlccsingleconsumerqueue.cpp -*-C++-*- -#include +// bmqc_monitoredqueue_bdlccsingleconsumerqueue.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcc { +namespace bmqc { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleconsumerqueue.h b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleconsumerqueue.h similarity index 89% rename from src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleconsumerqueue.h rename to src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleconsumerqueue.h index 786e4bc41..ab4ca05b7 100644 --- a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleconsumerqueue.h +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleconsumerqueue.h @@ -13,24 +13,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_monitoredqueue_bdlccsingleconsumerqueue.h -*-C++-*- -#ifndef INCLUDED_MWCC_MONITOREDQUEUE_BDLCCSINGLECONSUMERQUEUE -#define INCLUDED_MWCC_MONITOREDQUEUE_BDLCCSINGLECONSUMERQUEUE +// bmqc_monitoredqueue_bdlccsingleconsumerqueue.h -*-C++-*- +#ifndef INCLUDED_BMQC_MONITOREDQUEUE_BDLCCSINGLECONSUMERQUEUE +#define INCLUDED_BMQC_MONITOREDQUEUE_BDLCCSINGLECONSUMERQUEUE //@PURPOSE: Provide 'MonitoredQueueTraits' for 'bdlcc::SingleConsumerQueue'. // //@CLASSES: // MonitoredQueueTraits: specialization for 'bdlcc::SingleConsumerQueue' // -//@SEE_ALSO: mwcc_monitoredqueue, bdlcc_singleconsumerqueue +//@SEE_ALSO: bmqc_monitoredqueue, bdlcc_singleconsumerqueue // //@DESCRIPTION: This component defines a partial specialization of -// 'mwcc::MonitoredQueueTraits' that interfaces -// 'mwcc::MonitoredSingleConsumerQueue' with 'bdlcc::SingleConsumerQueue' +// 'bmqc::MonitoredQueueTraits' that interfaces +// 'bmqc::MonitoredSingleConsumerQueue' with 'bdlcc::SingleConsumerQueue' -// MWC - -#include +#include // BDE #include @@ -40,14 +38,14 @@ namespace BloombergLP { -namespace mwcc { +namespace bmqc { // ================================================================== // struct MonitoredQueueTraits< bdlcc::SingleConsumerQueue > // ================================================================== /// This specialization provides the types and functions necessary to -/// interface a `mwcc::MonitoredQueue` with a `bdlcc::SingleConsumerQueue`. +/// interface a `bmqc::MonitoredQueue` with a `bdlcc::SingleConsumerQueue`. template struct MonitoredQueueTraits > { // PUBLIC TYPES diff --git a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleconsumerqueue.t.cpp b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleconsumerqueue.t.cpp similarity index 95% rename from src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleconsumerqueue.t.cpp rename to src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleconsumerqueue.t.cpp index 7951bd921..4f2038eb7 100644 --- a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleconsumerqueue.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleconsumerqueue.t.cpp @@ -13,12 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_monitoredqueue_bdlccsingleconsumerqueue.t.cpp -*-C++-*- -#include +// bmqc_monitoredqueue_bdlccsingleconsumerqueue.t.cpp -*-C++-*- +#include -// MWC -#include -#include +#include +#include // BDE #include @@ -38,7 +37,7 @@ #include // TEST DRIVER -#include +#include // BENCHMARKING LIBRARY #ifdef BSLS_PLATFORM_OS_LINUX @@ -60,7 +59,7 @@ struct PerformanceTestObject { typedef bdlcc::ObjectPool PerformanceTestObjectPool; -typedef mwcc::MonitoredQueue< +typedef bmqc::MonitoredQueue< bdlcc::SingleConsumerQueue > PerformanceTestObjectQueue; @@ -115,8 +114,8 @@ static void printProcessedItems(int numItems, bsls::Types::Int64 elapsedTime) numItems / numSeconds); bsl::cout << "Processed " << numItems << " items in " - << mwcu::PrintUtil::prettyTimeInterval(elapsedTime) << ". " - << mwcu::PrintUtil::prettyNumber(itemsPerSec) << "/s" + << bmqu::PrintUtil::prettyTimeInterval(elapsedTime) << ". " + << bmqu::PrintUtil::prettyNumber(itemsPerSec) << "/s" << bsl::endl; } @@ -125,7 +124,7 @@ static void printProcessedItems(int numItems, bsls::Types::Int64 elapsedTime) // Check that all member functions can be instantiated. namespace BloombergLP { -namespace mwcc { +namespace bmqc { template class MonitoredQueue< bdlcc::SingleConsumerQueue >; @@ -155,7 +154,7 @@ static void test1_MonitoredSingleConsumerQueue_breathingTest() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("MONITORED SINGLECONSUMER QUEUE " + bmqtst::TestHelper::printTestName("MONITORED SINGLECONSUMER QUEUE " "- BREATHING TEST"); // CONSTRAINS @@ -167,13 +166,13 @@ static void test1_MonitoredSingleConsumerQueue_breathingTest() { PV("Constructor without 'timedOpertions' flag"); - mwcc::MonitoredQueue > queue( + bmqc::MonitoredQueue > queue( k_QUEUE_SIZE, s_allocator_p); ASSERT_EQ(queue.numElements(), 0); ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), mwcc::MonitoredQueueState::e_NORMAL); + ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); queue.setWatermarks(k_LOW_WATERMARK, k_HIGH_WATERMARK, @@ -181,7 +180,7 @@ static void test1_MonitoredSingleConsumerQueue_breathingTest() ASSERT_EQ(queue.numElements(), 0); ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), mwcc::MonitoredQueueState::e_NORMAL); + ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); ASSERT_EQ(queue.lowWatermark(), k_LOW_WATERMARK); ASSERT_EQ(queue.highWatermark(), k_HIGH_WATERMARK); @@ -216,7 +215,7 @@ static void test1_MonitoredSingleConsumerQueue_breathingTest() { PV("Constructor with 'timedOperations' flag"); - mwcc::MonitoredQueue > queue( + bmqc::MonitoredQueue > queue( k_QUEUE_SIZE, true, // supportTimedOperations @@ -224,7 +223,7 @@ static void test1_MonitoredSingleConsumerQueue_breathingTest() ASSERT_EQ(queue.numElements(), 0); ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), mwcc::MonitoredQueueState::e_NORMAL); + ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); queue.setWatermarks(k_LOW_WATERMARK, k_HIGH_WATERMARK, @@ -232,7 +231,7 @@ static void test1_MonitoredSingleConsumerQueue_breathingTest() ASSERT_EQ(queue.numElements(), 0); ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), mwcc::MonitoredQueueState::e_NORMAL); + ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); ASSERT_EQ(queue.lowWatermark(), k_LOW_WATERMARK); ASSERT_EQ(queue.highWatermark(), k_HIGH_WATERMARK); @@ -284,7 +283,7 @@ static void test2_MonitoredSingleConsumerQueue_exceed_reset() // reset // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "MONITORED SINGLECONSUMER QUEUE - RESET"); // CONSTRAINS @@ -293,7 +292,7 @@ static void test2_MonitoredSingleConsumerQueue_exceed_reset() const int k_HIGH_WATERMARK = 6; const int k_HIGH_WATERMARK2 = 9; - mwcc::MonitoredQueue > queue( + bmqc::MonitoredQueue > queue( k_QUEUE_SIZE, s_allocator_p); queue.setWatermarks(k_LOW_WATERMARK, k_HIGH_WATERMARK, k_HIGH_WATERMARK2); @@ -321,7 +320,7 @@ static void test2_MonitoredSingleConsumerQueue_exceed_reset() ASSERT_EQ(queue.numElements(), 0); ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), mwcc::MonitoredQueueState::e_NORMAL); + ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); } BSLA_MAYBE_UNUSED @@ -344,7 +343,7 @@ static void testN1_MonitoredSingleConsumerQueue_performance() { s_ignoreCheckDefAlloc = true; - mwctst::TestHelper::printTestName("MONITORED SINGLE CONSUMER QUEUE " + bmqtst::TestHelper::printTestName("MONITORED SINGLE CONSUMER QUEUE " "- PERFORMANCE TEST"); // CONSTANTS @@ -556,7 +555,7 @@ static void testN1_MonitoredSingleConsumerQueue_performance_GoogleBenchmark( { s_ignoreCheckDefAlloc = true; - mwctst::TestHelper::printTestName("MONITORED SINGLE CONSUMER QUEUE " + bmqtst::TestHelper::printTestName("MONITORED SINGLE CONSUMER QUEUE " "- PERFORMANCE TEST"); // CONSTANTS @@ -804,7 +803,7 @@ testN1_bdlccSingleConsumerQueueThreaded_performance_GoogleBenchmark( int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -835,7 +834,7 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } // ---------------------------------------------------------------------------- diff --git a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleproducerqueue.cpp b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleproducerqueue.cpp similarity index 81% rename from src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleproducerqueue.cpp rename to src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleproducerqueue.cpp index 3ecdff69d..ecde910f4 100644 --- a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleproducerqueue.cpp +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleproducerqueue.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_monitoredqueue_bdlccsingleproducerqueue.cpp -*-C++-*- -#include +// bmqc_monitoredqueue_bdlccsingleproducerqueue.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcc { +namespace bmqc { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleproducerqueue.h b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleproducerqueue.h similarity index 89% rename from src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleproducerqueue.h rename to src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleproducerqueue.h index c1e830725..9ae106972 100644 --- a/src/groups/mwc/mwcc/mwcc_monitoredqueue_bdlccsingleproducerqueue.h +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleproducerqueue.h @@ -13,24 +13,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_monitoredqueue_bdlccsingleproducerqueue.h -*-C++-*- -#ifndef INCLUDED_MWCC_MONITOREDQUEUE_BDLCCSINGLEPRODUCERQUEUE -#define INCLUDED_MWCC_MONITOREDQUEUE_BDLCCSINGLEPRODUCERQUEUE +// bmqc_monitoredqueue_bdlccsingleproducerqueue.h -*-C++-*- +#ifndef INCLUDED_BMQC_MONITOREDQUEUE_BDLCCSINGLEPRODUCERQUEUE +#define INCLUDED_BMQC_MONITOREDQUEUE_BDLCCSINGLEPRODUCERQUEUE //@PURPOSE: Provide 'MonitoredQueueTraits' for 'bdlcc::SingleProducerQueue'. // //@CLASSES: // MonitoredQueueTraits: specialization for 'bdlcc::SingleProducerQueue' // -//@SEE_ALSO: mwcc_monitoredqueue, bdlcc_singleproducerqueue +//@SEE_ALSO: bmqc_monitoredqueue, bdlcc_singleproducerqueue // //@DESCRIPTION: This component defines a partial specialization of -// 'mwcc::MonitoredQueueTraits' that interfaces -// 'mwcc::MonitoredSingleProducerQueue' with 'bdlcc::SingleProducerQueue' +// 'bmqc::MonitoredQueueTraits' that interfaces +// 'bmqc::MonitoredSingleProducerQueue' with 'bdlcc::SingleProducerQueue' -// MWC - -#include +#include // BDE #include @@ -40,14 +38,14 @@ namespace BloombergLP { -namespace mwcc { +namespace bmqc { // ================================================================== // struct MonitoredQueueTraits< bdlcc::SingleProducerQueue > // ================================================================== /// This specialization provides the types and functions necessary to -/// interface a `mwcc::MonitoredQueue` with a `bdlcc::SingleProducerQueue`. +/// interface a `bmqc::MonitoredQueue` with a `bdlcc::SingleProducerQueue`. template struct MonitoredQueueTraits > { // PUBLIC TYPES diff --git a/src/groups/mwc/mwcc/mwcc_multiqueuethreadpool.cpp b/src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.cpp similarity index 90% rename from src/groups/mwc/mwcc/mwcc_multiqueuethreadpool.cpp rename to src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.cpp index 474fc0467..7fb5fd621 100644 --- a/src/groups/mwc/mwcc/mwcc_multiqueuethreadpool.cpp +++ b/src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_multiqueuethreadpool.cpp -*-C++-*- -#include +// bmqc_multiqueuethreadpool.cpp -*-C++-*- +#include -#include +#include // BDE #include namespace BloombergLP { -namespace mwcc { +namespace bmqc { // ------------------------------------------ // class MultiQueueThreadPool_QueueCreatorRet diff --git a/src/groups/mwc/mwcc/mwcc_multiqueuethreadpool.h b/src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.h similarity index 95% rename from src/groups/mwc/mwcc/mwcc_multiqueuethreadpool.h rename to src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.h index cb7ecb810..411b21372 100644 --- a/src/groups/mwc/mwcc/mwcc_multiqueuethreadpool.h +++ b/src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.h @@ -13,29 +13,29 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_multiqueuethreadpool.h -*-C++-*- -#ifndef INCLUDED_MWCC_MULTIQUEUETHREADPOOL -#define INCLUDED_MWCC_MULTIQUEUETHREADPOOL +// bmqc_multiqueuethreadpool.h -*-C++-*- +#ifndef INCLUDED_BMQC_MULTIQUEUETHREADPOOL +#define INCLUDED_BMQC_MULTIQUEUETHREADPOOL //@PURPOSE: Provide a set of monitored queues processed by a thread pool. // MultiQueueThreadPool is referred to as MQTP below. // //@CLASSES: -// mwcc::MultiQueueThreadPool: Queues processed by a thread pool -// mwcc::MultiQueueThreadPoolConfig: Configuration for a MQTP -// mwcc::MultiQueueThreadPoolUtil: Utilities for MQTP -// mwcc::MultiQueueThreadPool_QueueCreatorRet: MQTP queueCreator args +// bmqc::MultiQueueThreadPool: Queues processed by a thread pool +// bmqc::MultiQueueThreadPoolConfig: Configuration for a MQTP +// bmqc::MultiQueueThreadPoolUtil: Utilities for MQTP +// bmqc::MultiQueueThreadPool_QueueCreatorRet: MQTP queueCreator args // //@DESCRIPTION: This component defines a mechanism, -// 'mwcc::MultiQueueThreadPool', which encapsulates the common pattern of +// 'bmqc::MultiQueueThreadPool', which encapsulates the common pattern of // creating a number of Queues processed by a dedicated thread, using an // ObjectPool to create the queue items for performance. Aside from this -// common use case, the 'mwcc::MultiQueueThreadPool' offers additional options +// common use case, the 'bmqc::MultiQueueThreadPool' offers additional options // for its operation: // - Creating it with a 'bdlmt::EventScheduler' allows the -// 'mwcc::MultiQueueThreadPool' to enqueue items on the appropriate queue at +// 'bmqc::MultiQueueThreadPool' to enqueue items on the appropriate queue at // the requested time. -// - Creating the 'mwcc::MultiQueueThreadPool' without a 'bdlmt::ThreadPool' +// - Creating the 'bmqc::MultiQueueThreadPool' without a 'bdlmt::ThreadPool' // allows the user to flush the queues manually. This is intended to be used // in test drivers to obviate the need for any synchronization logic while // keeping the operation of the object under test unchanged. @@ -46,7 +46,7 @@ // important integer messages on three(3) queues. The first thing we should do // is establish a more convenient typedef for our MQTP: //.. -// typedef MultiQueueThreadPool< mwcc::MonitoredFixedQueue > MQTP; +// typedef MultiQueueThreadPool< bmqc::MonitoredFixedQueue > MQTP; //.. // The context for each of our queues will be a 'bsl::vector' that the // queue will push its very important integer messages into, and that we'll be @@ -80,14 +80,14 @@ //.. // void eventCb(int queueId, void *context, MQTP::Event *event) // { -// if (event->type() == MQTP::Event::MWCC_USER) { +// if (event->type() == MQTP::Event::BMQC_USER) { // bsl::vector *vec = reinterpret_cast *>( // context); // vec->push_back(event->object()); // } // } //.. -// Notice that the handler first checks the type of event. 'MWCC_USER' +// Notice that the handler first checks the type of event. 'BMQC_USER' // indicates that the event was enqueued by the user, and that // 'event->object()' is a valid object. The MQTP can call the callback with // several other types of events that are beyond the scope of this simple @@ -153,10 +153,8 @@ // assert(queueContextMap[2][1] == 3); //.. -// MWC - -#include -#include +#include +#include // BDE #include @@ -193,7 +191,7 @@ #include namespace BloombergLP { -namespace mwcc { +namespace bmqc { // FORWARD DECLARE template @@ -211,14 +209,14 @@ class MultiQueueThreadPoolEvent { public: // PUBLIC TYPES enum Type { - MWCC_USER // Event generated by the user. + BMQC_USER // Event generated by the user. , - MWCC_FINALIZE_EVENT // For events that were enqueued on multiple + BMQC_FINALIZE_EVENT // For events that were enqueued on multiple // queues, this event will be called for the last // queue that finished processing it, right before // the event is returned to the pool. , - MWCC_QUEUE_EMPTY // Automatically generated when no more items are + BMQC_QUEUE_EMPTY // Automatically generated when no more items are // available in a queue. }; @@ -321,7 +319,7 @@ class MultiQueueThreadPool_QueueCreatorRet { public: // CREATORS - /// Create a new `mwcc::MultiQueueThreadPool_QueueCreatorRet` object + /// Create a new `bmqc::MultiQueueThreadPool_QueueCreatorRet` object /// using the optionally specified `basicAllocator`. explicit MultiQueueThreadPool_QueueCreatorRet( bslma::Allocator* basicAllocator = 0); @@ -351,15 +349,15 @@ class MultiQueueThreadPoolConfig { public: // PUBLIC TYPES enum EventFinalizationType { - // Enum controlling for which events 'MWCC_FINALIZE_EVENT' events are + // Enum controlling for which events 'BMQC_FINALIZE_EVENT' events are // generated. - MWCC_FINALIZE_NONE // Don't finalize any events + BMQC_FINALIZE_NONE // Don't finalize any events , - MWCC_FINALIZE_MULTI_QUEUE // Finalize only events that were enqueued + BMQC_FINALIZE_MULTI_QUEUE // Finalize only events that were enqueued // on multiple queues , - MWCC_FINALIZE_ALL // Finalize all events + BMQC_FINALIZE_ALL // Finalize all events }; private: @@ -449,7 +447,7 @@ class MultiQueueThreadPoolConfig { // CREATORS - /// Create a `mwcc::MultiQueueThreadPoolConfig` for a + /// Create a `bmqc::MultiQueueThreadPoolConfig` for a /// MultiQueueThreadPool with the specified `numQueues` number of queues /// and using `numQueues` threads from the specified `threadPool` to /// exclusively process events. Use the specified `eventCallback` to @@ -469,7 +467,7 @@ class MultiQueueThreadPoolConfig { const ResetterFn& objectResetter, bslma::Allocator* basicAllocator = 0); - /// Create a `mwcc::MultiQueueThreadPoolConfig` object having the same + /// Create a `bmqc::MultiQueueThreadPoolConfig` object having the same /// value as the specified `original` object. Use the optionally /// specified `basicAllocator` to supply memory. MultiQueueThreadPoolConfig(const MultiQueueThreadPoolConfig& other, @@ -504,9 +502,9 @@ class MultiQueueThreadPoolConfig { /// reference offering modifiable access to this object. MultiQueueThreadPoolConfig& setName(bslstl::StringRef name); - /// Set for which types of events `MWCC_FINALIZE_EVENT` events should be + /// Set for which types of events `BMQC_FINALIZE_EVENT` events should be /// generated and return a reference offering modifiable access to this - /// object. By default, this is `MWCC_FINALIZE_NONE`. + /// object. By default, this is `BMQC_FINALIZE_NONE`. MultiQueueThreadPoolConfig& setFinalizeEvents(EventFinalizationType type); @@ -621,7 +619,7 @@ class MultiQueueThreadPool BSLS_KEYWORD_FINAL { private: // CLASS-SCOPE CATEGORY - BALL_LOG_SET_CLASS_CATEGORY("MWCC.MULTIQUEUETHREADPOOL"); + BALL_LOG_SET_CLASS_CATEGORY("BMQC.MULTIQUEUETHREADPOOL"); private: // DATA @@ -682,7 +680,7 @@ class MultiQueueThreadPool BSLS_KEYWORD_FINAL { public: // CREATORS - /// Create a `mwcc::MultiQueueThreadPool` with the specified `config` + /// Create a `bmqc::MultiQueueThreadPool` with the specified `config` /// and the optionally specified `basicAllocator`. MultiQueueThreadPool(const Config& config, bslma::Allocator* basicAllocator = 0); @@ -748,7 +746,7 @@ class MultiQueueThreadPool BSLS_KEYWORD_FINAL { /// Flush the specified `queue` if `queue >= 0` or all queues if 'queue /// < 0'. The behavior is undefined unless this - /// `mwcc::MultiQueueThreadPool` was created without a + /// `bmqc::MultiQueueThreadPool` was created without a /// `bdlmt::ThreadPool`, it has started, and `queue < numQueues()`. void flushQueue(int queue = -1); @@ -836,7 +834,7 @@ inline MultiQueueThreadPoolEvent::MultiQueueThreadPoolEvent( : d_object() , d_objectResetterFn(bsl::allocator_arg, basicAllocator, resetter) , d_refCount(0) -, d_type(MWCC_USER) +, d_type(BMQC_USER) , d_singleThreadedImmediateExecute(false) , d_enqueuedOnMultipleQueues(false) { @@ -853,7 +851,7 @@ inline MultiQueueThreadPoolEvent::~MultiQueueThreadPoolEvent() template inline void MultiQueueThreadPoolEvent::reset() { - d_type = MWCC_USER; + d_type = BMQC_USER; d_objectResetterFn(&d_object.object()); d_singleThreadedImmediateExecute = false; @@ -916,7 +914,7 @@ inline MultiQueueThreadPoolConfig::MultiQueueThreadPoolConfig( Util::resetResetter()) , d_queueCreatorFn(bsl::allocator_arg, basicAllocator, queueCreator) , d_name(basicAllocator) -, d_finalizeType(MWCC_FINALIZE_NONE) +, d_finalizeType(BMQC_FINALIZE_NONE) , d_monitorAlarmString(basicAllocator) , d_monitorAlarmTimeout() , d_growBy(-1) @@ -942,7 +940,7 @@ inline MultiQueueThreadPoolConfig::MultiQueueThreadPoolConfig( , d_objectResetterFn(bsl::allocator_arg, basicAllocator, objectResetter) , d_queueCreatorFn(bsl::allocator_arg, basicAllocator, queueCreator) , d_name(basicAllocator) -, d_finalizeType(MWCC_FINALIZE_NONE) +, d_finalizeType(BMQC_FINALIZE_NONE) , d_monitorAlarmString(basicAllocator) , d_monitorAlarmTimeout() , d_growBy(-1) @@ -1086,7 +1084,7 @@ inline void MultiQueueThreadPool::processMonitorEvents() << d_config.d_monitorAlarmString << " Queue '" << d_queues[i].d_name << "' hasn't processed an event enqueued " - << mwcu::PrintUtil::prettyTimeInterval( + << bmqu::PrintUtil::prettyTimeInterval( d_config.d_monitorAlarmTimeout.totalMicroseconds() * bdlt::TimeUnitRatio::k_NS_PER_US) << " ago."; @@ -1179,13 +1177,13 @@ inline void MultiQueueThreadPool::processQueue(int queue) if (unrefEvent(event, false)) { bool finalize = (d_config.d_finalizeType == - Config::MWCC_FINALIZE_ALL); + Config::BMQC_FINALIZE_ALL); finalize = finalize || ((d_config.d_finalizeType == - Config::MWCC_FINALIZE_MULTI_QUEUE) && + Config::BMQC_FINALIZE_MULTI_QUEUE) && event->d_enqueuedOnMultipleQueues); if (finalize) { - event->d_type = Event::MWCC_FINALIZE_EVENT; + event->d_type = Event::BMQC_FINALIZE_EVENT; d_config.d_eventCallbackFn(queue, info.d_context_p.get(), event); @@ -1291,7 +1289,7 @@ inline MultiQueueThreadPool::MultiQueueThreadPool( reinterpret_cast(&d_queueEmptyEvent)) , d_allocator_p(bslma::Default::allocator(basicAllocator)) { - d_queueEmptyEvent.d_type = Event::MWCC_QUEUE_EMPTY; + d_queueEmptyEvent.d_type = Event::BMQC_QUEUE_EMPTY; } template diff --git a/src/groups/mwc/mwcc/mwcc_multiqueuethreadpool.t.cpp b/src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.t.cpp similarity index 93% rename from src/groups/mwc/mwcc/mwcc_multiqueuethreadpool.t.cpp rename to src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.t.cpp index 81b30ff75..35d34e3ee 100644 --- a/src/groups/mwc/mwcc/mwcc_multiqueuethreadpool.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.t.cpp @@ -13,13 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_multiqueuethreadpool.t.cpp -*-C++-*- -#include +// bmqc_multiqueuethreadpool.t.cpp -*-C++-*- +#include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -42,7 +41,7 @@ #include // TEST DRIVER -#include +#include // BENCHMARKING LIBRARY #ifdef BSLS_PLATFORM_OS_LINUX @@ -58,7 +57,7 @@ using namespace bsl; // ---------------------------------------------------------------------------- namespace { -typedef mwcc::MultiQueueThreadPool MQTP; +typedef bmqc::MultiQueueThreadPool MQTP; static MQTP::Queue* queueCreator(MQTP::QueueCreatorRet* ret, @@ -79,7 +78,7 @@ queueCreator(MQTP::QueueCreatorRet* ret, static void eventCb(BSLS_ANNOTATION_UNUSED int queueId, void* context, MQTP::Event* event) { - if (event->type() == MQTP::Event::MWCC_USER) { + if (event->type() == MQTP::Event::BMQC_USER) { bsl::vector* vec = reinterpret_cast*>(context); vec->push_back(event->object()); } @@ -122,8 +121,8 @@ static void printProcessedItems(int numItems, bsls::Types::Int64 elapsedTime) const bsls::Types::Int64 itemsPerSec = numItems / numSeconds; bsl::cout << "Processed " << numItems << " items in " - << mwcu::PrintUtil::prettyTimeInterval(elapsedTime) << ". " - << mwcu::PrintUtil::prettyNumber(itemsPerSec) << "/s" + << bmqu::PrintUtil::prettyTimeInterval(elapsedTime) << ". " + << bmqu::PrintUtil::prettyNumber(itemsPerSec) << "/s" << bsl::endl; } @@ -149,9 +148,9 @@ static void test1_breathingTest() // Ignore default allocator check for now because instantiating the // 'MQTP::Config' object fails the default allocator check for a // reason yet to be identified (the source appears to be in - // 'mwcc::MultiQueueThreadPoolUtil::defaultCreator()'). + // 'bmqc::MultiQueueThreadPoolUtil::defaultCreator()'). - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // CONSTANTS const int k_NUM_QUEUES = 3; @@ -182,8 +181,8 @@ static void test1_breathingTest() bdlf::PlaceHolders::_3, // allocator k_FIXED_QUEUE_SIZE, &queueContextMap), - mwcc::MultiQueueThreadPoolUtil::defaultCreator(), - mwcc::MultiQueueThreadPoolUtil::noOpResetter(), + bmqc::MultiQueueThreadPoolUtil::defaultCreator(), + bmqc::MultiQueueThreadPoolUtil::noOpResetter(), s_allocator_p); MQTP mfqtp(config, s_allocator_p); @@ -247,7 +246,7 @@ static void testN1_performance() { s_ignoreCheckDefAlloc = true; - mwctst::TestHelper::printTestName("PERFORMANCE TEST"); + bmqtst::TestHelper::printTestName("PERFORMANCE TEST"); // CONSTANTS const int k_NUM_QUEUES = 1; @@ -275,8 +274,8 @@ static void testN1_performance() &performanceTestQueueCreator, bdlf::PlaceHolders::_3, k_FIXED_QUEUE_SIZE), - mwcc::MultiQueueThreadPoolUtil::defaultCreator(), - mwcc::MultiQueueThreadPoolUtil::noOpResetter(), + bmqc::MultiQueueThreadPoolUtil::defaultCreator(), + bmqc::MultiQueueThreadPoolUtil::noOpResetter(), s_allocator_p); MQTP mfqtp(config, s_allocator_p); @@ -391,7 +390,7 @@ static void testN1_performance_GoogleBenchmark(benchmark::State& state) { s_ignoreCheckDefAlloc = true; - mwctst::TestHelper::printTestName("PERFORMANCE TEST"); + bmqtst::TestHelper::printTestName("PERFORMANCE TEST"); // CONSTANTS const int k_NUM_QUEUES = 1; @@ -419,8 +418,8 @@ static void testN1_performance_GoogleBenchmark(benchmark::State& state) &performanceTestQueueCreator, bdlf::PlaceHolders::_3, k_FIXED_QUEUE_SIZE), - mwcc::MultiQueueThreadPoolUtil::defaultCreator(), - mwcc::MultiQueueThreadPoolUtil::noOpResetter(), + bmqc::MultiQueueThreadPoolUtil::defaultCreator(), + bmqc::MultiQueueThreadPoolUtil::noOpResetter(), s_allocator_p); MQTP mfqtp(config, s_allocator_p); @@ -460,7 +459,7 @@ static void testN1_fixedPerformance_GoogleBenchmark(benchmark::State& state) { s_ignoreCheckDefAlloc = true; - mwctst::TestHelper::printTestName("FIXED PERFORMANCE TEST"); + bmqtst::TestHelper::printTestName("FIXED PERFORMANCE TEST"); // CONSTANTS const int k_NUM_ITERATIONS = 10 * 1000 * 1000; // 10 M @@ -510,7 +509,7 @@ static void testN1_fixedPerformance_GoogleBenchmark(benchmark::State& state) int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -533,7 +532,7 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } // ---------------------------------------------------------------------------- diff --git a/src/groups/mwc/mwcc/mwcc_orderedhashmap.cpp b/src/groups/bmq/bmqc/bmqc_orderedhashmap.cpp similarity index 93% rename from src/groups/mwc/mwcc/mwcc_orderedhashmap.cpp rename to src/groups/bmq/bmqc/bmqc_orderedhashmap.cpp index e859e1921..3182a733c 100644 --- a/src/groups/mwc/mwcc/mwcc_orderedhashmap.cpp +++ b/src/groups/bmq/bmqc/bmqc_orderedhashmap.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_orderedhashmap.cpp -*-C++-*- -#include +// bmqc_orderedhashmap.cpp -*-C++-*- +#include -#include +#include // BDE #include namespace BloombergLP { -namespace mwcc { +namespace bmqc { // -------------------------------- // struct OrderedHashMap_ImpDetails diff --git a/src/groups/mwc/mwcc/mwcc_orderedhashmap.h b/src/groups/bmq/bmqc/bmqc_orderedhashmap.h similarity index 98% rename from src/groups/mwc/mwcc/mwcc_orderedhashmap.h rename to src/groups/bmq/bmqc/bmqc_orderedhashmap.h index c8dc2c965..6acb6ae58 100644 --- a/src/groups/mwc/mwcc/mwcc_orderedhashmap.h +++ b/src/groups/bmq/bmqc/bmqc_orderedhashmap.h @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_orderedhashmap.h -*-C++-*- -#ifndef INCLUDED_MWCC_ORDEREDHASHMAP -#define INCLUDED_MWCC_ORDEREDHASHMAP +// bmqc_orderedhashmap.h -*-C++-*- +#ifndef INCLUDED_BMQC_ORDEREDHASHMAP +#define INCLUDED_BMQC_ORDEREDHASHMAP //@PURPOSE: Provide a hash table with predictive iteration order. // //@CLASSES: -// mwcc::OrderedHashMap : Hash table with predictive iteration order. +// bmqc::OrderedHashMap : Hash table with predictive iteration order. // //@SEE_ALSO: bsl::unordered_map // -//@DESCRIPTION: 'mwcc::OrderedHashMap' provides an associative container with +//@DESCRIPTION: 'bmqc::OrderedHashMap' provides an associative container with // constant time performance for basic operations (insertion, deletion and // lookup), along with predictive iteration order. The iteration order is the // order in which keys are inserted in the container. Note that this feature @@ -56,7 +56,7 @@ // the newly inserted element. Following snippet explains it: // //.. -// typedef mwcc::OrderedHashMap MyMapType; +// typedef bmqc::OrderedHashMap MyMapType; // typedef MyMapType::iterator IterType; // // IterType endIt = map.end(); @@ -116,7 +116,7 @@ namespace BloombergLP { -namespace mwcc { +namespace bmqc { // FORWARD DECLARATION template @@ -126,7 +126,7 @@ class OrderedHashMap; // struct OrderedHashMap_ImpDetails // ================================ -/// PRIVATE CLASS. For use only by `mwcc::OrderedHashMap` implementation. +/// PRIVATE CLASS. For use only by `bmqc::OrderedHashMap` implementation. struct OrderedHashMap_ImpDetails { /// Return the next prime number greater-than or equal to the specified /// `n` in the increasing sequence of primes chosen to disperse hash @@ -143,7 +143,7 @@ struct OrderedHashMap_ImpDetails { // class OrderedHashMap_Link // ========================= -/// PRIVATE CLASS. For use only by `mwcc::OrderedHashMap` implementation. +/// PRIVATE CLASS. For use only by `bmqc::OrderedHashMap` implementation. /// Each node is part of two lists, the sequential list (which provides /// insertion order iteration feature), and the bucket list (which provides /// open hashing feature in case of collision). @@ -188,7 +188,7 @@ class OrderedHashMap_Link { // class OrderedHashMap_Node // ========================= -/// PRIVATE CLASS TEMPLATE. For use only by `mwcc::OrderedHashMap` +/// PRIVATE CLASS TEMPLATE. For use only by `bmqc::OrderedHashMap` /// implementation. template class OrderedHashMap_Node : public OrderedHashMap_Link { @@ -221,7 +221,7 @@ class OrderedHashMap_Node : public OrderedHashMap_Link { // struct OrderedHashMap_Bucket // ============= -/// PRIVATE CLASS. For use only by `mwcc::OrderedHashMap` implementation. +/// PRIVATE CLASS. For use only by `bmqc::OrderedHashMap` implementation. struct OrderedHashMap_Bucket { typedef OrderedHashMap_Link Link; @@ -245,7 +245,7 @@ struct OrderedHashMap_Bucket { // class OrderedHashMap_SequentialIterator // ======================================= -/// PRIVATE CLASS TEMPLATE. For use only by `mwcc::OrderedHashMap` +/// PRIVATE CLASS TEMPLATE. For use only by `bmqc::OrderedHashMap` /// implementation. template class OrderedHashMap_SequentialIterator { @@ -363,7 +363,7 @@ bool operator!=(const OrderedHashMap_SequentialIterator& lhs, // class OrderedHashMap_BucketIterator // =================================== -/// PRIVATE CLASS TEMPLATE. For use only by `mwcc::OrderedHashMap` +/// PRIVATE CLASS TEMPLATE. For use only by `bmqc::OrderedHashMap` /// implementation. template class OrderedHashMap_BucketIterator { diff --git a/src/groups/mwc/mwcc/mwcc_orderedhashmap.t.cpp b/src/groups/bmq/bmqc/bmqc_orderedhashmap.t.cpp similarity index 90% rename from src/groups/mwc/mwcc/mwcc_orderedhashmap.t.cpp rename to src/groups/bmq/bmqc/bmqc_orderedhashmap.t.cpp index 33a744cc1..d276f2111 100644 --- a/src/groups/mwc/mwcc/mwcc_orderedhashmap.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_orderedhashmap.t.cpp @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_orderedhashmap.t.cpp -*-C++-*- -#include +// bmqc_orderedhashmap.t.cpp -*-C++-*- +#include // BDE #include @@ -29,7 +29,7 @@ #include // TEST DRIVER -#include +#include // BENCHMARKING LIBRARY #ifdef BSLS_PLATFORM_OS_LINUX @@ -118,10 +118,10 @@ static void test1_breathingTest() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // Breathing test - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef MyMapType::const_iterator ConstIterType; @@ -173,7 +173,7 @@ static void test2_impDetails_nextPrime() // OrderedHashMap_ImpDetails::nextPrime // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("IMP DETAILS - NEXT PRIME"); + bmqtst::TestHelper::printTestName("IMP DETAILS - NEXT PRIME"); const size_t k_MAX_ITERATIONS = 1000; @@ -184,7 +184,7 @@ static void test2_impDetails_nextPrime() size_t i = 0; while (i++ < k_MAX_ITERATIONS) { prevPrime = currPrime; - currPrime = mwcc::OrderedHashMap_ImpDetails::nextPrime(currPrime + 1); + currPrime = bmqc::OrderedHashMap_ImpDetails::nextPrime(currPrime + 1); if (currPrime == 0) { lastPrime = currPrime; break; // RETURN @@ -202,9 +202,9 @@ static void test3_insert() // INSERT // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("INSERT"); + bmqtst::TestHelper::printTestName("INSERT"); - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef MyMapType::const_iterator ConstIterType; typedef bsl::pair RcType; @@ -272,10 +272,10 @@ static void test4_rinsert() // RINSERT // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("RINSERT"); + bmqtst::TestHelper::printTestName("RINSERT"); // rinsert() test - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef MyMapType::const_iterator ConstIterType; typedef bsl::pair RcType; @@ -342,10 +342,10 @@ static void test5_insertEraseInsert() // INSERT ERASE INSERT // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("INSERT ERASE INSERT"); + bmqtst::TestHelper::printTestName("INSERT ERASE INSERT"); // insert/erase/insert test - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef MyMapType::const_iterator ConstIterType; typedef bsl::pair RcType; @@ -447,10 +447,10 @@ static void test6_clear() // CLEAR // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLEAR"); + bmqtst::TestHelper::printTestName("CLEAR"); // clear - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef bsl::pair RcType; @@ -493,10 +493,10 @@ static void test7_erase() // ERASE // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ERASE"); + bmqtst::TestHelper::printTestName("ERASE"); // erase - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef MyMapType::const_iterator ConstIterType; typedef bsl::pair RcType; @@ -531,10 +531,10 @@ static void test8_eraseClear() // Erase/clear invoke destructors of keys and values. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ERASE CLEAR"); + bmqtst::TestHelper::printTestName("ERASE CLEAR"); // Erase/clear invoke destructors of keys and values - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef bsl::pair RcType; @@ -573,10 +573,10 @@ static void test9_insertFailure() // fails. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("INSERT FAILURE"); + bmqtst::TestHelper::printTestName("INSERT FAILURE"); // insert (key, value) already present in the container - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef bsl::pair RcType; @@ -606,10 +606,10 @@ static void test10_erasureIterator() // Use iterator returned by erase(const_iterator) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ERASURE ITERATOR"); + bmqtst::TestHelper::printTestName("ERASURE ITERATOR"); // Use iterator returned by erase(const_iterator) - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef bsl::pair RcType; @@ -648,14 +648,14 @@ static void test11_copyConstructor() // Copy constructor. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("COPY CONSTRUCTOR"); + bmqtst::TestHelper::printTestName("COPY CONSTRUCTOR"); // Copy constructor // Create object 1. Insert elements. // Copy construct object 2 from object 1. // Assert that object 2 has same elements etc. - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef MyMapType::const_iterator ConstIterType; typedef bsl::pair RcType; @@ -700,7 +700,7 @@ static void test12_assignmentOperator() // Assignment operator. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ASSIGNMENT OPERATOR"); + bmqtst::TestHelper::printTestName("ASSIGNMENT OPERATOR"); // Assignment operator // Create object 1. Insert elements. @@ -708,7 +708,7 @@ static void test12_assignmentOperator() // object 2 = object 1 // Assert that object 2 has same elements as object 1 etc. - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef MyMapType::const_iterator ConstIterType; typedef bsl::pair RcType; @@ -762,10 +762,10 @@ static void test13_previousEndIterator() // pointing to the newly inserted element. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PREVIOUS END ITERATOR"); + bmqtst::TestHelper::printTestName("PREVIOUS END ITERATOR"); // is pointing to the newly inserted element. - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef MyMapType::const_iterator ConstIterType; @@ -826,14 +826,14 @@ static void test14_localIterator() // Testing {const_}local_iterator. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LOCAL ITERATOR"); + bmqtst::TestHelper::printTestName("LOCAL ITERATOR"); // Note that we choose key's type to be an int, and we specify an // identify hash function. With this knowledge and the bucket count // of the hash table, we specify such keys such that they will all map // to the same bucket in the table. - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::local_iterator LocalIterType; typedef MyMapType::const_local_iterator ConstLocalIterType; @@ -901,10 +901,10 @@ static void test15_eraseRange() // erase(const_iterator first, const_iterator last) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ERASE RANGE"); + bmqtst::TestHelper::printTestName("ERASE RANGE"); // erase - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef MyMapType::const_iterator ConstIterType; typedef bsl::pair RcType; @@ -954,7 +954,7 @@ static void testN1_insertPerformanceOrdered() // INSERT PERFORMANCE // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("INSERT PERFORMANCE"); + bmqtst::TestHelper::printTestName("INSERT PERFORMANCE"); // Performance comparison of insert() with bsl::unordered_map const size_t k_NUM_ELEMENTS = 5000000; @@ -962,7 +962,7 @@ static void testN1_insertPerformanceOrdered() { // OrderedHashMap - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; MyMapType map(k_NUM_ELEMENTS, s_allocator_p); @@ -982,7 +982,7 @@ static void testN1_insertPerformanceUnordered() // INSERT PERFORMANCE // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("INSERT PERFORMANCE"); + bmqtst::TestHelper::printTestName("INSERT PERFORMANCE"); // Performance comparison of insert() with bsl::unordered_map const size_t k_NUM_ELEMENTS = 5000000; @@ -1009,7 +1009,7 @@ BSLA_MAYBE_UNUSED static void testN2_erasePerformanceOrdered() // ERASE PERFORMANCE // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ERASE"); + bmqtst::TestHelper::printTestName("ERASE"); // Performance comparison of erase() with bsl::unordered_map @@ -1018,7 +1018,7 @@ BSLA_MAYBE_UNUSED static void testN2_erasePerformanceOrdered() const size_t k_NUM_ELEMENTS = 5000000; bsls::Types::Int64 ohmTime; { - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef bsl::pair RcType; @@ -1047,7 +1047,7 @@ BSLA_MAYBE_UNUSED static void testN2_erasePerformanceUnordered() // ERASE PERFORMANCE // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ERASE"); + bmqtst::TestHelper::printTestName("ERASE"); // Performance comparison of erase() with bsl::unordered_map @@ -1085,13 +1085,13 @@ BSLA_MAYBE_UNUSED static void testN3_profile() // PROFILE // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PROFILE"); + bmqtst::TestHelper::printTestName("PROFILE"); // A simple snippet which inserts elements in the ordered hash map. // This case can be used to profile the component. const size_t k_NUM_ELEMENTS = 5000000; - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; MyMapType map(k_NUM_ELEMENTS, s_allocator_p); // Insert elements. @@ -1106,7 +1106,7 @@ BSLA_MAYBE_UNUSED static void testN3_profile() static void testN1_insertPerformanceUnordered_GoogleBenchmark(benchmark::State& state) { - mwctst::TestHelper::printTestName("INSERT PERFORMANCE"); + bmqtst::TestHelper::printTestName("INSERT PERFORMANCE"); // Performance comparison of insert() with bsl::unordered_map { @@ -1124,12 +1124,12 @@ testN1_insertPerformanceUnordered_GoogleBenchmark(benchmark::State& state) static void testN1_insertPerformanceOrdered_GoogleBenchmark(benchmark::State& state) { - mwctst::TestHelper::printTestName("INSERT PERFORMANCE"); + bmqtst::TestHelper::printTestName("INSERT PERFORMANCE"); // Performance comparison of insert() with bsl::unordered_map { // OrderedHashMap - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; MyMapType map(static_cast(state.range(0)), s_allocator_p); for (auto _ : state) { @@ -1168,12 +1168,12 @@ testN2_erasePerformanceUnordered_GoogleBenchmark(benchmark::State& state) static void testN2_erasePerformanceOrdered_GoogleBenchmark(benchmark::State& state) { - mwctst::TestHelper::printTestName("ERASE"); + bmqtst::TestHelper::printTestName("ERASE"); // Performance comparison of erase() with bsl::unordered_map // Insert elements, iterate and erase while iterating - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; typedef MyMapType::iterator IterType; typedef bsl::pair RcType; @@ -1200,12 +1200,12 @@ static void testN3_profile_GoogleBenchmark(benchmark::State& state) // PROFILE // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PROFILE"); + bmqtst::TestHelper::printTestName("PROFILE"); // A simple snippet which inserts elements in the ordered hash map. // This case can be used to profile the component. - typedef mwcc::OrderedHashMap MyMapType; + typedef bmqc::OrderedHashMap MyMapType; MyMapType map(static_cast(state.range(0)), s_allocator_p); // Insert elements. @@ -1225,7 +1225,7 @@ int main(int argc, char* argv[]) // One time initialization bsls::TimeUtil::initialize(); - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -1245,30 +1245,30 @@ int main(int argc, char* argv[]) case 2: test2_impDetails_nextPrime(); break; case 1: test1_breathingTest(); break; case -1: - MWC_BENCHMARK_WITH_ARGS(testN1_insertPerformanceOrdered, - RangeMultiplier(10) - ->Range(10, 5000000) - ->Unit(benchmark::kMillisecond)); - MWC_BENCHMARK_WITH_ARGS(testN1_insertPerformanceUnordered, - RangeMultiplier(10) - ->Range(10, 5000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN1_insertPerformanceOrdered, + RangeMultiplier(10) + ->Range(10, 5000000) + ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN1_insertPerformanceUnordered, + RangeMultiplier(10) + ->Range(10, 5000000) + ->Unit(benchmark::kMillisecond)); break; case -2: - MWC_BENCHMARK_WITH_ARGS(testN2_erasePerformanceUnordered, - RangeMultiplier(10) - ->Range(100, 50000000) - ->Unit(benchmark::kMillisecond)); - MWC_BENCHMARK_WITH_ARGS(testN2_erasePerformanceOrdered, - RangeMultiplier(10) - ->Range(100, 50000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN2_erasePerformanceUnordered, + RangeMultiplier(10) + ->Range(100, 50000000) + ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN2_erasePerformanceOrdered, + RangeMultiplier(10) + ->Range(100, 50000000) + ->Unit(benchmark::kMillisecond)); break; case -3: - MWC_BENCHMARK_WITH_ARGS(testN3_profile, - RangeMultiplier(10) - ->Range(10, 5000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN3_profile, + RangeMultiplier(10) + ->Range(10, 5000000) + ->Unit(benchmark::kMillisecond)); break; default: { cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; @@ -1282,5 +1282,5 @@ int main(int argc, char* argv[]) } #endif - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcc/mwcc_orderedhashmapwithhistory.cpp b/src/groups/bmq/bmqc/bmqc_orderedhashmapwithhistory.cpp similarity index 83% rename from src/groups/mwc/mwcc/mwcc_orderedhashmapwithhistory.cpp rename to src/groups/bmq/bmqc/bmqc_orderedhashmapwithhistory.cpp index 97fc20c47..798401ce4 100644 --- a/src/groups/mwc/mwcc/mwcc_orderedhashmapwithhistory.cpp +++ b/src/groups/bmq/bmqc/bmqc_orderedhashmapwithhistory.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_orderedhashmapwithhistory.cpp -*-C++-*- -#include +// bmqc_orderedhashmapwithhistory.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcc { +namespace bmqc { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcc/mwcc_orderedhashmapwithhistory.h b/src/groups/bmq/bmqc/bmqc_orderedhashmapwithhistory.h similarity index 96% rename from src/groups/mwc/mwcc/mwcc_orderedhashmapwithhistory.h rename to src/groups/bmq/bmqc/bmqc_orderedhashmapwithhistory.h index bf3087260..36daf372c 100644 --- a/src/groups/mwc/mwcc/mwcc_orderedhashmapwithhistory.h +++ b/src/groups/bmq/bmqc/bmqc_orderedhashmapwithhistory.h @@ -13,21 +13,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_orderedhashmapwithhistory.h -*-C++-*- -#ifndef INCLUDED_MWCC_ORDEREDHASHMAPWITHHISTORY -#define INCLUDED_MWCC_ORDEREDHASHMAPWITHHISTORY +// bmqc_orderedhashmapwithhistory.h -*-C++-*- +#ifndef INCLUDED_BMQC_ORDEREDHASHMAPWITHHISTORY +#define INCLUDED_BMQC_ORDEREDHASHMAPWITHHISTORY //@PURPOSE: Provide a hash set with predictive iteration order and a history of // erased items. // //@CLASSES: -// mwcc::OrderedHashMapWithHistory : Hash table with predictive iteration +// bmqc::OrderedHashMapWithHistory : Hash table with predictive iteration // order and history. // -//@SEE_ALSO: mwcc::OrderedHashMap +//@SEE_ALSO: bmqc::OrderedHashMap // -//@DESCRIPTION: 'mwcc::OrderedHashMapWithHistory' is a wrapper around -// 'mwcc::OrderedHashMap' which adds insertion time in nanoseconds as part of +//@DESCRIPTION: 'bmqc::OrderedHashMapWithHistory' is a wrapper around +// 'bmqc::OrderedHashMap' which adds insertion time in nanoseconds as part of // the value. It keeps history of erased keys until called 'gc' outside of // specified time window. For optimization (at expense of extra memory), it // tracks the history from the moment an item is inserted. That means, there @@ -37,9 +37,7 @@ // component adds 3) and exposes new iterator over valid, not-erased items. // -// MWC - -#include +#include // BDE #include @@ -53,13 +51,13 @@ #include namespace BloombergLP { -namespace mwcc { +namespace bmqc { // ======================================== // class OrderedHashMapWithHistory_Iterator // ======================================== -/// For use only by `mwcc::OrderedHashMapWithHistory` implementation. +/// For use only by `bmqc::OrderedHashMapWithHistory` implementation. /// This iterator iterates un-expired (not historical) records. template class OrderedHashMapWithHistory_Iterator { @@ -356,6 +354,9 @@ class OrderedHashMapWithHistory { /// Return the number of elements in this container. size_t size() const; + + /// Return the number of elements in this container's history. + size_t historySize() const; }; // ============================================================================ @@ -763,6 +764,13 @@ OrderedHashMapWithHistory::size() const return d_impl.size() - d_historySize; } +template +inline size_t +OrderedHashMapWithHistory::historySize() const +{ + return d_historySize; +} + } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcc/mwcc_orderedhashmapwithhistory.t.cpp b/src/groups/bmq/bmqc/bmqc_orderedhashmapwithhistory.t.cpp similarity index 93% rename from src/groups/mwc/mwcc/mwcc_orderedhashmapwithhistory.t.cpp rename to src/groups/bmq/bmqc/bmqc_orderedhashmapwithhistory.t.cpp index 46d448a16..e180113e1 100644 --- a/src/groups/mwc/mwcc/mwcc_orderedhashmapwithhistory.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_orderedhashmapwithhistory.t.cpp @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_orderedhashmapwithhistory.t.cpp -*-C++-*- -#include +// bmqc_orderedhashmapwithhistory.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; using namespace bsl; -typedef mwcc::OrderedHashMapWithHistory ObjectUnderTest; +typedef bmqc::OrderedHashMapWithHistory ObjectUnderTest; typedef ObjectUnderTest::iterator Iterator; static void setup(ObjectUnderTest& obj, size_t total, int timeout) @@ -63,7 +63,7 @@ static void test1_insert() // Testing: // insert, find, isInHistory, size, isInHistory // - - mwctst::TestHelper::printTestName("HISTORY"); + bmqtst::TestHelper::printTestName("HISTORY"); int timeout = 1; ObjectUnderTest obj(timeout, s_allocator_p); @@ -87,7 +87,7 @@ static void test2_eraseMiddleToEnd() // Testing: // insert, find, isInHistory, size, isInHistory, erase, gc // ------------------------------------------------------------------------ - mwctst::TestHelper::printTestName("ERASE_MIDDLE_TO_END"); + bmqtst::TestHelper::printTestName("ERASE_MIDDLE_TO_END"); int timeout = 1; ObjectUnderTest obj(timeout, s_allocator_p); @@ -141,7 +141,7 @@ static void test3_eraseMiddleToBegin() // insert, find, isInHistory, size, isInHistory, erase, gc // ------------------------------------------------------------------------ - mwctst::TestHelper::printTestName("ERASE_MIDDLE_TO_BEGIN"); + bmqtst::TestHelper::printTestName("ERASE_MIDDLE_TO_BEGIN"); int timeout = 1; ObjectUnderTest obj(timeout, s_allocator_p); @@ -196,7 +196,7 @@ static void test4_gc() // insert, find, isInHistory, size, isInHistory, erase, gc // ------------------------------------------------------------------------ - mwctst::TestHelper::printTestName("ERASE_AND_GC"); + bmqtst::TestHelper::printTestName("ERASE_AND_GC"); int timeout = 1; ObjectUnderTest obj(timeout, s_allocator_p); @@ -266,7 +266,7 @@ static void test5_insertAfterEnd() // end, insert // ------------------------------------------------------------------------ - mwctst::TestHelper::printTestName("INSERT_AFTER_END"); + bmqtst::TestHelper::printTestName("INSERT_AFTER_END"); int timeout = 1; ObjectUnderTest obj(timeout, s_allocator_p); @@ -304,7 +304,7 @@ static void test6_eraseThenGc() // insert, gc, erase // ------------------------------------------------------------------------ - mwctst::TestHelper::printTestName("INSERT_AFTER_END"); + bmqtst::TestHelper::printTestName("INSERT_AFTER_END"); int timeout = 1; ObjectUnderTest obj(timeout, s_allocator_p); @@ -338,7 +338,7 @@ static void test6_eraseThenGc() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -354,5 +354,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcc/mwcc_orderedhashset.cpp b/src/groups/bmq/bmqc/bmqc_orderedhashset.cpp similarity index 84% rename from src/groups/mwc/mwcc/mwcc_orderedhashset.cpp rename to src/groups/bmq/bmqc/bmqc_orderedhashset.cpp index 077633750..355a339dc 100644 --- a/src/groups/mwc/mwcc/mwcc_orderedhashset.cpp +++ b/src/groups/bmq/bmqc/bmqc_orderedhashset.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_orderedhashset.cpp -*-C++-*- -#include +// bmqc_orderedhashset.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcc { +namespace bmqc { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcc/mwcc_orderedhashset.h b/src/groups/bmq/bmqc/bmqc_orderedhashset.h similarity index 69% rename from src/groups/mwc/mwcc/mwcc_orderedhashset.h rename to src/groups/bmq/bmqc/bmqc_orderedhashset.h index 5275f95dd..3eb6ad2fd 100644 --- a/src/groups/mwc/mwcc/mwcc_orderedhashset.h +++ b/src/groups/bmq/bmqc/bmqc_orderedhashset.h @@ -13,31 +13,29 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_orderedhashset.h -*-C++-*- -#ifndef INCLUDED_MWCC_ORDEREDHASHSET -#define INCLUDED_MWCC_ORDEREDHASHSET +// bmqc_orderedhashset.h -*-C++-*- +#ifndef INCLUDED_BMQC_ORDEREDHASHSET +#define INCLUDED_BMQC_ORDEREDHASHSET //@PURPOSE: Provide a hash set with predictive iteration order. // //@CLASSES: -// mwcc::OrderedHashSet : Hash set with predictive iteration order. +// bmqc::OrderedHashSet : Hash set with predictive iteration order. // -//@SEE_ALSO: mwcc::OrderedHashMap +//@SEE_ALSO: bmqc::OrderedHashMap // -//@DESCRIPTION: 'mwcc::OrderedHashSet' is a specialization of -// 'mwcc::OrderedHashMap' in which key and value are of the same type and the -// same storage. All other features of 'mwcc::OrderedHashMap' are preserved +//@DESCRIPTION: 'bmqc::OrderedHashSet' is a specialization of +// 'bmqc::OrderedHashMap' in which key and value are of the same type and the +// same storage. All other features of 'bmqc::OrderedHashMap' are preserved // -// MWC - -#include +#include // BDE #include // for 'bsl::hash' namespace BloombergLP { -namespace mwcc { +namespace bmqc { /// Pre-C++11 template typedef template > diff --git a/src/groups/mwc/mwcc/mwcc_twokeyhashmap.cpp b/src/groups/bmq/bmqc/bmqc_twokeyhashmap.cpp similarity index 84% rename from src/groups/mwc/mwcc/mwcc_twokeyhashmap.cpp rename to src/groups/bmq/bmqc/bmqc_twokeyhashmap.cpp index 8242ad74f..0802306fe 100644 --- a/src/groups/mwc/mwcc/mwcc_twokeyhashmap.cpp +++ b/src/groups/bmq/bmqc/bmqc_twokeyhashmap.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_twokeyhashmap.cpp -*-C++-*- -#include +// bmqc_twokeyhashmap.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcc { +namespace bmqc { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcc/mwcc_twokeyhashmap.h b/src/groups/bmq/bmqc/bmqc_twokeyhashmap.h similarity index 98% rename from src/groups/mwc/mwcc/mwcc_twokeyhashmap.h rename to src/groups/bmq/bmqc/bmqc_twokeyhashmap.h index 152c5cac0..637ff993c 100644 --- a/src/groups/mwc/mwcc/mwcc_twokeyhashmap.h +++ b/src/groups/bmq/bmqc/bmqc_twokeyhashmap.h @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_twokeyhashmap.h -*-C++-*- -#ifndef INCLUDED_MWCC_TWOKEYHASHMAP -#define INCLUDED_MWCC_TWOKEYHASHMAP +// bmqc_twokeyhashmap.h -*-C++-*- +#ifndef INCLUDED_BMQC_TWOKEYHASHMAP +#define INCLUDED_BMQC_TWOKEYHASHMAP //@PURPOSE: Provide a simple hash map container with two keys. // //@CLASSES: -// mwcc::TwoKeyHashMap: hash map container with two keys -// mwcc::TwoKeyHashMapValue: element of the 'TwoKeyHashMap' container +// bmqc::TwoKeyHashMap: hash map container with two keys +// bmqc::TwoKeyHashMapValue: element of the 'TwoKeyHashMap' container // //@DESCRIPTION: -// This component provides a mechanism, 'mwcc::TwoKeyHashMap', which is an +// This component provides a mechanism, 'bmqc::TwoKeyHashMap', which is an // equivalent to a hash map container but using two keys instead of one. The // 'TwoKeyHashMap' (which we will refer to as the "map") tries to follow the // style of STL containers to the extent that is possible. @@ -34,7 +34,7 @@ // Following is a very simple usage example. First lets create an instance of // 'TwoKeyHashMap' with 2 different types for keys and one type for values: //.. -// typedef mwcc::TwoKeyHashMap TestMap; // TestMap map(&allocator); @@ -132,8 +132,6 @@ //: o if an exception is thrown by an 'eraseByKey1()' or 'eraseByKey2()' //: function, that function has no effects. -// MWC - // BDE #include #include @@ -159,7 +157,7 @@ namespace BloombergLP { -namespace mwcc { +namespace bmqc { template class TwoKeyHashMap; @@ -1038,7 +1036,7 @@ inline TwoKeyHashMap::TwoKeyHashMap( H2(), typename K2Map::key_equal(), basicAllocator) -, d_nodeAllocator(new (*allocator()) bdlma::Pool(sizeof(Node), allocator()), +, d_nodeAllocator(new(*allocator()) bdlma::Pool(sizeof(Node), allocator()), allocator()) { // POSTCONDITIONS @@ -1057,7 +1055,7 @@ inline TwoKeyHashMap::TwoKeyHashMap( H2(), typename K2Map::key_equal(), basicAllocator) -, d_nodeAllocator(new (*allocator()) bdlma::Pool(sizeof(Node), allocator()), +, d_nodeAllocator(new(*allocator()) bdlma::Pool(sizeof(Node), allocator()), allocator()) { // POSTCONDITIONS @@ -1077,7 +1075,7 @@ inline TwoKeyHashMap::TwoKeyHashMap( hash2, typename K2Map::key_equal(), basicAllocator) -, d_nodeAllocator(new (*allocator()) bdlma::Pool(sizeof(Node), allocator()), +, d_nodeAllocator(new(*allocator()) bdlma::Pool(sizeof(Node), allocator()), allocator()) { // POSTCONDITIONS @@ -1096,7 +1094,7 @@ inline TwoKeyHashMap::TwoKeyHashMap( original.d_k2Map.hash_function(), original.d_k2Map.key_eq(), basicAllocator) -, d_nodeAllocator(new (*allocator()) bdlma::Pool(sizeof(Node), allocator()), +, d_nodeAllocator(new(*allocator()) bdlma::Pool(sizeof(Node), allocator()), allocator()) { // free memory on failure @@ -1129,7 +1127,7 @@ inline TwoKeyHashMap::TwoKeyHashMap( H2(), typename K2Map::key_equal(), basicAllocator) -, d_nodeAllocator(new (*allocator()) bdlma::Pool(sizeof(Node), allocator()), +, d_nodeAllocator(new(*allocator()) bdlma::Pool(sizeof(Node), allocator()), allocator()) { if (allocator() == bslmf::MovableRefUtil::access(original).allocator()) { @@ -1621,14 +1619,14 @@ TwoKeyHashMapValue::value() const BSLS_KEYWORD_NOEXCEPT // FREE OPERATORS template inline void -mwcc::swap(TwoKeyHashMap& lhs, +bmqc::swap(TwoKeyHashMap& lhs, TwoKeyHashMap& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); } template -inline bool mwcc::operator==(const TwoKeyHashMap& lhs, +inline bool bmqc::operator==(const TwoKeyHashMap& lhs, const TwoKeyHashMap& rhs) { if (lhs.size() != rhs.size()) { @@ -1648,14 +1646,14 @@ inline bool mwcc::operator==(const TwoKeyHashMap& lhs, } template -inline bool mwcc::operator!=(const TwoKeyHashMap& lhs, +inline bool bmqc::operator!=(const TwoKeyHashMap& lhs, const TwoKeyHashMap& rhs) { return !(lhs == rhs); } template -inline bool mwcc::operator==(const TwoKeyHashMapValue& lhs, +inline bool bmqc::operator==(const TwoKeyHashMapValue& lhs, const TwoKeyHashMapValue& rhs) { return lhs.key1() == rhs.key1() && lhs.key2() == rhs.key2() && @@ -1663,7 +1661,7 @@ inline bool mwcc::operator==(const TwoKeyHashMapValue& lhs, } template -inline bool mwcc::operator!=(const TwoKeyHashMapValue& lhs, +inline bool bmqc::operator!=(const TwoKeyHashMapValue& lhs, const TwoKeyHashMapValue& rhs) { return !(lhs == rhs); diff --git a/src/groups/mwc/mwcc/mwcc_twokeyhashmap.t.cpp b/src/groups/bmq/bmqc/bmqc_twokeyhashmap.t.cpp similarity index 97% rename from src/groups/mwc/mwcc/mwcc_twokeyhashmap.t.cpp rename to src/groups/bmq/bmqc/bmqc_twokeyhashmap.t.cpp index deeae62b7..146820e97 100644 --- a/src/groups/mwc/mwcc/mwcc_twokeyhashmap.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_twokeyhashmap.t.cpp @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcc_twokeyhashmap.t.cpp -*-C++-*- -#include +// bmqc_twokeyhashmap.t.cpp -*-C++-*- +#include // BDE #include // bsl::swap @@ -30,7 +30,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -38,7 +38,7 @@ using namespace BloombergLP; //============================================================================= // TEST PLAN //----------------------------------------------------------------------------- -// The component under test: mwcc_twokeyhashmap +// The component under test: bmqc_twokeyhashmap // //----------------------------------------------------------------------------- // [0] usage example @@ -191,7 +191,7 @@ static void test0_usageExample() bslma::TestAllocator alloc; // create a map - typedef mwcc::TwoKeyHashMap TestMap; + typedef bmqc::TwoKeyHashMap TestMap; TestMap map(&alloc); // add elements @@ -287,12 +287,12 @@ static void test1_basicCreators() // 1. destructor { - mwcc::TwoKeyHashMap map(&alloc); + bmqc::TwoKeyHashMap map(&alloc); } // 2. default constructor { - mwcc::TwoKeyHashMap, TestHasher > + bmqc::TwoKeyHashMap, TestHasher > map(&alloc); ASSERT_EQ(map.empty(), true); @@ -305,7 +305,7 @@ static void test1_basicCreators() // 3. one-hasher constructor { - mwcc::TwoKeyHashMap, TestHasher > + bmqc::TwoKeyHashMap, TestHasher > map(TestHasher(1), &alloc); ASSERT_EQ(map.empty(), true); @@ -318,7 +318,7 @@ static void test1_basicCreators() // 4. two-hasher constructor { - mwcc::TwoKeyHashMap, TestHasher > + bmqc::TwoKeyHashMap, TestHasher > map(TestHasher(1), TestHasher(2), &alloc); ASSERT_EQ(map.empty(), true); @@ -362,7 +362,7 @@ static void test2_copyAndMove() // Move assignment operator // ------------------------------------------------------------------------ { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; bslma::TestAllocator alloc; Map original(&alloc); @@ -573,7 +573,7 @@ static void test3_insert() // 1. general case { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; typedef bsl::pair InsertPair; Map map(&alloc); @@ -624,7 +624,7 @@ static void test3_insert() // 2. first key already exists { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; Map map(&alloc); @@ -653,7 +653,7 @@ static void test3_insert() // 3. second key already exists { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; Map map(&alloc); @@ -679,7 +679,7 @@ static void test3_insert() // 4. check exception safety { - typedef mwcc:: + typedef bmqc:: TwoKeyHashMap Map; @@ -797,7 +797,7 @@ static void test4_erase() // erase() // ------------------------------------------------------------------------ { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; bslma::TestAllocator alloc; @@ -1045,7 +1045,7 @@ static void test5_eraseByKey1() // 1. erase by first key { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; Map::iterator it; Map map(&alloc); @@ -1130,7 +1130,7 @@ static void test5_eraseByKey1() // 2. erase by first key, which doesn't exist { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; Map map(&alloc); @@ -1153,7 +1153,7 @@ static void test5_eraseByKey1() // 3. erase by first key, which exists, but throws on comparison { - typedef mwcc::TwoKeyHashMap + typedef bmqc::TwoKeyHashMap Map; Map map(&alloc); @@ -1215,7 +1215,7 @@ static void test6_eraseByKey2() // 1. erase by second key { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; Map::iterator it; Map map(&alloc); @@ -1300,7 +1300,7 @@ static void test6_eraseByKey2() // 2. erase by second key, which doesn't exist { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; Map map(&alloc); @@ -1323,7 +1323,7 @@ static void test6_eraseByKey2() // 3. erase by second key, which exists, but throws on comparison { - typedef mwcc::TwoKeyHashMap + typedef bmqc::TwoKeyHashMap Map; Map map(&alloc); @@ -1369,7 +1369,7 @@ static void test7_clear() // clear() // ------------------------------------------------------------------------ { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; bslma::TestAllocator alloc; Map map(&alloc); @@ -1408,7 +1408,7 @@ static void test8_swap() // swap() // ------------------------------------------------------------------------ { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; bslma::TestAllocator alloc; Map map1(&alloc); @@ -1468,7 +1468,7 @@ static void test9_rangeObservers() // cend() // ------------------------------------------------------------------------ { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; bslma::TestAllocator alloc; Map emptyMap(&alloc); @@ -1681,7 +1681,7 @@ static void test10_findByKey1() // findByKey1() // ------------------------------------------------------------------------ { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; bslma::TestAllocator alloc; Map map(&alloc); @@ -1760,7 +1760,7 @@ static void test11_findByKey2() // findByKey2() // ------------------------------------------------------------------------ { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; bslma::TestAllocator alloc; Map map(&alloc); @@ -1821,7 +1821,7 @@ static void test12_sizeObservers() // size() // ------------------------------------------------------------------------ { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; bslma::TestAllocator alloc; Map map(&alloc); @@ -1875,7 +1875,7 @@ static void test13_equality() // == // ------------------------------------------------------------------------ { - typedef mwcc::TwoKeyHashMap Map; + typedef bmqc::TwoKeyHashMap Map; bslma::TestAllocator alloc; Map map1(&alloc); @@ -1907,7 +1907,7 @@ static void test13_equality() int main(int argc, char** argv) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 13: test13_equality(); break; @@ -1931,5 +1931,5 @@ int main(int argc, char** argv) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcc/doc/mwcc.txt b/src/groups/bmq/bmqc/doc/bmqc.txt similarity index 55% rename from src/groups/mwc/mwcc/doc/mwcc.txt rename to src/groups/bmq/bmqc/doc/bmqc.txt index a998ea3c4..5f2a80eb7 100644 --- a/src/groups/mwc/mwcc/doc/mwcc.txt +++ b/src/groups/bmq/bmqc/doc/bmqc.txt @@ -1,49 +1,49 @@ - mwcc.txt + bmqc.txt @PURPOSE: Provide container vocabulary types. -@MNEMONIC: MiddleWare Core Containers (mwcc) +@MNEMONIC: BlazingMQ Containers (bmqc) @DESCRIPTION: This package provides miscellaneous container vocabulary types to be reused through various applications. /Hierarchical Synopsis /--------------------- -The 'mwcc' package currently has 7 components having 3 level of physical +The 'bmqc' package currently has 7 components having 3 level of physical dependency. The list below shows the hierarchal ordering of the components. .. - 3. mwcc_multiqueuethreadpool - 2. mwcc_monitoredqueue_bdlccfixedqueue - mwcc_monitoredqueue_bdlccsingleconsumerqueue - mwcc_monitoredqueue_bdlccsingleproducerqueue - 1. mwcc_array - mwcc_monitoredqueue - mwcc_orderedhashmap - mwcc_twokeyhashmap + 3. bmqc_multiqueuethreadpool + 2. bmqc_monitoredqueue_bdlccfixedqueue + bmqc_monitoredqueue_bdlccsingleconsumerqueue + bmqc_monitoredqueue_bdlccsingleproducerqueue + 1. bmqc_array + bmqc_monitoredqueue + bmqc_orderedhashmap + bmqc_twokeyhashmap .. /Component Synopsis /------------------ -: 'mwcc_array': +: 'bmqc_array': : Provide a hybrid of static and dynamic array. : -: 'mwcc_monitoredqueue': +: 'bmqc_monitoredqueue': : Provide a queue that monitors its load. : -: 'mwcc_monitoredqueue_bdlccfixedqueue': +: 'bmqc_monitoredqueue_bdlccfixedqueue': : Provide a fixed queue queue that monitors its load. : -: 'mwcc_monitoredqueue_bdlccsingleconsumerqueue': +: 'bmqc_monitoredqueue_bdlccsingleconsumerqueue': : Provide a single consumer queue that monitors its load. : -: 'mwcc_monitoredqueue_bdlccsingleproducerqueue': +: 'bmqc_monitoredqueue_bdlccsingleproducerqueue': : Provide a single producer queue that monitors its load. : -: 'mwcc_multiqueuethreadpool': +: 'bmqc_multiqueuethreadpool': : Provide a set of queues processed by a thread pool. : -: 'mwcc_orderedhashmap': +: 'bmqc_orderedhashmap': : Provide a hash table with predictive iteration order. : -: 'mwcc_twokeyhashmap': +: 'bmqc_twokeyhashmap': : Provide a simple hash map with two keys. diff --git a/src/groups/bmq/bmqc/package/bmqc.dep b/src/groups/bmq/bmqc/package/bmqc.dep new file mode 100644 index 000000000..193d5c9dd --- /dev/null +++ b/src/groups/bmq/bmqc/package/bmqc.dep @@ -0,0 +1,2 @@ +bmqscm +bmqu diff --git a/src/groups/bmq/bmqc/package/bmqc.mem b/src/groups/bmq/bmqc/package/bmqc.mem new file mode 100644 index 000000000..6a50e3e3f --- /dev/null +++ b/src/groups/bmq/bmqc/package/bmqc.mem @@ -0,0 +1,10 @@ +bmqc_array +bmqc_monitoredqueue +bmqc_monitoredqueue_bdlccfixedqueue +bmqc_monitoredqueue_bdlccsingleconsumerqueue +bmqc_monitoredqueue_bdlccsingleproducerqueue +bmqc_multiqueuethreadpool +bmqc_orderedhashmap +bmqc_orderedhashmapwithhistory +bmqc_orderedhashset +bmqc_twokeyhashmap diff --git a/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.cpp b/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.cpp index fa953a8cc..b88ef3d47 100644 --- a/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.cpp +++ b/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.cpp @@ -82,6 +82,13 @@ void SimpleEvaluator::parse(const bsl::string& expression, context.d_numProperties = 0; context.d_os.reset(); + if (expression.length() > k_MAX_EXPRESSION_LENGTH) { + context.d_os << "expression is too long (" << expression.length() + << "), max allowed length: " << k_MAX_EXPRESSION_LENGTH; + context.d_lastError = ErrorType::e_TOO_LONG; + return; // RETURN + } + bsl::istringstream is(expression, context.d_allocator); SimpleEvaluatorScanner scanner; scanner.switch_streams(&is, &context.d_os); @@ -90,28 +97,27 @@ void SimpleEvaluator::parse(const bsl::string& expression, if (parser.parse() != 0) { context.d_lastError = ErrorType::e_SYNTAX; - return; // RETURN } if (context.d_numOperators > k_MAX_OPERATORS) { - context.d_os << "too many operators"; + context.d_os << "too many operators (" << context.d_numOperators + << "), max allowed operators: " << k_MAX_OPERATORS; context.d_lastError = ErrorType::e_TOO_COMPLEX; - return; // RETURN } if (context.d_numProperties == 0) { context.d_os << "expression does not use any properties"; context.d_lastError = ErrorType::e_NO_PROPERTIES; - return; // RETURN } if (context.d_numProperties > k_MAX_PROPERTIES) { - context.d_os << "expression uses too many properties"; + context.d_os << "expression uses too many properties (" + << context.d_numProperties + << "), max allowed properties: " << k_MAX_PROPERTIES; context.d_lastError = ErrorType::e_TOO_COMPLEX; - return; // RETURN } } @@ -204,8 +210,8 @@ SimpleEvaluator::IntegerLiteral::evaluate(EvaluationContext& context) const // class SimpleEvaluator::BooleanLiteral // ------------------------------------- -bdld::Datum -SimpleEvaluator::BooleanLiteral::evaluate(EvaluationContext& context) const +bdld::Datum SimpleEvaluator::BooleanLiteral::evaluate( + BSLS_ANNOTATION_UNUSED EvaluationContext& context) const { return bdld::Datum::createBoolean(d_value); } diff --git a/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.h b/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.h index 1a071ced6..2362b340b 100644 --- a/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.h +++ b/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.h @@ -66,8 +66,7 @@ #include #include -// MWC -#include +#include namespace BloombergLP { @@ -79,17 +78,25 @@ class EvaluationContext; struct ErrorType { enum Enum { - e_OK = 0 // no error - , + /// no error + e_OK = 0, + e_COMPILATION_FIRST = -100, - e_SYNTAX = -100 // syntax error - , - e_NO_PROPERTIES = -101 // expression does not use any property - , - e_TOO_COMPLEX = -102 // too many properties - // or operators in expression - , - e_COMPILATION_LAST = -102, + + /// syntax error + e_SYNTAX = -100, + + /// expression does not use any property + e_NO_PROPERTIES = -101, + + /// too many properties or operators in expression + e_TOO_COMPLEX = -102, + + /// expression string is too long + e_TOO_LONG = -103, + + e_COMPILATION_LAST = -103, + e_EVALUATION_FIRST = -1, e_NAME = -1, e_TYPE = -2, @@ -492,10 +499,14 @@ class SimpleEvaluator { public: // PUBLIC CONSTANTS enum { + /// The maximum length of an expression string. + k_MAX_EXPRESSION_LENGTH = 128, + /// The maximum number of operators allowed in a single expression. - k_MAX_OPERATORS = 10, + k_MAX_OPERATORS = 10, + + /// The maximum number of properties allowed in a single expression. k_MAX_PROPERTIES = 10 - // The maximum number of properties allowed in a single expression. }; // CREATORS @@ -583,7 +594,7 @@ class CompilationContext { ErrorType::Enum d_lastError; // If `d_lastError` is not zero, contains a description of the error. - mwcu::MemOutStream d_os; + bmqu::MemOutStream d_os; // The resulting AST, if `d_validationOnly` is set to `false`. ExpressionPtr d_expression; @@ -706,19 +717,36 @@ class EvaluationContext { inline const char* ErrorType::toString(ErrorType::Enum value) { switch (value) { - case 0: return ""; // RETURN - case bmqeval::ErrorType::e_SYNTAX: return "syntax error"; // RETURN - case bmqeval::ErrorType::e_TOO_COMPLEX: - return "subscription expression is too complex"; // RETURN - case bmqeval::ErrorType::e_NO_PROPERTIES: + case bmqeval::ErrorType::e_OK: { + return ""; // RETURN + } + case bmqeval::ErrorType::e_SYNTAX: { + return "syntax error"; // RETURN + } + case bmqeval::ErrorType::e_NO_PROPERTIES: { return "expression does not use any property"; // RETURN - case bmqeval::ErrorType::e_NAME: + } + case bmqeval::ErrorType::e_TOO_COMPLEX: { + return "subscription expression is too complex"; // RETURN + } + case bmqeval::ErrorType::e_TOO_LONG: { + return "subscription expression is too long"; // RETURN + } + case bmqeval::ErrorType::e_NAME: { return "undefined name in subscription expression"; // RETURN - case bmqeval::ErrorType::e_TYPE: + } + case bmqeval::ErrorType::e_TYPE: { return "type error in expression"; // RETURN - case bmqeval::ErrorType::e_BINARY: + } + case bmqeval::ErrorType::e_BINARY: { return "binary properties are not supported"; // RETURN - default: return "unknown error"; // RETURN + } + case bmqeval::ErrorType::e_UNDEFINED: { + return "undefined error"; // RETURN + } + default: { + return "unknown error"; // RETURN + } } } diff --git a/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.t.cpp b/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.t.cpp index 0bb8048e9..307c585cd 100644 --- a/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.t.cpp +++ b/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.t.cpp @@ -26,7 +26,7 @@ #endif // TEST DRIVER -#include +#include #include #include @@ -61,9 +61,9 @@ class MockPropertiesReader : public PropertiesReader { // MANIPULATORS /// Return a `bdld::Datum` object with value for the specified `name`. - /// Use the specified `allocator` for any memory allocation. - virtual bdld::Datum get(const bsl::string& name, - bslma::Allocator* allocator) + /// The `bslma::Allocator*` argument is unused. + bdld::Datum get(const bsl::string& name, + bslma::Allocator*) BSLS_KEYWORD_OVERRIDE { bsl::unordered_map::const_iterator iter = d_map.find(name); @@ -79,7 +79,7 @@ class MockPropertiesReader : public PropertiesReader { #ifdef BSLS_PLATFORM_OS_LINUX static void testN1_SimpleEvaluator_GoogleBenchmark(benchmark::State& state) { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK: SimpleEvaluator"); + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK: SimpleEvaluator"); bdlma::LocalSequentialAllocator<2048> localAllocator; MockPropertiesReader reader(&localAllocator); @@ -102,7 +102,7 @@ static void testN1_SimpleEvaluator_GoogleBenchmark(benchmark::State& state) #else static void testN1_SimpleEvaluator() { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK: SimpleEvaluator"); + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK: SimpleEvaluator"); PV("GoogleBenchmark is not supported on this platform, skipping...") } #endif @@ -113,7 +113,7 @@ static void testN1_SimpleEvaluator() static bsl::string makeTooManyOperators() { - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); for (size_t i = 0; i < SimpleEvaluator::k_MAX_OPERATORS + 1; ++i) { os << "!"; @@ -124,6 +124,30 @@ static bsl::string makeTooManyOperators() return os.str(); } +static bsl::string makeTooLongExpression() +{ + bmqu::MemOutStream os(s_allocator_p); + + // Note that we want to create `k_STACK_SIZE` nested NOT objects in AST, + // and when we call destructor chain for all these objects, we'll need + // much more memory on a stack, since each destructor address is not a + // single byte, and also we need to call shared_ptr and Not destructors in + // pairs. But the initial guess of `k_STACK_SIZE` is more than sufficient + // to cause segfault if this case is not handled properly. + const size_t k_STACK_SIZE = 1024 * 1024; + ASSERT(SimpleEvaluator::k_MAX_EXPRESSION_LENGTH < k_STACK_SIZE); + + for (size_t i = 0; i < k_STACK_SIZE; i += 16) { + // Combining `!` and `~` differently in case we want to introduce + // "NOT" optimization one day (remove double sequential "NOTs") + os << "!!!!~~~~!~!~!!~~"; + } + + os << "x"; + + return os.str(); +} + static void test1_compilationErrors() { struct TestParameters { @@ -139,10 +163,13 @@ static void test1_compilationErrors() "syntax error, unexpected invalid character at offset 3"}, {makeTooManyOperators(), ErrorType::e_TOO_COMPLEX, - "too many operators"}, + "too many operators (12), max allowed operators: 10"}, {"true && true", ErrorType::e_NO_PROPERTIES, "expression does not use any properties"}, + {makeTooLongExpression(), + ErrorType::e_TOO_LONG, + "expression is too long (1048577), max allowed length: 128"}, // only C-style operator variants supported {"val = 42", @@ -157,6 +184,27 @@ static void test1_compilationErrors() {"val <> 42", ErrorType::e_SYNTAX, "syntax error, unexpected > at offset 5"}, + + // unsupported_ints + {"i_0 != 9223372036854775808", + ErrorType::e_SYNTAX, + "integer overflow at offset 7"}, // 2 ** 63 + {"i_0 != -170141183460469231731687303715884105728", + ErrorType::e_SYNTAX, + "integer overflow at offset 7"}, // -(2 ** 127) + {"i_0 != 170141183460469231731687303715884105727", + ErrorType::e_SYNTAX, + "integer overflow at offset 7"}, // 2 ** 127 - 1 + {"i_0 != " + "-5789604461865809771178549250434395392663499233282028201972879200395" + "6564819968", + ErrorType::e_SYNTAX, + "integer overflow at offset 7"}, // -(2 ** 255) + {"i_0 != " + "57896044618658097711785492504343953926634992332820282019728792003956" + "564819967", + ErrorType::e_SYNTAX, + "integer overflow at offset 7"}, // 2 ** 255 - 1 }; const TestParameters* testParametersEnd = testParameters + sizeof(testParameters) / @@ -234,6 +282,42 @@ static void test2_propertyNames() {"aaa_111BBBaaa222__BBBaaa3_3_3BBB > 0", true}, {"B_a_1_B_a_2_B_a_3_B_a_4_B_a_5_B_ > 0", true}, + // letters + dot + {"name. > 0", true}, + {"NA.ME > 0", true}, + {"Na.me. > 0", true}, + {"name.Name > 0", true}, + {"Name.Name. > 0", true}, + {"n. > 0", true}, + {"N. > 0", true}, + {"aB.aB..aB...aB....aB..... > 0", true}, + {"aaa.BBBaaa..BBBaaa...BBBaaa > 0", true}, + {"B.a.B.a.B.a.B.a.B.a.B.a.B.a. > 0", true}, + + // letters + digits + dots + {"n1a2m3e4. > 0", true}, + {"N1A2.M3E4 > 0", true}, + {"N1a2.m3e4. > 0", true}, + {"n1a2m3e4.N5a6m7e8 > 0", true}, + {"N1a2m3e4.N5a6m7e8. > 0", true}, + {"n0. > 0", true}, + {"N.0 > 0", true}, + {"aB1.aB..2a...B3aB4.... > 0", true}, + {"aaa.111BBBaaa222..BBBaaa3.3.3BBB > 0", true}, + {"B.a.1.B.a.2.B.a.3.B.a.4.B.a.5.B. > 0", true}, + + // letters + digits + dots + underscores + {"n1a2m3e4._ > 0", true}, + {"N1A2.M3E4_ > 0", true}, + {"N1a2_m3e4. > 0", true}, + {"n1a2m3e4_N5a6m7e8. > 0", true}, + {"N1a2m3e4.N5a6m7e8_ > 0", true}, + {"n0_. > 0", true}, + {"N_0. > 0", true}, + {"aB1_aB._2a__.B3aB4..._ > 0", true}, + {"aaa.111BBBaaa222__BBBaaa3.3_3BBB > 0", true}, + {"B.a_1_B.a_2.B_a.3.B.a_4.B_a.5.B. > 0", true}, + // readable examples {"camelCase > 0", true}, {"snake_case > 0", true}, @@ -243,10 +327,11 @@ static void test2_propertyNames() {"firmId > 0", true}, {"TheStandardAndPoor500 > 0", true}, {"SPX_IND > 0", true}, + {"organization.repository > 0", true}, // all available characters - {"abcdefghijklmnopqrstuvwxyz_0123456789 > 0", true}, - {"ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789 > 0", true}, + {"abcdefghijklmnopqrstuvwxyz_.0123456789 > 0", true}, + {"ABCDEFGHIJKLMNOPQRSTUVWXYZ_.0123456789 > 0", true}, // negative examples {"0name > 0", false}, @@ -259,6 +344,13 @@ static void test2_propertyNames() {"_ > 0", false}, {"_11111111111111111111111111111 > 0", false}, {"22222222222222222222222222222_ > 0", false}, + {".nameName > 0", false}, + {"0.NameName > 0", false}, + {".1n > 0", false}, + {"1.N > 0", false}, + {". > 0", false}, + {".11111111111111111111111111111 > 0", false}, + {"22222222222222222222222222222. > 0", false}, }; const TestParameters* testParametersEnd = testParameters + sizeof(testParameters) / @@ -287,7 +379,6 @@ static void test3_evaluation() struct TestParameters { const char* expression; bool expected; - bool expectCompilationFailure; } testParameters[] = { {"b_true", true}, @@ -427,25 +518,6 @@ static void test3_evaluation() {"i_0 != -9223372036854775807", true}, // -(2 ** 63) + 1 {"i_0 != 9223372036854775807", true}, // 2 ** 63 - 1 {"i_0 != -9223372036854775808", true}, // -(2 ** 63) - - // unsupported_ints - {"i_0 != 9223372036854775808", false, true}, // 2 ** 63 - {"i_0 != -170141183460469231731687303715884105728", - false, - true}, // -(2 ** 127) - {"i_0 != 170141183460469231731687303715884105727", - false, - true}, // 2 ** 127 - 1 - {"i_0 != " - "-5789604461865809771178549250434395392663499233282028201972879200395" - "6564819968", - false, - true}, // -(2 ** 255) - {"i_0 != " - "57896044618658097711785492504343953926634992332820282019728792003956" - "564819967", - false, - true}, // 2 ** 255 - 1 }; const TestParameters* testParametersEnd = testParameters + sizeof(testParameters) / @@ -461,20 +533,12 @@ static void test3_evaluation() ASSERT(!evaluator.isValid()); - if (int rc = evaluator.compile(parameters->expression, - compilationContext)) { - if (!parameters->expectCompilationFailure) { - PV(bsl::string("UNEXPECTED: ") + - compilationContext.lastErrorMessage()); - ASSERT(false); - } + if (evaluator.compile(parameters->expression, compilationContext)) { + PV(bsl::string("UNEXPECTED: ") + + compilationContext.lastErrorMessage()); + ASSERT(false); } else { - if (parameters->expectCompilationFailure) { - PV("Expected compilation failure"); - ASSERT(false); - } - ASSERT(evaluator.isValid()); ASSERT_EQ(evaluator.evaluate(evaluationContext), parameters->expected); @@ -488,14 +552,14 @@ static void test3_evaluation() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: case 3: test3_evaluation(); break; case 2: test2_propertyNames(); break; case 1: test1_compilationErrors(); break; - case -1: MWC_BENCHMARK(testN1_SimpleEvaluator); break; + case -1: BMQTST_BENCHMARK(testN1_SimpleEvaluator); break; default: { cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; s_testStatus = -1; @@ -509,5 +573,5 @@ int main(int argc, char* argv[]) } #endif - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqeval/bmqeval_simpleevaluatorparser.y b/src/groups/bmq/bmqeval/bmqeval_simpleevaluatorparser.y index 1e1f1aaca..cfcd81e15 100644 --- a/src/groups/bmq/bmqeval/bmqeval_simpleevaluatorparser.y +++ b/src/groups/bmq/bmqeval/bmqeval_simpleevaluatorparser.y @@ -112,7 +112,7 @@ expression { $$ = ctx.makeLiteral($1); } | OVERFLOW { - ctx.d_os << " integer overflow at offset " << scanner.lastTokenLocation(); + ctx.d_os << "integer overflow at offset " << scanner.lastTokenLocation(); YYABORT; } | STRING diff --git a/src/groups/bmq/bmqeval/bmqeval_simpleevaluatorscanner.l b/src/groups/bmq/bmqeval/bmqeval_simpleevaluatorscanner.l index 2c125c076..c0da8dea8 100644 --- a/src/groups/bmq/bmqeval/bmqeval_simpleevaluatorscanner.l +++ b/src/groups/bmq/bmqeval/bmqeval_simpleevaluatorscanner.l @@ -32,7 +32,7 @@ return SimpleEvaluatorParser::make_FALSE(); } -[a-zA-Z][a-zA-Z0-9_]* { +[a-zA-Z][a-zA-Z0-9_.]* { updatePosition(); return SimpleEvaluatorParser::make_PROPERTY(yytext); } diff --git a/src/groups/bmq/bmqeval/package/bmqeval.dep b/src/groups/bmq/bmqeval/package/bmqeval.dep index 0241de4b4..c960bb0e3 100644 --- a/src/groups/bmq/bmqeval/package/bmqeval.dep +++ b/src/groups/bmq/bmqeval/package/bmqeval.dep @@ -1 +1 @@ -bmqscm \ No newline at end of file +bmqu diff --git a/src/groups/mwc/mwcex/README.md b/src/groups/bmq/bmqex/README.md similarity index 99% rename from src/groups/mwc/mwcex/README.md rename to src/groups/bmq/bmqex/README.md index aa7f263cc..a3a05bcfb 100644 --- a/src/groups/mwc/mwcex/README.md +++ b/src/groups/bmq/bmqex/README.md @@ -1,7 +1,7 @@ -## MWCEX +## BMQEX ### Description -The `MWCEX` (MiddleWare Core Executors) package provides executors and other +The `BMQEX` (BlazingMQ Executors) package provides executors and other async programming utilites and mechanisms. ### Basic Terminology @@ -168,7 +168,7 @@ submitted function objects. In the table below: * `e`, `e1` and `e2` denote (possibly const) values of type `E`. -* `T` is `mwcex::ExecutorTraits`. +* `T` is `bmqex::ExecutorTraits`. * `f` denotes a function object of type `F&&` callable as `DECAY_COPY(std::forward(f))()` and where `bsl::decay_t` satisfies the Destructible and MoveConstructible requirements as specified in diff --git a/src/groups/mwc/mwcex/mwcex_bdlmteventschedulerexecutor.cpp b/src/groups/bmq/bmqex/bmqex_bdlmteventschedulerexecutor.cpp similarity index 88% rename from src/groups/mwc/mwcex/mwcex_bdlmteventschedulerexecutor.cpp rename to src/groups/bmq/bmqex/bmqex_bdlmteventschedulerexecutor.cpp index 040bbe272..2a215409d 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmteventschedulerexecutor.cpp +++ b/src/groups/bmq/bmqex/bmqex_bdlmteventschedulerexecutor.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmteventschedulerexecutor.cpp -*-C++-*- -#include +// bmqex_bdlmteventschedulerexecutor.cpp -*-C++-*- +#include -#include +#include // BDE #include namespace BloombergLP { -namespace mwcex { +namespace bmqex { // --------------------------------- // class BdlmtEventSchedulerExecutor diff --git a/src/groups/mwc/mwcex/mwcex_bdlmteventschedulerexecutor.h b/src/groups/bmq/bmqex/bmqex_bdlmteventschedulerexecutor.h similarity index 89% rename from src/groups/mwc/mwcex/mwcex_bdlmteventschedulerexecutor.h rename to src/groups/bmq/bmqex/bmqex_bdlmteventschedulerexecutor.h index d0c1fa4ca..aff56808b 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmteventschedulerexecutor.h +++ b/src/groups/bmq/bmqex/bmqex_bdlmteventschedulerexecutor.h @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmteventschedulerexecutor.h -*-C++-*- -#ifndef INCLUDED_MWCEX_BDLMTEVENTSCHEDULEREXECUTOR -#define INCLUDED_MWCEX_BDLMTEVENTSCHEDULEREXECUTOR +// bmqex_bdlmteventschedulerexecutor.h -*-C++-*- +#ifndef INCLUDED_BMQEX_BDLMTEVENTSCHEDULEREXECUTOR +#define INCLUDED_BMQEX_BDLMTEVENTSCHEDULEREXECUTOR //@PURPOSE: Provides an executor adapter for 'bdlmt::EventScheduler'. // @@ -23,13 +23,13 @@ // BdlmtEventSchedulerExecutor: an executor adapter for the bdlmt scheduler // //@DESCRIPTION: -// This component provides a class, 'mwcex::BdlmtEventSchedulerExecutor', that +// This component provides a class, 'bmqex::BdlmtEventSchedulerExecutor', that // is an executor adapter for 'bdlmt::EventScheduler'. // /// Thread safety ///------------- // With the exception of assignment operators, as well as the 'swap' member -// function, 'mwcex::BdlmtEventSchedulerExecutor' is fully thread-safe, meaning +// function, 'bmqex::BdlmtEventSchedulerExecutor' is fully thread-safe, meaning // that multiple threads may use their own instances of the class or use a // shared instance without further synchronization. // @@ -37,13 +37,13 @@ ///----- // Lets assume that you already have an instance of 'bdlmt::EventScheduler', // 'd_eventScheduler'. Then, you can create an executor adapter on top of the -// scheduler, and use the adapter with the 'mwcex' package. For example: +// scheduler, and use the adapter with the 'bmqex' package. For example: //.. // // create an executor -// mwcex::BdlmtEventSchedulerExecutor ex(&d_eventScheduler); +// bmqex::BdlmtEventSchedulerExecutor ex(&d_eventScheduler); // // // use it -// mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::oneWay() +// bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::oneWay() // .neverBlocking() // .useExecutor(ex), // [](){ bsl::cout << "Hello World!\n"; }); @@ -53,7 +53,7 @@ // point in time when you want the job to be executed: //.. // // create an executor with a time point of 1 second from now -// mwcex::BdlmtEventSchedulerExecutor ex( +// bmqex::BdlmtEventSchedulerExecutor ex( // &d_eventScheduler, // bsls::SystemTime::now(d_eventScheduler.clockType()) // .addSeconds(1)); @@ -63,16 +63,14 @@ // Note that the time point is relative to the clock used by the event // scheduler. // -// 'mwcex::BdlmtEventSchedulerExecutor' also provides a convenient +// 'bmqex::BdlmtEventSchedulerExecutor' also provides a convenient // 'rebindTimePoint' function that returns a new executor associated with the // same event scheduler, but having a different time point: //.. -// mwcex::BdlmtEventSchedulerExecutor ex2 = +// bmqex::BdlmtEventSchedulerExecutor ex2 = // ex.rebindTimePoint(ex.timePoint().addSeconds(1)); //.. -// MWC - // BDE #include // bsl::swap #include @@ -89,7 +87,7 @@ namespace bdlmt { class EventScheduler; } -namespace mwcex { +namespace bmqex { // ================================= // class BdlmtEventSchedulerExecutor @@ -229,7 +227,7 @@ BdlmtEventSchedulerExecutor::rebindTimePoint( // FREE OPERATORS inline bool -mwcex::operator==(const BdlmtEventSchedulerExecutor& lhs, +bmqex::operator==(const BdlmtEventSchedulerExecutor& lhs, const BdlmtEventSchedulerExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { return &lhs.context() == &rhs.context() && @@ -237,13 +235,13 @@ mwcex::operator==(const BdlmtEventSchedulerExecutor& lhs, } inline bool -mwcex::operator!=(const BdlmtEventSchedulerExecutor& lhs, +bmqex::operator!=(const BdlmtEventSchedulerExecutor& lhs, const BdlmtEventSchedulerExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { return !(lhs == rhs); } -inline void mwcex::swap(BdlmtEventSchedulerExecutor& lhs, +inline void bmqex::swap(BdlmtEventSchedulerExecutor& lhs, BdlmtEventSchedulerExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); diff --git a/src/groups/mwc/mwcex/mwcex_bdlmteventschedulerexecutor.t.cpp b/src/groups/bmq/bmqex/bmqex_bdlmteventschedulerexecutor.t.cpp similarity index 82% rename from src/groups/mwc/mwcex/mwcex_bdlmteventschedulerexecutor.t.cpp rename to src/groups/bmq/bmqex/bmqex_bdlmteventschedulerexecutor.t.cpp index 717fc0782..4e78c4330 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmteventschedulerexecutor.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_bdlmteventschedulerexecutor.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmteventschedulerexecutor.t.cpp -*-C++-*- -#include +// bmqex_bdlmteventschedulerexecutor.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -67,18 +67,18 @@ static void test1_constructor() // Ensure proper behavior of the constructor. // // Plan: -// Construct an instance of 'mwcex::BdlmtEventSchedulerExecutor' +// Construct an instance of 'bmqex::BdlmtEventSchedulerExecutor' // and check postconditions. // // Testing: -// mwcex::BdlmtEventSchedulerExecutor's constructor +// bmqex::BdlmtEventSchedulerExecutor's constructor // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; bdlmt::EventScheduler eventScheduler(&alloc); // create executor - mwcex::BdlmtEventSchedulerExecutor ex(&eventScheduler, + bmqex::BdlmtEventSchedulerExecutor ex(&eventScheduler, bsls::TimeInterval(42)); // check postconditions @@ -100,7 +100,7 @@ static void test2_post() // - Are using the executor's associated time point. // // Testing: -// mwcex::BdlmtEventSchedulerExecutor::post +// bmqex::BdlmtEventSchedulerExecutor::post // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -113,12 +113,12 @@ static void test2_post() BSLS_ASSERT_OPT(rc == 0); // create an executor with a time point at 1 second from now - mwcex::BdlmtEventSchedulerExecutor ex1( + bmqex::BdlmtEventSchedulerExecutor ex1( &eventScheduler, eventSchedulerTimeSource.now().addSeconds(1)); // create an executor with a time point at 2 second from now - mwcex::BdlmtEventSchedulerExecutor ex2( + bmqex::BdlmtEventSchedulerExecutor ex2( &eventScheduler, eventSchedulerTimeSource.now().addSeconds(2)); @@ -165,7 +165,7 @@ static void test3_swap() // #1. // // Testing: -// mwcex::BdlmtEventSchedulerExecutor::swap +// bmqex::BdlmtEventSchedulerExecutor::swap // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -173,9 +173,9 @@ static void test3_swap() bdlmt::EventScheduler eventScheduler2(&alloc); // create executors - mwcex::BdlmtEventSchedulerExecutor ex1(&eventScheduler1, + bmqex::BdlmtEventSchedulerExecutor ex1(&eventScheduler1, bsls::TimeInterval(1)); - mwcex::BdlmtEventSchedulerExecutor ex2(&eventScheduler2, + bmqex::BdlmtEventSchedulerExecutor ex2(&eventScheduler2, bsls::TimeInterval(2)); // do swap @@ -201,17 +201,17 @@ static void test4_context() // associated 'bdlmt::EventScheduler' object. // // Testing: -// mwcex::BdlmtEventSchedulerExecutor::context +// bmqex::BdlmtEventSchedulerExecutor::context // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; bdlmt::EventScheduler eventScheduler1(&alloc); bdlmt::EventScheduler eventScheduler2(&alloc); - mwcex::BdlmtEventSchedulerExecutor ex1(&eventScheduler1); + bmqex::BdlmtEventSchedulerExecutor ex1(&eventScheduler1); ASSERT_EQ(&ex1.context(), &eventScheduler1); - mwcex::BdlmtEventSchedulerExecutor ex2(&eventScheduler2); + bmqex::BdlmtEventSchedulerExecutor ex2(&eventScheduler2); ASSERT_EQ(&ex2.context(), &eventScheduler2); } @@ -226,17 +226,17 @@ static void test5_timePoint() // Check that 'timePoint()' returns the executor's associated time point. // // Testing: -// mwcex::BdlmtEventSchedulerExecutor::timePoint +// bmqex::BdlmtEventSchedulerExecutor::timePoint // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; bdlmt::EventScheduler eventScheduler(&alloc); - mwcex::BdlmtEventSchedulerExecutor ex1(&eventScheduler, + bmqex::BdlmtEventSchedulerExecutor ex1(&eventScheduler, bsls::TimeInterval(1)); ASSERT_EQ(ex1.timePoint(), bsls::TimeInterval(1)); - mwcex::BdlmtEventSchedulerExecutor ex2(&eventScheduler, + bmqex::BdlmtEventSchedulerExecutor ex2(&eventScheduler, bsls::TimeInterval(2)); ASSERT_EQ(ex2.timePoint(), bsls::TimeInterval(2)); } @@ -254,16 +254,16 @@ static void test6_rebindTimePoint() // time point. // // Testing: -// mwcex::BdlmtEventSchedulerExecutor::rebindTimePoint +// bmqex::BdlmtEventSchedulerExecutor::rebindTimePoint // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; bdlmt::EventScheduler eventScheduler(&alloc); - mwcex::BdlmtEventSchedulerExecutor ex1(&eventScheduler, + bmqex::BdlmtEventSchedulerExecutor ex1(&eventScheduler, bsls::TimeInterval(1)); - mwcex::BdlmtEventSchedulerExecutor ex2 = ex1.rebindTimePoint( + bmqex::BdlmtEventSchedulerExecutor ex2 = ex1.rebindTimePoint( bsls::TimeInterval(2)); ASSERT_EQ(&ex2.context(), &eventScheduler); ASSERT_EQ(ex2.timePoint(), bsls::TimeInterval(2)); @@ -282,8 +282,8 @@ static void test7_comparison() // otherwise. // // Testing: -// mwcex::BdlmtEventSchedulerExecutor's equality comp. operator -// mwcex::BdlmtEventSchedulerExecutor's inequality comp. operator +// bmqex::BdlmtEventSchedulerExecutor's equality comp. operator +// bmqex::BdlmtEventSchedulerExecutor's inequality comp. operator // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -293,23 +293,23 @@ static void test7_comparison() // equality { ASSERT_EQ( - mwcex::BdlmtEventSchedulerExecutor(&eventScheduler1, + bmqex::BdlmtEventSchedulerExecutor(&eventScheduler1, bsls::TimeInterval(1)) == - mwcex::BdlmtEventSchedulerExecutor(&eventScheduler1, + bmqex::BdlmtEventSchedulerExecutor(&eventScheduler1, bsls::TimeInterval(1)), true); ASSERT_EQ( - mwcex::BdlmtEventSchedulerExecutor(&eventScheduler1, + bmqex::BdlmtEventSchedulerExecutor(&eventScheduler1, bsls::TimeInterval(1)) == - mwcex::BdlmtEventSchedulerExecutor(&eventScheduler2, + bmqex::BdlmtEventSchedulerExecutor(&eventScheduler2, bsls::TimeInterval(1)), false); ASSERT_EQ( - mwcex::BdlmtEventSchedulerExecutor(&eventScheduler1, + bmqex::BdlmtEventSchedulerExecutor(&eventScheduler1, bsls::TimeInterval(1)) == - mwcex::BdlmtEventSchedulerExecutor(&eventScheduler1, + bmqex::BdlmtEventSchedulerExecutor(&eventScheduler1, bsls::TimeInterval(2)), false); } @@ -317,23 +317,23 @@ static void test7_comparison() // inequality { ASSERT_EQ( - mwcex::BdlmtEventSchedulerExecutor(&eventScheduler1, + bmqex::BdlmtEventSchedulerExecutor(&eventScheduler1, bsls::TimeInterval(1)) != - mwcex::BdlmtEventSchedulerExecutor(&eventScheduler1, + bmqex::BdlmtEventSchedulerExecutor(&eventScheduler1, bsls::TimeInterval(1)), false); ASSERT_EQ( - mwcex::BdlmtEventSchedulerExecutor(&eventScheduler1, + bmqex::BdlmtEventSchedulerExecutor(&eventScheduler1, bsls::TimeInterval(1)) != - mwcex::BdlmtEventSchedulerExecutor(&eventScheduler2, + bmqex::BdlmtEventSchedulerExecutor(&eventScheduler2, bsls::TimeInterval(1)), true); ASSERT_EQ( - mwcex::BdlmtEventSchedulerExecutor(&eventScheduler1, + bmqex::BdlmtEventSchedulerExecutor(&eventScheduler1, bsls::TimeInterval(1)) != - mwcex::BdlmtEventSchedulerExecutor(&eventScheduler1, + bmqex::BdlmtEventSchedulerExecutor(&eventScheduler1, bsls::TimeInterval(2)), true); } @@ -351,11 +351,11 @@ static void test8_defaultTimePoint() // and realtime clocks. // // Testing: -// mwcex::BdlmtEventSchedulerExecutor::k_DEFAULT_TIME_POINT +// bmqex::BdlmtEventSchedulerExecutor::k_DEFAULT_TIME_POINT // ------------------------------------------------------------------------ { const bsls::TimeInterval defTimePoint = - mwcex::BdlmtEventSchedulerExecutor::k_DEFAULT_TIME_POINT; + bmqex::BdlmtEventSchedulerExecutor::k_DEFAULT_TIME_POINT; ASSERT(defTimePoint < bsls::SystemTime::nowMonotonicClock()); ASSERT(defTimePoint < bsls::SystemTime::nowRealtimeClock()); @@ -367,7 +367,7 @@ static void test8_defaultTimePoint() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_constructor(); break; @@ -386,5 +386,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/mwcex_bdlmtfixedthreadpoolexecutor.cpp b/src/groups/bmq/bmqex/bmqex_bdlmtfixedthreadpoolexecutor.cpp similarity index 87% rename from src/groups/mwc/mwcex/mwcex_bdlmtfixedthreadpoolexecutor.cpp rename to src/groups/bmq/bmqex/bmqex_bdlmtfixedthreadpoolexecutor.cpp index 8e3acdcca..1cb739800 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmtfixedthreadpoolexecutor.cpp +++ b/src/groups/bmq/bmqex/bmqex_bdlmtfixedthreadpoolexecutor.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmtfixedthreadpoolexecutor.cpp -*-C++-*- -#include +// bmqex_bdlmtfixedthreadpoolexecutor.cpp -*-C++-*- +#include -#include +#include // BDE #include namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ---------------------------------- // class BdlmtFixedThreadPoolExecutor diff --git a/src/groups/mwc/mwcex/mwcex_bdlmtfixedthreadpoolexecutor.h b/src/groups/bmq/bmqex/bmqex_bdlmtfixedthreadpoolexecutor.h similarity index 88% rename from src/groups/mwc/mwcex/mwcex_bdlmtfixedthreadpoolexecutor.h rename to src/groups/bmq/bmqex/bmqex_bdlmtfixedthreadpoolexecutor.h index 8b48451cc..a1dfa535f 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmtfixedthreadpoolexecutor.h +++ b/src/groups/bmq/bmqex/bmqex_bdlmtfixedthreadpoolexecutor.h @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmtfixedthreadpoolexecutor.h -*-C++-*- -#ifndef INCLUDED_MWCEX_BDLMTFIXEDTHREADPOOLEXECUTOR -#define INCLUDED_MWCEX_BDLMTFIXEDTHREADPOOLEXECUTOR +// bmqex_bdlmtfixedthreadpoolexecutor.h -*-C++-*- +#ifndef INCLUDED_BMQEX_BDLMTFIXEDTHREADPOOLEXECUTOR +#define INCLUDED_BMQEX_BDLMTFIXEDTHREADPOOLEXECUTOR //@PURPOSE: Provides an executor adapter for 'bdlmt::FixedThreadPool'. // @@ -23,13 +23,13 @@ // BdlmtFixedThreadPoolExecutor: executor adapter for bdlmt fixed thread pool // //@DESCRIPTION: -// This component provides a class, 'mwcex::BdlmtFixedThreadPoolExecutor', that +// This component provides a class, 'bmqex::BdlmtFixedThreadPoolExecutor', that // is an executor adapter for 'bdlmt::FixedThreadPool'. // /// Thread safety ///------------- // With the exception of assignment operators, as well as the 'swap' member -// function, 'mwcex::BdlmtFixedThreadPoolExecutor' is fully thread-safe, +// function, 'bmqex::BdlmtFixedThreadPoolExecutor' is fully thread-safe, // meaning that multiple threads may use their own instances of the class or // use a shared instance without further synchronization. // @@ -37,20 +37,18 @@ ///----- // Lets assume that you already have an instance of 'bdlmt::FixedThreadPool', // 'd_threadPool'. Then, you can create an executor adapter on top of it, and -// use the adapter with the 'mwcex' package. For example: +// use the adapter with the 'bmqex' package. For example: //.. // // create an executor -// mwcex::BdlmtFixedThreadPoolExecutor ex(&d_threadPool); +// bmqex::BdlmtFixedThreadPoolExecutor ex(&d_threadPool); // // // use it -// mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::oneWay() +// bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::oneWay() // .neverBlocking() // .useExecutor(ex), // [](){ bsl::cout << "Hello World!\n"; }); //.. -// MWC - // BDE #include // bsl::swap #include @@ -66,7 +64,7 @@ namespace bdlmt { class FixedThreadPool; } -namespace mwcex { +namespace bmqex { // ================================== // class BdlmtFixedThreadPoolExecutor @@ -165,14 +163,14 @@ BdlmtFixedThreadPoolExecutor::context() const BSLS_KEYWORD_NOEXCEPT } // close package namespace // FREE OPERATORS -inline bool mwcex::operator==(const BdlmtFixedThreadPoolExecutor& lhs, +inline bool bmqex::operator==(const BdlmtFixedThreadPoolExecutor& lhs, const BdlmtFixedThreadPoolExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { return &lhs.context() == &rhs.context(); } -inline bool mwcex::operator!=(const BdlmtFixedThreadPoolExecutor& lhs, +inline bool bmqex::operator!=(const BdlmtFixedThreadPoolExecutor& lhs, const BdlmtFixedThreadPoolExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { @@ -180,7 +178,7 @@ inline bool mwcex::operator!=(const BdlmtFixedThreadPoolExecutor& lhs, } inline void -mwcex::swap(BdlmtFixedThreadPoolExecutor& lhs, +bmqex::swap(BdlmtFixedThreadPoolExecutor& lhs, BdlmtFixedThreadPoolExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); diff --git a/src/groups/mwc/mwcex/mwcex_bdlmtfixedthreadpoolexecutor.t.cpp b/src/groups/bmq/bmqex/bmqex_bdlmtfixedthreadpoolexecutor.t.cpp similarity index 82% rename from src/groups/mwc/mwcex/mwcex_bdlmtfixedthreadpoolexecutor.t.cpp rename to src/groups/bmq/bmqex/bmqex_bdlmtfixedthreadpoolexecutor.t.cpp index b69f270ea..279430836 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmtfixedthreadpoolexecutor.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_bdlmtfixedthreadpoolexecutor.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmtfixedthreadpoolexecutor.t.cpp -*-C++-*- -#include +// bmqex_bdlmtfixedthreadpoolexecutor.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -66,11 +66,11 @@ static void test1_constructor() // Ensure proper behavior of the constructor. // // Plan: -// Construct an instance of 'mwcex::BdlmtFixedThreadPoolExecutor' and +// Construct an instance of 'bmqex::BdlmtFixedThreadPoolExecutor' and // check postconditions. // // Testing: -// mwcex::BdlmtFixedThreadPoolExecutor's constructor +// bmqex::BdlmtFixedThreadPoolExecutor's constructor // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -79,7 +79,7 @@ static void test1_constructor() &alloc); // create executor - mwcex::BdlmtFixedThreadPoolExecutor ex(&threadPool); + bmqex::BdlmtFixedThreadPoolExecutor ex(&threadPool); // check postconditions ASSERT_EQ(&ex.context(), &threadPool); @@ -97,7 +97,7 @@ static void test2_post() // executor's associated execution context. // // Testing: -// mwcex::BdlmtFixedThreadPoolExecutor::post +// bmqex::BdlmtFixedThreadPoolExecutor::post // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -106,7 +106,7 @@ static void test2_post() &alloc); // create executor - mwcex::BdlmtFixedThreadPoolExecutor ex(&threadPool); + bmqex::BdlmtFixedThreadPoolExecutor ex(&threadPool); // start thread pool int rc = threadPool.start(); @@ -142,7 +142,7 @@ static void test3_swap() // 'ex2' now refers to 'threadPool1'. // // Testing: -// mwcex::BdlmtFixedThreadPoolExecutor::swap +// bmqex::BdlmtFixedThreadPoolExecutor::swap // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -154,8 +154,8 @@ static void test3_swap() &alloc); // create executor - mwcex::BdlmtFixedThreadPoolExecutor ex1(&threadPool1); - mwcex::BdlmtFixedThreadPoolExecutor ex2(&threadPool2); + bmqex::BdlmtFixedThreadPoolExecutor ex1(&threadPool1); + bmqex::BdlmtFixedThreadPoolExecutor ex2(&threadPool2); // do swap ex1.swap(ex2); @@ -177,7 +177,7 @@ static void test4_context() // associated 'bdlmt::FixedThreadPool' object. // // Testing: -// mwcex::BdlmtFixedThreadPoolExecutor::context +// bmqex::BdlmtFixedThreadPoolExecutor::context // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -188,10 +188,10 @@ static void test4_context() 1, // maxNumPendingJobs &alloc); - mwcex::BdlmtFixedThreadPoolExecutor ex1(&threadPool1); + bmqex::BdlmtFixedThreadPoolExecutor ex1(&threadPool1); ASSERT_EQ(&ex1.context(), &threadPool1); - mwcex::BdlmtFixedThreadPoolExecutor ex2(&threadPool2); + bmqex::BdlmtFixedThreadPoolExecutor ex2(&threadPool2); ASSERT_EQ(&ex2.context(), &threadPool2); } @@ -207,8 +207,8 @@ static void test5_comparison() // execution context and vice versa. // // Testing: -// mwcex::BdlmtFixedThreadPoolExecutor's equality comparison operator -// mwcex::BdlmtFixedThreadPoolExecutor's inequality comparison operator +// bmqex::BdlmtFixedThreadPoolExecutor's equality comparison operator +// bmqex::BdlmtFixedThreadPoolExecutor's inequality comparison operator // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -221,23 +221,23 @@ static void test5_comparison() // equality { - ASSERT_EQ(mwcex::BdlmtFixedThreadPoolExecutor(&threadPool1) == - mwcex::BdlmtFixedThreadPoolExecutor(&threadPool1), + ASSERT_EQ(bmqex::BdlmtFixedThreadPoolExecutor(&threadPool1) == + bmqex::BdlmtFixedThreadPoolExecutor(&threadPool1), true); - ASSERT_EQ(mwcex::BdlmtFixedThreadPoolExecutor(&threadPool1) == - mwcex::BdlmtFixedThreadPoolExecutor(&threadPool2), + ASSERT_EQ(bmqex::BdlmtFixedThreadPoolExecutor(&threadPool1) == + bmqex::BdlmtFixedThreadPoolExecutor(&threadPool2), false); } // inequality { - ASSERT_EQ(mwcex::BdlmtFixedThreadPoolExecutor(&threadPool1) != - mwcex::BdlmtFixedThreadPoolExecutor(&threadPool1), + ASSERT_EQ(bmqex::BdlmtFixedThreadPoolExecutor(&threadPool1) != + bmqex::BdlmtFixedThreadPoolExecutor(&threadPool1), false); - ASSERT_EQ(mwcex::BdlmtFixedThreadPoolExecutor(&threadPool1) != - mwcex::BdlmtFixedThreadPoolExecutor(&threadPool2), + ASSERT_EQ(bmqex::BdlmtFixedThreadPoolExecutor(&threadPool1) != + bmqex::BdlmtFixedThreadPoolExecutor(&threadPool2), true); } } @@ -248,7 +248,7 @@ static void test5_comparison() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_constructor(); break; @@ -264,7 +264,7 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); // Default: there is a check in the 'bslmt_fastpostsemaphoreimpl.h': // BSLS.LOG BSLS_REVIEW failure: (level:R-OPT). // During this check some temporal objects constructed in diff --git a/src/groups/mwc/mwcex/mwcex_bdlmtmultiprioritythreadpoolexecutor.cpp b/src/groups/bmq/bmqex/bmqex_bdlmtmultiprioritythreadpoolexecutor.cpp similarity index 87% rename from src/groups/mwc/mwcex/mwcex_bdlmtmultiprioritythreadpoolexecutor.cpp rename to src/groups/bmq/bmqex/bmqex_bdlmtmultiprioritythreadpoolexecutor.cpp index 28690a7ce..299e7db21 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmtmultiprioritythreadpoolexecutor.cpp +++ b/src/groups/bmq/bmqex/bmqex_bdlmtmultiprioritythreadpoolexecutor.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmtmultiprioritythreadpoolexecutor.cpp -*-C++-*- -#include +// bmqex_bdlmtmultiprioritythreadpoolexecutor.cpp -*-C++-*- +#include -#include +#include // BDE #include namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ------------------------------------------ // class BdlmtMultipriorityThreadPoolExecutor diff --git a/src/groups/mwc/mwcex/mwcex_bdlmtmultiprioritythreadpoolexecutor.h b/src/groups/bmq/bmqex/bmqex_bdlmtmultiprioritythreadpoolexecutor.h similarity index 90% rename from src/groups/mwc/mwcex/mwcex_bdlmtmultiprioritythreadpoolexecutor.h rename to src/groups/bmq/bmqex/bmqex_bdlmtmultiprioritythreadpoolexecutor.h index 887f988b8..0c570b073 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmtmultiprioritythreadpoolexecutor.h +++ b/src/groups/bmq/bmqex/bmqex_bdlmtmultiprioritythreadpoolexecutor.h @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmtmultiprioritythreadpoolexecutor.h -*-C++-*- -#ifndef INCLUDED_MWCEX_BDLMTMULTIPRIORITYTHREADPOOLEXECUTOR -#define INCLUDED_MWCEX_BDLMTMULTIPRIORITYTHREADPOOLEXECUTOR +// bmqex_bdlmtmultiprioritythreadpoolexecutor.h -*-C++-*- +#ifndef INCLUDED_BMQEX_BDLMTMULTIPRIORITYTHREADPOOLEXECUTOR +#define INCLUDED_BMQEX_BDLMTMULTIPRIORITYTHREADPOOLEXECUTOR //@PURPOSE: Provides an executor adapter for 'bdlmt::MultipriorityThreadPool'. // @@ -24,13 +24,13 @@ // //@DESCRIPTION: // This component provides a class, -// 'mwcex::BdlmtMultipriorityThreadPoolExecutor', that is an executor adapter +// 'bmqex::BdlmtMultipriorityThreadPoolExecutor', that is an executor adapter // for 'bdlmt::MultipriorityThreadPool'. // /// Thread safety ///------------- // With the exception of assignment operators, as well as the 'swap' member -// function, 'mwcex::BdlmtMultipriorityThreadPoolExecutor' is fully thread- +// function, 'bmqex::BdlmtMultipriorityThreadPoolExecutor' is fully thread- // safe, meaning that multiple threads may use their own instances of the class // or use a shared instance without further synchronization. // @@ -39,20 +39,18 @@ // Lets assume that you already have an instance of // 'bdlmt::MultiQueueThreadPool', 'd_threadPool', and a priority, 'd_priority'. // Then, you can create an executor adapter on top of the thread pool, and use -// the adapter with the 'mwcex' package. For example: +// the adapter with the 'bmqex' package. For example: //.. // // create an executor -// mwcex::BdlmtMultipriorityThreadPoolExecutor ex(&d_threadPool, d_priority); +// bmqex::BdlmtMultipriorityThreadPoolExecutor ex(&d_threadPool, d_priority); // // // use it -// mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::oneWay() +// bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::oneWay() // .neverBlocking() // .useExecutor(ex), // [](){ bsl::cout << "Hello World!\n"; }); //.. -// MWC - // BDE #include // bsl::swap #include @@ -68,7 +66,7 @@ namespace bdlmt { class MultipriorityThreadPool; } -namespace mwcex { +namespace bmqex { // ========================================== // class BdlmtMultipriorityThreadPoolExecutor @@ -205,7 +203,7 @@ BdlmtMultipriorityThreadPoolExecutor::rebindPriority(int priority) const } // close package namespace // FREE OPERATORS -inline bool mwcex::operator==(const BdlmtMultipriorityThreadPoolExecutor& lhs, +inline bool bmqex::operator==(const BdlmtMultipriorityThreadPoolExecutor& lhs, const BdlmtMultipriorityThreadPoolExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { @@ -213,7 +211,7 @@ inline bool mwcex::operator==(const BdlmtMultipriorityThreadPoolExecutor& lhs, lhs.priority() == rhs.priority(); } -inline bool mwcex::operator!=(const BdlmtMultipriorityThreadPoolExecutor& lhs, +inline bool bmqex::operator!=(const BdlmtMultipriorityThreadPoolExecutor& lhs, const BdlmtMultipriorityThreadPoolExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { @@ -221,7 +219,7 @@ inline bool mwcex::operator!=(const BdlmtMultipriorityThreadPoolExecutor& lhs, } inline void -mwcex::swap(BdlmtMultipriorityThreadPoolExecutor& lhs, +bmqex::swap(BdlmtMultipriorityThreadPoolExecutor& lhs, BdlmtMultipriorityThreadPoolExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); diff --git a/src/groups/mwc/mwcex/mwcex_bdlmtmultiprioritythreadpoolexecutor.t.cpp b/src/groups/bmq/bmqex/bmqex_bdlmtmultiprioritythreadpoolexecutor.t.cpp similarity index 81% rename from src/groups/mwc/mwcex/mwcex_bdlmtmultiprioritythreadpoolexecutor.t.cpp rename to src/groups/bmq/bmqex/bmqex_bdlmtmultiprioritythreadpoolexecutor.t.cpp index ca77f9e95..a10a0dc98 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmtmultiprioritythreadpoolexecutor.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_bdlmtmultiprioritythreadpoolexecutor.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmtmultiprioritythreadpoolexecutor.t.cpp -*-C++-*- -#include +// bmqex_bdlmtmultiprioritythreadpoolexecutor.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -66,11 +66,11 @@ static void test1_constructor() // Ensure proper behavior of the constructor. // // Plan: -// Construct an instance of 'mwcex::BdlmtMultipriorityThreadPoolExecutor' +// Construct an instance of 'bmqex::BdlmtMultipriorityThreadPoolExecutor' // and check postconditions. // // Testing: -// mwcex::BdlmtMultipriorityThreadPoolExecutor's constructor +// bmqex::BdlmtMultipriorityThreadPoolExecutor's constructor // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -79,7 +79,7 @@ static void test1_constructor() &alloc); // create executor - mwcex::BdlmtMultipriorityThreadPoolExecutor ex(&threadPool, + bmqex::BdlmtMultipriorityThreadPoolExecutor ex(&threadPool, 42); // priority // check postconditions @@ -101,7 +101,7 @@ static void test2_post() // - Are using the executor's associated priority. // // Testing: -// mwcex::BdlmtMultipriorityThreadPoolExecutor::post +// bmqex::BdlmtMultipriorityThreadPoolExecutor::post // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -117,8 +117,8 @@ static void test2_post() threadPool.suspendProcessing(); // create executors with different priorities - mwcex::BdlmtMultipriorityThreadPoolExecutor ex1(&threadPool, 1); - mwcex::BdlmtMultipriorityThreadPoolExecutor ex2(&threadPool, 0); + bmqex::BdlmtMultipriorityThreadPoolExecutor ex1(&threadPool, 1); + bmqex::BdlmtMultipriorityThreadPoolExecutor ex2(&threadPool, 0); // store job results here bsl::vector out(&alloc); @@ -157,7 +157,7 @@ static void test3_swap() // refers to 'threadPool1' and have a priority of 1. // // Testing: -// mwcex::BdlmtMultipriorityThreadPoolExecutor::swap +// bmqex::BdlmtMultipriorityThreadPoolExecutor::swap // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -169,9 +169,9 @@ static void test3_swap() &alloc); // create executors - mwcex::BdlmtMultipriorityThreadPoolExecutor ex1(&threadPool1, + bmqex::BdlmtMultipriorityThreadPoolExecutor ex1(&threadPool1, 1); // priority - mwcex::BdlmtMultipriorityThreadPoolExecutor ex2(&threadPool2, + bmqex::BdlmtMultipriorityThreadPoolExecutor ex2(&threadPool2, 2); // priority // do swap @@ -197,7 +197,7 @@ static void test4_context() // associated 'bdlmt::MultipriorityThreadPool' object. // // Testing: -// mwcex::BdlmtMultipriorityThreadPoolExecutor::context +// bmqex::BdlmtMultipriorityThreadPoolExecutor::context // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -208,10 +208,10 @@ static void test4_context() 1, // numPriorities &alloc); - mwcex::BdlmtMultipriorityThreadPoolExecutor ex1(&threadPool1); + bmqex::BdlmtMultipriorityThreadPoolExecutor ex1(&threadPool1); ASSERT_EQ(&ex1.context(), &threadPool1); - mwcex::BdlmtMultipriorityThreadPoolExecutor ex2(&threadPool2); + bmqex::BdlmtMultipriorityThreadPoolExecutor ex2(&threadPool2); ASSERT_EQ(&ex2.context(), &threadPool2); } @@ -226,7 +226,7 @@ static void test5_priority() // Check that 'priority()' returns the executors's associated priority. // // Testing: -// mwcex::BdlmtMultipriorityThreadPoolExecutor::priority +// bmqex::BdlmtMultipriorityThreadPoolExecutor::priority // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -234,11 +234,11 @@ static void test5_priority() 1, // numPriorities &alloc); - mwcex::BdlmtMultipriorityThreadPoolExecutor ex1(&threadPool, + bmqex::BdlmtMultipriorityThreadPoolExecutor ex1(&threadPool, 1); // priority ASSERT_EQ(ex1.priority(), 1); - mwcex::BdlmtMultipriorityThreadPoolExecutor ex2(&threadPool, + bmqex::BdlmtMultipriorityThreadPoolExecutor ex2(&threadPool, 2); // priority ASSERT_EQ(ex2.priority(), 2); } @@ -256,7 +256,7 @@ static void test6_rebindPriority() // priority. // // Testing: -// mwcex::BdlmtMultipriorityThreadPoolExecutor::rebindPriority +// bmqex::BdlmtMultipriorityThreadPoolExecutor::rebindPriority // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -264,10 +264,10 @@ static void test6_rebindPriority() 1, // numPriorities &alloc); - mwcex::BdlmtMultipriorityThreadPoolExecutor ex1(&threadPool, + bmqex::BdlmtMultipriorityThreadPoolExecutor ex1(&threadPool, 1); // priority - mwcex::BdlmtMultipriorityThreadPoolExecutor ex2 = ex1.rebindPriority(2); + bmqex::BdlmtMultipriorityThreadPoolExecutor ex2 = ex1.rebindPriority(2); ASSERT_EQ(&ex2.context(), &threadPool); ASSERT_EQ(ex2.priority(), 2); } @@ -285,8 +285,8 @@ static void test7_comparison() // otherwise. // // Testing: -// mwcex::BdlmtMultipriorityThreadPoolExecutor's equality comp. op. -// mwcex::BdlmtMultipriorityThreadPoolExecutor's inequality comp. op. +// bmqex::BdlmtMultipriorityThreadPoolExecutor's equality comp. op. +// bmqex::BdlmtMultipriorityThreadPoolExecutor's inequality comp. op. // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -300,36 +300,36 @@ static void test7_comparison() // equality { ASSERT_EQ( - mwcex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1) == - mwcex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1), + bmqex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1) == + bmqex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1), true); ASSERT_EQ( - mwcex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1) == - mwcex::BdlmtMultipriorityThreadPoolExecutor(&threadPool2, 1), + bmqex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1) == + bmqex::BdlmtMultipriorityThreadPoolExecutor(&threadPool2, 1), false); ASSERT_EQ( - mwcex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1) == - mwcex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 2), + bmqex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1) == + bmqex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 2), false); } // inequality { ASSERT_EQ( - mwcex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1) != - mwcex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1), + bmqex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1) != + bmqex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1), false); ASSERT_EQ( - mwcex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1) != - mwcex::BdlmtMultipriorityThreadPoolExecutor(&threadPool2, 1), + bmqex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1) != + bmqex::BdlmtMultipriorityThreadPoolExecutor(&threadPool2, 1), true); ASSERT_EQ( - mwcex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1) != - mwcex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 2), + bmqex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 1) != + bmqex::BdlmtMultipriorityThreadPoolExecutor(&threadPool1, 2), true); } } @@ -340,7 +340,7 @@ static void test7_comparison() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_constructor(); break; @@ -358,5 +358,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/mwcex_bdlmtmultiqueuethreadpoolexecutor.cpp b/src/groups/bmq/bmqex/bmqex_bdlmtmultiqueuethreadpoolexecutor.cpp similarity index 88% rename from src/groups/mwc/mwcex/mwcex_bdlmtmultiqueuethreadpoolexecutor.cpp rename to src/groups/bmq/bmqex/bmqex_bdlmtmultiqueuethreadpoolexecutor.cpp index 08b32eef0..d84e06531 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmtmultiqueuethreadpoolexecutor.cpp +++ b/src/groups/bmq/bmqex/bmqex_bdlmtmultiqueuethreadpoolexecutor.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmtmultiqueuethreadpoolexecutor.cpp -*-C++-*- -#include +// bmqex_bdlmtmultiqueuethreadpoolexecutor.cpp -*-C++-*- +#include -#include +#include // BDE #include namespace BloombergLP { -namespace mwcex { +namespace bmqex { // --------------------------------------- // class BdlmtMultiQueueThreadPoolExecutor diff --git a/src/groups/mwc/mwcex/mwcex_bdlmtmultiqueuethreadpoolexecutor.h b/src/groups/bmq/bmqex/bmqex_bdlmtmultiqueuethreadpoolexecutor.h similarity index 91% rename from src/groups/mwc/mwcex/mwcex_bdlmtmultiqueuethreadpoolexecutor.h rename to src/groups/bmq/bmqex/bmqex_bdlmtmultiqueuethreadpoolexecutor.h index bcb42ea79..bd62312b2 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmtmultiqueuethreadpoolexecutor.h +++ b/src/groups/bmq/bmqex/bmqex_bdlmtmultiqueuethreadpoolexecutor.h @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmtmultiqueuethreadpoolexecutor.h -*-C++-*- -#ifndef INCLUDED_MWCEX_BDLMTMULTIQUEUETHREADPOOLEXECUTOR -#define INCLUDED_MWCEX_BDLMTMULTIQUEUETHREADPOOLEXECUTOR +// bmqex_bdlmtmultiqueuethreadpoolexecutor.h -*-C++-*- +#ifndef INCLUDED_BMQEX_BDLMTMULTIQUEUETHREADPOOLEXECUTOR +#define INCLUDED_BMQEX_BDLMTMULTIQUEUETHREADPOOLEXECUTOR //@PURPOSE: Provides an executor adapter for 'bdlmt::MultiQueueThreadPool'. // @@ -23,13 +23,13 @@ // BdlmtMultiQueueThreadPoolExecutor: executor adapter for bdlmt m.q.t. pool // //@DESCRIPTION: -// This component provides a class, 'mwcex::BdlmtMultiQueueThreadPoolExecutor', +// This component provides a class, 'bmqex::BdlmtMultiQueueThreadPoolExecutor', // that is an executor adapter for 'bdlmt::MultiQueueThreadPool'. // /// Thread safety ///------------- // With the exception of assignment operators, as well as the 'swap' member -// function, 'mwcex::BdlmtMultiQueueThreadPoolExecutor' is fully thread-safe, +// function, 'bmqex::BdlmtMultiQueueThreadPoolExecutor' is fully thread-safe, // meaning that multiple threads may use their own instances of the class or // use a shared instance without further synchronization. // @@ -39,20 +39,18 @@ // 'bdlmt::MultiQueueThreadPool', 'd_threadPool', and a queue id, 'd_queueId', // that represents a queue on that thread pool. Then, you can create an // executor adapter on top of the thread pool, and use the adapter with the -// 'mwcex' package. For example: +// 'bmqex' package. For example: //.. // // create an executor -// mwcex::BdlmtMultiQueueThreadPoolExecutor ex(&d_threadPool, d_queueId); +// bmqex::BdlmtMultiQueueThreadPoolExecutor ex(&d_threadPool, d_queueId); // // // use it -// mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::oneWay() +// bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::oneWay() // .neverBlocking() // .useExecutor(ex), // [](){ bsl::cout << "Hello World!\n"; }); //.. -// MWC - // BDE #include // bsl::swap #include @@ -68,7 +66,7 @@ namespace bdlmt { class MultiQueueThreadPool; } -namespace mwcex { +namespace bmqex { // ======================================= // class BdlmtMultiQueueThreadPoolExecutor @@ -205,14 +203,14 @@ BdlmtMultiQueueThreadPoolExecutor::rebindQueueId(int queueId) const } // close package namespace // FREE OPERATORS -inline bool mwcex::operator==(const BdlmtMultiQueueThreadPoolExecutor& lhs, +inline bool bmqex::operator==(const BdlmtMultiQueueThreadPoolExecutor& lhs, const BdlmtMultiQueueThreadPoolExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { return &lhs.context() == &rhs.context() && lhs.queueId() == rhs.queueId(); } -inline bool mwcex::operator!=(const BdlmtMultiQueueThreadPoolExecutor& lhs, +inline bool bmqex::operator!=(const BdlmtMultiQueueThreadPoolExecutor& lhs, const BdlmtMultiQueueThreadPoolExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { @@ -220,7 +218,7 @@ inline bool mwcex::operator!=(const BdlmtMultiQueueThreadPoolExecutor& lhs, } inline void -mwcex::swap(BdlmtMultiQueueThreadPoolExecutor& lhs, +bmqex::swap(BdlmtMultiQueueThreadPoolExecutor& lhs, BdlmtMultiQueueThreadPoolExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); diff --git a/src/groups/mwc/mwcex/mwcex_bdlmtmultiqueuethreadpoolexecutor.t.cpp b/src/groups/bmq/bmqex/bmqex_bdlmtmultiqueuethreadpoolexecutor.t.cpp similarity index 84% rename from src/groups/mwc/mwcex/mwcex_bdlmtmultiqueuethreadpoolexecutor.t.cpp rename to src/groups/bmq/bmqex/bmqex_bdlmtmultiqueuethreadpoolexecutor.t.cpp index 32e54123d..35c33d90a 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmtmultiqueuethreadpoolexecutor.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_bdlmtmultiqueuethreadpoolexecutor.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmtmultiqueuethreadpoolexecutor.t.cpp -*-C++-*- -#include +// bmqex_bdlmtmultiqueuethreadpoolexecutor.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -66,11 +66,11 @@ static void test1_constructor() // Ensure proper behavior of the constructor. // // Plan: -// Construct an instance of 'mwcex::BdlmtMultiQueueThreadPoolExecutor' +// Construct an instance of 'bmqex::BdlmtMultiQueueThreadPoolExecutor' // and check postconditions. // // Testing: -// mwcex::BdlmtMultiQueueThreadPoolExecutor's constructor +// bmqex::BdlmtMultiQueueThreadPoolExecutor's constructor // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -81,7 +81,7 @@ static void test1_constructor() &alloc); // create executor - mwcex::BdlmtMultiQueueThreadPoolExecutor ex(&threadPool, + bmqex::BdlmtMultiQueueThreadPoolExecutor ex(&threadPool, 42); // queueId // check postconditions @@ -103,8 +103,8 @@ static void test2_postDispatch() // - Are using the executor's associated queue ids. // // Testing: -// mwcex::BdlmtMultiQueueThreadPoolExecutor::post -// mwcex::BdlmtMultiQueueThreadPoolExecutor::dispatch +// bmqex::BdlmtMultiQueueThreadPoolExecutor::post +// bmqex::BdlmtMultiQueueThreadPoolExecutor::dispatch // ------------------------------------------------------------------------ { s_ignoreCheckDefAlloc = true; @@ -141,8 +141,8 @@ static void test2_postDispatch() BSLS_ASSERT_OPT(rc == 0); // create executors - mwcex::BdlmtMultiQueueThreadPoolExecutor ex1(&threadPool, queue1Id); - mwcex::BdlmtMultiQueueThreadPoolExecutor ex2(&threadPool, queue2Id); + bmqex::BdlmtMultiQueueThreadPoolExecutor ex1(&threadPool, queue1Id); + bmqex::BdlmtMultiQueueThreadPoolExecutor ex2(&threadPool, queue2Id); // both queues are empty ASSERT_EQ(threadPool.numElements(queue1Id), 0); @@ -194,7 +194,7 @@ static void test3_swap() // refers to 'threadPool1' and have a queue id of 1. // // Testing: -// mwcex::BdlmtMultiQueueThreadPoolExecutor::swap +// bmqex::BdlmtMultiQueueThreadPoolExecutor::swap // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -210,9 +210,9 @@ static void test3_swap() &alloc); // create executors - mwcex::BdlmtMultiQueueThreadPoolExecutor ex1(&threadPool1, + bmqex::BdlmtMultiQueueThreadPoolExecutor ex1(&threadPool1, 1); // queueId - mwcex::BdlmtMultiQueueThreadPoolExecutor ex2(&threadPool2, + bmqex::BdlmtMultiQueueThreadPoolExecutor ex2(&threadPool2, 2); // queueId // do swap @@ -238,7 +238,7 @@ static void test4_context() // associated 'bdlmt::MultiQueueThreadPool' object. // // Testing: -// mwcex::BdlmtMultiQueueThreadPoolExecutor::context +// bmqex::BdlmtMultiQueueThreadPoolExecutor::context // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -253,11 +253,11 @@ static void test4_context() 1, // maxIdleTime &alloc); - mwcex::BdlmtMultiQueueThreadPoolExecutor ex1(&threadPool1, + bmqex::BdlmtMultiQueueThreadPoolExecutor ex1(&threadPool1, 42); // queueId ASSERT_EQ(&ex1.context(), &threadPool1); - mwcex::BdlmtMultiQueueThreadPoolExecutor ex2(&threadPool2, + bmqex::BdlmtMultiQueueThreadPoolExecutor ex2(&threadPool2, 42); // queueId ASSERT_EQ(&ex2.context(), &threadPool2); } @@ -273,7 +273,7 @@ static void test5_queueId() // Check that 'queueId()' returns the executors's associated queue id. // // Testing: -// mwcex::BdlmtMultiQueueThreadPoolExecutor::queueId +// bmqex::BdlmtMultiQueueThreadPoolExecutor::queueId // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -283,11 +283,11 @@ static void test5_queueId() 1, // maxIdleTime &alloc); - mwcex::BdlmtMultiQueueThreadPoolExecutor ex1(&threadPool, + bmqex::BdlmtMultiQueueThreadPoolExecutor ex1(&threadPool, 1); // queueId ASSERT_EQ(ex1.queueId(), 1); - mwcex::BdlmtMultiQueueThreadPoolExecutor ex2(&threadPool, + bmqex::BdlmtMultiQueueThreadPoolExecutor ex2(&threadPool, 2); // queueId ASSERT_EQ(ex2.queueId(), 2); } @@ -305,7 +305,7 @@ static void test6_rebindQueueId() // id. // // Testing: -// mwcex::BdlmtMultiQueueThreadPoolExecutor::rebindQueueId +// bmqex::BdlmtMultiQueueThreadPoolExecutor::rebindQueueId // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -315,10 +315,10 @@ static void test6_rebindQueueId() 1, // maxIdleTime &alloc); - mwcex::BdlmtMultiQueueThreadPoolExecutor ex1(&threadPool, + bmqex::BdlmtMultiQueueThreadPoolExecutor ex1(&threadPool, 1); // queueId - mwcex::BdlmtMultiQueueThreadPoolExecutor ex2 = ex1.rebindQueueId(2); + bmqex::BdlmtMultiQueueThreadPoolExecutor ex2 = ex1.rebindQueueId(2); ASSERT_EQ(&ex2.context(), &threadPool); ASSERT_EQ(ex2.queueId(), 2); } @@ -336,8 +336,8 @@ static void test7_comparison() // otherwise. // // Testing: -// mwcex::BdlmtMultiQueueThreadPoolExecutor's equality comp. operator -// mwcex::BdlmtMultiQueueThreadPoolExecutor's inequality comp. operator +// bmqex::BdlmtMultiQueueThreadPoolExecutor's equality comp. operator +// bmqex::BdlmtMultiQueueThreadPoolExecutor's inequality comp. operator // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -354,36 +354,36 @@ static void test7_comparison() // equality { - ASSERT_EQ(mwcex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1) == - mwcex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, + ASSERT_EQ(bmqex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1) == + bmqex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1), true); - ASSERT_EQ(mwcex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1) == - mwcex::BdlmtMultiQueueThreadPoolExecutor(&threadPool2, + ASSERT_EQ(bmqex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1) == + bmqex::BdlmtMultiQueueThreadPoolExecutor(&threadPool2, 1), false); - ASSERT_EQ(mwcex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1) == - mwcex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, + ASSERT_EQ(bmqex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1) == + bmqex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 2), false); } // inequality { - ASSERT_EQ(mwcex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1) != - mwcex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, + ASSERT_EQ(bmqex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1) != + bmqex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1), false); - ASSERT_EQ(mwcex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1) != - mwcex::BdlmtMultiQueueThreadPoolExecutor(&threadPool2, + ASSERT_EQ(bmqex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1) != + bmqex::BdlmtMultiQueueThreadPoolExecutor(&threadPool2, 1), true); - ASSERT_EQ(mwcex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1) != - mwcex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, + ASSERT_EQ(bmqex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 1) != + bmqex::BdlmtMultiQueueThreadPoolExecutor(&threadPool1, 2), true); } @@ -395,7 +395,7 @@ static void test7_comparison() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_constructor(); break; @@ -413,5 +413,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/mwcex_bdlmtthreadpoolexecutor.cpp b/src/groups/bmq/bmqex/bmqex_bdlmtthreadpoolexecutor.cpp similarity index 87% rename from src/groups/mwc/mwcex/mwcex_bdlmtthreadpoolexecutor.cpp rename to src/groups/bmq/bmqex/bmqex_bdlmtthreadpoolexecutor.cpp index 660ec57f5..7ec108cba 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmtthreadpoolexecutor.cpp +++ b/src/groups/bmq/bmqex/bmqex_bdlmtthreadpoolexecutor.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmtthreadpoolexecutor.cpp -*-C++-*- -#include +// bmqex_bdlmtthreadpoolexecutor.cpp -*-C++-*- +#include -#include +#include // BDE #include namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ----------------------------- // class BdlmtThreadPoolExecutor diff --git a/src/groups/mwc/mwcex/mwcex_bdlmtthreadpoolexecutor.h b/src/groups/bmq/bmqex/bmqex_bdlmtthreadpoolexecutor.h similarity index 88% rename from src/groups/mwc/mwcex/mwcex_bdlmtthreadpoolexecutor.h rename to src/groups/bmq/bmqex/bmqex_bdlmtthreadpoolexecutor.h index c90729415..3c969ff38 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmtthreadpoolexecutor.h +++ b/src/groups/bmq/bmqex/bmqex_bdlmtthreadpoolexecutor.h @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmtthreadpoolexecutor.h -*-C++-*- -#ifndef INCLUDED_MWCEX_BDLMTTHREADPOOLEXECUTOR -#define INCLUDED_MWCEX_BDLMTTHREADPOOLEXECUTOR +// bmqex_bdlmtthreadpoolexecutor.h -*-C++-*- +#ifndef INCLUDED_BMQEX_BDLMTTHREADPOOLEXECUTOR +#define INCLUDED_BMQEX_BDLMTTHREADPOOLEXECUTOR //@PURPOSE: Provides an executor adapter for 'bdlmt::ThreadPool'. // @@ -23,13 +23,13 @@ // BdlmtThreadPoolExecutor: executor adapter for bdlmt thread pool // //@DESCRIPTION: -// This component provides a class, 'mwcex::BdlmtThreadPoolExecutor', that is +// This component provides a class, 'bmqex::BdlmtThreadPoolExecutor', that is // an executor adapter for 'bdlmt::ThreadPool'. // /// Thread safety ///------------- // With the exception of assignment operators, as well as the 'swap' member -// function, 'mwcex::BdlmtThreadPoolExecutor' is fully thread-safe, meaning +// function, 'bmqex::BdlmtThreadPoolExecutor' is fully thread-safe, meaning // that multiple threads may use their own instances of the class or use a // shared instance without further synchronization. // @@ -37,20 +37,18 @@ ///----- // Lets assume that you already have an instance of 'bdlmt::ThreadPool', // 'd_threadPool'. Then, you can create an executor adapter on top of it, and -// use the adapter with the 'mwcex' package. For example: +// use the adapter with the 'bmqex' package. For example: //.. // // create an executor -// mwcex::BdlmtThreadPoolExecutor ex(&d_threadPool); +// bmqex::BdlmtThreadPoolExecutor ex(&d_threadPool); // // // use it -// mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::oneWay() +// bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::oneWay() // .neverBlocking() // .useExecutor(ex), // [](){ bsl::cout << "Hello World!\n"; }); //.. -// MWC - // BDE #include // bsl::swap #include @@ -66,7 +64,7 @@ namespace bdlmt { class ThreadPool; } -namespace mwcex { +namespace bmqex { // ============================= // class BdlmtThreadPoolExecutor @@ -165,20 +163,20 @@ BdlmtThreadPoolExecutor::context() const BSLS_KEYWORD_NOEXCEPT // FREE OPERATORS inline bool -mwcex::operator==(const BdlmtThreadPoolExecutor& lhs, +bmqex::operator==(const BdlmtThreadPoolExecutor& lhs, const BdlmtThreadPoolExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { return &lhs.context() == &rhs.context(); } inline bool -mwcex::operator!=(const BdlmtThreadPoolExecutor& lhs, +bmqex::operator!=(const BdlmtThreadPoolExecutor& lhs, const BdlmtThreadPoolExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { return !(lhs == rhs); } -inline void mwcex::swap(BdlmtThreadPoolExecutor& lhs, +inline void bmqex::swap(BdlmtThreadPoolExecutor& lhs, BdlmtThreadPoolExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); diff --git a/src/groups/mwc/mwcex/mwcex_bdlmtthreadpoolexecutor.t.cpp b/src/groups/bmq/bmqex/bmqex_bdlmtthreadpoolexecutor.t.cpp similarity index 84% rename from src/groups/mwc/mwcex/mwcex_bdlmtthreadpoolexecutor.t.cpp rename to src/groups/bmq/bmqex/bmqex_bdlmtthreadpoolexecutor.t.cpp index ca177cbc6..0632a4f48 100644 --- a/src/groups/mwc/mwcex/mwcex_bdlmtthreadpoolexecutor.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_bdlmtthreadpoolexecutor.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bdlmtthreadpoolexecutor.t.cpp -*-C++-*- -#include +// bmqex_bdlmtthreadpoolexecutor.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -67,11 +67,11 @@ static void test1_constructor() // Ensure proper behavior of the constructor. // // Plan: -// Construct an instance of 'mwcex::BdlmtThreadPoolExecutor' and check +// Construct an instance of 'bmqex::BdlmtThreadPoolExecutor' and check // postconditions. // // Testing: -// mwcex::BdlmtThreadPoolExecutor's constructor +// bmqex::BdlmtThreadPoolExecutor's constructor // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -82,7 +82,7 @@ static void test1_constructor() &alloc); // create executor - mwcex::BdlmtThreadPoolExecutor ex(&threadPool); + bmqex::BdlmtThreadPoolExecutor ex(&threadPool); // check postconditions ASSERT_EQ(&ex.context(), &threadPool); @@ -100,7 +100,7 @@ static void test2_post() // executor's associated execution context. // // Testing: -// mwcex::BdlmtThreadPoolExecutor::post +// bmqex::BdlmtThreadPoolExecutor::post // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -111,7 +111,7 @@ static void test2_post() &alloc); // start thread pool - mwcex::BdlmtThreadPoolExecutor ex(&threadPool); + bmqex::BdlmtThreadPoolExecutor ex(&threadPool); // start the execution context int rc = threadPool.start(); @@ -147,7 +147,7 @@ static void test3_swap() // 'ex2' now refers to 'threadPool1'. // // Testing: -// mwcex::BdlmtThreadPoolExecutor::swap +// bmqex::BdlmtThreadPoolExecutor::swap // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -163,8 +163,8 @@ static void test3_swap() &alloc); // create executors - mwcex::BdlmtThreadPoolExecutor ex1(&threadPool1); - mwcex::BdlmtThreadPoolExecutor ex2(&threadPool2); + bmqex::BdlmtThreadPoolExecutor ex1(&threadPool1); + bmqex::BdlmtThreadPoolExecutor ex2(&threadPool2); // do swap ex1.swap(ex2); @@ -186,7 +186,7 @@ static void test4_context() // associated 'bdlmt::ThreadPool' object. // // Testing: -// mwcex::BdlmtThreadPoolExecutor::context +// bmqex::BdlmtThreadPoolExecutor::context // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -201,10 +201,10 @@ static void test4_context() 1, // maxIdleTime &alloc); - mwcex::BdlmtThreadPoolExecutor ex1(&threadPool1); + bmqex::BdlmtThreadPoolExecutor ex1(&threadPool1); ASSERT_EQ(&ex1.context(), &threadPool1); - mwcex::BdlmtThreadPoolExecutor ex2(&threadPool2); + bmqex::BdlmtThreadPoolExecutor ex2(&threadPool2); ASSERT_EQ(&ex2.context(), &threadPool2); } @@ -220,8 +220,8 @@ static void test5_comparison() // execution context and vice versa. // // Testing: -// mwcex::BdlmtThreadPoolExecutor's equality comparison operator -// mwcex::BdlmtThreadPoolExecutor's inequality comparison operator +// bmqex::BdlmtThreadPoolExecutor's equality comparison operator +// bmqex::BdlmtThreadPoolExecutor's inequality comparison operator // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -238,23 +238,23 @@ static void test5_comparison() // equality { - ASSERT_EQ(mwcex::BdlmtThreadPoolExecutor(&threadPool1) == - mwcex::BdlmtThreadPoolExecutor(&threadPool1), + ASSERT_EQ(bmqex::BdlmtThreadPoolExecutor(&threadPool1) == + bmqex::BdlmtThreadPoolExecutor(&threadPool1), true); - ASSERT_EQ(mwcex::BdlmtThreadPoolExecutor(&threadPool1) == - mwcex::BdlmtThreadPoolExecutor(&threadPool2), + ASSERT_EQ(bmqex::BdlmtThreadPoolExecutor(&threadPool1) == + bmqex::BdlmtThreadPoolExecutor(&threadPool2), false); } // inequality { - ASSERT_EQ(mwcex::BdlmtThreadPoolExecutor(&threadPool1) != - mwcex::BdlmtThreadPoolExecutor(&threadPool1), + ASSERT_EQ(bmqex::BdlmtThreadPoolExecutor(&threadPool1) != + bmqex::BdlmtThreadPoolExecutor(&threadPool1), false); - ASSERT_EQ(mwcex::BdlmtThreadPoolExecutor(&threadPool1) != - mwcex::BdlmtThreadPoolExecutor(&threadPool2), + ASSERT_EQ(bmqex::BdlmtThreadPoolExecutor(&threadPool1) != + bmqex::BdlmtThreadPoolExecutor(&threadPool2), true); } } @@ -265,7 +265,7 @@ static void test5_comparison() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_constructor(); break; @@ -281,5 +281,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/mwcex_bindutil.cpp b/src/groups/bmq/bmqex/bmqex_bindutil.cpp similarity index 84% rename from src/groups/mwc/mwcex/mwcex_bindutil.cpp rename to src/groups/bmq/bmqex/bmqex_bindutil.cpp index 7438467ac..27155a89b 100644 --- a/src/groups/mwc/mwcex/mwcex_bindutil.cpp +++ b/src/groups/bmq/bmqex/bmqex_bindutil.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bindutil.cpp -*-C++-*- -#include +// bmqex_bindutil.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcex { +namespace bmqex { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcex/mwcex_bindutil.h b/src/groups/bmq/bmqex/bmqex_bindutil.h similarity index 93% rename from src/groups/mwc/mwcex/mwcex_bindutil.h rename to src/groups/bmq/bmqex/bmqex_bindutil.h index e0bcf02d4..0e94a1099 100644 --- a/src/groups/mwc/mwcex/mwcex_bindutil.h +++ b/src/groups/bmq/bmqex/bmqex_bindutil.h @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bindutil.h -*-C++-*- -#ifndef INCLUDED_MWCEX_BINDUTIL -#define INCLUDED_MWCEX_BINDUTIL +// bmqex_bindutil.h -*-C++-*- +#ifndef INCLUDED_BMQEX_BINDUTIL +#define INCLUDED_BMQEX_BINDUTIL //@PURPOSE: Provides utility functions to bind functors to execution functions // @@ -23,7 +23,7 @@ // BindUtil: a namespace for utility functions to bind functors to ex. funcs. // //@DESCRIPTION: -// This component provides a struct, 'mwcex::BindUtil', that serves as a +// This component provides a struct, 'bmqex::BindUtil', that serves as a // namespace for utility functions to bind function objects of arbitrary // (template parameter) type to an invocation of an execution function. // @@ -38,8 +38,8 @@ // // This function is executed in the scheduler's thread. // { // // execute 'doHeavyStuff' in a separate thread (use system executor) -// mwcex::ExecutionUtil::execute( -// mwcex::ExecutionPolicyUtil::oneWay() +// bmqex::ExecutionUtil::execute( +// bmqex::ExecutionPolicyUtil::oneWay() // .neverBlocking(), // &doHeavyStuff); // } @@ -60,15 +60,15 @@ // // Having 2 functions ('onDoHeavyStuff' and 'doHeavyStuff') seems redundant. // Using 'BindUtil::bindExecute' we can bind the invocation of the execution -// function (i.e. 'mwcex::ExecutionUtil::execute') directly into the +// function (i.e. 'bmqex::ExecutionUtil::execute') directly into the // scheduler's callback. //.. // // schedule a recurring event // g_eventScheduler.scheduleRecurringEvent( // &g_heavyStuffEvent, // bsls::TimeInterval(10.0), // 10 sec -// mwcex::BindUtil::bindExecute( -// mwcex::ExecutionPolicyUtil::oneWay() +// bmqex::BindUtil::bindExecute( +// bmqex::ExecutionPolicyUtil::oneWay() // .neverBlocking(), // &doHeavyStuff)); //.. @@ -101,8 +101,8 @@ // // thread. // { // // execute 'processEvent' in a separate thread (use system executor) -// mwcex::ExecutionUtil::execute( -// mwcex::ExecutionPolicyUtil::oneWay() +// bmqex::ExecutionUtil::execute( +// bmqex::ExecutionPolicyUtil::oneWay() // .neverBlocking(), // bdlf::BindUtil::bind(&processEvent, eventCode)); // } @@ -120,12 +120,12 @@ //.. // // And again, using 'BindUtil::bindExecute' we can bind the invocation of the -// execution function (i.e. 'mwcex::ExecutionUtil::execute') directly into the +// execution function (i.e. 'bmqex::ExecutionUtil::execute') directly into the // notification callback. //.. // // subscribe to notifications -// g_observable_p->subscribe(mwcex::BindUtil::bindExecute( -// mwcex::ExecutionPolicyUtil::oneWay() +// g_observable_p->subscribe(bmqex::BindUtil::bindExecute( +// bmqex::ExecutionPolicyUtil::oneWay() // .neverBlocking(), // &processEvent)); //.. @@ -135,9 +135,7 @@ // not work if the bound function object's call operator is non-const. // Should solve that. -// MWC - -#include +#include // BDE #include @@ -154,15 +152,15 @@ #if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES // Include version that can be compiled with C++03 -// Generated on Wed Jun 29 05:10:11 2022 -// Command line: sim_cpp11_features.pl mwcex_bindutil.h -#define COMPILING_MWCEX_BINDUTIL_H -#include -#undef COMPILING_MWCEX_BINDUTIL_H +// Generated on Tue Oct 15 18:12:34 2024 +// Command line: sim_cpp11_features.pl bmqex_bindutil.h +#define COMPILING_BMQEX_BINDUTIL_H +#include +#undef COMPILING_BMQEX_BINDUTIL_H #else namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ==================================== // struct BindUtil_DummyNullaryFunction @@ -195,7 +193,7 @@ struct BindUtil_DummyNullaryFunction { /// Provides a callable bind wrapper containing an execution policy and a /// function object bound to the invocation of `ExecutionUtil::execute`. /// -/// `POLICY` must be an execution policy type (see `mwcex_executionpolicy`). +/// `POLICY` must be an execution policy type (see `bmqex_executionpolicy`). /// /// `FUNCTION` must meet the requirements of Destructible as specified in /// the C++ standard. @@ -309,7 +307,7 @@ struct BindUtil { /// when called as `f2()`, performs `return f1(args1...)`. /// /// `POLICY` must be an execution policy type (see - /// `mwcex_executionpolicy`). + /// `bmqex_executionpolicy`). /// /// `bsl::decay_t` must meet the requirements of Destructible /// and MoveConstructible as specified in the C++ standard. diff --git a/src/groups/mwc/mwcex/mwcex_bindutil.t.cpp b/src/groups/bmq/bmqex/bmqex_bindutil.t.cpp similarity index 91% rename from src/groups/mwc/mwcex/mwcex_bindutil.t.cpp rename to src/groups/bmq/bmqex/bmqex_bindutil.t.cpp index 3e06bb1ed..1f64af4fe 100644 --- a/src/groups/mwc/mwcex/mwcex_bindutil.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_bindutil.t.cpp @@ -13,14 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bindutil.t.cpp -*-C++-*- -#include +// bmqex_bindutil.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include -// MWC -#include +#include // BDE #include @@ -244,13 +243,13 @@ static void test1_bindUtil_bindExecute() // Ensure proper behavior of the 'bindExecute' function. // // Plan: -// Create a bind wrapper via a call to 'mwcex::BindUtil::bindExecute' +// Create a bind wrapper via a call to 'bmqex::BindUtil::bindExecute' // with an execution policy and a function object. Call the wrapper and // check that the supplied function object was executed according to the // supplied execution policy. // // Testing: -// mwcex::BindUtil::bindExecute +// bmqex::BindUtil::bindExecute // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -260,8 +259,8 @@ static void test1_bindUtil_bindExecute() bsl::function wrapper( bsl::allocator_arg, &alloc, - mwcex::BindUtil::bindExecute( - mwcex::ExecutionPolicyUtil::defaultPolicy().useAllocator(&alloc), + bmqex::BindUtil::bindExecute( + bmqex::ExecutionPolicyUtil::defaultPolicy().useAllocator(&alloc), SetFlagOnCall(&executed))); // target not executed yet @@ -294,12 +293,12 @@ static void test2_bindWrapper_creators() // check that it behaves as the original would. // // Testing: -// mwcex::BindUtil::BindUtil_BindWrapper init constructor -// mwcex::BindUtil::BindUtil_BindWrapper copy constructor -// mwcex::BindUtil::BindUtil_BindWrapper move constructor +// bmqex::BindUtil::BindUtil_BindWrapper init constructor +// bmqex::BindUtil::BindUtil_BindWrapper copy constructor +// bmqex::BindUtil::BindUtil_BindWrapper move constructor // ------------------------------------------------------------------------ { - typedef mwcex::BindUtil_BindWrapper, + typedef bmqex::BindUtil_BindWrapper, SetFlagOnCall> BindWrapper; @@ -311,7 +310,7 @@ static void test2_bindWrapper_creators() // create a bind wrapper BindWrapper wrapper( - mwcex::ExecutionPolicyUtil::defaultPolicy().useAllocator(&alloc), + bmqex::ExecutionPolicyUtil::defaultPolicy().useAllocator(&alloc), SetFlagOnCall(&executed), &alloc); @@ -331,7 +330,7 @@ static void test2_bindWrapper_creators() // create a bind wrapper BindWrapper wrapper( - mwcex::ExecutionPolicyUtil::defaultPolicy().useAllocator(&alloc), + bmqex::ExecutionPolicyUtil::defaultPolicy().useAllocator(&alloc), SetFlagOnCall(&executed), &alloc); @@ -351,7 +350,7 @@ static void test2_bindWrapper_creators() // create a bind wrapper BindWrapper wrapper( - mwcex::ExecutionPolicyUtil::defaultPolicy().useAllocator(&alloc), + bmqex::ExecutionPolicyUtil::defaultPolicy().useAllocator(&alloc), SetFlagOnCall(&executed), &alloc); @@ -378,10 +377,10 @@ static void test3_bindWrapper_callOperator() // call operator behave properly. // // Testing: -// mwcex::BindUtil::BindUtil_BindWrapper::operator() +// bmqex::BindUtil::BindUtil_BindWrapper::operator() // ------------------------------------------------------------------------ { - typedef mwcex::BindUtil_BindWrapper, + typedef bmqex::BindUtil_BindWrapper, AssignEmplaceOnCall > BindWrapper; @@ -390,7 +389,7 @@ static void test3_bindWrapper_callOperator() // create a bind wrapper BindWrapper wrapper( - mwcex::ExecutionPolicyUtil::defaultPolicy().useAllocator(&alloc), + bmqex::ExecutionPolicyUtil::defaultPolicy().useAllocator(&alloc), AssignEmplaceOnCall(&sumOf), &alloc); @@ -432,7 +431,7 @@ static void test3_bindWrapper_callOperator() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_bindUtil_bindExecute(); break; @@ -446,5 +445,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/mwcex_bindutil_cpp03.cpp b/src/groups/bmq/bmqex/bmqex_bindutil_cpp03.cpp similarity index 80% rename from src/groups/mwc/mwcex/mwcex_bindutil_cpp03.cpp rename to src/groups/bmq/bmqex/bmqex_bindutil_cpp03.cpp index c3b0056fc..8093bec93 100644 --- a/src/groups/mwc/mwcex/mwcex_bindutil_cpp03.cpp +++ b/src/groups/bmq/bmqex/bmqex_bindutil_cpp03.cpp @@ -13,22 +13,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bindutil_cpp03.cpp -*-C++-*- +// bmqex_bindutil_cpp03.cpp -*-C++-*- // Automatically generated file. **DO NOT EDIT** // Generated on Thu Jul 14 05:47:32 2022 -// Command line: sim_cpp11_features.pl mwcex_bindutil.cpp +// Command line: sim_cpp11_features.pl bmqex_bindutil.cpp -#define INCLUDED_MWCEX_BINDUTIL_CPP03 // Disable inclusion -#include // Pro-forma #include +#define INCLUDED_BMQEX_BINDUTIL_CPP03 // Disable inclusion +#include // Pro-forma #include -// Empty file except when compiling mwcex_bindutil.cpp -#ifdef COMPILING_MWCEX_BINDUTIL_CPP +// Empty file except when compiling bmqex_bindutil.cpp +#ifdef COMPILING_BMQEX_BINDUTIL_CPP // No C++03 Expansion -#endif // defined(COMPILING_MWCEX_BINDUTIL_CPP) +#endif // defined(COMPILING_BMQEX_BINDUTIL_CPP) // ---------------------------------------------------------------------------- // Copyright 2022-2023 Bloomberg Finance L.P. diff --git a/src/groups/mwc/mwcex/mwcex_bindutil_cpp03.h b/src/groups/bmq/bmqex/bmqex_bindutil_cpp03.h similarity index 83% rename from src/groups/mwc/mwcex/mwcex_bindutil_cpp03.h rename to src/groups/bmq/bmqex/bmqex_bindutil_cpp03.h index 3a4b845d9..46cda5733 100644 --- a/src/groups/mwc/mwcex/mwcex_bindutil_cpp03.h +++ b/src/groups/bmq/bmqex/bmqex_bindutil_cpp03.h @@ -1,4 +1,4 @@ -// Copyright 2022-2023 Bloomberg Finance L.P. +// Copyright 2019-2023 Bloomberg Finance L.P. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_bindutil_cpp03.h -*-C++-*- +// bmqex_bindutil_cpp03.h -*-C++-*- // Automatically generated file. **DO NOT EDIT** -#ifndef INCLUDED_MWCEX_BINDUTIL_CPP03 -#define INCLUDED_MWCEX_BINDUTIL_CPP03 +#ifndef INCLUDED_BMQEX_BINDUTIL_CPP03 +#define INCLUDED_BMQEX_BINDUTIL_CPP03 -//@PURPOSE: Provide C++03 implementation for mwcex_bindutil.h +//@PURPOSE: Provide C++03 implementation for bmqex_bindutil.h // -//@CLASSES: See mwcex_bindutil.h for list of classes +//@CLASSES: See bmqex_bindutil.h for list of classes // -//@SEE_ALSO: mwcex_bindutil +//@SEE_ALSO: bmqex_bindutil // //@DESCRIPTION: This component is the C++03 translation of a C++11 component, // generated by the 'sim_cpp11_features.pl' program. If the original header @@ -36,13 +36,13 @@ // regions of C++11 code, then this header contains no code and is not // '#include'd in the original header. // -// Generated on Wed Jul 13 12:01:40 2022 -// Command line: sim_cpp11_features.pl mwcex_bindutil.h +// Generated on Thu Oct 17 16:05:31 2024 +// Command line: sim_cpp11_features.pl bmqex_bindutil.h -#ifdef COMPILING_MWCEX_BINDUTIL_H +#ifdef COMPILING_BMQEX_BINDUTIL_H namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ==================================== // struct BindUtil_DummyNullaryFunction @@ -50,81 +50,82 @@ namespace mwcex { #if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES // {{{ BEGIN GENERATED CODE -// Command line: sim_cpp11_features.pl mwcex_bindutil.h -#ifndef MWCEX_BINDUTIL_VARIADIC_LIMIT -#define MWCEX_BINDUTIL_VARIADIC_LIMIT 9 +// Command line: sim_cpp11_features.pl bmqex_bindutil.h +#ifndef BMQEX_BINDUTIL_VARIADIC_LIMIT +#define BMQEX_BINDUTIL_VARIADIC_LIMIT 9 #endif -#ifndef MWCEX_BINDUTIL_VARIADIC_LIMIT_A -#define MWCEX_BINDUTIL_VARIADIC_LIMIT_A MWCEX_BINDUTIL_VARIADIC_LIMIT +#ifndef BMQEX_BINDUTIL_VARIADIC_LIMIT_A +#define BMQEX_BINDUTIL_VARIADIC_LIMIT_A BMQEX_BINDUTIL_VARIADIC_LIMIT #endif + template = 0 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 0 , class ARGS_0 = BSLS_COMPILERFEATURES_NILT -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 0 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 0 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 1 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 1 , class ARGS_1 = BSLS_COMPILERFEATURES_NILT -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 1 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 1 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 2 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 2 , class ARGS_2 = BSLS_COMPILERFEATURES_NILT -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 2 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 2 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 3 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 3 , class ARGS_3 = BSLS_COMPILERFEATURES_NILT -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 3 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 3 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 4 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 4 , class ARGS_4 = BSLS_COMPILERFEATURES_NILT -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 4 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 4 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 5 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 5 , class ARGS_5 = BSLS_COMPILERFEATURES_NILT -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 5 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 5 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 6 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 6 , class ARGS_6 = BSLS_COMPILERFEATURES_NILT -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 6 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 6 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 7 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 7 , class ARGS_7 = BSLS_COMPILERFEATURES_NILT -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 7 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 7 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 8 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 8 , class ARGS_8 = BSLS_COMPILERFEATURES_NILT -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 8 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 8 , class = BSLS_COMPILERFEATURES_NILT> struct BindUtil_DummyNullaryFunction; -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 0 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 0 template struct BindUtil_DummyNullaryFunction { typedef typename bsl::invoke_result::type ResultType; ResultType operator()() const; }; -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 0 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 0 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 1 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 1 template struct BindUtil_DummyNullaryFunction { typedef typename bsl::invoke_result::type ResultType; ResultType operator()() const; }; -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 1 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 1 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 2 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 2 template struct BindUtil_DummyNullaryFunction { typedef @@ -132,9 +133,9 @@ struct BindUtil_DummyNullaryFunction { ResultType operator()() const; }; -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 2 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 2 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 3 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 3 template struct BindUtil_DummyNullaryFunction { typedef typename bsl::invoke_result::type @@ -142,9 +143,9 @@ struct BindUtil_DummyNullaryFunction { ResultType operator()() const; }; -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 3 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 3 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 4 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 4 template = 4 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 4 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 5 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 5 template = 5 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 5 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 6 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 6 template = 6 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 6 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 7 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 7 template = 7 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 7 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 8 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 8 template = 8 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 8 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_A >= 9 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 9 template = 9 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_A >= 9 #else // The generated code below is a workaround for the absence of perfect // forwarding in some compilers. + template struct BindUtil_DummyNullaryFunction { typedef typename bsl::invoke_result::type ResultType; @@ -327,16 +329,15 @@ struct BindUtil_DummyNullaryFunction { // class BindUtil_BindWrapper // ========================== +/// Provides a callable bind wrapper containing an execution policy and a +/// function object bound to the invocation of `ExecutionUtil::execute`. +/// +/// `POLICY` must be an execution policy type (see `bmqex_executionpolicy`). +/// +/// `FUNCTION` must meet the requirements of Destructible as specified in +/// the C++ standard. template class BindUtil_BindWrapper { - // Provides a callable bind wrapper containing an execution policy and a - // function object bound to the invocation of 'ExecutionUtil::execute'. - // - // 'POLICY' must be an execution policy type (see 'mwcex_executionpolicy'). - // - // 'FUNCTION' must meet the requirements of Destructible as specified in - // the C++ standard. - private: // PRIVATE DATA POLICY d_policy; @@ -345,69 +346,72 @@ class BindUtil_BindWrapper { public: // CREATORS + + /// Create a `BindUtil_BindWrapper` object containing an execution + /// policy of type `POLICY` direct-non-list-initialized with + /// `bsl::forward(policy)` and a function object of type + /// `FUNCTION` direct-non-list-initialized with + /// `bsl::forward(function)`. Specify an `allocator` + /// used to supply memory. + /// + /// `POLICY` must be constructible from + /// `bsl::forward(policy)`. + /// + /// `FUNCTION` must be constructible from + /// `bsl::forward(function)`. template BindUtil_BindWrapper(BSLS_COMPILERFEATURES_FORWARD_REF(POLICY_PARAM) policy, BSLS_COMPILERFEATURES_FORWARD_REF(FUNCTION_PARAM) function, bslma::Allocator* allocator); - // Create a 'BindUtil_BindWrapper' object containing an execution - // policy of type 'POLICY' direct-non-list-initialized with - // 'bsl::forward(policy)' and a function object of type - // 'FUNCTION' direct-non-list-initialized with - // 'bsl::forward(function)'. Specify an 'allocator' - // used to supply memory. - // - // 'POLICY' must be constructible from - // 'bsl::forward(policy)'. - // - // 'FUNCTION' must be constructible from - // 'bsl::forward(function)'. + /// Create a `BindUtil_BindWrapper` object having the same state as the + /// specified `original` object. Optionally specify an `allocator` used + /// to supply memory. If `allocator` is 0, the default memory allocator + /// is used. BindUtil_BindWrapper(const BindUtil_BindWrapper& original, bslma::Allocator* allocator = 0); - // Create a 'BindUtil_BindWrapper' object having the same state as the - // specified 'original' object. Optionally specify an 'allocator' used - // to supply memory. If 'allocator' is 0, the default memory allocator - // is used. + /// Create a `BindUtil_BindWrapper` object having the same state as the + /// specified `original` object, leaving `original` in an unspecified + /// state. Optionally specify an `allocator` used to supply memory. If + /// `allocator` is 0, the default memory allocator is used. BindUtil_BindWrapper(bslmf::MovableRef original, bslma::Allocator* allocator = 0); - // Create a 'BindUtil_BindWrapper' object having the same state as the - // specified 'original' object, leaving 'original' in an unspecified - // state. Optionally specify an 'allocator' used to supply memory. If - // 'allocator' is 0, the default memory allocator is used. public: // ACCESSORS + + /// Call `ExecutionUtil::execute(p, f)` and return the result of that + /// operation, where `p` is the contained execution policy and `f` is + /// the contained function object. + /// + /// Given an object `f` of type `FUNCTION`, `f()` shall be a valid + /// expression. typename ExecutionUtil::ExecuteResult::Type operator()() const; - // Call 'ExecutionUtil::execute(p, f)' and return the result of that - // operation, where 'p' is the contained execution policy and 'f' is - // the contained function object. - // - // Given an object 'f' of type 'FUNCTION', 'f()' shall be a valid - // expression. #if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES // {{{ BEGIN GENERATED CODE -// Command line: sim_cpp11_features.pl mwcex_bindutil.h -#ifndef MWCEX_BINDUTIL_VARIADIC_LIMIT -#define MWCEX_BINDUTIL_VARIADIC_LIMIT 8 +// Command line: sim_cpp11_features.pl bmqex_bindutil.h +#ifndef BMQEX_BINDUTIL_VARIADIC_LIMIT +#define BMQEX_BINDUTIL_VARIADIC_LIMIT 8 #endif -#ifndef MWCEX_BINDUTIL_VARIADIC_LIMIT_B -#define MWCEX_BINDUTIL_VARIADIC_LIMIT_B MWCEX_BINDUTIL_VARIADIC_LIMIT +#ifndef BMQEX_BINDUTIL_VARIADIC_LIMIT_B +#define BMQEX_BINDUTIL_VARIADIC_LIMIT_B BMQEX_BINDUTIL_VARIADIC_LIMIT #endif -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_B >= 0 + +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 0 template typename ExecutionUtil::ExecuteResult< POLICY, BindUtil_DummyNullaryFunction::type> >::Type operator()(BSLS_COMPILERFEATURES_FORWARD_REF(ARG1) arg1) const; -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_B >= 0 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 0 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_B >= 1 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 1 template typename ExecutionUtil::ExecuteResult< POLICY, @@ -417,9 +421,9 @@ class BindUtil_BindWrapper { Type operator()(BSLS_COMPILERFEATURES_FORWARD_REF(ARG1) arg1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1) const; -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_B >= 1 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 1 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_B >= 2 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 2 template typename ExecutionUtil::ExecuteResult< POLICY, @@ -431,9 +435,9 @@ class BindUtil_BindWrapper { operator()(BSLS_COMPILERFEATURES_FORWARD_REF(ARG1) arg1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_2) args_2) const; -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_B >= 2 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 2 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_B >= 3 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 3 template typename ExecutionUtil::ExecuteResult< POLICY, @@ -447,9 +451,9 @@ class BindUtil_BindWrapper { BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_2) args_2, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_3) args_3) const; -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_B >= 3 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 3 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_B >= 4 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 4 template = 4 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 4 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_B >= 5 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 5 template = 5 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 5 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_B >= 6 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 6 template = 6 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 6 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_B >= 7 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 7 template = 7 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 7 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_B >= 8 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 8 template = 8 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_B >= 8 #else // The generated code below is a workaround for the absence of perfect // forwarding in some compilers. + template typename ExecutionUtil::ExecuteResult< POLICY, @@ -614,37 +619,37 @@ class BindUtil_BindWrapper { // struct BindUtil // =============== +/// Provides a namespace for utility functions to bind functors to execution +/// functions. struct BindUtil { - // Provides a namespace for utility functions to bind functors to execution - // functions. - // CLASS METHODS + + /// Return a callable object of unspecified type containing an execution + /// policy `p` of type `bsl::decay_t` direct-non-list- + /// initialized with `bsl::forward(policy)` and a function + /// object `f` of type `bsl::decay_t` direct-non-list- + /// initialized with `bsl::forward(function)`, such that: + /// * When called with no arguments, performs + ///: `ExecutionUtil::execute(p, f)` and returns the result of that + ///: operation. + /// * When called with 1 or more arguments `args...` of type `ARGS...`, + /// performs `ExecutionUtil::execute(p, bsl::move(f2))` and return + /// the result of that operation, where `f1` is the result of + /// `DECAY_COPY(f)` evaluated in the calling thread, `args1...` is + /// the result of `DECAY_COPY(args)...` evaluated in the calling + /// thread, and `f2` is a function object of unspecified type that, + /// when called as `f2()`, performs `return f1(args1...)`. + /// + /// `POLICY` must be an execution policy type (see + /// `bmqex_executionpolicy`). + /// + /// `bsl::decay_t` must meet the requirements of Destructible + /// and MoveConstructible as specified in the C++ standard. template static BindUtil_BindWrapper::type, typename bsl::decay::type> bindExecute(BSLS_COMPILERFEATURES_FORWARD_REF(POLICY) policy, BSLS_COMPILERFEATURES_FORWARD_REF(FUNCTION) function); - // Return a callable object of unspecified type containing an execution - // policy 'p' of type 'bsl::decay_t' direct-non-list- - // initialized with 'bsl::forward(policy)' and a function - // object 'f' of type 'bsl::decay_t' direct-non-list- - // initialized with 'bsl::forward(function)', such that: - //: o When called with no arguments, performs - //: 'ExecutionUtil::execute(p, f)' and returns the result of that - //: operation. - //: o When called with 1 or more arguments 'args...' of type 'ARGS...', - //: performs 'ExecutionUtil::execute(p, bsl::move(f2))' and return - //: the result of that operation, where 'f1' is the result of - //: 'DECAY_COPY(f)' evaluated in the calling thread, 'args1...' is - //: the result of 'DECAY_COPY(args)...' evaluated in the calling - //: thread, and 'f2' is a function object of unspecified type that, - //: when called as 'f2()', performs 'return f1(args1...)'. - // - // 'POLICY' must be an execution policy type (see - // 'mwcex_executionpolicy'). - // - // 'bsl::decay_t' must meet the requirements of Destructible - // and MoveConstructible as specified in the C++ standard. }; // ============================================================================ @@ -702,14 +707,14 @@ BindUtil_BindWrapper::operator()() const #if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES // {{{ BEGIN GENERATED CODE -// Command line: sim_cpp11_features.pl mwcex_bindutil.h -#ifndef MWCEX_BINDUTIL_VARIADIC_LIMIT -#define MWCEX_BINDUTIL_VARIADIC_LIMIT 8 +// Command line: sim_cpp11_features.pl bmqex_bindutil.h +#ifndef BMQEX_BINDUTIL_VARIADIC_LIMIT +#define BMQEX_BINDUTIL_VARIADIC_LIMIT 8 #endif -#ifndef MWCEX_BINDUTIL_VARIADIC_LIMIT_C -#define MWCEX_BINDUTIL_VARIADIC_LIMIT_C MWCEX_BINDUTIL_VARIADIC_LIMIT +#ifndef BMQEX_BINDUTIL_VARIADIC_LIMIT_C +#define BMQEX_BINDUTIL_VARIADIC_LIMIT_C BMQEX_BINDUTIL_VARIADIC_LIMIT #endif -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 0 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 0 template template inline typename ExecutionUtil::ExecuteResult< @@ -730,9 +735,9 @@ BindUtil_BindWrapper::operator()( bdlf::BindUtil::bindR(d_function.object(), bslmf::Util::forward(arg1))); } -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 0 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 0 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 1 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 1 template template inline typename ExecutionUtil::ExecuteResult< @@ -757,9 +762,9 @@ BindUtil_BindWrapper::operator()( bslmf::Util::forward(arg1), bslmf::Util::forward(args_1))); } -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 1 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 1 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 2 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 2 template template inline typename ExecutionUtil::ExecuteResult< @@ -788,9 +793,9 @@ BindUtil_BindWrapper::operator()( bslmf::Util::forward(args_1), bslmf::Util::forward(args_2))); } -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 2 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 2 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 3 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 3 template template inline typename ExecutionUtil::ExecuteResult< @@ -823,9 +828,9 @@ BindUtil_BindWrapper::operator()( bslmf::Util::forward(args_2), bslmf::Util::forward(args_3))); } -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 3 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 3 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 4 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 4 template template inline typename ExecutionUtil::ExecuteResult< @@ -862,9 +867,9 @@ BindUtil_BindWrapper::operator()( bslmf::Util::forward(args_3), bslmf::Util::forward(args_4))); } -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 4 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 4 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 5 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 5 template template ::operator()( bslmf::Util::forward(args_4), bslmf::Util::forward(args_5))); } -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 5 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 5 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 6 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 6 template template ::operator()( bslmf::Util::forward(args_5), bslmf::Util::forward(args_6))); } -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 6 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 6 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 7 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 7 template template ::operator()( bslmf::Util::forward(args_6), bslmf::Util::forward(args_7))); } -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 7 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 7 -#if MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 8 +#if BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 8 template template ::operator()( bslmf::Util::forward(args_7), bslmf::Util::forward(args_8))); } -#endif // MWCEX_BINDUTIL_VARIADIC_LIMIT_C >= 8 +#endif // BMQEX_BINDUTIL_VARIADIC_LIMIT_C >= 8 #else // The generated code below is a workaround for the absence of perfect @@ -1137,24 +1142,11 @@ BindUtil::bindExecute(BSLS_COMPILERFEATURES_FORWARD_REF(POLICY) policy, } // close package namespace } // close enterprise namespace -#else // if ! defined(DEFINED_MWCEX_BINDUTIL_H) -#error Not valid except when included from mwcex_bindutil.h -#endif // ! defined(COMPILING_MWCEX_BINDUTIL_H) +#else // if ! defined(DEFINED_BMQEX_BINDUTIL_H) +#error Not valid except when included from bmqex_bindutil.h +#endif // ! defined(COMPILING_BMQEX_BINDUTIL_H) -#endif // ! defined(INCLUDED_MWCEX_BINDUTIL_CPP03) +#endif // ! defined(INCLUDED_BMQEX_BINDUTIL_CPP03) -// ---------------------------------------------------------------------------- -// Copyright 2022-2023 Bloomberg Finance L.P. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ----------------------------- END-OF-FILE ---------------------------------- +// SCRIPT-SHA: 60926cad35f1091c31a7d8cc9d33acc38edd25e4891f3e1d41fe7c40fd6e02f5 +// SOURCE-SHA: 5f2b7427931a119efbbe9a485a7c750fd96f10272c1f3732ffa7af0b1827d1de diff --git a/src/groups/mwc/mwcex/mwcex_executionpolicy.cpp b/src/groups/bmq/bmqex/bmqex_executionpolicy.cpp similarity index 83% rename from src/groups/mwc/mwcex/mwcex_executionpolicy.cpp rename to src/groups/bmq/bmqex/bmqex_executionpolicy.cpp index b5ddf53a8..b5d6e67cc 100644 --- a/src/groups/mwc/mwcex/mwcex_executionpolicy.cpp +++ b/src/groups/bmq/bmqex/bmqex_executionpolicy.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executionpolicy.cpp -*-C++-*- -#include +// bmqex_executionpolicy.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcex { +namespace bmqex { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcex/mwcex_executionpolicy.h b/src/groups/bmq/bmqex/bmqex_executionpolicy.h similarity index 94% rename from src/groups/mwc/mwcex/mwcex_executionpolicy.h rename to src/groups/bmq/bmqex/bmqex_executionpolicy.h index bdda06add..1d50b3ff9 100644 --- a/src/groups/mwc/mwcex/mwcex_executionpolicy.h +++ b/src/groups/bmq/bmqex/bmqex_executionpolicy.h @@ -13,23 +13,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executionpolicy.h -*-C++-*- -#ifndef INCLUDED_MWCEX_EXECUTIONPOLICY -#define INCLUDED_MWCEX_EXECUTIONPOLICY +// bmqex_executionpolicy.h -*-C++-*- +#ifndef INCLUDED_BMQEX_EXECUTIONPOLICY +#define INCLUDED_BMQEX_EXECUTIONPOLICY //@PURPOSE: Provides an execution policy to customize execution functions. // //@CLASSES: -// mwcex::ExecutionPolicy: an execution policy -// mwcex::ExecutionPolicyUtil: a namespace for factory functions +// bmqex::ExecutionPolicy: an execution policy +// bmqex::ExecutionPolicyUtil: a namespace for factory functions // //@SEE ALSO: -// mwcex_executionutil +// bmqex_executionutil // //@DESCRIPTION -// This component provides a value-semantic class, 'mwcex::ExecutionPolicy', +// This component provides a value-semantic class, 'bmqex::ExecutionPolicy', // used to customize the behavior of execution functions provided by the -// 'mwcex_executionutil' component. A policy object contains the following +// 'bmqex_executionutil' component. A policy object contains the following // properties: //: o Directionality. Is either One-Way, or Two-Way (for more information see //: package documentation). @@ -39,7 +39,7 @@ //: //: o The associated executor. Is the executor used by the execution function //: to submit function objects. By default, the system executor is used (see -//: 'mwcex_systemexecutor'). +//: 'bmqex_systemexecutor'). //: //: o The associated allocator. Is the allocator used by the execution function //: to allocate the shared state used to store the result of the submitted @@ -65,7 +65,7 @@ // defined in the 'ExecutionPolicyUtil' namespace, they mirror each // transformation operation accessible on a policy object. For example: //.. -// mwcex::ExecutionPolicyUtil::oneWay() +// bmqex::ExecutionPolicyUtil::oneWay() // .neverBlocking() // .useExecutor(myExecutor) // .useAllocator(myAllocator); @@ -77,22 +77,22 @@ /// Using policies to execute function objects ///------------------------------------------ // Execution policies are meant to be used in pair with the -// 'mwcex_executionutil' component that provides a set of execution functions -// named 'execute', defined in the 'mwcex::ExecutionUtil' namespace. 'execute' +// 'bmqex_executionutil' component that provides a set of execution functions +// named 'execute', defined in the 'bmqex::ExecutionUtil' namespace. 'execute' // accepts an execution policy and a function object to be executed according // to the specified policy. Depending on the directionality and blocking // properties of the specified policy an execution function returns either // 'void' (for One-Way policies), or the result of the submitted function -// object invocation, via a 'mwcex::Future' object. The exact type of the +// object invocation, via a 'bmqex::Future' object. The exact type of the // execution function return value can be obtained at compile time using the -// 'mwcex::ExecutionUtil::ExecuteResult' metafunction (see -// 'mwcex_executionutil'). +// 'bmqex::ExecutionUtil::ExecuteResult' metafunction (see +// 'bmqex_executionutil'). // // Lets say we are to execute a function object 'myFunction' on an unspecified // execution context associated with an executor object 'myExecutor'. If what // we desire is "fire and forget", then we would use a One-Way policy: //.. -// using mwcex; +// using bmqex; // // auto myFunction = []() -> void { bsl::cout << "It works!\n"; }; // @@ -104,7 +104,7 @@ // However, if we were to obtain the result (lets say an 'int') of the // submitted function object invocation, we would use a Two-Way policy: //.. -// using mwcex; +// using bmqex; // // auto myFunction = []() -> int { return 42; }; // @@ -121,22 +121,22 @@ ///--------------------------------------- // A continuation callback is a function object that is executed after the // completion of a previously initiated asynchronous operation and is passed -// the result of that operation. The 'mwcex::ExecutionUtil' namespace provides +// the result of that operation. The 'bmqex::ExecutionUtil' namespace provides // a set of execution functions named 'thenExecute' used to execute // continuations. Similarly to 'execute', 'thenExecute' takes an execution -// policy and a function object arguments, but also a 'mwcex::Future' object to +// policy and a function object arguments, but also a 'bmqex::Future' object to // be attached the continuation callback to. When the shared state associated // with the future object becomes ready, the attached callback is executed as // if by a call to 'execute' with the same policy passed to 'thenExecute', // except that the callback is passed the result of the completed asynchronous -// operation encoded in a 'mwcex::FutureResult' object. If the policy used is -// Two-Way policy, the caller of 'thenExecute' is returned a 'mwcex::Future' +// operation encoded in a 'bmqex::FutureResult' object. If the policy used is +// Two-Way policy, the caller of 'thenExecute' is returned a 'bmqex::Future' // object to be containing the result of the continuation callback invocation. // The exact type of the execution function return value can be obtained at -// compile time using the 'mwcex::ExecutionUtil::ThenExecuteResult' -// metafunction (see 'mwcex_executionutil'). +// compile time using the 'bmqex::ExecutionUtil::ThenExecuteResult' +// metafunction (see 'bmqex_executionutil'). //.. -// using mwcex; +// using bmqex; // // // initiate an async operation and obtain an associated future object // Future future1 = asyncDoStuff(); @@ -171,7 +171,7 @@ // result type using the 'twoWayR' policy transformation operation, as shown // below: //.. -// using mwcex; +// using bmqex; // Future result = ExecutionUtil::execute( // ExecutionPolicyUtil::twoWayR() // .neverBlocking() @@ -183,10 +183,8 @@ // does occur. If the specified result type is 'void' and the returned type is // not, the result of the function object invocation is discarded. -// MWC - -#include -#include +#include +#include // BDE #include @@ -199,7 +197,7 @@ namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ================================== // struct ExecutionPolicy_IsTwoWayTag @@ -384,7 +382,7 @@ struct ExecutionPolicyUtil { // CLASS METHODS /// Return the default execution policy, that is a One-Way Possibly - /// Blocking policy using a default-constructed `mwcex::SystemExecutor` + /// Blocking policy using a default-constructed `bmqex::SystemExecutor` /// and the currently installed default allocator. static ExecutionPolicy<> defaultPolicy(); diff --git a/src/groups/mwc/mwcex/mwcex_executionpolicy.t.cpp b/src/groups/bmq/bmqex/bmqex_executionpolicy.t.cpp similarity index 70% rename from src/groups/mwc/mwcex/mwcex_executionpolicy.t.cpp rename to src/groups/bmq/bmqex/bmqex_executionpolicy.t.cpp index 993f430b1..e11fe746c 100644 --- a/src/groups/mwc/mwcex/mwcex_executionpolicy.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_executionpolicy.t.cpp @@ -13,14 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executionpolicy.t.cpp -*-C++-*- -#include +// bmqex_executionpolicy.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include -// MWC -#include +#include // BDE #include @@ -44,7 +43,7 @@ static void test1_policy_constructor() // Create a policy. Check postconditions. // // Testing: -// mwcex::ExecutionPolicy's constructor +// bmqex::ExecutionPolicy's constructor // ------------------------------------------------------------------------ { typedef int ExecutorType; @@ -55,13 +54,13 @@ static void test1_policy_constructor() bslma::TestAllocator allocator; // construct - mwcex::ExecutionPolicy p( - mwcex::ExecutionProperty::e_NEVER_BLOCKING, + bmqex::ExecutionPolicy p( + bmqex::ExecutionProperty::e_NEVER_BLOCKING, executor, &allocator); // check postconditions - ASSERT_EQ(p.blocking(), mwcex::ExecutionProperty::e_NEVER_BLOCKING); + ASSERT_EQ(p.blocking(), bmqex::ExecutionProperty::e_NEVER_BLOCKING); ASSERT_EQ(p.executor(), executor); ASSERT_EQ(p.allocator(), &allocator); } @@ -77,7 +76,7 @@ static void test2_policy_copyConstructor() // Create a policy. Copy it. Check postconditions. // // Testing: -// mwcex::ExecutionPolicy's copy constructor +// bmqex::ExecutionPolicy's copy constructor // ------------------------------------------------------------------------ { typedef int ExecutorType1; @@ -91,13 +90,13 @@ static void test2_policy_copyConstructor() // regular copy { // make original - mwcex::ExecutionPolicy - original(mwcex::ExecutionProperty::e_ALWAYS_BLOCKING, + bmqex::ExecutionPolicy + original(bmqex::ExecutionProperty::e_ALWAYS_BLOCKING, executor, &allocator); // make a copy - mwcex::ExecutionPolicy + bmqex::ExecutionPolicy copy = original; // check the copy @@ -109,13 +108,13 @@ static void test2_policy_copyConstructor() // executor-converting copy { // make original - mwcex::ExecutionPolicy - original(mwcex::ExecutionProperty::e_ALWAYS_BLOCKING, + bmqex::ExecutionPolicy + original(bmqex::ExecutionProperty::e_ALWAYS_BLOCKING, executor, &allocator); // make a copy - mwcex::ExecutionPolicy + bmqex::ExecutionPolicy copy = original; // check the copy @@ -139,14 +138,14 @@ static void test3_policy_transformations() // the transformed property. // // Testing: -// mwcex::ExecutionPolicy::oneWay -// mwcex::ExecutionPolicy::twoWay -// mwcex::ExecutionPolicy::twoWayR -// mwcex::ExecutionPolicy::neverBlocking -// mwcex::ExecutionPolicy::possiblyBlocking -// mwcex::ExecutionPolicy::alwaysBlocking -// mwcex::ExecutionPolicy::useExecutor -// mwcex::ExecutionPolicy::useAllocator +// bmqex::ExecutionPolicy::oneWay +// bmqex::ExecutionPolicy::twoWay +// bmqex::ExecutionPolicy::twoWayR +// bmqex::ExecutionPolicy::neverBlocking +// bmqex::ExecutionPolicy::possiblyBlocking +// bmqex::ExecutionPolicy::alwaysBlocking +// bmqex::ExecutionPolicy::useExecutor +// bmqex::ExecutionPolicy::useAllocator // ------------------------------------------------------------------------ { typedef int ExecutorType1; @@ -161,12 +160,12 @@ static void test3_policy_transformations() // oneWay { - mwcex::ExecutionPolicy - p1(mwcex::ExecutionProperty::e_NEVER_BLOCKING, + bmqex::ExecutionPolicy + p1(bmqex::ExecutionProperty::e_NEVER_BLOCKING, executor1, &allocator1); - mwcex::ExecutionPolicy + bmqex::ExecutionPolicy p2 = p1.oneWay(); ASSERT_EQ(p2.blocking(), p1.blocking()); @@ -176,12 +175,12 @@ static void test3_policy_transformations() // twoWay { - mwcex::ExecutionPolicy - p1(mwcex::ExecutionProperty::e_NEVER_BLOCKING, + bmqex::ExecutionPolicy + p1(bmqex::ExecutionProperty::e_NEVER_BLOCKING, executor1, &allocator1); - mwcex::ExecutionPolicy + bmqex::ExecutionPolicy p2 = p1.twoWay(); ASSERT_EQ(p2.blocking(), p1.blocking()); @@ -191,12 +190,12 @@ static void test3_policy_transformations() // twoWayR { - mwcex::ExecutionPolicy - p1(mwcex::ExecutionProperty::e_NEVER_BLOCKING, + bmqex::ExecutionPolicy + p1(bmqex::ExecutionProperty::e_NEVER_BLOCKING, executor1, &allocator1); - mwcex::ExecutionPolicy, + bmqex::ExecutionPolicy, ExecutorType1> p2 = p1.twoWayR(); @@ -207,58 +206,58 @@ static void test3_policy_transformations() // neverBlocking { - mwcex::ExecutionPolicy - p1(mwcex::ExecutionProperty::e_ALWAYS_BLOCKING, + bmqex::ExecutionPolicy + p1(bmqex::ExecutionProperty::e_ALWAYS_BLOCKING, executor1, &allocator1); - mwcex::ExecutionPolicy + bmqex::ExecutionPolicy p2 = p1.neverBlocking(); - ASSERT_EQ(p2.blocking(), mwcex::ExecutionProperty::e_NEVER_BLOCKING); + ASSERT_EQ(p2.blocking(), bmqex::ExecutionProperty::e_NEVER_BLOCKING); ASSERT_EQ(p2.executor(), p1.executor()); ASSERT_EQ(p2.allocator(), p1.allocator()); } // possiblyBlocking { - mwcex::ExecutionPolicy - p1(mwcex::ExecutionProperty::e_NEVER_BLOCKING, + bmqex::ExecutionPolicy + p1(bmqex::ExecutionProperty::e_NEVER_BLOCKING, executor1, &allocator1); - mwcex::ExecutionPolicy + bmqex::ExecutionPolicy p2 = p1.possiblyBlocking(); ASSERT_EQ(p2.blocking(), - mwcex::ExecutionProperty::e_POSSIBLY_BLOCKING); + bmqex::ExecutionProperty::e_POSSIBLY_BLOCKING); ASSERT_EQ(p2.executor(), p1.executor()); ASSERT_EQ(p2.allocator(), p1.allocator()); } // alwaysBlocking { - mwcex::ExecutionPolicy - p1(mwcex::ExecutionProperty::e_NEVER_BLOCKING, + bmqex::ExecutionPolicy + p1(bmqex::ExecutionProperty::e_NEVER_BLOCKING, executor1, &allocator1); - mwcex::ExecutionPolicy + bmqex::ExecutionPolicy p2 = p1.alwaysBlocking(); - ASSERT_EQ(p2.blocking(), mwcex::ExecutionProperty::e_ALWAYS_BLOCKING); + ASSERT_EQ(p2.blocking(), bmqex::ExecutionProperty::e_ALWAYS_BLOCKING); ASSERT_EQ(p2.executor(), p1.executor()); ASSERT_EQ(p2.allocator(), p1.allocator()); } // useExecutor { - mwcex::ExecutionPolicy - p1(mwcex::ExecutionProperty::e_NEVER_BLOCKING, + bmqex::ExecutionPolicy + p1(bmqex::ExecutionProperty::e_NEVER_BLOCKING, executor1, &allocator1); - mwcex::ExecutionPolicy + bmqex::ExecutionPolicy p2 = p1.useExecutor(executor2); ASSERT_EQ(p2.blocking(), p1.blocking()); @@ -270,12 +269,12 @@ static void test3_policy_transformations() // useAllocator { - mwcex::ExecutionPolicy - p1(mwcex::ExecutionProperty::e_NEVER_BLOCKING, + bmqex::ExecutionPolicy + p1(bmqex::ExecutionProperty::e_NEVER_BLOCKING, executor1, &allocator1); - mwcex::ExecutionPolicy + bmqex::ExecutionPolicy p2 = p1.useAllocator(&allocator2); ASSERT_EQ(p2.blocking(), p1.blocking()); @@ -295,17 +294,17 @@ static void test4_policy_traits() // Check that each policy traits returns the right value. // // Testing: -// mwcex::ExecutionPolicy::k_IS_ONE_WAY -// mwcex::ExecutionPolicy::k_IS_TWO_WAY +// bmqex::ExecutionPolicy::k_IS_ONE_WAY +// bmqex::ExecutionPolicy::k_IS_TWO_WAY // ------------------------------------------------------------------------ { - typedef mwcex::ExecutionPolicy + typedef bmqex::ExecutionPolicy OneWayPolicy; - typedef mwcex::ExecutionPolicy + typedef bmqex::ExecutionPolicy TwoWayPolicy; - typedef mwcex::ExecutionPolicy > + typedef bmqex::ExecutionPolicy > TwoWayPolicyWithResult; ASSERT(OneWayPolicy::k_IS_ONE_WAY && !OneWayPolicy::k_IS_TWO_WAY); @@ -327,42 +326,42 @@ static void test5_util() // Check each utility function. // // Testing: -// mwcex::ExecutionPolicyUtil::defaultPolicy -// mwcex::ExecutionPolicyUtil::oneWay -// mwcex::ExecutionPolicyUtil::twoWay -// mwcex::ExecutionPolicyUtil::twoWayR -// mwcex::ExecutionPolicyUtil::neverBlocking -// mwcex::ExecutionPolicyUtil::possiblyBlocking -// mwcex::ExecutionPolicyUtil::alwaysBlocking -// mwcex::ExecutionPolicyUtil::useExecutor -// mwcex::ExecutionPolicyUtil::useAllocator +// bmqex::ExecutionPolicyUtil::defaultPolicy +// bmqex::ExecutionPolicyUtil::oneWay +// bmqex::ExecutionPolicyUtil::twoWay +// bmqex::ExecutionPolicyUtil::twoWayR +// bmqex::ExecutionPolicyUtil::neverBlocking +// bmqex::ExecutionPolicyUtil::possiblyBlocking +// bmqex::ExecutionPolicyUtil::alwaysBlocking +// bmqex::ExecutionPolicyUtil::useExecutor +// bmqex::ExecutionPolicyUtil::useAllocator // ------------------------------------------------------------------------ { typedef int ExecutorType; // NOTE: This is not a real executor type, but for the purpose of this // test it will do. - typedef mwcex::ExecutionPolicy + typedef bmqex::ExecutionPolicy DefaultPolicyType; ExecutorType executor = 42; bslma::TestAllocator allocator; DefaultPolicyType defaultPolicy = - mwcex::ExecutionPolicyUtil::defaultPolicy(); + bmqex::ExecutionPolicyUtil::defaultPolicy(); // defaultPolicy { ASSERT_EQ(defaultPolicy.blocking(), - mwcex::ExecutionProperty::e_POSSIBLY_BLOCKING); - ASSERT(defaultPolicy.executor() == mwcex::SystemExecutor()); + bmqex::ExecutionProperty::e_POSSIBLY_BLOCKING); + ASSERT(defaultPolicy.executor() == bmqex::SystemExecutor()); ASSERT_EQ(defaultPolicy.allocator(), bslma::Default::allocator()); } // oneWay { DefaultPolicyType::RebindOneWay::Type p = - mwcex::ExecutionPolicyUtil::oneWay(); + bmqex::ExecutionPolicyUtil::oneWay(); ASSERT_EQ(p.blocking(), defaultPolicy.blocking()); ASSERT(p.executor() == defaultPolicy.executor()); @@ -372,7 +371,7 @@ static void test5_util() // twoWay { DefaultPolicyType::RebindTwoWay::Type p = - mwcex::ExecutionPolicyUtil::twoWay(); + bmqex::ExecutionPolicyUtil::twoWay(); ASSERT_EQ(p.blocking(), defaultPolicy.blocking()); ASSERT(p.executor() == defaultPolicy.executor()); @@ -382,7 +381,7 @@ static void test5_util() // twoWayR { DefaultPolicyType::RebindTwoWayR::Type p = - mwcex::ExecutionPolicyUtil::twoWayR(); + bmqex::ExecutionPolicyUtil::twoWayR(); ASSERT_EQ(p.blocking(), defaultPolicy.blocking()); ASSERT(p.executor() == defaultPolicy.executor()); @@ -391,27 +390,27 @@ static void test5_util() // neverBlocking { - DefaultPolicyType p = mwcex::ExecutionPolicyUtil::neverBlocking(); + DefaultPolicyType p = bmqex::ExecutionPolicyUtil::neverBlocking(); - ASSERT_EQ(p.blocking(), mwcex::ExecutionProperty::e_NEVER_BLOCKING); + ASSERT_EQ(p.blocking(), bmqex::ExecutionProperty::e_NEVER_BLOCKING); ASSERT(p.executor() == defaultPolicy.executor()); ASSERT_EQ(p.allocator(), defaultPolicy.allocator()); } // possiblyBlocking { - DefaultPolicyType p = mwcex::ExecutionPolicyUtil::possiblyBlocking(); + DefaultPolicyType p = bmqex::ExecutionPolicyUtil::possiblyBlocking(); - ASSERT_EQ(p.blocking(), mwcex::ExecutionProperty::e_POSSIBLY_BLOCKING); + ASSERT_EQ(p.blocking(), bmqex::ExecutionProperty::e_POSSIBLY_BLOCKING); ASSERT(p.executor() == defaultPolicy.executor()); ASSERT_EQ(p.allocator(), defaultPolicy.allocator()); } // alwaysBlocking { - DefaultPolicyType p = mwcex::ExecutionPolicyUtil::alwaysBlocking(); + DefaultPolicyType p = bmqex::ExecutionPolicyUtil::alwaysBlocking(); - ASSERT_EQ(p.blocking(), mwcex::ExecutionProperty::e_ALWAYS_BLOCKING); + ASSERT_EQ(p.blocking(), bmqex::ExecutionProperty::e_ALWAYS_BLOCKING); ASSERT(p.executor() == defaultPolicy.executor()); ASSERT_EQ(p.allocator(), defaultPolicy.allocator()); } @@ -419,7 +418,7 @@ static void test5_util() // useExecutor { DefaultPolicyType::RebindExecutor::Type p = - mwcex::ExecutionPolicyUtil::useExecutor(executor); + bmqex::ExecutionPolicyUtil::useExecutor(executor); ASSERT_EQ(p.blocking(), defaultPolicy.blocking()); ASSERT_EQ(p.executor(), executor); @@ -428,7 +427,7 @@ static void test5_util() // useAllocator { - DefaultPolicyType p = mwcex::ExecutionPolicyUtil::useAllocator( + DefaultPolicyType p = bmqex::ExecutionPolicyUtil::useAllocator( &allocator); ASSERT_EQ(p.blocking(), defaultPolicy.blocking()); @@ -443,7 +442,7 @@ static void test5_util() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_policy_constructor(); break; @@ -459,5 +458,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/mwcex_executionproperty.cpp b/src/groups/bmq/bmqex/bmqex_executionproperty.cpp similarity index 83% rename from src/groups/mwc/mwcex/mwcex_executionproperty.cpp rename to src/groups/bmq/bmqex/bmqex_executionproperty.cpp index 2061ffab7..a69b63883 100644 --- a/src/groups/mwc/mwcex/mwcex_executionproperty.cpp +++ b/src/groups/bmq/bmqex/bmqex_executionproperty.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executionproperty.cpp -*-C++-*- -#include +// bmqex_executionproperty.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcex { +namespace bmqex { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcex/mwcex_executionproperty.h b/src/groups/bmq/bmqex/bmqex_executionproperty.h similarity index 79% rename from src/groups/mwc/mwcex/mwcex_executionproperty.h rename to src/groups/bmq/bmqex/bmqex_executionproperty.h index e6959fb42..56db38682 100644 --- a/src/groups/mwc/mwcex/mwcex_executionproperty.h +++ b/src/groups/bmq/bmqex/bmqex_executionproperty.h @@ -13,35 +13,33 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executionproperty.h -*-C++-*- -#ifndef INCLUDED_MWCEX_EXECUTIONPROPERTY -#define INCLUDED_MWCEX_EXECUTIONPROPERTY +// bmqex_executionproperty.h -*-C++-*- +#ifndef INCLUDED_BMQEX_EXECUTIONPROPERTY +#define INCLUDED_BMQEX_EXECUTIONPROPERTY -//@PURPOSE: Provides utility tag types to be used with 'mwcex::ExecutionPolicy' +//@PURPOSE: Provides utility tag types to be used with 'bmqex::ExecutionPolicy' // //@CLASSES: // ExecutionProperty: a namespace for utility tag types and enumeration values // //@SEE ALSO: -// mwcex::ExecutionPolicy +// bmqex::ExecutionPolicy // //@DESCRIPTION: -// This component provides a struct, 'mwcex::ExecutionProperty', that serves as +// This component provides a struct, 'bmqex::ExecutionProperty', that serves as // a namespace for utility tag types and enumeration values to be used with -// 'mwcex::ExecutionPolicy' to specify the execution policy direction and +// 'bmqex::ExecutionPolicy' to specify the execution policy direction and // blocking properties. -// MWC - namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ======================== // struct ExecutionProperty // ======================== /// Provides a namespace for utility tag types and enumeration values to be -/// used with `mwcex::ExecutionPolicy` to specify the execution policy +/// used with `bmqex::ExecutionPolicy` to specify the execution policy /// direction and blocking properties. struct ExecutionProperty { // TYPES @@ -55,8 +53,7 @@ struct ExecutionProperty { /// Provides a tag type defining the Two-Way direction property and the /// result type of the execution function. template - struct TwoWayR { - }; + struct TwoWayR {}; enum Blocking { // Provides a enumeration type defining the blocking behavior property. diff --git a/src/groups/mwc/mwcex/mwcex_executionutil.cpp b/src/groups/bmq/bmqex/bmqex_executionutil.cpp similarity index 83% rename from src/groups/mwc/mwcex/mwcex_executionutil.cpp rename to src/groups/bmq/bmqex/bmqex_executionutil.cpp index aede10ccc..1f5b46ff4 100644 --- a/src/groups/mwc/mwcex/mwcex_executionutil.cpp +++ b/src/groups/bmq/bmqex/bmqex_executionutil.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executionutil.cpp -*-C++-*- -#include +// bmqex_executionutil.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcex { +namespace bmqex { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcex/mwcex_executionutil.h b/src/groups/bmq/bmqex/bmqex_executionutil.h similarity index 97% rename from src/groups/mwc/mwcex/mwcex_executionutil.h rename to src/groups/bmq/bmqex/bmqex_executionutil.h index 6affdafb6..73294fff8 100644 --- a/src/groups/mwc/mwcex/mwcex_executionutil.h +++ b/src/groups/bmq/bmqex/bmqex_executionutil.h @@ -13,23 +13,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executionutil.h -*-C++-*- -#ifndef INCLUDED_MWCEX_EXECUTIONUTIL -#define INCLUDED_MWCEX_EXECUTIONUTIL +// bmqex_executionutil.h -*-C++-*- +#ifndef INCLUDED_BMQEX_EXECUTIONUTIL +#define INCLUDED_BMQEX_EXECUTIONUTIL //@PURPOSE: Provides utility functions to execute function objects. // //@CLASSES: -// mwcex::ExecutionUtil: a namespace for utility functions to execute functors +// bmqex::ExecutionUtil: a namespace for utility functions to execute functors // //@SEE ALSO: -// mwcex_executionpolicy +// bmqex_executionpolicy // //@DESCRIPTION: -// This component provides a struct, 'mwcex::ExecutionUtil', that serves as a +// This component provides a struct, 'bmqex::ExecutionUtil', that serves as a // namespace for utility functions to execute function objects of arbitrary // (template parameter) type according to a set of rules defined by a specific -// execution policy (see 'mwcex_executionpolicy'). +// execution policy (see 'bmqex_executionpolicy'). // // Those utility functions are commonly referred as execution functions. There // are two types of them: @@ -38,7 +38,7 @@ // /// Execution functions for immediate execution ///------------------------------------------- -// Those are functions, all named 'mwcex::ExecutionUtil::execute', to initiate +// Those are functions, all named 'bmqex::ExecutionUtil::execute', to initiate // immediate execution of function objects. Function objects executed should // not take any argument, and may or may not return a value. //.. @@ -49,10 +49,10 @@ // return 42; // }; //.. -// 'execute' takes an execution policy (see 'mwcex_executionpolicy') specifying +// 'execute' takes an execution policy (see 'bmqex_executionpolicy') specifying // how the function object is to be executed, and the function object itself. // -// Below are several usage examples of 'mwcex::ExecutionUtil::execute' for +// Below are several usage examples of 'bmqex::ExecutionUtil::execute' for // different use cases. // // 1. All we want is the function object to be executed. Don't want the result, @@ -60,7 +60,7 @@ // commonly referred as "fire and forget". For that we may use a One-Way // Never Blocking execution policy. //.. -// using mwcex; +// using bmqex; // // // initiate the execution and "forget" about it // ExecutionUtil::execute(ExecutionPolicyUtil::oneWay() @@ -71,7 +71,7 @@ // completion, but still want to retrieve the invocation result. Lets use a // Two-Way Never Blocking execution policy. //.. -// using mwcex; +// using bmqex; // // // initiate the execution, obtain a future // Future future = ExecutionUtil::execute( @@ -93,15 +93,15 @@ // /// Execution functions for deferred execution ///------------------------------------------ -// Those are functions, all named 'mwcex::ExecutionUtil::thenExecute', to +// Those are functions, all named 'bmqex::ExecutionUtil::thenExecute', to // execute continuation callbacks. A continuation callback being a function // object that is executed after the completion of a previously initiated // asynchronous operation and is passed the result of that operation encoded in -// a 'mwcex::FutureResult' object. The callback itself may or may not return a +// a 'bmqex::FutureResult' object. The callback itself may or may not return a // value. //.. // // a continuation callback to be executed -// auto myCallback = [](mwcex::FutureResult result) -> bsl::string +// auto myCallback = [](bmqex::FutureResult result) -> bsl::string // { // bsl::cout << result.get() << "\n"; // return bsl::to_string(result.get()); @@ -109,11 +109,11 @@ //.. // // Like 'execute', 'thenExecute' takes an execution policy and a function -// object (the continuation callback), but also a 'mwcex::Future' object +// object (the continuation callback), but also a 'bmqex::Future' object // representing the asynchronous operation after the completion of which the // callback is to be executed. //.. -// using mwcex; +// using bmqex; // // // initiate an async operation, obtain an associated future // Future future = doAsyncStuff(); @@ -129,7 +129,7 @@ // execution policy, the callback result is discarded. If we want to obtain the // callback invocation result, we have to use a Two-Way policy. //.. -// using mwcex; +// using bmqex; // // // initiate an async operation, obtain an associated future // Future future1 = doAsyncStuff(); @@ -142,15 +142,15 @@ // myCallback); //.. // -///'mwcex::ExecutionUtil::invoke' +///'bmqex::ExecutionUtil::invoke' ///------------------------------ -// 'mwcex::ExecutionUtil::invoke' is a special execution function that is +// 'bmqex::ExecutionUtil::invoke' is a special execution function that is // functionally equivalent to a Two-Way Always Blocking execution function, // except that it returns the invocation result directly, rather than via a // 'Future' object. That optimization allows to avoid unnecessary memory // allocations. //.. -// using mwcex; +// using bmqex; // // // initiate the execution, wait for its completion, and get the result // int result = ExecutionUtil::invoke(SystemExecutor(), myFunction); @@ -158,11 +158,9 @@ // BSLS_ASSERT(result == 42); //.. -// MWC - -#include -#include -#include +#include +#include +#include // BDE #include @@ -193,7 +191,7 @@ namespace BloombergLP { -namespace mwcex { +namespace bmqex { // FORWARD DECLARATION template @@ -204,10 +202,9 @@ class ExecutionPolicy; // ================================== /// Provides a metafunction that determines, at compile time, the type -/// returned by `mwcex::ExecutionUtil::execute`. +/// returned by `bmqex::ExecutionUtil::execute`. template -struct ExecutionUtil_ExecuteResult { -}; +struct ExecutionUtil_ExecuteResult {}; /// Provides a specialization of `ExecutionUtil_ExecuteResult` for One-Way /// policies. @@ -251,10 +248,9 @@ struct ExecutionUtil_ExecuteResult< // ====================================== /// Provides a metafunction that determines, at compile time, the type -/// returned by `mwcex::ExecutionUtil::thenExecute`. +/// returned by `bmqex::ExecutionUtil::thenExecute`. template -struct ExecutionUtil_ThenExecuteResult { -}; +struct ExecutionUtil_ThenExecuteResult {}; /// Provides a specialization of `ExecutionUtil_ThenExecuteResult` for /// One-Way policies. @@ -840,7 +836,7 @@ class ExecutionUtil_ContinuationCallbackWrapper { /// object. /// /// `P` must be a One-Way execution policy type (see -/// `mwcex_executionpolicy`). +/// `bmqex_executionpolicy`). /// /// `R` must be such as `Future` is a valid type. /// @@ -921,7 +917,7 @@ class ExecutionUtil_OneWayContinuation { /// to the same shared state and callback object. /// /// `P` must be a Two-Way execution policy type (see -/// `mwcex_executionpolicy`). +/// `bmqex_executionpolicy`). /// /// `R1` must be such as `Future` is a valid type. /// @@ -1000,11 +996,11 @@ struct ExecutionUtil { // TYPES /// Provides a metafunction that determines, at compile time, the type - /// returned by `mwcex::ExecutionUtil::execute`. + /// returned by `bmqex::ExecutionUtil::execute`. /// /// Given: /// * A type `P`, that is an execution policy type (see - ///: `mwcex_executionpolicy`). + ///: `bmqex_executionpolicy`). ///: /// * A type `F`, such that `bsl::decay_t` satisfies the /// requirements of Destructible and MoveConstructible as specified @@ -1014,10 +1010,10 @@ struct ExecutionUtil { /// specified, or the result type of /// `DECAY_COPY(std::forward(f))()` otherwise. /// - /// The type of `mwcex::ExecutionUtil::ExecuteResult::Type` + /// The type of `bmqex::ExecutionUtil::ExecuteResult::Type` /// expression is the follow: /// * If `P` is a One-Way policy - `void`. - /// * If `P` is a Two-Way policy - `mwcex::Future`. + /// * If `P` is a Two-Way policy - `bmqex::Future`. template struct ExecuteResult { // TYPES @@ -1026,13 +1022,13 @@ struct ExecutionUtil { }; /// Provides a metafunction that determines, at compile time, the type - /// returned by `mwcex::ExecutionUtil::thenExecute`. + /// returned by `bmqex::ExecutionUtil::thenExecute`. /// /// Given: /// * A type `P`, that is an execution policy type (see - ///: `mwcex_executionpolicy`). + ///: `bmqex_executionpolicy`). ///: - /// * A type `FT`, that is `mwcex::Future`. + /// * A type `FT`, that is `bmqex::Future`. /// * A type `FN`, such that `bsl::decay_t` satisfies the /// requirements of Destructible and MoveConstructible as specified /// in the C++ standard, and such that and object `fn` of type `FN` @@ -1043,10 +1039,10 @@ struct ExecutionUtil { /// std::forward(fn))(bsl::declval>())' /// otherwise. /// - /// The type of `mwcex::ThenExecuteResult::Type` expression + /// The type of `bmqex::ThenExecuteResult::Type` expression /// is the follow: /// * If `P` is a One-Way policy - `void`. - /// * If `P` is a Two-Way policy - `mwcex::Future`. + /// * If `P` is a Two-Way policy - `bmqex::Future`. template struct ThenExecuteResult { // TYPES @@ -1493,7 +1489,7 @@ ExecutionUtil_UniqueTwoWayTask::operator()() BSLS_NOTHROW_SPEC // will be destroyed immediately after 'get' return. // // We wouldn't need to perform such synchronization if the completion - // of 'mwcex::FutureSharedState's 'get' function were synchronizing + // of 'bmqex::FutureSharedState's 'get' function were synchronizing // with the completion of its setter functions, but, for performance // reasons, it does not. @@ -1866,7 +1862,7 @@ ExecutionUtil::execute( #else typedef typename bsl::invoke_result::type>::type - Result; + Result; #endif return execute(policy.template twoWayR(), diff --git a/src/groups/mwc/mwcex/mwcex_executionutil.t.cpp b/src/groups/bmq/bmqex/bmqex_executionutil.t.cpp similarity index 84% rename from src/groups/mwc/mwcex/mwcex_executionutil.t.cpp rename to src/groups/bmq/bmqex/bmqex_executionutil.t.cpp index 3d48eb695..8bf824ada 100644 --- a/src/groups/mwc/mwcex/mwcex_executionutil.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_executionutil.t.cpp @@ -13,16 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executionutil.t.cpp -*-C++-*- -#include +// bmqex_executionutil.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -90,7 +89,7 @@ struct DummyNullaryFunction { // ================================ /// Provides a dummy function object which call operator takes a value of -/// type `mwcex::FutureResult` and returns a value of type `R2`. +/// type `bmqex::FutureResult` and returns a value of type `R2`. template struct DummyContinuationFunction { /// Defines the result type of the call operator. @@ -99,7 +98,7 @@ struct DummyContinuationFunction { // ACCESSORS /// Not implemented. - R2 operator()(mwcex::FutureResult) const; + R2 operator()(bmqex::FutureResult) const; }; // ==================== @@ -234,7 +233,7 @@ struct SetValueContinuation { } // ACCESSORS - void operator()(mwcex::FutureResult result) const + void operator()(bmqex::FutureResult result) const { *d_value_p = result.get(); } @@ -254,7 +253,7 @@ struct ForwardValueContinuation { typedef VALUE ResultType; // ACCESSORS - VALUE operator()(mwcex::FutureResult result) const + VALUE operator()(bmqex::FutureResult result) const { return result.get(); } @@ -465,12 +464,12 @@ static void test1_executeResult() // Ensure proper behavior of the 'ExecuteResult' metafunction // // Plan: -// Check that the 'mwcex::ExecutionUtil::ExecuteResult' metafunction +// Check that the 'bmqex::ExecutionUtil::ExecuteResult' metafunction // conforms to the specification. That is: // // Given: //: o A type 'P', that is an execution policy type (see -//: 'mwcex_executionpolicy'). +//: 'bmqex_executionpolicy'). //: //: o A type 'F', such that 'bsl::decay_t' satisfies the requirements //: of Destructible and MoveConstructible as specified in the C++ @@ -481,32 +480,32 @@ static void test1_executeResult() //: specified, or the result type of 'DECAY_COPY(std::forward(f))()' //: otherwise. // -// The type of 'mwcex::ExecutionUtil::ExecuteResult::Type' +// The type of 'bmqex::ExecutionUtil::ExecuteResult::Type' // expression is the follow: //: o If 'P' is a One-Way policy - 'void'. //: -//: o If 'P' is a Two-Way policy - 'mwcex::Future'. +//: o If 'P' is a Two-Way policy - 'bmqex::Future'. // // Testing: -// mwcex::ExecutionUtil::ExecuteResult +// bmqex::ExecutionUtil::ExecuteResult // ------------------------------------------------------------------------ { // One-Way policy { - typedef mwcex::ExecutionPolicy + typedef bmqex::ExecutionPolicy PolicyType; - ASSERT((bsl::is_same >::Type, void>::value)); - ASSERT((bsl::is_same >::Type, void>::value)); - ASSERT((bsl::is_same >::Type, void>::value)); @@ -514,45 +513,45 @@ static void test1_executeResult() // Two-Way policy { - typedef mwcex::ExecutionPolicy + typedef bmqex::ExecutionPolicy PolicyType; - ASSERT((bsl::is_same >::Type, - mwcex::Future >::value)); + bmqex::Future >::value)); - ASSERT((bsl::is_same >::Type, - mwcex::Future >::value)); + bmqex::Future >::value)); - ASSERT((bsl::is_same >::Type, - mwcex::Future >::value)); + bmqex::Future >::value)); } // Two-Way policy with encoded result type { - typedef mwcex::ExecutionPolicy< - mwcex::ExecutionProperty::TwoWayR > + typedef bmqex::ExecutionPolicy< + bmqex::ExecutionProperty::TwoWayR > PolicyType; - ASSERT((bsl::is_same >::Type, - mwcex::Future >::value)); + bmqex::Future >::value)); - ASSERT((bsl::is_same >::Type, - mwcex::Future >::value)); + bmqex::Future >::value)); - ASSERT((bsl::is_same >::Type, - mwcex::Future >::value)); + bmqex::Future >::value)); } } @@ -564,14 +563,14 @@ static void test2_thenExecuteResult() // Ensure proper behavior of the 'ThenExecuteResult' metafunction // // Plan: -// Check that the 'mwcex::ExecutionUtil::ThenExecuteResult' metafunction +// Check that the 'bmqex::ExecutionUtil::ThenExecuteResult' metafunction // conforms to the specification. That is: // // Given: //: o A type 'P', that is an execution policy type (see -//: 'mwcex_executionpolicy'). +//: 'bmqex_executionpolicy'). //: -//: o A type 'FT', that is 'mwcex::Future'. +//: o A type 'FT', that is 'bmqex::Future'. //: //: o A type 'FN', such that 'bsl::decay_t' satisfies the requirements //: of Destructible and MoveConstructible as specified in the C++ @@ -583,87 +582,87 @@ static void test2_thenExecuteResult() //: 'DECAY_COPY(std::forward(fn))(bsl::declval>())' //: otherwise. // -// The type of 'mwcex::ExecutionUtil::ThenExecuteResult::Type' +// The type of 'bmqex::ExecutionUtil::ThenExecuteResult::Type' // expression is the follow: //: o If 'P' is a One-Way policy - 'void'. //: -//: o If 'P' is a Two-Way policy - 'mwcex::Future'. +//: o If 'P' is a Two-Way policy - 'bmqex::Future'. // // Testing: -// mwcex::ExecutionUtil::ThenExecuteResult +// bmqex::ExecutionUtil::ThenExecuteResult // ------------------------------------------------------------------------ { // One-Way policy { - typedef mwcex::ExecutionPolicy + typedef bmqex::ExecutionPolicy PolicyType; - ASSERT((bsl::is_same, + bmqex::Future, DummyContinuationFunction >::Type, void>::value)); - ASSERT((bsl::is_same, + bmqex::Future, DummyContinuationFunction >::Type, void>::value)); - ASSERT((bsl::is_same, + bmqex::Future, DummyContinuationFunction >::Type, void>::value)); } // Two-Way policy { - typedef mwcex::ExecutionPolicy + typedef bmqex::ExecutionPolicy PolicyType; - ASSERT((bsl::is_same, + bmqex::Future, DummyContinuationFunction >::Type, - mwcex::Future >::value)); + bmqex::Future >::value)); - ASSERT((bsl::is_same, + bmqex::Future, DummyContinuationFunction >::Type, - mwcex::Future >::value)); + bmqex::Future >::value)); - ASSERT((bsl::is_same, + bmqex::Future, DummyContinuationFunction >::Type, - mwcex::Future >::value)); + bmqex::Future >::value)); } // Two-Way policy with encoded result type { - typedef mwcex::ExecutionPolicy< - mwcex::ExecutionProperty::TwoWayR > + typedef bmqex::ExecutionPolicy< + bmqex::ExecutionProperty::TwoWayR > PolicyType; - ASSERT((bsl::is_same, + bmqex::Future, DummyContinuationFunction >::Type, - mwcex::Future >::value)); + bmqex::Future >::value)); - ASSERT((bsl::is_same, + bmqex::Future, DummyContinuationFunction >::Type, - mwcex::Future >::value)); + bmqex::Future >::value)); - ASSERT((bsl::is_same, + bmqex::Future, DummyContinuationFunction >::Type, - mwcex::Future >::value)); + bmqex::Future >::value)); } } @@ -688,7 +687,7 @@ static void test3_execute_one_way_never_blocking() // not to the caller of the execution function). // // Testing: -// mwcex::ExecutionUtil::execute +// bmqex::ExecutionUtil::execute // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -704,8 +703,8 @@ static void test3_execute_one_way_never_blocking() bslmt::Semaphore sem1, sem2; // submit function object for execution - mwcex::ExecutionUtil::execute( - mwcex::ExecutionPolicyUtil::oneWay() + bmqex::ExecutionUtil::execute( + bmqex::ExecutionPolicyUtil::oneWay() .neverBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -736,7 +735,7 @@ static void test3_execute_one_way_never_blocking() // 2. Submitted function object throws an exception. { // submit function object for execution - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::oneWay() + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::oneWay() .neverBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -772,7 +771,7 @@ static void test4_execute_one_way_possibly_blocking() // not to the caller of the execution function). // // Testing: -// mwcex::ExecutionUtil::execute +// bmqex::ExecutionUtil::execute // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -788,8 +787,8 @@ static void test4_execute_one_way_possibly_blocking() bslmt::Semaphore sem1, sem2; // submit function object for execution - mwcex::ExecutionUtil::execute( - mwcex::ExecutionPolicyUtil::oneWay() + bmqex::ExecutionUtil::execute( + bmqex::ExecutionPolicyUtil::oneWay() .possiblyBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -820,7 +819,7 @@ static void test4_execute_one_way_possibly_blocking() // 2. Submitted function object throws an exception. { // submit function object for execution - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::oneWay() + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::oneWay() .possiblyBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -856,7 +855,7 @@ static void test5_execute_one_way_always_blocking() // not to the caller of the execution function). // // Testing: -// mwcex::ExecutionUtil::execute +// bmqex::ExecutionUtil::execute // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -868,7 +867,7 @@ static void test5_execute_one_way_always_blocking() SetFlagOnCall toBeExecuted(&executed); // submit function object for execution - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::oneWay() + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::oneWay() .alwaysBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -891,7 +890,7 @@ static void test5_execute_one_way_always_blocking() // 2. Submitted function object throws an exception. { // submit function object for execution - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::oneWay() + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::oneWay() .alwaysBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -919,31 +918,31 @@ static void test6_execute_two_way_never_blocking() //: o The execution function does not block the calling thread pending //: completion of the submitted function object invocation; //: o The function object is executed as if by a call to 'ex.post(f)'; -//: o The execution function returns a 'mwcex::Future' object that +//: o The execution function returns a 'bmqex::Future' object that //: becomes ready after the submitted function object completes. // // 2. Execute a function object 'f', according to a Two-Way Never // Blocking execution policy, and such that 'f()' returns a value. -// Check that the execution function returns a 'mwcex::Future' object +// Check that the execution function returns a 'bmqex::Future' object // to be containing the returned value. // // 3. Execute a function object 'f', according to a Two-Way Never // Blocking execution policy, and such that 'f()' returns a reference. -// Check that the execution function returns a 'mwcex::Future' object +// Check that the execution function returns a 'bmqex::Future' object // to be containing the returned reference. // // 4. Execute a function object 'f', according to a Two-Way Never // Blocking execution policy, and such that 'f()' returns 'void'. -// Check that the execution function returns a 'mwcex::Future' object +// Check that the execution function returns a 'bmqex::Future' object // to become ready. // // 5. Execute a function object 'f', according to a Two-Way Never // Blocking execution policy, and such that 'f()' throws an exception. -// Check that the execution function returns a 'mwcex::Future' object +// Check that the execution function returns a 'bmqex::Future' object // to be containing the thrown exception. // // Testing: -// mwcex::ExecutionUtil::execute +// bmqex::ExecutionUtil::execute // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -959,8 +958,8 @@ static void test6_execute_two_way_never_blocking() bslmt::Semaphore sem1, sem2; // submit function object for execution - mwcex::Future result = mwcex::ExecutionUtil::execute( - mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = bmqex::ExecutionUtil::execute( + bmqex::ExecutionPolicyUtil::twoWay() .neverBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -997,8 +996,8 @@ static void test6_execute_two_way_never_blocking() // 2. Submitted function object returns a value. { // submit function object for execution - mwcex::Future result = - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .neverBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1011,8 +1010,8 @@ static void test6_execute_two_way_never_blocking() // 3. Submitted function object returns a reference. { // submit function object for execution - mwcex::Future result = - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .neverBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1025,8 +1024,8 @@ static void test6_execute_two_way_never_blocking() // 4. Submitted function object returns 'void'. { // submit function object for execution - mwcex::Future result = - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .neverBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1044,9 +1043,9 @@ static void test6_execute_two_way_never_blocking() TestExecutionContext localContext(&localAlloc); // submit function object for execution - mwcex::Future result = - mwcex::ExecutionUtil::execute( - mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = + bmqex::ExecutionUtil::execute( + bmqex::ExecutionPolicyUtil::twoWay() .neverBlocking() .useExecutor(localContext.executor()) .useAllocator(&localAlloc), @@ -1081,31 +1080,31 @@ static void test7_execute_two_way_possibly_blocking() //: completion of the submitted function object; //: o The function object is executed as if by a call to //: 'ex.dispatch(f)'; -//: o The execution function returns a 'mwcex::Future' object that +//: o The execution function returns a 'bmqex::Future' object that //: becomes ready after the submitted function object completes. // // 2. Execute a function object 'f', according to a Two-Way Possibly // Blocking execution policy, and such that 'f()' returns a value. -// Check that the execution function returns a 'mwcex::Future' object +// Check that the execution function returns a 'bmqex::Future' object // to be containing the returned value. // // 3. Execute a function object 'f', according to a Two-Way Possibly // Blocking execution policy, and such that 'f()' returns a reference. -// Check that the execution function returns a 'mwcex::Future' object +// Check that the execution function returns a 'bmqex::Future' object // to be containing the returned reference. // // 4. Execute a function object 'f', according to a Two-Way Possibly // Blocking execution policy, and such that 'f()' returns 'void'. -// Check that the execution function returns a 'mwcex::Future' object +// Check that the execution function returns a 'bmqex::Future' object // to become ready. // // 5. Execute a function object 'f', according to a Two-Way Possibly // Blocking execution policy, and such that 'f()' throws an exception. -// Check that the execution function return a 'mwcex::Future' object +// Check that the execution function return a 'bmqex::Future' object // to be containing the thrown exception. // // Testing: -// mwcex::ExecutionUtil::execute +// bmqex::ExecutionUtil::execute // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -1121,8 +1120,8 @@ static void test7_execute_two_way_possibly_blocking() bslmt::Semaphore sem1, sem2; // submit function object for execution - mwcex::Future result = mwcex::ExecutionUtil::execute( - mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = bmqex::ExecutionUtil::execute( + bmqex::ExecutionPolicyUtil::twoWay() .possiblyBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1159,8 +1158,8 @@ static void test7_execute_two_way_possibly_blocking() // 2. Submitted function object returns a value. { // submit function object for execution - mwcex::Future result = - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .possiblyBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1173,8 +1172,8 @@ static void test7_execute_two_way_possibly_blocking() // 3. Submitted function object returns a reference. { // submit function object for execution - mwcex::Future result = - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .possiblyBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1187,8 +1186,8 @@ static void test7_execute_two_way_possibly_blocking() // 4. Submitted function object returns 'void'. { // submit function object for execution - mwcex::Future result = - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .possiblyBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1203,8 +1202,8 @@ static void test7_execute_two_way_possibly_blocking() // 5. Submitted function object throws an exception. { // submit function object for execution - mwcex::Future result = - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .possiblyBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1239,31 +1238,31 @@ static void test8_execute_two_way_always_blocking() //: completion of the submitted function object; //: o The function object is executed as if by a call to //: 'ex.dispatch(f)'; -//: o The execution function returns a 'mwcex::Future' object that +//: o The execution function returns a 'bmqex::Future' object that //: is ready. // // 2. Execute a function object 'f', according to a Two-Way Always // Blocking execution policy, and such that 'f()' returns a value. -// Check that the execution function returns a ready 'mwcex::Future' +// Check that the execution function returns a ready 'bmqex::Future' // object that contains that value. // // 3. Execute a function object 'f', according to a Two-Way Always // Blocking execution policy, and such that 'f()' returns a reference. -// Check that the execution function returns a ready 'mwcex::Future' +// Check that the execution function returns a ready 'bmqex::Future' // object that contains that reference. // // 4. Execute a function object 'f', according to a Two-Way Always // Blocking execution policy, and such that 'f()' returns 'void'. -// Check that the execution function returns a ready 'mwcex::Future' +// Check that the execution function returns a ready 'bmqex::Future' // object. // // 5. Execute a function object 'f', according to a Two-Way Always // Blocking execution policy, and such that 'f()' throws an exception. -// Check that the execution function returns a ready 'mwcex::Future' +// Check that the execution function returns a ready 'bmqex::Future' // object that contains that exception. // // Testing: -// mwcex::ExecutionUtil::execute +// bmqex::ExecutionUtil::execute // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -1275,8 +1274,8 @@ static void test8_execute_two_way_always_blocking() SetFlagOnCall toBeExecuted(&executed); // submit function object for execution - mwcex::Future result = mwcex::ExecutionUtil::execute( - mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = bmqex::ExecutionUtil::execute( + bmqex::ExecutionPolicyUtil::twoWay() .alwaysBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1302,8 +1301,8 @@ static void test8_execute_two_way_always_blocking() // 2. Submitted function object returns a value. { // submit function object for execution - mwcex::Future result = - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .alwaysBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1317,8 +1316,8 @@ static void test8_execute_two_way_always_blocking() // 3. Submitted function object returns a reference. { // submit function object for execution - mwcex::Future result = - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .alwaysBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1332,8 +1331,8 @@ static void test8_execute_two_way_always_blocking() // 4. Submitted function object returns 'void'. { // submit function object for execution - mwcex::Future result = - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .alwaysBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1348,8 +1347,8 @@ static void test8_execute_two_way_always_blocking() // 5. Submitted function object throws an exception. { // submit function object for execution - mwcex::Future result = - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future result = + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .alwaysBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1391,7 +1390,7 @@ static void test9_thenExecute_one_way() // end of the continuation callback execution. // // Testing: -// mwcex::ExecutionUtil::thenExecute +// bmqex::ExecutionUtil::thenExecute // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -1400,17 +1399,17 @@ static void test9_thenExecute_one_way() // 1. general use-case { // prepare a future - bsl::shared_ptr > sharedState = - bsl::allocate_shared >(&alloc); + bsl::shared_ptr > sharedState = + bsl::allocate_shared >(&alloc); - mwcex::Future future(sharedState); + bmqex::Future future(sharedState); ASSERT_EQ(future.isReady(), false); // attach a continuation int result = 0; SetValueContinuation toBeExecuted(&result); - mwcex::ExecutionUtil::thenExecute(mwcex::ExecutionPolicyUtil::oneWay() + bmqex::ExecutionUtil::thenExecute(bmqex::ExecutionPolicyUtil::oneWay() .alwaysBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1428,7 +1427,7 @@ static void test9_thenExecute_one_way() ASSERT_EQ(result, 42); // continuation callback was submitted for execution as if by a call to - // 'mwcex::ExecutionUtil::execute' with the same policy as passed to + // 'bmqex::ExecutionUtil::execute' with the same policy as passed to // 'thenExecute' ASSERT_EQ(context.statistics().d_dispatchCount, 1); } @@ -1436,17 +1435,17 @@ static void test9_thenExecute_one_way() // 2. shared state lifetime { // prepare a shared state - bsl::shared_ptr > sharedState = - bsl::allocate_shared >(&alloc); + bsl::shared_ptr > sharedState = + bsl::allocate_shared >(&alloc); ASSERT_EQ(sharedState.use_count(), 1); // attach a continuation - mwcex::ExecutionUtil::thenExecute(mwcex::ExecutionPolicyUtil::oneWay() + bmqex::ExecutionUtil::thenExecute(bmqex::ExecutionPolicyUtil::oneWay() .neverBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), - mwcex::Future(sharedState), + bmqex::Future(sharedState), NoOp()); // the continuation holds a reference to the shared state @@ -1485,7 +1484,7 @@ static void test10_thenExecute_two_way() // end of the continuation callback execution. // // Testing: -// mwcex::ExecutionUtil::thenExecute +// bmqex::ExecutionUtil::thenExecute // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -1494,17 +1493,17 @@ static void test10_thenExecute_two_way() // 1. general use-case { // prepare the input future - bsl::shared_ptr > sharedState = - bsl::allocate_shared >(&alloc); + bsl::shared_ptr > sharedState = + bsl::allocate_shared >(&alloc); - mwcex::Future future1(sharedState); + bmqex::Future future1(sharedState); ASSERT_EQ(future1.isReady(), false); // attach a continuation, obtain the output future ForwardValueContinuation toBeExecuted; - mwcex::Future future2 = mwcex::ExecutionUtil::thenExecute( - mwcex::ExecutionPolicyUtil::twoWay() + bmqex::Future future2 = bmqex::ExecutionUtil::thenExecute( + bmqex::ExecutionPolicyUtil::twoWay() .alwaysBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), @@ -1516,7 +1515,7 @@ static void test10_thenExecute_two_way() ASSERT_EQ(future1.isReady(), true); // continuation callback was submitted for execution as if by a call to - // 'mwcex::ExecutionUtil::execute' with the same policy as passed to + // 'bmqex::ExecutionUtil::execute' with the same policy as passed to // 'thenExecute' ASSERT_EQ(context.statistics().d_dispatchCount, 1); @@ -1528,17 +1527,17 @@ static void test10_thenExecute_two_way() // 2. shared state lifetime { // prepare a shared state - bsl::shared_ptr > sharedState = - bsl::allocate_shared >(&alloc); + bsl::shared_ptr > sharedState = + bsl::allocate_shared >(&alloc); ASSERT_EQ(sharedState.use_count(), 1); // attach a continuation - mwcex::ExecutionUtil::thenExecute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::ExecutionUtil::thenExecute(bmqex::ExecutionPolicyUtil::twoWay() .neverBlocking() .useExecutor(context.executor()) .useAllocator(&alloc), - mwcex::Future(sharedState), + bmqex::Future(sharedState), NoOp()); // the continuation holds a reference to the shared state @@ -1580,7 +1579,7 @@ static void test11_invoke() // Check that the execution function (re)throws that exception. // // Testing: -// mwcex::ExecutionUtil::invoke +// bmqex::ExecutionUtil::invoke // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -1592,7 +1591,7 @@ static void test11_invoke() SetFlagOnCall toBeExecuted(&executed); // submit function object for execution - mwcex::ExecutionUtil::invoke(context.executor(), toBeExecuted); + bmqex::ExecutionUtil::invoke(context.executor(), toBeExecuted); // function object was submitted for execution via a call to // 'dispatch()' an the specified executor @@ -1611,7 +1610,7 @@ static void test11_invoke() // 2. Submitted function object returns a value. { // submit function object for execution - ReturnValueOnCall::ResultType result = mwcex::ExecutionUtil::invoke( + ReturnValueOnCall::ResultType result = bmqex::ExecutionUtil::invoke( context.executor(), ReturnValueOnCall()); @@ -1623,7 +1622,7 @@ static void test11_invoke() { // submit function object for execution ReturnReferenceOnCall::ResultType result = - mwcex::ExecutionUtil::invoke(context.executor(), + bmqex::ExecutionUtil::invoke(context.executor(), ReturnReferenceOnCall()); // retrieve the result @@ -1633,7 +1632,7 @@ static void test11_invoke() // 4. Submitted function object returns 'void'. { // submit function object for execution - mwcex::ExecutionUtil::invoke(context.executor(), ReturnVoidOnCall()); + bmqex::ExecutionUtil::invoke(context.executor(), ReturnVoidOnCall()); } #ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_EXCEPTION_HANDLING @@ -1642,7 +1641,7 @@ static void test11_invoke() // execute the function object and retrieve the result bool exceptionThrown = false; try { - mwcex::ExecutionUtil::invoke(context.executor(), ThrowOnCall()); + bmqex::ExecutionUtil::invoke(context.executor(), ThrowOnCall()); } catch (const ThrowOnCall::ExceptionType&) { exceptionThrown = true; @@ -1659,7 +1658,7 @@ static void test11_invoke() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { // traits @@ -1690,5 +1689,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/mwcex_executor.cpp b/src/groups/bmq/bmqex/bmqex_executor.cpp similarity index 97% rename from src/groups/mwc/mwcex/mwcex_executor.cpp rename to src/groups/bmq/bmqex/bmqex_executor.cpp index 3b4abaa5f..e500bd5ca 100644 --- a/src/groups/mwc/mwcex/mwcex_executor.cpp +++ b/src/groups/bmq/bmqex/bmqex_executor.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executor.cpp -*-C++-*- -#include +// bmqex_executor.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ------------------------- // class Executor_TargetBase diff --git a/src/groups/mwc/mwcex/mwcex_executor.h b/src/groups/bmq/bmqex/bmqex_executor.h similarity index 96% rename from src/groups/mwc/mwcex/mwcex_executor.h rename to src/groups/bmq/bmqex/bmqex_executor.h index 7cf0ea11f..5b003ecf1 100644 --- a/src/groups/mwc/mwcex/mwcex_executor.h +++ b/src/groups/bmq/bmqex/bmqex_executor.h @@ -13,22 +13,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executor.h -*-C++-*- -#ifndef INCLUDED_MWCEX_EXECUTOR -#define INCLUDED_MWCEX_EXECUTOR +// bmqex_executor.h -*-C++-*- +#ifndef INCLUDED_BMQEX_EXECUTOR +#define INCLUDED_BMQEX_EXECUTOR //@PURPOSE: Provides a polymorphic wrapper for executor types. // //@CLASSES: -// mwcex::Executor: a polymorphic wrapper for executor types +// bmqex::Executor: a polymorphic wrapper for executor types // //@DESCRIPTION: // This component provides a polymorphic wrapper for types that satisfy the // Executor requirements (see package documentation). // -// Objects of type 'mwcex::Executor' are generally used to avoid templatizing +// Objects of type 'bmqex::Executor' are generally used to avoid templatizing // a function or class, like shown in the example below. In short, -// 'mwcex::Executor' is to an executor object what 'bsl::function' is to a +// 'bmqex::Executor' is to an executor object what 'bsl::function' is to a // function object. // // Note that to meet the 'noexcept' requirements for executor copy and move @@ -39,7 +39,7 @@ ///----- // Here is simple example demonstrating the intended usage of this component. // Notice how the 'Notificator's constructor takes an polymorphic executor, -// but is supplied an executor of type 'mwcex::SystemExecutor'. +// but is supplied an executor of type 'bmqex::SystemExecutor'. //.. // class Notificator { // // Provides a class that asynchronously invokes a user-supplied @@ -53,7 +53,7 @@ // // private: // // PRIVATE DATA -// mwcex::Executor d_executor; +// bmqex::Executor d_executor; // // Callback d_callback; // @@ -64,7 +64,7 @@ // // public: // // CREATORS -// Notificator(const mwcex::Executor& executor, +// Notificator(const bmqex::Executor& executor, // const Callback& callback); // // Create a 'Notificator' object that asynchronously invokes the // // specified 'callback' in the context of the specified 'executor' @@ -76,7 +76,7 @@ // // Simulate an "event". // }; // -// Notificator::Notificator(const mwcex::Executor& executor, +// Notificator::Notificator(const bmqex::Executor& executor, // const Callback& callback) // : d_executor(executor) // , d_callback(callback) @@ -93,7 +93,7 @@ // //.. // // create a notificator with the system executor -// Notificator notificator(mwces::SystemExecutor(), +// Notificator notificator(bmqex::SystemExecutor(), // [](){ // bsl::cout << "Got it!" << bsl::endl; // }); @@ -104,8 +104,7 @@ // // our handler is invoked somewhere in another thread ... //.. -// MWC -#include +#include // BDE #include @@ -126,7 +125,7 @@ namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ========================= // class Executor_TargetBase @@ -136,7 +135,7 @@ namespace mwcex { /// When creating a polymorphic executor with a target of type `EX`, an /// instance of derived class template `Executor_Target` is /// instantiated and stored via a pointer to its base class (this one). -/// Then, calls to `mwcex::Executor`s public methods are forwarded to this +/// Then, calls to `bmqex::Executor`s public methods are forwarded to this /// class. class Executor_TargetBase { public: @@ -768,7 +767,7 @@ inline const T* Executor::target() const BSLS_KEYWORD_NOEXCEPT } // close package namespace // FREE OPERATORS -inline void mwcex::swap(Executor& lhs, Executor& rhs) BSLS_KEYWORD_NOEXCEPT +inline void bmqex::swap(Executor& lhs, Executor& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); } diff --git a/src/groups/mwc/mwcex/mwcex_executor.t.cpp b/src/groups/bmq/bmqex/bmqex_executor.t.cpp similarity index 79% rename from src/groups/mwc/mwcex/mwcex_executor.t.cpp rename to src/groups/bmq/bmqex/bmqex_executor.t.cpp index 6704952a6..9d1fe242f 100644 --- a/src/groups/mwc/mwcex/mwcex_executor.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_executor.t.cpp @@ -13,14 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executor.t.cpp -*-C++-*- -#include +// bmqex_executor.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include -// MWC -#include +#include // BDE #include // bsl::reference_wrapper @@ -200,7 +199,7 @@ class SelfUnequalExecutor { // ===================== /// Provides an adapter that increase the size of the executor object so it -/// won't fit in the small on-stack buffer used by `mwcex::Executor` for +/// won't fit in the small on-stack buffer used by `bmqex::Executor` for /// optimization. template class ExecutorElarger { @@ -229,7 +228,7 @@ class ExecutorElarger { template void post(BSLS_COMPILERFEATURES_FORWARD_REF(F) f) const { - mwcex::ExecutorTraits::post( + bmqex::ExecutorTraits::post( d_executor, BSLS_COMPILERFEATURES_FORWARD(F, f)); } @@ -237,7 +236,7 @@ class ExecutorElarger { template void dispatch(BSLS_COMPILERFEATURES_FORWARD_REF(F) f) const { - mwcex::ExecutorTraits::dispatch( + bmqex::ExecutorTraits::dispatch( d_executor, BSLS_COMPILERFEATURES_FORWARD(F, f)); } @@ -264,16 +263,16 @@ static void test1_creators() // Ensure proper behavior of creator methods. // // Plan: -// 1. Default-construct an instance of 'mwcex::Executor'. Check +// 1. Default-construct an instance of 'bmqex::Executor'. Check // postconditions. // -// 2. Construct an instance of 'mwcex::Executor' from another executor. +// 2. Construct an instance of 'bmqex::Executor' from another executor. // Check postconditions. // -// 3. Copy-construct an instance of 'mwcex::Executor'. Check +// 3. Copy-construct an instance of 'bmqex::Executor'. Check // postconditions. // -// 4. Move-construct an instance of 'mwcex::Executor'. Check +// 4. Move-construct an instance of 'bmqex::Executor'. Check // postconditions. // // Testing: @@ -284,9 +283,9 @@ static void test1_creators() // ------------------------------------------------------------------------ { // PRECONDITIONS - BSLMF_ASSERT(mwcex::Executor_Box_SboImpCanHold::value == + BSLMF_ASSERT(bmqex::Executor_Box_SboImpCanHold::value == true); - BSLMF_ASSERT(mwcex::Executor_Box_SboImpCanHold< + BSLMF_ASSERT(bmqex::Executor_Box_SboImpCanHold< ExecutorElarger >::value == false); bslma::TestAllocator alloc; @@ -294,7 +293,7 @@ static void test1_creators() // 1. default constructor { - mwcex::Executor ex; + bmqex::Executor ex; // 'ex's target is empty ASSERT_EQ(static_cast(ex), false); @@ -305,15 +304,15 @@ static void test1_creators() StatExecutor smallEx(&estat); ExecutorElarger largeEx = smallEx; - // create an 'mwcex::Executor' from a small executor to enable SBO - mwcex::Executor ex1(smallEx, &alloc); + // create an 'bmqex::Executor' from a small executor to enable SBO + bmqex::Executor ex1(smallEx, &alloc); // check postconditions ASSERT(ex1.target()); ASSERT(*ex1.target() == smallEx); - // create an 'mwcex::Executor' from a large executor to disable SBO - mwcex::Executor ex2(largeEx, &alloc); + // create an 'bmqex::Executor' from a large executor to disable SBO + bmqex::Executor ex2(largeEx, &alloc); // check postconditions ASSERT(ex2.target >()); @@ -325,25 +324,25 @@ static void test1_creators() StatExecutor smallEx(&estat); ExecutorElarger largeEx = smallEx; - mwcex::Executor ex1; // empty - mwcex::Executor ex2(smallEx, &alloc); // contains small target - mwcex::Executor ex3(largeEx, &alloc); // contains large target + bmqex::Executor ex1; // empty + bmqex::Executor ex2(smallEx, &alloc); // contains small target + bmqex::Executor ex3(largeEx, &alloc); // contains large target // copy an empty executor - mwcex::Executor ex1Copy(ex1); + bmqex::Executor ex1Copy(ex1); // check postconditions ASSERT(!ex1Copy); // copy an empty executor specifying an (to be ignored) allocator - mwcex::Executor ex1CopyAlloc(ex1, &alloc); + bmqex::Executor ex1CopyAlloc(ex1, &alloc); // check postconditions, the copy constructor should have been selected // against the template one ASSERT(!ex1CopyAlloc); // copy executor containing a small target - mwcex::Executor ex2Copy(ex2); + bmqex::Executor ex2Copy(ex2); // check postconditions ASSERT(ex2Copy.target()); @@ -351,7 +350,7 @@ static void test1_creators() ASSERT(*ex2Copy.target() == smallEx); // copy executor containing a large target - mwcex::Executor ex3Copy(ex3); + bmqex::Executor ex3Copy(ex3); // check postconditions ASSERT(ex3Copy.target >()); @@ -365,25 +364,25 @@ static void test1_creators() StatExecutor smallEx(&estat); ExecutorElarger largeEx = smallEx; - mwcex::Executor ex1; // empty - mwcex::Executor ex2(smallEx, &alloc); // contains small target - mwcex::Executor ex3(largeEx, &alloc); // contains large target + bmqex::Executor ex1; // empty + bmqex::Executor ex2(smallEx, &alloc); // contains small target + bmqex::Executor ex3(largeEx, &alloc); // contains large target // move an empty executor - mwcex::Executor ex1Copy(bslmf::MovableRefUtil::move(ex1)); + bmqex::Executor ex1Copy(bslmf::MovableRefUtil::move(ex1)); // check postconditions ASSERT(!ex1Copy); // move an empty executor specifying an (to be ignored) allocator - mwcex::Executor ex1CopyAlloc(bslmf::MovableRefUtil::move(ex1), &alloc); + bmqex::Executor ex1CopyAlloc(bslmf::MovableRefUtil::move(ex1), &alloc); // check postconditions, the move constructor should have been selected // against the template one ASSERT(!ex1CopyAlloc); // move executor containing a small target - mwcex::Executor ex2Copy(bslmf::MovableRefUtil::move(ex2)); + bmqex::Executor ex2Copy(bslmf::MovableRefUtil::move(ex2)); // check postconditions ASSERT(ex2.target()); @@ -392,7 +391,7 @@ static void test1_creators() ASSERT(*ex2Copy.target() == smallEx); // move executor containing a large target - mwcex::Executor ex3Copy(bslmf::MovableRefUtil::move(ex3)); + bmqex::Executor ex3Copy(bslmf::MovableRefUtil::move(ex3)); // check postconditions ASSERT(ex3Copy.target >()); @@ -409,16 +408,16 @@ static void test2_assignment() // methods. // // Plan: -// 1. Executor-assign an instance of 'mwcex::Executor'. Check +// 1. Executor-assign an instance of 'bmqex::Executor'. Check // postconditions. // -// 2. Copy-assign an instance of 'mwcex::Executor'. Check +// 2. Copy-assign an instance of 'bmqex::Executor'. Check // postconditions. // -// 3. Move-assign an instance of 'mwcex::Executor'. Check +// 3. Move-assign an instance of 'bmqex::Executor'. Check // postconditions. // -// 4. Assign a new target to an instance of 'mwcex::Executor' via the +// 4. Assign a new target to an instance of 'bmqex::Executor' via the // 'assign' member function. Check postconditions. // // Testing: @@ -427,9 +426,9 @@ static void test2_assignment() // ------------------------------------------------------------------------ { // PRECONDITIONS - BSLMF_ASSERT(mwcex::Executor_Box_SboImpCanHold::value == + BSLMF_ASSERT(bmqex::Executor_Box_SboImpCanHold::value == true); - BSLMF_ASSERT(mwcex::Executor_Box_SboImpCanHold< + BSLMF_ASSERT(bmqex::Executor_Box_SboImpCanHold< ExecutorElarger >::value == false); bslma::TestAllocator alloc; @@ -440,15 +439,15 @@ static void test2_assignment() StatExecutor smallEx(&estat); ExecutorElarger largeEx = smallEx; - // create an 'mwcex::Executor' from a small executor to enable SBO - mwcex::Executor ex1; + // create an 'bmqex::Executor' from a small executor to enable SBO + bmqex::Executor ex1; ex1 = smallEx; // check postconditions ASSERT(*ex1.target() == smallEx); - // create an 'mwcex::Executor' from a large executor to disable SBO - mwcex::Executor ex2; + // create an 'bmqex::Executor' from a large executor to disable SBO + bmqex::Executor ex2; ex2 = largeEx; ASSERT(*ex2.target >() == largeEx); } @@ -458,19 +457,19 @@ static void test2_assignment() StatExecutor smallEx(&estat); ExecutorElarger largeEx = smallEx; - mwcex::Executor ex1; // empty - mwcex::Executor ex2(smallEx, &alloc); // contains small target - mwcex::Executor ex3(largeEx, &alloc); // contains large target + bmqex::Executor ex1; // empty + bmqex::Executor ex2(smallEx, &alloc); // contains small target + bmqex::Executor ex3(largeEx, &alloc); // contains large target // copy an empty executor - mwcex::Executor ex1Copy; + bmqex::Executor ex1Copy; ex1Copy = ex1; // check postconditions ASSERT(!ex1Copy); // copy executor containing a small target - mwcex::Executor ex2Copy; + bmqex::Executor ex2Copy; ex2Copy = ex2; // check postconditions @@ -479,7 +478,7 @@ static void test2_assignment() ASSERT(*ex2Copy.target() == smallEx); // copy executor containing a large target - mwcex::Executor ex3Copy; + bmqex::Executor ex3Copy; ex3Copy = ex3; // check postconditions @@ -494,19 +493,19 @@ static void test2_assignment() StatExecutor smallEx(&estat); ExecutorElarger largeEx = smallEx; - mwcex::Executor ex1; // empty - mwcex::Executor ex2(smallEx, &alloc); // contains small target - mwcex::Executor ex3(largeEx, &alloc); // contains large target + bmqex::Executor ex1; // empty + bmqex::Executor ex2(smallEx, &alloc); // contains small target + bmqex::Executor ex3(largeEx, &alloc); // contains large target // move an empty executor - mwcex::Executor ex1Copy; + bmqex::Executor ex1Copy; ex1Copy = bslmf::MovableRefUtil::move(ex1); // check postconditions ASSERT(!ex1Copy); // move executor containing a small target - mwcex::Executor ex2Copy; + bmqex::Executor ex2Copy; ex2Copy = bslmf::MovableRefUtil::move(ex2); // check postconditions @@ -515,7 +514,7 @@ static void test2_assignment() ASSERT(*ex2Copy.target() == smallEx); // move executor containing a large target - mwcex::Executor ex3Copy; + bmqex::Executor ex3Copy; ex3Copy = bslmf::MovableRefUtil::move(ex3); // check postconditions @@ -526,7 +525,7 @@ static void test2_assignment() // 4. assign { StatExecutor ex1(&estat); - mwcex::Executor ex2; + bmqex::Executor ex2; // do assign ex2.assign(ex1, &alloc); @@ -545,7 +544,7 @@ static void test3_post() // Ensure proper behavior of the 'post' method. // // Plan: -// Create an instance of 'mwcex::Executor' 'ex1' by constructing +// Create an instance of 'bmqex::Executor' 'ex1' by constructing // it from another executor 'ex2'. Call 'ex1.post(f)', where 'f' // is a function object, and check that this operation is equivalent // to 'ex2.post(f)'. @@ -556,7 +555,7 @@ static void test3_post() { bslma::TestAllocator alloc; StatExecutor::Statistics estat; - mwcex::Executor ex(StatExecutor(&estat), &alloc); + bmqex::Executor ex(StatExecutor(&estat), &alloc); bool executed = false; ex.post(SetFlagOnCall(&executed)); @@ -574,7 +573,7 @@ static void test4_dispatch() // Ensure proper behavior of the 'dispatch' method. // // Plan: -// Create an instance of 'mwcex::Executor' 'ex1' by constructing +// Create an instance of 'bmqex::Executor' 'ex1' by constructing // it from another executor 'ex2'. Call 'ex1.dispatch(f)', where 'f' // is a function object, and check that this operation is equivalent // to 'ex2.dispatch(f)'. @@ -585,7 +584,7 @@ static void test4_dispatch() { bslma::TestAllocator alloc; StatExecutor::Statistics estat; - mwcex::Executor ex(StatExecutor(&estat), &alloc); + bmqex::Executor ex(StatExecutor(&estat), &alloc); bool executed = false; ex.dispatch(SetFlagOnCall(&executed)); @@ -615,9 +614,9 @@ static void test5_swap() // ------------------------------------------------------------------------ { // PRECONDITIONS - BSLMF_ASSERT(mwcex::Executor_Box_SboImpCanHold::value == + BSLMF_ASSERT(bmqex::Executor_Box_SboImpCanHold::value == true); - BSLMF_ASSERT(mwcex::Executor_Box_SboImpCanHold< + BSLMF_ASSERT(bmqex::Executor_Box_SboImpCanHold< ExecutorElarger >::value == false); bslma::TestAllocator alloc; @@ -629,8 +628,8 @@ static void test5_swap() StatExecutor smallEx1(&estat1); StatExecutor smallEx2(&estat2); - mwcex::Executor ex1(smallEx1, &alloc); - mwcex::Executor ex2(smallEx2, &alloc); + bmqex::Executor ex1(smallEx1, &alloc); + bmqex::Executor ex2(smallEx2, &alloc); // do swap ex1.swap(ex2); @@ -647,8 +646,8 @@ static void test5_swap() ExecutorElarger largeEx1 = StatExecutor(&estat1); ExecutorElarger largeEx2 = StatExecutor(&estat2); - mwcex::Executor ex1(largeEx1, &alloc); - mwcex::Executor ex2(largeEx2, &alloc); + bmqex::Executor ex1(largeEx1, &alloc); + bmqex::Executor ex2(largeEx2, &alloc); // do swap ex1.swap(ex2); @@ -665,8 +664,8 @@ static void test5_swap() StatExecutor smallEx(&estat1); ExecutorElarger largeEx = StatExecutor(&estat2); - mwcex::Executor ex1(smallEx, &alloc); - mwcex::Executor ex2(largeEx, &alloc); + bmqex::Executor ex1(smallEx, &alloc); + bmqex::Executor ex2(largeEx, &alloc); // do swap ex1.swap(ex2); @@ -697,8 +696,8 @@ static void test6_boolOperator() { bslma::TestAllocator alloc; StatExecutor::Statistics estat; - mwcex::Executor ex1; - mwcex::Executor ex2(StatExecutor(&estat), &alloc); + bmqex::Executor ex1; + bmqex::Executor ex2(StatExecutor(&estat), &alloc); ASSERT_EQ(static_cast(ex1), false); ASSERT_EQ(static_cast(ex2), true); @@ -728,7 +727,7 @@ static void test7_target() // check default-constructed executor // NOTE: check const and non-const overloads { - mwcex::Executor ex; + bmqex::Executor ex; ASSERT(!ex.target()); ASSERT(!bsl::cref(ex).get().target()); } @@ -737,7 +736,7 @@ static void test7_target() // NOTE: check const and non-const overloads { StatExecutor ex1(&estat); - mwcex::Executor ex2(ex1, &alloc); + bmqex::Executor ex2(ex1, &alloc); ASSERT_EQ(ex2.target()->statistics(), &estat); ASSERT_EQ(bsl::cref(ex2).get().target()->statistics(), @@ -765,8 +764,8 @@ static void test8_targetType() { bslma::TestAllocator alloc; StatExecutor::Statistics estat; - mwcex::Executor ex1; - mwcex::Executor ex2(StatExecutor(&estat), &alloc); + bmqex::Executor ex1; + bmqex::Executor ex2(StatExecutor(&estat), &alloc); ASSERT_EQ(ex1.targetType() == typeid(void), true); ASSERT_EQ(ex2.targetType() == typeid(StatExecutor), true); @@ -793,34 +792,34 @@ static void test9_equalityComparison() // ------------------------------------------------------------------------ { // PRECONDITIONS - BSLMF_ASSERT(mwcex::Executor_Box_SboImpCanHold< + BSLMF_ASSERT(bmqex::Executor_Box_SboImpCanHold< ExecutorElarger >::value == false); bslma::TestAllocator alloc; // two empty executors compare equal - ASSERT_EQ(mwcex::Executor() == mwcex::Executor(), true); - ASSERT_EQ(mwcex::Executor() != mwcex::Executor(), false); + ASSERT_EQ(bmqex::Executor() == bmqex::Executor(), true); + ASSERT_EQ(bmqex::Executor() != bmqex::Executor(), false); // empty executor is not equal to a non-empty executor - ASSERT_EQ(mwcex::Executor() == - mwcex::Executor(SelfEqualExecutor(), &alloc), + ASSERT_EQ(bmqex::Executor() == + bmqex::Executor(SelfEqualExecutor(), &alloc), false); - ASSERT_EQ(mwcex::Executor() != - mwcex::Executor(SelfEqualExecutor(), &alloc), + ASSERT_EQ(bmqex::Executor() != + bmqex::Executor(SelfEqualExecutor(), &alloc), true); // non-empty executor is not equal to an empty executor - ASSERT_EQ(mwcex::Executor(SelfEqualExecutor(), &alloc) == - mwcex::Executor(), + ASSERT_EQ(bmqex::Executor(SelfEqualExecutor(), &alloc) == + bmqex::Executor(), false); - ASSERT_EQ(mwcex::Executor(SelfEqualExecutor(), &alloc) != - mwcex::Executor(), + ASSERT_EQ(bmqex::Executor(SelfEqualExecutor(), &alloc) != + bmqex::Executor(), true); // executors sharing the same target compares equal - mwcex::Executor ex1(ExecutorElarger(), &alloc); - mwcex::Executor ex2 = ex1; + bmqex::Executor ex1(ExecutorElarger(), &alloc); + bmqex::Executor ex2 = ex1; ASSERT_EQ(ex1.target() == ex2.target(), true); @@ -828,28 +827,28 @@ static void test9_equalityComparison() ASSERT_EQ(ex1 != ex2, false); // executors with different target types compare unequal - ASSERT_EQ(mwcex::Executor(SelfEqualExecutor(), &alloc) == - mwcex::Executor(SelfUnequalExecutor(), &alloc), + ASSERT_EQ(bmqex::Executor(SelfEqualExecutor(), &alloc) == + bmqex::Executor(SelfUnequalExecutor(), &alloc), false); - ASSERT_EQ(mwcex::Executor(SelfEqualExecutor(), &alloc) != - mwcex::Executor(SelfUnequalExecutor(), &alloc), + ASSERT_EQ(bmqex::Executor(SelfEqualExecutor(), &alloc) != + bmqex::Executor(SelfUnequalExecutor(), &alloc), true); // executors with the same target type compare equal if their targets // compare equal ... - ASSERT_EQ(mwcex::Executor(SelfUnequalExecutor(), &alloc) == - mwcex::Executor(SelfUnequalExecutor(), &alloc), + ASSERT_EQ(bmqex::Executor(SelfUnequalExecutor(), &alloc) == + bmqex::Executor(SelfUnequalExecutor(), &alloc), false); - ASSERT_EQ(mwcex::Executor(SelfUnequalExecutor(), &alloc) != - mwcex::Executor(SelfUnequalExecutor(), &alloc), + ASSERT_EQ(bmqex::Executor(SelfUnequalExecutor(), &alloc) != + bmqex::Executor(SelfUnequalExecutor(), &alloc), true); // ... and vice versa - ASSERT_EQ(mwcex::Executor(SelfEqualExecutor(), &alloc) == - mwcex::Executor(SelfEqualExecutor(), &alloc), + ASSERT_EQ(bmqex::Executor(SelfEqualExecutor(), &alloc) == + bmqex::Executor(SelfEqualExecutor(), &alloc), true); - ASSERT_EQ(mwcex::Executor(SelfEqualExecutor(), &alloc) != - mwcex::Executor(SelfEqualExecutor(), &alloc), + ASSERT_EQ(bmqex::Executor(SelfEqualExecutor(), &alloc) != + bmqex::Executor(SelfEqualExecutor(), &alloc), false); } @@ -859,7 +858,7 @@ static void test9_equalityComparison() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_creators(); break; @@ -879,5 +878,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/mwcex_executortraits.cpp b/src/groups/bmq/bmqex/bmqex_executortraits.cpp similarity index 83% rename from src/groups/mwc/mwcex/mwcex_executortraits.cpp rename to src/groups/bmq/bmqex/bmqex_executortraits.cpp index 020dae100..b0be3a2e2 100644 --- a/src/groups/mwc/mwcex/mwcex_executortraits.cpp +++ b/src/groups/bmq/bmqex/bmqex_executortraits.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executortraits.cpp -*-C++-*- -#include +// bmqex_executortraits.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcex { +namespace bmqex { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcex/mwcex_executortraits.h b/src/groups/bmq/bmqex/bmqex_executortraits.h similarity index 95% rename from src/groups/mwc/mwcex/mwcex_executortraits.h rename to src/groups/bmq/bmqex/bmqex_executortraits.h index 0fd61efdc..64d775d18 100644 --- a/src/groups/mwc/mwcex/mwcex_executortraits.h +++ b/src/groups/bmq/bmqex/bmqex_executortraits.h @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executortraits.h -*-C++-*- -#ifndef INCLUDED_MWCEX_EXECUTORTRAITS -#define INCLUDED_MWCEX_EXECUTORTRAITS +// bmqex_executortraits.h -*-C++-*- +#ifndef INCLUDED_BMQEX_EXECUTORTRAITS +#define INCLUDED_BMQEX_EXECUTORTRAITS //@PURPOSE: Provides a traits class to access various properties of executors. // @@ -23,14 +23,12 @@ // ExecutorTraits: executor traits. // //@DESCRIPTION: -// This component provides a class template, 'mwcex::ExecutorTraits', to access -// various properties of Executors. Other components provided by the 'mwcex' +// This component provides a class template, 'bmqex::ExecutorTraits', to access +// various properties of Executors. Other components provided by the 'bmqex' // package access executors through this template, which makes it possible to // use any class type as an executor, as long as the user-provided // specialization of 'ExecutorTraits' implements all required functionality. -// MWC - // BDE #include #include @@ -48,7 +46,7 @@ #endif namespace BloombergLP { -namespace mwcex { +namespace bmqex { #if defined(BSLS_COMPILERFEATURES_SUPPORT_DECLTYPE) && \ defined(BSLS_COMPILERFEATURES_SUPPORT_VARIADIC_TEMPLATES) && \ @@ -63,16 +61,14 @@ namespace mwcex { /// Provides a metafunction to detect if an executor has a proper `dispatch` /// member function. template -struct ExecutorTraits_CanDispatch : bsl::false_type { -}; +struct ExecutorTraits_CanDispatch : bsl::false_type {}; template struct ExecutorTraits_CanDispatch< EXECUTOR, FUNCTION, bsl::void_t().dispatch( - bsl::declval()))> > : bsl::true_type { -}; + bsl::declval()))> > : bsl::true_type {}; #else template @@ -91,14 +87,11 @@ struct ExecutorTraits_CanDispatch { typedef bslmf::MovableRef > JobRef; template - struct Test1 { - }; + struct Test1 {}; template - struct Test2 { - }; + struct Test2 {}; template - struct Test3 { - }; + struct Test3 {}; // CLASS METHODS template diff --git a/src/groups/mwc/mwcex/mwcex_executortraits.t.cpp b/src/groups/bmq/bmqex/bmqex_executortraits.t.cpp similarity index 87% rename from src/groups/mwc/mwcex/mwcex_executortraits.t.cpp rename to src/groups/bmq/bmqex/bmqex_executortraits.t.cpp index 20a747283..1ae889664 100644 --- a/src/groups/mwc/mwcex/mwcex_executortraits.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_executortraits.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_executortraits.t.cpp -*-C++-*- -#include +// bmqex_executortraits.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -129,25 +129,25 @@ static void test1_post() // Plan: // Let 'f' be a function object of type 'F', and 'e' an executor object // of type 'E', such that 'e.post(f)' is a valid operations. Check that -// 'mwcex::ExecutorTraits::post(e, f)' results in a call to +// 'bmqex::ExecutorTraits::post(e, f)' results in a call to // 'e.post(f)'. // // Testing: -// mwcex::ExecutorTraits::post +// bmqex::ExecutorTraits::post // ------------------------------------------------------------------------ { PostDispatchExecutor executor; ASSERT_EQ(executor.d_postCallCount, 0); bool executed = false; - mwcex::ExecutorTraits::post( + bmqex::ExecutorTraits::post( executor, SetFlagOnCall(&executed)); ASSERT(executed); ASSERT_EQ(executor.d_postCallCount, 1); executed = false; - mwcex::ExecutorTraits::post( + bmqex::ExecutorTraits::post( executor, SetFlagOnCall(&executed)); ASSERT(executed); @@ -164,16 +164,16 @@ static void test2_dispatch() // Plan: // 1. Let 'f' be a function object of type 'F', and 'e' an executor // object of type 'E', such that 'e.dispatch(f)' is a valid -// operations. Check that 'mwcex::ExecutorTraits::dispatch(e, f)' +// operations. Check that 'bmqex::ExecutorTraits::dispatch(e, f)' // results in a call to 'e.dispatch(f)'. // // 2. Let 'f' be a function object of type 'F', and 'e' an executor // object of type 'E', such that 'e.dispatch(f)' is not a valid -// operations. Check that 'mwcex::ExecutorTraits::dispatch(e, f)' +// operations. Check that 'bmqex::ExecutorTraits::dispatch(e, f)' // results in a call to 'e.post(f)'. // // Testing: -// mwcex::ExecutorTraits::dispatch +// bmqex::ExecutorTraits::dispatch // ------------------------------------------------------------------------ { // 1. dispatchable executor @@ -182,14 +182,14 @@ static void test2_dispatch() ASSERT_EQ(executor.d_dispatchCallCount, 0); bool executed = false; - mwcex::ExecutorTraits::dispatch( + bmqex::ExecutorTraits::dispatch( executor, SetFlagOnCall(&executed)); ASSERT(executed); ASSERT_EQ(executor.d_dispatchCallCount, 1); executed = false; - mwcex::ExecutorTraits::dispatch( + bmqex::ExecutorTraits::dispatch( executor, SetFlagOnCall(&executed)); ASSERT(executed); @@ -202,14 +202,14 @@ static void test2_dispatch() ASSERT_EQ(executor.d_postCallCount, 0); bool executed = false; - mwcex::ExecutorTraits::dispatch( + bmqex::ExecutorTraits::dispatch( executor, SetFlagOnCall(&executed)); ASSERT(executed); ASSERT_EQ(executor.d_postCallCount, 1); executed = false; - mwcex::ExecutorTraits::dispatch( + bmqex::ExecutorTraits::dispatch( executor, SetFlagOnCall(&executed)); ASSERT(executed); @@ -223,7 +223,7 @@ static void test2_dispatch() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_post(); break; @@ -236,5 +236,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/mwcex_future.cpp b/src/groups/bmq/bmqex/bmqex_future.cpp similarity index 92% rename from src/groups/mwc/mwcex/mwcex_future.cpp rename to src/groups/bmq/bmqex/bmqex_future.cpp index f75bbcede..0cab18a25 100644 --- a/src/groups/mwc/mwcex/mwcex_future.cpp +++ b/src/groups/bmq/bmqex/bmqex_future.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_future.cpp -*-C++-*- -#include +// bmqex_future.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ---------------------- // class Future_Exception diff --git a/src/groups/mwc/mwcex/mwcex_future.h b/src/groups/bmq/bmqex/bmqex_future.h similarity index 96% rename from src/groups/mwc/mwcex/mwcex_future.h rename to src/groups/bmq/bmqex/bmqex_future.h index a3af01f18..b42ab4aeb 100644 --- a/src/groups/mwc/mwcex/mwcex_future.h +++ b/src/groups/bmq/bmqex/bmqex_future.h @@ -13,56 +13,56 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_future.h -*-C++-*- -#ifndef INCLUDED_MWCEX_FUTURE -#define INCLUDED_MWCEX_FUTURE +// bmqex_future.h -*-C++-*- +#ifndef INCLUDED_BMQEX_FUTURE +#define INCLUDED_BMQEX_FUTURE //@PURPOSE: Provides a mechanism to access the result of an async operation. // //@CLASSES: -// mwcex::Future: an async result provider -// mwcex::FutureStatus: codes returned by public API -// mwcex::FutureResult: an established async result provider -// mwcex::FutureSharedState: a shared state +// bmqex::Future: an async result provider +// bmqex::FutureStatus: codes returned by public API +// bmqex::FutureResult: an established async result provider +// bmqex::FutureSharedState: a shared state // //@SEE ALSO: -// mwcex_promise +// bmqex_promise // //@DESCRIPTION: -// This component provides a mechanism, 'mwcex::Future', to access the result -// of an asynchronous operation. In addition the generalized 'mwcex::Future' -// class template two specializations, 'mwcex::Future', and -// 'mwcex::Future' are provided. +// This component provides a mechanism, 'bmqex::Future', to access the result +// of an asynchronous operation. In addition the generalized 'bmqex::Future' +// class template two specializations, 'bmqex::Future', and +// 'bmqex::Future' are provided. // -// This component also provides a mechanism, 'mwcex::FutureResult', to access +// This component also provides a mechanism, 'bmqex::FutureResult', to access // the result of an asynchronous operation that is already established. Objects // of that type are used as parameters for notification callbacks (see usage -// examples below). In addition the generalized 'mwcex::FutureResult' class -// template two specializations, 'mwcex::FutureResult', and -// 'mwcex::FutureResult' are provided. +// examples below). In addition the generalized 'bmqex::FutureResult' class +// template two specializations, 'bmqex::FutureResult', and +// 'bmqex::FutureResult' are provided. // -// Behind a 'mwcex::Future' or 'mwcex::FutureResult' lies an -// 'mwcex::FutureSharedState' object called the shared state. The shared state +// Behind a 'bmqex::Future' or 'bmqex::FutureResult' lies an +// 'bmqex::FutureSharedState' object called the shared state. The shared state // is what will actually hold the async result (or the exception). Note that // Future objects are not meant to be created by users directly, but rather to // be obtained from an asynchronous result provider (an example of such -// provider is 'mwcex::Promise'). Result providers do create a shared state and +// provider is 'bmqex::Promise'). Result providers do create a shared state and // assign it the result (or the exception) when it becomes ready. That result // may then be retrieved via an associated future object. // /// Thread safety ///------------- // With the exception of assignment operators, as well as the 'swap' member -// function, 'mwcex::Future' is thread-safe, meaning that multiple threads may +// function, 'bmqex::Future' is thread-safe, meaning that multiple threads may // use their own instances of the class or use a shared instance without // further synchronization. // // With the exception of assignment operators, as well as the 'swap' member -// function, 'mwcex::FutureResult' is thread-safe, meaning that multiple +// function, 'bmqex::FutureResult' is thread-safe, meaning that multiple // threads may use their own instances of the class or use a shared instance // without further synchronization. // -// 'mwcex::FutureSharedState' is fully thread-safe, meaning that multiple +// 'bmqex::FutureSharedState' is fully thread-safe, meaning that multiple // threads may use their own instances of the class or use a shared instance // without further synchronization. However, note that the shared state can // only be made ready once, making concurrent calls to 'setValue', @@ -72,10 +72,10 @@ /// Usage ///----- // The simplest way to obtain a future object is from an async result -// provider, such as 'mwcex::Promise'. +// provider, such as 'bmqex::Promise'. //.. -// mwcex::Promise promise; -// mwcex::Future future = promise.future(); +// bmqex::Promise promise; +// bmqex::Future future = promise.future(); //.. // This future does not contain a result yet. The result (in this example an // 'int') is to be supplied by the result provider, possibly from another @@ -98,7 +98,7 @@ // }); //.. // The attached callback shall accept an argument of type -// 'mwcex::FutureResult', where 'R' is the type of the result. Objects of +// 'bmqex::FutureResult', where 'R' is the type of the result. Objects of // this type are implicitly convertible to the result type, so it is also // possible for the callback to accept an argument of type 'R', as long as 'R' // is not 'void'. @@ -112,8 +112,7 @@ // keep in mind is that the attached callback is always invoked from the // result-supplier thread. -// MWC -#include +#include // BDE #include @@ -151,15 +150,15 @@ #if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES // Include version that can be compiled with C++03 // Generated on Wed Jul 17 12:44:45 2024 -// Command line: sim_cpp11_features.pl mwcex_future.h -#define COMPILING_MWCEX_FUTURE_H -#include -#undef COMPILING_MWCEX_FUTURE_H +// Command line: sim_cpp11_features.pl bmqex_future.h +#define COMPILING_BMQEX_FUTURE_H +#include +#undef COMPILING_BMQEX_FUTURE_H #else namespace BloombergLP { -namespace mwcex { +namespace bmqex { template class FutureResult; @@ -180,7 +179,7 @@ class Future_Exception { /// When creating a polymorphic exception with a target of type `E`, an /// instance of derived class template `Target` is instantiated and /// stored via a pointer to its base class (this one). Then, calls to - /// `mwcex::Future_Exception`s public methods are forwarded to this + /// `bmqex::Future_Exception`s public methods are forwarded to this /// class. class TargetBase { public: @@ -243,7 +242,7 @@ class Future_Exception { // falls back to requesting memory from the supplied allocator if // the buffer is not large enough. Note that the size of the on-stack // buffer is an arbitrary value. - mwcu::ObjectPlaceHolder)> d_target; + bmqu::ObjectPlaceHolder)> d_target; private: // NOT IMPLEMENTED @@ -295,8 +294,7 @@ class Future_Callback { /// Provides a tag type to specify the type of the async result accepted /// by the callback, template - struct AsyncResultTypeTag { - }; + struct AsyncResultTypeTag {}; private: // PRIVATE TYPES @@ -305,7 +303,7 @@ class Future_Callback { /// When creating a polymorphic wrapper with an async result type `R` /// and a callback of type `F`, an instance of derived class template /// `Target` is instantiated and stored via a pointer to its base - /// class (this one). Then, calls to `mwcex::Future_Callback`s public + /// class (this one). Then, calls to `bmqex::Future_Callback`s public /// methods are forwarded to this class. class TargetBase { public: @@ -370,7 +368,7 @@ class Future_Callback { // falls back to requesting memory from the supplied allocator if // the buffer is not large enough. Note that the size of the on-stack // buffer is an arbitrary value. - mwcu::ObjectPlaceHolder)> d_target; + bmqu::ObjectPlaceHolder)> d_target; private: // NOT IMPLEMENTED @@ -416,7 +414,7 @@ class Future_Callback { // =================== /// Specifies state of a future as returned by `waitFor` and `waitUntil` -/// functions of `mwcex::Future` and `mwcex::FutureSharedState`. +/// functions of `bmqex::Future` and `bmqex::FutureSharedState`. struct FutureStatus { enum Enum { e_READY // the shared state is ready @@ -855,14 +853,14 @@ class FutureSharedState { typedef typename bsl::remove_const::type ValueType; #ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_EXCEPTION_HANDLING - typedef bsl::exception_ptr ExceptionPtrType; + typedef bsl::exception_ptr ExceptionPtrType; #endif - typedef Future_Exception ExceptionObjType; + typedef Future_Exception ExceptionObjType; /// Shared state result. May contain a value, an exception pointer /// (C++11 only), or an exception object. union Result { - bsls::ObjectBuffer d_value; + bsls::ObjectBuffer d_value; #ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_EXCEPTION_HANDLING bsls::ObjectBuffer d_exceptionPtr; #endif @@ -1886,13 +1884,13 @@ FutureSharedState::allocator() const BSLS_KEYWORD_NOEXCEPT // FREE OPERATORS template -inline void mwcex::swap(Future& lhs, Future& rhs) BSLS_KEYWORD_NOEXCEPT +inline void bmqex::swap(Future& lhs, Future& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); } template -inline void mwcex::swap(FutureResult& lhs, +inline void bmqex::swap(FutureResult& lhs, FutureResult& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); diff --git a/src/groups/mwc/mwcex/mwcex_future.t.cpp b/src/groups/bmq/bmqex/bmqex_future.t.cpp similarity index 88% rename from src/groups/mwc/mwcex/mwcex_future.t.cpp rename to src/groups/bmq/bmqex/bmqex_future.t.cpp index ec62e5cc2..8add9fd82 100644 --- a/src/groups/mwc/mwcex/mwcex_future.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_future.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_future.t.cpp -*-C++-*- -#include +// bmqex_future.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -152,19 +152,19 @@ static void test1_sharedState_creators() // Ensure proper behavior of creator methods. // // Plan: -// Construct an instance of 'mwcex::FutureSharedState'. Check +// Construct an instance of 'bmqex::FutureSharedState'. Check // postconditions. Destroy the object. // // Testing: -// 'mwcex::FutureSharedState's constructors -// 'mwcex::FutureSharedState's destructor +// 'bmqex::FutureSharedState's constructors +// 'bmqex::FutureSharedState's destructor // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // default constructor { - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // check postconditions ASSERT_EQ(sharedState.isReady(), false); @@ -174,7 +174,7 @@ static void test1_sharedState_creators() // clock constructor { - mwcex::FutureSharedState sharedState( + bmqex::FutureSharedState sharedState( bsls::SystemClockType::e_REALTIME, &alloc); @@ -215,7 +215,7 @@ static void test2_sharedState_setValue() // the assigned value. // // Testing: -// mwcex::FutureSharedState::setValue +// bmqex::FutureSharedState::setValue // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -223,7 +223,7 @@ static void test2_sharedState_setValue() // 1. general use-case { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // set value sharedState.setValue(42); @@ -236,7 +236,7 @@ static void test2_sharedState_setValue() // 2. callback invocation { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // attach callback int result = 0; @@ -262,7 +262,7 @@ static void test2_sharedState_setValue() // 3. exception safety, value throws on construction { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // attach callback bslma::TestAllocator callbackAlloc; @@ -306,7 +306,7 @@ static void test2_sharedState_setValue() // 4. exception safety, callback throws on invocation { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // attach callback that throws on call bslma::TestAllocator callbackAlloc; @@ -364,7 +364,7 @@ static void test3_sharedState_emplaceValue() // contains the assigned value. // // Testing: -// mwcex::FutureSharedState::emplaceValue +// bmqex::FutureSharedState::emplaceValue // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -372,7 +372,7 @@ static void test3_sharedState_emplaceValue() // 1. general use-case { // create shared state - mwcex::FutureSharedState > sharedState(&alloc); + bmqex::FutureSharedState > sharedState(&alloc); // set value sharedState.emplaceValue(4, 2); @@ -385,7 +385,7 @@ static void test3_sharedState_emplaceValue() // 2. callback invocation { // create shared state - mwcex::FutureSharedState > sharedState(&alloc); + bmqex::FutureSharedState > sharedState(&alloc); // attach callback bsl::pair result(0, 0); @@ -411,7 +411,7 @@ static void test3_sharedState_emplaceValue() // 3. exception safety { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // attach callback bslma::TestAllocator callbackAlloc; @@ -455,7 +455,7 @@ static void test3_sharedState_emplaceValue() // 4. exception safety, callback throws on invocation { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // attach callback that throws on call bslma::TestAllocator callbackAlloc; @@ -508,7 +508,7 @@ static void test4_sharedState_setException_pointer() // contains the assigned exception. // // Testing: -// mwcex::FutureSharedState::setException +// bmqex::FutureSharedState::setException // ------------------------------------------------------------------------ { #ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_EXCEPTION_HANDLING @@ -517,7 +517,7 @@ static void test4_sharedState_setException_pointer() // 1. general use-case { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // set exception try { @@ -543,7 +543,7 @@ static void test4_sharedState_setException_pointer() // 2. callback invocation { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // attach callback int result = 0; @@ -579,7 +579,7 @@ static void test4_sharedState_setException_pointer() // 3. exception safety, callback throws on invocation { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // attach callback that throws on call bslma::TestAllocator callbackAlloc; @@ -651,7 +651,7 @@ static void test5_sharedState_setException_object() // contains the assigned exception. // // Testing: -// mwcex::FutureSharedState::setException +// bmqex::FutureSharedState::setException // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -659,7 +659,7 @@ static void test5_sharedState_setException_object() // 1. general use-case { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // set exception sharedState.setException(42); @@ -680,7 +680,7 @@ static void test5_sharedState_setException_object() // 2. callback invocation { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // attach callback int result = 0; @@ -711,7 +711,7 @@ static void test5_sharedState_setException_object() // 3. exception safety { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // attach callback bslma::TestAllocator callbackAlloc; @@ -755,7 +755,7 @@ static void test5_sharedState_setException_object() // 4. exception safety, callback throws on invocation { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // attach callback that throws on call bslma::TestAllocator callbackAlloc; @@ -812,14 +812,14 @@ static void test6_sharedState_whenReady() // - The shared state stays usable. // // Testing: -// mwcex::FutureSharedState::whenReady +// bmqex::FutureSharedState::whenReady // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // 1. ready shared state { - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // make the shared state ready sharedState.setValue(42); @@ -835,7 +835,7 @@ static void test6_sharedState_whenReady() // 2. non-ready shared state { - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // attach the callback int result = 0; @@ -855,7 +855,7 @@ static void test6_sharedState_whenReady() // 3. exception safety { // create shared state - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // set value that throws on copy ThrowOnCopyCallback callback; @@ -897,21 +897,21 @@ static void test7_sharedState_isReady() // otherwise. // // Testing: -// mwcex::FutureSharedState::isReady +// bmqex::FutureSharedState::isReady // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // assign nothing, check not ready { - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); ASSERT_EQ(sharedState.isReady(), false); } // assign value, check ready { - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); sharedState.setValue(42); ASSERT_EQ(sharedState.isReady(), true); @@ -920,7 +920,7 @@ static void test7_sharedState_isReady() // assign exception pointer, check ready { #ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_EXCEPTION_HANDLING - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); try { throw 42; @@ -934,7 +934,7 @@ static void test7_sharedState_isReady() // assign exception object, check ready { - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); sharedState.setException(42); ASSERT_EQ(sharedState.isReady(), true); @@ -959,14 +959,14 @@ static void test8_sharedState_get() // Check that 'get()' throws the contained exception. // // Testing: -// mwcex::FutureSharedState::get +// bmqex::FutureSharedState::get // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // 1. shared state contains a value { - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // make the state ready with a value sharedState.setValue(42); @@ -978,7 +978,7 @@ static void test8_sharedState_get() // 2. shared state contains an exception pointer { #ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_EXCEPTION_HANDLING - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // make the state ready with an exception pointer try { @@ -1002,7 +1002,7 @@ static void test8_sharedState_get() // 3. shared state contains an exception object { - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // make the state ready with an exception object sharedState.setException(42); @@ -1031,11 +1031,11 @@ static void test9_sharedState_wait() // thread is not blocked. // // Testing: -// mwcex::FutureSharedState::wait +// bmqex::FutureSharedState::wait // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // make the state ready sharedState.emplaceValue(); @@ -1054,37 +1054,37 @@ static void test10_sharedState_waitFor() // Plan: // 1. Call 'waitFor' on a ready shared state. Check that: // - The calling thread is not blocked; -// - The returned value is 'mwcex::FutureStatus::e_READY'. +// - The returned value is 'bmqex::FutureStatus::e_READY'. // // 2. Call 'waitFor' on a not ready shared state. Check that the -// returned value is 'mwcex::FutureStatus::e_TIMEOUT'. +// returned value is 'bmqex::FutureStatus::e_TIMEOUT'. // // Testing: -// mwcex::FutureSharedState::waitFor +// bmqex::FutureSharedState::waitFor // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // 1. shared state ready { - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // make the state ready sharedState.emplaceValue(); // ok bsls::TimeInterval duration(1000000.0); - ASSERT_EQ(sharedState.waitFor(duration), mwcex::FutureStatus::e_READY); + ASSERT_EQ(sharedState.waitFor(duration), bmqex::FutureStatus::e_READY); } // 2. shared state not ready { - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // timeout bsls::TimeInterval duration(0.1); ASSERT_EQ(sharedState.waitFor(duration), - mwcex::FutureStatus::e_TIMEOUT); + bmqex::FutureStatus::e_TIMEOUT); } } @@ -1098,36 +1098,36 @@ static void test11_sharedState_waitUntil() // Plan: // 1. Call 'waitUntil' on a ready shared state. Check that: // - The calling thread is not blocked; -// - The returned value is 'mwcex::FutureStatus::e_READY'. +// - The returned value is 'bmqex::FutureStatus::e_READY'. // // 2. Call 'waitUntil' on a not ready shared state. Check that the -// returned value is 'mwcex::FutureStatus::e_TIMEOUT'. +// returned value is 'bmqex::FutureStatus::e_TIMEOUT'. // // Testing: -// mwcex::FutureSharedState::waitUntil +// bmqex::FutureSharedState::waitUntil // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // 1. shared state ready { - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // make the state ready sharedState.emplaceValue(); // ok bsls::TimeInterval time(1000000.0); - ASSERT_EQ(sharedState.waitUntil(time), mwcex::FutureStatus::e_READY); + ASSERT_EQ(sharedState.waitUntil(time), bmqex::FutureStatus::e_READY); } // 2. shared state not ready { - mwcex::FutureSharedState sharedState(&alloc); + bmqex::FutureSharedState sharedState(&alloc); // timeout bsls::TimeInterval time(0.1); - ASSERT_EQ(sharedState.waitUntil(time), mwcex::FutureStatus::e_TIMEOUT); + ASSERT_EQ(sharedState.waitUntil(time), bmqex::FutureStatus::e_TIMEOUT); } } @@ -1164,15 +1164,15 @@ static void test12_future_creators() // the shared state ownership has been released. // // Testing: -// 'mwcex::Future's constructors -// 'mwcex::Future's destructor +// 'bmqex::Future's constructors +// 'bmqex::Future's destructor // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // 1. non-specialized, default-construct { - mwcex::Future future; + bmqex::Future future; // not valid ASSERT_EQ(future.isValid(), false); @@ -1181,13 +1181,13 @@ static void test12_future_creators() // 2. non-specialized, state-construct { // create shared state - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::Future::SharedStateType SharedState; bsl::shared_ptr sharedState = bsl::allocate_shared(&alloc); { // create future - mwcex::Future future(sharedState); + bmqex::Future future(sharedState); // is valid ASSERT(future.isValid()); @@ -1203,7 +1203,7 @@ static void test12_future_creators() // 3. void-specialized, default-construct { - mwcex::Future future; + bmqex::Future future; // not valid ASSERT_EQ(future.isValid(), false); @@ -1212,13 +1212,13 @@ static void test12_future_creators() // 4. void-specialized, state-construct { // create shared state - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::Future::SharedStateType SharedState; bsl::shared_ptr sharedState = bsl::allocate_shared(&alloc); { // create future - mwcex::Future future(sharedState); + bmqex::Future future(sharedState); // is valid ASSERT(future.isValid()); @@ -1234,7 +1234,7 @@ static void test12_future_creators() // 5. reference-specialized, default-construct { - mwcex::Future future; + bmqex::Future future; // not valid ASSERT_EQ(future.isValid(), false); @@ -1243,13 +1243,13 @@ static void test12_future_creators() // 6. reference-specialized, state-construct { // create shared state - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::Future::SharedStateType SharedState; bsl::shared_ptr sharedState = bsl::allocate_shared(&alloc); { // create future - mwcex::Future future(sharedState); + bmqex::Future future(sharedState); // is valid ASSERT(future.isValid()); @@ -1285,14 +1285,14 @@ static void test13_future_swap() // shared states. // // Testing: -// mwcex::Future::swap +// bmqex::Future::swap // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // 1. non-specialized { - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::Future::SharedStateType SharedState; // make a shared state for the first future bsl::shared_ptr sharedState1 = @@ -1303,26 +1303,26 @@ static void test13_future_swap() bsl::allocate_shared(&alloc); // create futures - mwcex::Future future1(sharedState1); - mwcex::Future future2(sharedState2); + bmqex::Future future1(sharedState1); + bmqex::Future future2(sharedState2); // swap futures future1.swap(future2); // first future now refers to the second shared state ASSERT_EQ(sharedState2.use_count(), 2); - future1 = mwcex::Future(); + future1 = bmqex::Future(); ASSERT_EQ(sharedState2.use_count(), 1); // second future now refers to the first shared state ASSERT_EQ(sharedState1.use_count(), 2); - future2 = mwcex::Future(); + future2 = bmqex::Future(); ASSERT_EQ(sharedState1.use_count(), 1); } // 2. void-specialized { - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::Future::SharedStateType SharedState; // make a shared state for the first future bsl::shared_ptr sharedState1 = @@ -1333,26 +1333,26 @@ static void test13_future_swap() bsl::allocate_shared(&alloc); // create futures - mwcex::Future future1(sharedState1); - mwcex::Future future2(sharedState2); + bmqex::Future future1(sharedState1); + bmqex::Future future2(sharedState2); // swap futures future1.swap(future2); // first future now refers to the second shared state ASSERT_EQ(sharedState2.use_count(), 2); - future1 = mwcex::Future(); + future1 = bmqex::Future(); ASSERT_EQ(sharedState2.use_count(), 1); // second future now refers to the first shared state ASSERT_EQ(sharedState1.use_count(), 2); - future2 = mwcex::Future(); + future2 = bmqex::Future(); ASSERT_EQ(sharedState1.use_count(), 1); } // 3. reference-specialized { - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::Future::SharedStateType SharedState; // make a shared state for the first future bsl::shared_ptr sharedState1 = @@ -1363,20 +1363,20 @@ static void test13_future_swap() bsl::allocate_shared(&alloc); // create futures - mwcex::Future future1(sharedState1); - mwcex::Future future2(sharedState2); + bmqex::Future future1(sharedState1); + bmqex::Future future2(sharedState2); // swap futures future1.swap(future2); // first future now refers to the second shared state ASSERT_EQ(sharedState2.use_count(), 2); - future1 = mwcex::Future(); + future1 = bmqex::Future(); ASSERT_EQ(sharedState2.use_count(), 1); // second future now refers to the first shared state ASSERT_EQ(sharedState1.use_count(), 2); - future2 = mwcex::Future(); + future2 = bmqex::Future(); ASSERT_EQ(sharedState1.use_count(), 1); } } @@ -1408,52 +1408,52 @@ static void test14_future_isValid() // Check that 'isValid()' returns 'true'. // // Testing: -// mwcex::Future::isValid +// bmqex::Future::isValid // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // 1. non-specialized, no shared state { - mwcex::Future future; + bmqex::Future future; ASSERT_EQ(future.isValid(), false); } // 2. non-specialized, have shared state { - typedef mwcex::Future::SharedStateType SharedState; - mwcex::Future future(bsl::allocate_shared(&alloc)); + typedef bmqex::Future::SharedStateType SharedState; + bmqex::Future future(bsl::allocate_shared(&alloc)); ASSERT_EQ(future.isValid(), true); } // 3. void-specialized, no shared state { - mwcex::Future future; + bmqex::Future future; ASSERT_EQ(future.isValid(), false); } // 4. void-specialized, have shared state { - typedef mwcex::Future::SharedStateType SharedState; - mwcex::Future future(bsl::allocate_shared(&alloc)); + typedef bmqex::Future::SharedStateType SharedState; + bmqex::Future future(bsl::allocate_shared(&alloc)); ASSERT_EQ(future.isValid(), true); } // 5. reference-specialized, no shared state { - mwcex::Future future; + bmqex::Future future; ASSERT_EQ(future.isValid(), false); } // 6. reference-specialized, have shared state { - typedef mwcex::Future::SharedStateType SharedState; - mwcex::Future future(bsl::allocate_shared(&alloc)); + typedef bmqex::Future::SharedStateType SharedState; + bmqex::Future future(bsl::allocate_shared(&alloc)); ASSERT_EQ(future.isValid(), true); } @@ -1487,17 +1487,17 @@ static void test15_futureResult_creators() // state. Check that the result refers to the specified shared state. // // Testing: -// 'mwcex::FutureResult's constructors -// 'mwcex::FutureResult's destructor +// 'bmqex::FutureResult's constructors +// 'bmqex::FutureResult's destructor // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // 1. non-specialized, future-construct { - typedef mwcex::Future Future; - typedef mwcex::FutureResult FutureResult; - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::Future Future; + typedef bmqex::FutureResult FutureResult; + typedef bmqex::Future::SharedStateType SharedState; // create a ready shared state bsl::shared_ptr sharedState = @@ -1514,8 +1514,8 @@ static void test15_futureResult_creators() // 2. non-specialized, state-construct { - typedef mwcex::FutureResult FutureResult; - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::FutureResult FutureResult; + typedef bmqex::Future::SharedStateType SharedState; // create a ready shared state SharedState sharedState(&alloc); @@ -1530,9 +1530,9 @@ static void test15_futureResult_creators() // 3. void-specialized, future-construct { - typedef mwcex::Future Future; - typedef mwcex::FutureResult FutureResult; - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::Future Future; + typedef bmqex::FutureResult FutureResult; + typedef bmqex::Future::SharedStateType SharedState; // create a ready shared state bsl::shared_ptr sharedState = @@ -1563,8 +1563,8 @@ static void test15_futureResult_creators() // 4. void-specialized, state-construct { - typedef mwcex::FutureResult FutureResult; - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::FutureResult FutureResult; + typedef bmqex::Future::SharedStateType SharedState; // create a ready shared state SharedState sharedState(&alloc); @@ -1593,9 +1593,9 @@ static void test15_futureResult_creators() // 5. reference-specialized, future-construct { - typedef mwcex::Future Future; - typedef mwcex::FutureResult FutureResult; - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::Future Future; + typedef bmqex::FutureResult FutureResult; + typedef bmqex::Future::SharedStateType SharedState; // create a ready shared state int val = 42; @@ -1613,8 +1613,8 @@ static void test15_futureResult_creators() // 6. reference-specialized, state-construct { - typedef mwcex::FutureResult FutureResult; - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::FutureResult FutureResult; + typedef bmqex::Future::SharedStateType SharedState; // create a ready shared state int val = 42; @@ -1650,15 +1650,15 @@ static void test16_futureResult_swap() // shared states. // // Testing: -// mwcex::FutureResult::swap +// bmqex::FutureResult::swap // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // 1. non-specialized { - typedef mwcex::FutureResult FutureResult; - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::FutureResult FutureResult; + typedef bmqex::Future::SharedStateType SharedState; // create fist ready shared state SharedState sharedState1(&alloc); @@ -1684,8 +1684,8 @@ static void test16_futureResult_swap() // 2. void-specialized { - typedef mwcex::FutureResult FutureResult; - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::FutureResult FutureResult; + typedef bmqex::Future::SharedStateType SharedState; // create fist ready shared state SharedState sharedState1(&alloc); @@ -1743,8 +1743,8 @@ static void test16_futureResult_swap() // 3. reference-specialized { - typedef mwcex::FutureResult FutureResult; - typedef mwcex::Future::SharedStateType SharedState; + typedef bmqex::FutureResult FutureResult; + typedef bmqex::Future::SharedStateType SharedState; // create fist ready shared state int val1 = 1; @@ -1777,10 +1777,10 @@ static void test16_futureResult_swap() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { - // mwcex::FutureSharedState + // bmqex::FutureSharedState case 1: test1_sharedState_creators(); break; case 2: test2_sharedState_setValue(); break; case 3: test3_sharedState_emplaceValue(); break; @@ -1793,12 +1793,12 @@ int main(int argc, char* argv[]) case 10: test10_sharedState_waitFor(); break; case 11: test11_sharedState_waitUntil(); break; - // mwcex::Future + // bmqex::Future case 12: test12_future_creators(); break; case 13: test13_future_swap(); break; case 14: test14_future_isValid(); break; - // mwcex::FutureResult + // bmqex::FutureResult case 15: test15_futureResult_creators(); break; case 16: test16_futureResult_swap(); break; @@ -1809,5 +1809,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/mwcex_future_cpp03.cpp b/src/groups/bmq/bmqex/bmqex_future_cpp03.cpp similarity index 80% rename from src/groups/mwc/mwcex/mwcex_future_cpp03.cpp rename to src/groups/bmq/bmqex/bmqex_future_cpp03.cpp index bb7b340cf..752672d66 100644 --- a/src/groups/mwc/mwcex/mwcex_future_cpp03.cpp +++ b/src/groups/bmq/bmqex/bmqex_future_cpp03.cpp @@ -13,22 +13,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_future_cpp03.cpp -*-C++-*- +// bmqex_future_cpp03.cpp -*-C++-*- // Automatically generated file. **DO NOT EDIT** // Generated on Thu Jul 14 05:51:54 2022 -// Command line: sim_cpp11_features.pl mwcex_future.cpp +// Command line: sim_cpp11_features.pl bmqex_future.cpp -#define INCLUDED_MWCEX_FUTURE_CPP03 // Disable inclusion -#include // Pro-forma #include +#define INCLUDED_BMQEX_FUTURE_CPP03 // Disable inclusion +#include // Pro-forma #include -// Empty file except when compiling mwcex_future.cpp -#ifdef COMPILING_MWCEX_FUTURE_CPP +// Empty file except when compiling bmqex_future.cpp +#ifdef COMPILING_BMQEX_FUTURE_CPP // No C++03 Expansion -#endif // defined(COMPILING_MWCEX_FUTURE_CPP) +#endif // defined(COMPILING_BMQEX_FUTURE_CPP) // ---------------------------------------------------------------------------- // Copyright 2022-2023 Bloomberg Finance L.P. diff --git a/src/groups/mwc/mwcex/mwcex_future_cpp03.h b/src/groups/bmq/bmqex/bmqex_future_cpp03.h similarity index 95% rename from src/groups/mwc/mwcex/mwcex_future_cpp03.h rename to src/groups/bmq/bmqex/bmqex_future_cpp03.h index a1cc23b6c..cc5b9126e 100644 --- a/src/groups/mwc/mwcex/mwcex_future_cpp03.h +++ b/src/groups/bmq/bmqex/bmqex_future_cpp03.h @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_future_cpp03.h -*-C++-*- +// bmqex_future_cpp03.h -*-C++-*- // Automatically generated file. **DO NOT EDIT** -#ifndef INCLUDED_MWCEX_FUTURE_CPP03 -#define INCLUDED_MWCEX_FUTURE_CPP03 +#ifndef INCLUDED_BMQEX_FUTURE_CPP03 +#define INCLUDED_BMQEX_FUTURE_CPP03 -//@PURPOSE: Provide C++03 implementation for mwcex_future.h +//@PURPOSE: Provide C++03 implementation for bmqex_future.h // -//@CLASSES: See mwcex_future.h for list of classes +//@CLASSES: See bmqex_future.h for list of classes // -//@SEE_ALSO: mwcex_future +//@SEE_ALSO: bmqex_future // //@DESCRIPTION: This component is the C++03 translation of a C++11 component, // generated by the 'sim_cpp11_features.pl' program. If the original header @@ -37,13 +37,13 @@ // '#include'd in the original header. // // Generated on Wed Jul 17 12:44:45 2024 -// Command line: sim_cpp11_features.pl mwcex_future.h +// Command line: sim_cpp11_features.pl bmqex_future.h -#ifdef COMPILING_MWCEX_FUTURE_H +#ifdef COMPILING_BMQEX_FUTURE_H namespace BloombergLP { -namespace mwcex { +namespace bmqex { template class FutureResult; @@ -64,7 +64,7 @@ class Future_Exception { /// When creating a polymorphic exception with a target of type `E`, an /// instance of derived class template `Target` is instantiated and /// stored via a pointer to its base class (this one). Then, calls to - /// `mwcex::Future_Exception`s public methods are forwarded to this + /// `bmqex::Future_Exception`s public methods are forwarded to this /// class. class TargetBase { public: @@ -127,7 +127,7 @@ class Future_Exception { // falls back to requesting memory from the supplied allocator if // the buffer is not large enough. Note that the size of the on-stack // buffer is an arbitrary value. - mwcu::ObjectPlaceHolder)> d_target; + bmqu::ObjectPlaceHolder)> d_target; private: // NOT IMPLEMENTED @@ -179,8 +179,7 @@ class Future_Callback { /// Provides a tag type to specify the type of the async result accepted /// by the callback, template - struct AsyncResultTypeTag { - }; + struct AsyncResultTypeTag {}; private: // PRIVATE TYPES @@ -189,7 +188,7 @@ class Future_Callback { /// When creating a polymorphic wrapper with an async result type `R` /// and a callback of type `F`, an instance of derived class template /// `Target` is instantiated and stored via a pointer to its base - /// class (this one). Then, calls to `mwcex::Future_Callback`s public + /// class (this one). Then, calls to `bmqex::Future_Callback`s public /// methods are forwarded to this class. class TargetBase { public: @@ -254,7 +253,7 @@ class Future_Callback { // falls back to requesting memory from the supplied allocator if // the buffer is not large enough. Note that the size of the on-stack // buffer is an arbitrary value. - mwcu::ObjectPlaceHolder)> d_target; + bmqu::ObjectPlaceHolder)> d_target; private: // NOT IMPLEMENTED @@ -300,7 +299,7 @@ class Future_Callback { // =================== /// Specifies state of a future as returned by `waitFor` and `waitUntil` -/// functions of `mwcex::Future` and `mwcex::FutureSharedState`. +/// functions of `bmqex::Future` and `bmqex::FutureSharedState`. struct FutureStatus { enum Enum { e_READY // the shared state is ready @@ -839,45 +838,45 @@ class FutureSharedState { #if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES // {{{ BEGIN GENERATED CODE -// Command line: sim_cpp11_features.pl mwcex_future.h -#ifndef MWCEX_FUTURE_VARIADIC_LIMIT -#define MWCEX_FUTURE_VARIADIC_LIMIT 9 +// Command line: sim_cpp11_features.pl bmqex_future.h +#ifndef BMQEX_FUTURE_VARIADIC_LIMIT +#define BMQEX_FUTURE_VARIADIC_LIMIT 9 #endif -#ifndef MWCEX_FUTURE_VARIADIC_LIMIT_A -#define MWCEX_FUTURE_VARIADIC_LIMIT_A MWCEX_FUTURE_VARIADIC_LIMIT +#ifndef BMQEX_FUTURE_VARIADIC_LIMIT_A +#define BMQEX_FUTURE_VARIADIC_LIMIT_A BMQEX_FUTURE_VARIADIC_LIMIT #endif -#if MWCEX_FUTURE_VARIADIC_LIMIT_A >= 0 +#if BMQEX_FUTURE_VARIADIC_LIMIT_A >= 0 void emplaceValue(); -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_A >= 0 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_A >= 0 -#if MWCEX_FUTURE_VARIADIC_LIMIT_A >= 1 +#if BMQEX_FUTURE_VARIADIC_LIMIT_A >= 1 template void emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1); -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_A >= 1 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_A >= 1 -#if MWCEX_FUTURE_VARIADIC_LIMIT_A >= 2 +#if BMQEX_FUTURE_VARIADIC_LIMIT_A >= 2 template void emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_2) args_2); -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_A >= 2 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_A >= 2 -#if MWCEX_FUTURE_VARIADIC_LIMIT_A >= 3 +#if BMQEX_FUTURE_VARIADIC_LIMIT_A >= 3 template void emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_2) args_2, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_3) args_3); -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_A >= 3 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_A >= 3 -#if MWCEX_FUTURE_VARIADIC_LIMIT_A >= 4 +#if BMQEX_FUTURE_VARIADIC_LIMIT_A >= 4 template void emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_2) args_2, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_3) args_3, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_4) args_4); -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_A >= 4 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_A >= 4 -#if MWCEX_FUTURE_VARIADIC_LIMIT_A >= 5 +#if BMQEX_FUTURE_VARIADIC_LIMIT_A >= 5 template = 5 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_A >= 5 -#if MWCEX_FUTURE_VARIADIC_LIMIT_A >= 6 +#if BMQEX_FUTURE_VARIADIC_LIMIT_A >= 6 template = 6 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_A >= 6 -#if MWCEX_FUTURE_VARIADIC_LIMIT_A >= 7 +#if BMQEX_FUTURE_VARIADIC_LIMIT_A >= 7 template = 7 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_A >= 7 -#if MWCEX_FUTURE_VARIADIC_LIMIT_A >= 8 +#if BMQEX_FUTURE_VARIADIC_LIMIT_A >= 8 template = 8 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_A >= 8 -#if MWCEX_FUTURE_VARIADIC_LIMIT_A >= 9 +#if BMQEX_FUTURE_VARIADIC_LIMIT_A >= 9 template = 9 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_A >= 9 #else // The generated code below is a workaround for the absence of perfect @@ -1664,14 +1663,14 @@ inline void FutureSharedState::setValue(bslmf::MovableRef value) #if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES // {{{ BEGIN GENERATED CODE -// Command line: sim_cpp11_features.pl mwcex_future.h -#ifndef MWCEX_FUTURE_VARIADIC_LIMIT -#define MWCEX_FUTURE_VARIADIC_LIMIT 9 +// Command line: sim_cpp11_features.pl bmqex_future.h +#ifndef BMQEX_FUTURE_VARIADIC_LIMIT +#define BMQEX_FUTURE_VARIADIC_LIMIT 9 #endif -#ifndef MWCEX_FUTURE_VARIADIC_LIMIT_B -#define MWCEX_FUTURE_VARIADIC_LIMIT_B MWCEX_FUTURE_VARIADIC_LIMIT +#ifndef BMQEX_FUTURE_VARIADIC_LIMIT_B +#define BMQEX_FUTURE_VARIADIC_LIMIT_B BMQEX_FUTURE_VARIADIC_LIMIT #endif -#if MWCEX_FUTURE_VARIADIC_LIMIT_B >= 0 +#if BMQEX_FUTURE_VARIADIC_LIMIT_B >= 0 template inline void FutureSharedState::emplaceValue() { @@ -1692,9 +1691,9 @@ inline void FutureSharedState::emplaceValue() d_condition.broadcast(); invokeAndDestroyCallback(); } -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_B >= 0 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_B >= 0 -#if MWCEX_FUTURE_VARIADIC_LIMIT_B >= 1 +#if BMQEX_FUTURE_VARIADIC_LIMIT_B >= 1 template template inline void @@ -1719,9 +1718,9 @@ FutureSharedState::emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) d_condition.broadcast(); invokeAndDestroyCallback(); } -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_B >= 1 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_B >= 1 -#if MWCEX_FUTURE_VARIADIC_LIMIT_B >= 2 +#if BMQEX_FUTURE_VARIADIC_LIMIT_B >= 2 template template inline void FutureSharedState::emplaceValue( @@ -1747,9 +1746,9 @@ inline void FutureSharedState::emplaceValue( d_condition.broadcast(); invokeAndDestroyCallback(); } -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_B >= 2 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_B >= 2 -#if MWCEX_FUTURE_VARIADIC_LIMIT_B >= 3 +#if BMQEX_FUTURE_VARIADIC_LIMIT_B >= 3 template template inline void FutureSharedState::emplaceValue( @@ -1777,9 +1776,9 @@ inline void FutureSharedState::emplaceValue( d_condition.broadcast(); invokeAndDestroyCallback(); } -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_B >= 3 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_B >= 3 -#if MWCEX_FUTURE_VARIADIC_LIMIT_B >= 4 +#if BMQEX_FUTURE_VARIADIC_LIMIT_B >= 4 template template inline void FutureSharedState::emplaceValue( @@ -1809,9 +1808,9 @@ inline void FutureSharedState::emplaceValue( d_condition.broadcast(); invokeAndDestroyCallback(); } -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_B >= 4 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_B >= 4 -#if MWCEX_FUTURE_VARIADIC_LIMIT_B >= 5 +#if BMQEX_FUTURE_VARIADIC_LIMIT_B >= 5 template template inline void FutureSharedState::emplaceValue( @@ -1843,9 +1842,9 @@ inline void FutureSharedState::emplaceValue( d_condition.broadcast(); invokeAndDestroyCallback(); } -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_B >= 5 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_B >= 5 -#if MWCEX_FUTURE_VARIADIC_LIMIT_B >= 6 +#if BMQEX_FUTURE_VARIADIC_LIMIT_B >= 6 template template ::emplaceValue( d_condition.broadcast(); invokeAndDestroyCallback(); } -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_B >= 6 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_B >= 6 -#if MWCEX_FUTURE_VARIADIC_LIMIT_B >= 7 +#if BMQEX_FUTURE_VARIADIC_LIMIT_B >= 7 template template ::emplaceValue( d_condition.broadcast(); invokeAndDestroyCallback(); } -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_B >= 7 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_B >= 7 -#if MWCEX_FUTURE_VARIADIC_LIMIT_B >= 8 +#if BMQEX_FUTURE_VARIADIC_LIMIT_B >= 8 template template ::emplaceValue( d_condition.broadcast(); invokeAndDestroyCallback(); } -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_B >= 8 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_B >= 8 -#if MWCEX_FUTURE_VARIADIC_LIMIT_B >= 9 +#if BMQEX_FUTURE_VARIADIC_LIMIT_B >= 9 template template ::emplaceValue( d_condition.broadcast(); invokeAndDestroyCallback(); } -#endif // MWCEX_FUTURE_VARIADIC_LIMIT_B >= 9 +#endif // BMQEX_FUTURE_VARIADIC_LIMIT_B >= 9 #else // The generated code below is a workaround for the absence of perfect @@ -2253,13 +2252,13 @@ FutureSharedState::allocator() const BSLS_KEYWORD_NOEXCEPT // FREE OPERATORS template -inline void mwcex::swap(Future& lhs, Future& rhs) BSLS_KEYWORD_NOEXCEPT +inline void bmqex::swap(Future& lhs, Future& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); } template -inline void mwcex::swap(FutureResult& lhs, +inline void bmqex::swap(FutureResult& lhs, FutureResult& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); @@ -2267,8 +2266,8 @@ inline void mwcex::swap(FutureResult& lhs, } // close enterprise namespace -#else // if ! defined(DEFINED_MWCEX_FUTURE_H) -#error Not valid except when included from mwcex_future.h -#endif // ! defined(COMPILING_MWCEX_FUTURE_H) +#else // if ! defined(DEFINED_BMQEX_FUTURE_H) +#error Not valid except when included from bmqex_future.h +#endif // ! defined(COMPILING_BMQEX_FUTURE_H) -#endif // ! defined(INCLUDED_MWCEX_FUTURE_CPP03) +#endif // ! defined(INCLUDED_BMQEX_FUTURE_CPP03) diff --git a/src/groups/mwc/mwcex/mwcex_job.cpp b/src/groups/bmq/bmqex/bmqex_job.cpp similarity index 89% rename from src/groups/mwc/mwcex/mwcex_job.cpp rename to src/groups/bmq/bmqex/bmqex_job.cpp index 30de387ab..23053e008 100644 --- a/src/groups/mwc/mwcex/mwcex_job.cpp +++ b/src/groups/bmq/bmqex/bmqex_job.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_job.cpp -*-C++-*- -#include +// bmqex_job.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcex { +namespace bmqex { // -------------------- // class Job_TargetBase diff --git a/src/groups/mwc/mwcex/mwcex_job.h b/src/groups/bmq/bmqex/bmqex_job.h similarity index 92% rename from src/groups/mwc/mwcex/mwcex_job.h rename to src/groups/bmq/bmqex/bmqex_job.h index 17f417346..d7cd0bc0e 100644 --- a/src/groups/mwc/mwcex/mwcex_job.h +++ b/src/groups/bmq/bmqex/bmqex_job.h @@ -13,30 +13,29 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_job.h -*-C++-*- -#ifndef INCLUDED_MWCEX_JOB -#define INCLUDED_MWCEX_JOB +// bmqex_job.h -*-C++-*- +#ifndef INCLUDED_BMQEX_JOB +#define INCLUDED_BMQEX_JOB //@PURPOSE: Provides a polymorphic function object wrapper. // //@CLASSES: -// mwcex::Job: a polymorphic function object wrapper. +// bmqex::Job: a polymorphic function object wrapper. // //@DESCRIPTION: // THIS IS A PRIVATE COMPONENT NOT TO BE USED OUTSIDE OF THIS PACKAGE. // // This component provides a polymorphic wrapper for nullary function objects, -// 'mwcex::Job', that is similar to 'bsl::function', but optimized for a narrow +// 'bmqex::Job', that is similar to 'bsl::function', but optimized for a narrow // purpose. // -// 'mwcex::Job' is designed to be memory-efficient, it cannot be copied, moved +// 'bmqex::Job' is designed to be memory-efficient, it cannot be copied, moved // or swapped, and only supports the absolute minimum amount of operations // required, that is construction, destruction and invocation. Unlike // 'bsl::function' that invokes the target functor 'f' as if by 'f()', -// 'mwcex::Job' does it as as if by 'bsl::move(f)()'. +// 'bmqex::Job' does it as as if by 'bsl::move(f)()'. -// MWC -#include +#include // BDE #include @@ -53,7 +52,7 @@ namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ==================== // class Job_TargetBase @@ -62,7 +61,7 @@ namespace mwcex { /// An interface used to implement the type erasure technique. When creating /// a polymorphic wrapper with a target of type `F`, an instance of derived /// class template `Job_Target` is instantiated and stored via a pointer -/// to its base class (this one). Then, calls to `mwcex::Job`s public +/// to its base class (this one). Then, calls to `bmqex::Job`s public /// methods are forwarded to this class. class Job_TargetBase { public: @@ -138,7 +137,7 @@ class Job { // falls back to requesting memory from the supplied allocator if // the buffer is not large enough. Note that the size of the on-stack // buffer is an arbitrary value. - mwcu::ObjectPlaceHolder)> d_target; + bmqu::ObjectPlaceHolder)> d_target; private: // NOT IMPLEMENTED diff --git a/src/groups/mwc/mwcex/mwcex_job.t.cpp b/src/groups/bmq/bmqex/bmqex_job.t.cpp similarity index 90% rename from src/groups/mwc/mwcex/mwcex_job.t.cpp rename to src/groups/bmq/bmqex/bmqex_job.t.cpp index 6a7399af3..5fcf2abb1 100644 --- a/src/groups/mwc/mwcex/mwcex_job.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_job.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_job.t.cpp -*-C++-*- -#include +// bmqex_job.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -37,7 +37,7 @@ namespace { // ========================= /// A nullary function for test purposes that should fit in the -/// `mwcex::Job`s on-stack buffer. +/// `bmqex::Job`s on-stack buffer. class SmallNullaryFunctor { private: // PRIVATE DATA @@ -69,7 +69,7 @@ class SmallNullaryFunctor { // ========================= /// A nullary function for test purposes that should NOT fit in the -/// `mwcex::Job`s on-stack buffer. +/// `bmqex::Job`s on-stack buffer. class LargeNullaryFunctor : public SmallNullaryFunctor { private: // PRIVATE DATA @@ -100,7 +100,7 @@ static void test1_breathing() // BREATHING // // Concerns: -// Ensure proper behavior of 'mwcex::Job'. +// Ensure proper behavior of 'bmqex::Job'. // // Plan: // Create a job, invoke it, check that the target was invoked. Test the @@ -120,7 +120,7 @@ static void test1_breathing() SmallNullaryFunctor target(&invoked); // create job - mwcex::Job job(target, &alloc); + bmqex::Job job(target, &alloc); // no memory allocated ASSERT_EQ(alloc.numBytesInUse(), 0); @@ -139,7 +139,7 @@ static void test1_breathing() LargeNullaryFunctor target(&invoked); // create job - mwcex::Job job(target, &alloc); + bmqex::Job job(target, &alloc); // memory allocated ASSERT_NE(alloc.numBytesInUse(), 0); @@ -158,7 +158,7 @@ static void test1_breathing() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_breathing(); break; @@ -170,5 +170,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/mwcex_promise.cpp b/src/groups/bmq/bmqex/bmqex_promise.cpp similarity index 88% rename from src/groups/mwc/mwcex/mwcex_promise.cpp rename to src/groups/bmq/bmqex/bmqex_promise.cpp index 85bba7d18..60c72b139 100644 --- a/src/groups/mwc/mwcex/mwcex_promise.cpp +++ b/src/groups/bmq/bmqex/bmqex_promise.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_promise.cpp -*-C++-*- -#include +// bmqex_promise.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ------------------- // class PromiseBroken diff --git a/src/groups/mwc/mwcex/mwcex_promise.h b/src/groups/bmq/bmqex/bmqex_promise.h similarity index 93% rename from src/groups/mwc/mwcex/mwcex_promise.h rename to src/groups/bmq/bmqex/bmqex_promise.h index 71e7077ee..98255c10b 100644 --- a/src/groups/mwc/mwcex/mwcex_promise.h +++ b/src/groups/bmq/bmqex/bmqex_promise.h @@ -13,37 +13,37 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_promise.h -*-C++-*- -#ifndef INCLUDED_MWCEX_PROMISE -#define INCLUDED_MWCEX_PROMISE +// bmqex_promise.h -*-C++-*- +#ifndef INCLUDED_BMQEX_PROMISE +#define INCLUDED_BMQEX_PROMISE //@PURPOSE: Provides a mechanism to store the result of an async operation. // //@CLASSES: -// mwcex::Promise: a promise -// mwcex::PromiseBroken: exception class to indicate a promise was broken +// bmqex::Promise: a promise +// bmqex::PromiseBroken: exception class to indicate a promise was broken // //@SEE ALSO: -// mwcex_future +// bmqex_future // //@DESCRIPTION: -// This component provides a mechanism, 'mwcex::Promise', to store a value (or +// This component provides a mechanism, 'bmqex::Promise', to store a value (or // an exception) that can later be retrieved from the corresponding -// 'mwcex::Future' object. 'mwcex::Promise' and 'mwcex::Future' communicate via -// their underlying shared state (see 'mwcex::FutureSharedState'). +// 'bmqex::Future' object. 'bmqex::Promise' and 'bmqex::Future' communicate via +// their underlying shared state (see 'bmqex::FutureSharedState'). // -// In addition the generalized 'mwcex::Promise' class template two -// specializations, 'mwcex::Promise', and 'mwcex::Promise' are +// In addition the generalized 'bmqex::Promise' class template two +// specializations, 'bmqex::Promise', and 'bmqex::Promise' are // provided. // -// This component also provides a class, 'mwcex::PromiseBroken', to indicate a -// promise was broken, that is, an 'mwcex::Promise' object was destroyed before +// This component also provides a class, 'bmqex::PromiseBroken', to indicate a +// promise was broken, that is, an 'bmqex::Promise' object was destroyed before // its associated shared state has been made ready. // /// Thread safety ///------------- // With the exception of assignment operators, as well as the 'swap' member -// function, 'mwcex::Promise' is fully thread-safe, meaning that multiple +// function, 'bmqex::Promise' is fully thread-safe, meaning that multiple // threads may use their own instances of the class or use a shared instance // without further synchronization. However, note that the shared state can // only be made ready once, making concurrent calls to 'setValue', @@ -53,11 +53,11 @@ ///----- // Create a promise with an 'int' result type: //.. -// mwcex::Promise promise; +// bmqex::Promise promise; //.. // Obtain a future: //.. -// mwcex::Future future = promise.future(); +// bmqex::Future future = promise.future(); //.. // Make the result ready: //.. @@ -68,9 +68,7 @@ // int result = future.get(); //.. -// MWC - -#include +#include // BDE #include @@ -92,24 +90,24 @@ #if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES // Include version that can be compiled with C++03 -// Generated on Wed Jun 29 04:19:38 2022 -// Command line: sim_cpp11_features.pl mwcex_promise.h -#define COMPILING_MWCEX_PROMISE_H -#include -#undef COMPILING_MWCEX_PROMISE_H +// Generated on Tue Oct 15 18:12:34 2024 +// Command line: sim_cpp11_features.pl bmqex_promise.h +#define COMPILING_BMQEX_PROMISE_H +#include +#undef COMPILING_BMQEX_PROMISE_H #else namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ============= // class Promise // ============= /// Provides a mechanism to store a value or an exception that is later -/// acquired asynchronously via a `mwcex::Future` object created by the -/// `mwcex::Promise` object. +/// acquired asynchronously via a `bmqex::Future` object created by the +/// `bmqex::Promise` object. /// /// `R` must meet the requirements of Destructible as specified in the C++ /// standard. @@ -136,12 +134,12 @@ class Promise { // CREATORS /// Create a `Promise` object holding a shared state of type - /// `mwcex::Future::SharedStateType` initialized with the specified + /// `bmqex::Future::SharedStateType` initialized with the specified /// `basicAllocator`. explicit Promise(bslma::Allocator* basicAllocator = 0); /// Create a `Promise` object holding a shared state of type - /// `mwcex::Future::SharedStateType` initialized with the specified + /// `bmqex::Future::SharedStateType` initialized with the specified /// `clockType` and `basicAllocator`. explicit Promise(bsls::SystemClockType::Enum clockType, bslma::Allocator* basicAllocator = 0); @@ -152,7 +150,7 @@ class Promise { Promise(bslmf::MovableRef original) BSLS_KEYWORD_NOEXCEPT; /// Destroy this object. If `*this` has a shared state and the shared - /// state is not ready, store a `mwcex::PromiseBroken` exception object + /// state is not ready, store a `bmqex::PromiseBroken` exception object /// into the shared state and make the state ready, then release the /// underlying shared state. ~Promise(); @@ -714,7 +712,7 @@ inline Future Promise::future() const BSLS_KEYWORD_NOEXCEPT // FREE OPERATORS template -inline void mwcex::swap(Promise& lhs, Promise& rhs) BSLS_KEYWORD_NOEXCEPT +inline void bmqex::swap(Promise& lhs, Promise& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); } diff --git a/src/groups/mwc/mwcex/mwcex_promise.t.cpp b/src/groups/bmq/bmqex/bmqex_promise.t.cpp similarity index 79% rename from src/groups/mwc/mwcex/mwcex_promise.t.cpp rename to src/groups/bmq/bmqex/bmqex_promise.t.cpp index f31adeafc..3ff64cf62 100644 --- a/src/groups/mwc/mwcex/mwcex_promise.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_promise.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_promise.t.cpp -*-C++-*- -#include +// bmqex_promise.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include // bsl::strcmp @@ -40,31 +40,31 @@ static void test1_promise_creators() // Ensure proper behavior of creators methods. // // Plan: -// 1. Default-construct a 'mwcex::Promise'. Check that it has a shared +// 1. Default-construct a 'bmqex::Promise'. Check that it has a shared // state. // -// 2. Clock-construct a 'mwcex::Promise'. Check that it has a shared +// 2. Clock-construct a 'bmqex::Promise'. Check that it has a shared // state. // -// 3. Move-construct a 'mwcex::Promise'. Check that the moved-to object +// 3. Move-construct a 'bmqex::Promise'. Check that the moved-to object // refers to the shared state of the moved-from object. // // 4. Destroy a promise object without making the shared state ready. -// Check that the shared state contains an 'mwcex::PromiseBroken' +// Check that the shared state contains an 'bmqex::PromiseBroken' // exception. // // Testing: -// mwcex::Promise's default constructor -// mwcex::Promise's clock constructor -// mwcex::Promise's move constructor -// mwcex::Promise's destructor +// bmqex::Promise's default constructor +// bmqex::Promise's clock constructor +// bmqex::Promise's move constructor +// bmqex::Promise's destructor // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // 1. default constructor { - mwcex::Promise promise(&alloc); + bmqex::Promise promise(&alloc); // has a shared state ASSERT(promise.future().isValid()); @@ -72,7 +72,7 @@ static void test1_promise_creators() // 2. clock constructor { - mwcex::Promise promise(bsls::SystemClockType::e_REALTIME, &alloc); + bmqex::Promise promise(bsls::SystemClockType::e_REALTIME, &alloc); // has a shared state ASSERT(promise.future().isValid()); @@ -81,11 +81,11 @@ static void test1_promise_creators() // 3. move constructor { // create a moved-from promise - mwcex::Promise movedFromPromise(&alloc); + bmqex::Promise movedFromPromise(&alloc); movedFromPromise.setValue(42); // create a moved-to promise - mwcex::Promise movedToPromise( + bmqex::Promise movedToPromise( bslmf::MovableRefUtil::move(movedFromPromise)); // moved-to promise contains the shared state of the moved-from promise @@ -96,21 +96,21 @@ static void test1_promise_creators() // 4. destructor { // create a promise, obtain a future, destroy the promise - mwcex::Future future; + bmqex::Future future; { - mwcex::Promise promise(&alloc); + bmqex::Promise promise(&alloc); future = promise.future(); } // the shared state is ready ASSERT(future.isReady()); - // the shared state contains a 'mwcex::PromiseBroken' exception + // the shared state contains a 'bmqex::PromiseBroken' exception bool exceptionThrown = false; try { future.get(); } - catch (const mwcex::PromiseBroken&) { + catch (const bmqex::PromiseBroken&) { exceptionThrown = true; } @@ -126,21 +126,21 @@ static void test2_promise_cassignment() // Ensure proper behavior of assignment operators. // // Plan: -// Move-assign a 'mwcex::Promise'. Check that the moved-to object refers +// Move-assign a 'bmqex::Promise'. Check that the moved-to object refers // to the shared state of the moved-from object. // // Testing: -// mwcex::Promise's move assignment operator +// bmqex::Promise's move assignment operator // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // create a moved-from promise - mwcex::Promise movedFromPromise(&alloc); + bmqex::Promise movedFromPromise(&alloc); movedFromPromise.setValue(42); // create a moved-to promise - mwcex::Promise movedToPromise(&alloc); + bmqex::Promise movedToPromise(&alloc); movedToPromise = bslmf::MovableRefUtil::move(movedFromPromise); // moved-to promise contains the shared state of the moved-from promise @@ -159,14 +159,14 @@ static void test3_promise_cswap() // Swap two promises and check that their shared state is swapped. // // Testing: -// mwcex::Promise::swap +// bmqex::Promise::swap // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // create promises - mwcex::Promise promise1(&alloc); - mwcex::Promise promise2(&alloc); + bmqex::Promise promise1(&alloc); + bmqex::Promise promise2(&alloc); promise1.setValue(1); promise2.setValue(2); @@ -191,17 +191,17 @@ static void test4_promise_cfuture() // associated shared state. // // Testing: -// mwcex::Promise::future +// bmqex::Promise::future // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // create promises - mwcex::Promise promise(&alloc); + bmqex::Promise promise(&alloc); promise.setValue(42); // obtain a future - mwcex::Future future = promise.future(); + bmqex::Future future = promise.future(); // the future refers to the promise's shared state ASSERT_EQ(future.isValid(), true); @@ -219,10 +219,10 @@ static void test5_promiseBroken_what() // Check that 'what()' returns a "PromiseBroken" string literal. // // Testing: -// mwcex::PromiseBroken::what +// bmqex::PromiseBroken::what // ------------------------------------------------------------------------ { - mwcex::PromiseBroken promiseBroken; + bmqex::PromiseBroken promiseBroken; ASSERT(bsl::strcmp(promiseBroken.what(), "PromiseBroken") == 0); } @@ -233,7 +233,7 @@ static void test5_promiseBroken_what() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_promise_creators(); break; @@ -249,5 +249,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqex/bmqex_promise_cpp03.cpp b/src/groups/bmq/bmqex/bmqex_promise_cpp03.cpp new file mode 100644 index 000000000..8fa6b951d --- /dev/null +++ b/src/groups/bmq/bmqex/bmqex_promise_cpp03.cpp @@ -0,0 +1,34 @@ +// Copyright 2018-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// bmqex_promise_cpp03.cpp -*-C++-*- + +// Automatically generated file. **DO NOT EDIT** + +// Generated on Thu Oct 17 16:05:31 2024 +// Command line: sim_cpp11_features.pl bmqex_promise.cpp + +#define INCLUDED_BMQEX_PROMISE_CPP03 // Disable inclusion +#include // Pro-forma #include + +// Empty file except when compiling bmqex_promise.cpp +#ifdef COMPILING_BMQEX_PROMISE_CPP + +// No C++03 Expansion + +#endif // defined(COMPILING_BMQEX_PROMISE_CPP) + +// SCRIPT-SHA: 60926cad35f1091c31a7d8cc9d33acc38edd25e4891f3e1d41fe7c40fd6e02f5 +// SOURCE-SHA: 8dbfd92723c9bbcf70d3bf432a3cfb80c635ac188627e1aa7d3afa37287fe6ee diff --git a/src/groups/mwc/mwcex/mwcex_promise_cpp03.h b/src/groups/bmq/bmqex/bmqex_promise_cpp03.h similarity index 69% rename from src/groups/mwc/mwcex/mwcex_promise_cpp03.h rename to src/groups/bmq/bmqex/bmqex_promise_cpp03.h index 00b64606d..717804d9f 100644 --- a/src/groups/mwc/mwcex/mwcex_promise_cpp03.h +++ b/src/groups/bmq/bmqex/bmqex_promise_cpp03.h @@ -1,4 +1,4 @@ -// Copyright 2022-2023 Bloomberg Finance L.P. +// Copyright 2018-2023 Bloomberg Finance L.P. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_promise_cpp03.h -*-C++-*- +// bmqex_promise_cpp03.h -*-C++-*- // Automatically generated file. **DO NOT EDIT** -#ifndef INCLUDED_MWCEX_PROMISE_CPP03 -#define INCLUDED_MWCEX_PROMISE_CPP03 +#ifndef INCLUDED_BMQEX_PROMISE_CPP03 +#define INCLUDED_BMQEX_PROMISE_CPP03 -//@PURPOSE: Provide C++03 implementation for mwcex_promise.h +//@PURPOSE: Provide C++03 implementation for bmqex_promise.h // -//@CLASSES: See mwcex_promise.h for list of classes +//@CLASSES: See bmqex_promise.h for list of classes // -//@SEE_ALSO: mwcex_promise +//@SEE_ALSO: bmqex_promise // //@DESCRIPTION: This component is the C++03 translation of a C++11 component, // generated by the 'sim_cpp11_features.pl' program. If the original header @@ -36,33 +36,27 @@ // regions of C++11 code, then this header contains no code and is not // '#include'd in the original header. // -// Generated on Wed Jun 29 04:19:38 2022 -// Command line: sim_cpp11_features.pl mwcex_promise.h +// Generated on Thu Oct 17 16:05:31 2024 +// Command line: sim_cpp11_features.pl bmqex_promise.h -#ifdef COMPILING_MWCEX_PROMISE_H +#ifdef COMPILING_BMQEX_PROMISE_H namespace BloombergLP { -// FORWARD DECLARATION -namespace bslma { -class Allocator; -} - -namespace mwcex { +namespace bmqex { // ============= // class Promise // ============= +/// Provides a mechanism to store a value or an exception that is later +/// acquired asynchronously via a `bmqex::Future` object created by the +/// `bmqex::Promise` object. +/// +/// `R` must meet the requirements of Destructible as specified in the C++ +/// standard. template class Promise { - // Provides a mechanism to store a value or an exception that is later - // acquired asynchronously via a 'mwcex::Future' object created by the - // 'mwcex::Promise' object. - // - // 'R' must meet the requirements of Destructible as specified in the C++ - // standard. - private: // PRIVATE TYPES typedef typename Future::SharedStateType SharedStateType; @@ -82,110 +76,113 @@ class Promise { public: // CREATORS + + /// Create a `Promise` object holding a shared state of type + /// `bmqex::Future::SharedStateType` initialized with the specified + /// `basicAllocator`. explicit Promise(bslma::Allocator* basicAllocator = 0); - // Create a 'Promise' object holding a shared state of type - // 'mwcex::Future::SharedStateType' initialized with the specified - // 'basicAllocator'. + /// Create a `Promise` object holding a shared state of type + /// `bmqex::Future::SharedStateType` initialized with the specified + /// `clockType` and `basicAllocator`. explicit Promise(bsls::SystemClockType::Enum clockType, bslma::Allocator* basicAllocator = 0); - // Create a 'Promise' object holding a shared state of type - // 'mwcex::Future::SharedStateType' initialized with the specified - // 'clockType' and 'basicAllocator'. + /// Create a `Promise` object that refers to and assumes management of + /// the same shared state (if any) as the specified `original` object, + /// and leave `original` having no shared state. Promise(bslmf::MovableRef original) BSLS_KEYWORD_NOEXCEPT; - // Create a 'Promise' object that refers to and assumes management of - // the same shared state (if any) as the specified 'original' object, - // and leave 'original' having no shared state. + /// Destroy this object. If `*this` has a shared state and the shared + /// state is not ready, store a `bmqex::PromiseBroken` exception object + /// into the shared state and make the state ready, then release the + /// underlying shared state. ~Promise(); - // Destroy this object. If '*this' has a shared state and the shared - // state is not ready, store a 'mwcex::PromiseBroken' exception object - // into the shared state and make the state ready, then release the - // underlying shared state. public: // MANIPULATORS + + /// Make this promise refer to and assume management of the same shared + /// state (if any) as the specified `rhs` promise, and leave `rhs` + /// having no shared state. Return `*this`. Promise& operator=(bslmf::MovableRef rhs) BSLS_KEYWORD_NOEXCEPT; - // Make this promise refer to and assume management of the same shared - // state (if any) as the specified 'rhs' promise, and leave 'rhs' - // having no shared state. Return '*this'. + /// Atomically store the specified `value` into the shared state as if + /// by direct-non-list-initializing an object of type `R` with `value` + /// and make the state ready. If a callback is attached to the shared + /// state, invoke, and then destroy it. Effectively calls `setValue` + /// on the underlying shared state. The behavior is undefined if the + /// shared state is ready or if the promise has no shared state. + /// + /// Throws any exception thrown by the selected constructor of `R`, or + /// any exception thrown by the attached callback. If an exception is + /// thrown by `R`s constructor, this function has no effect. If an + /// exception is thrown by the attached callback, the stored value stays + /// initialized and the callback is destroyed. + /// + /// `R` must meet the requirements of CopyConstructible as specified in + /// the C++ standard. void setValue(const R& value); - // Atomically store the specified 'value' into the shared state as if - // by direct-non-list-initializing an object of type 'R' with 'value' - // and make the state ready. If a callback is attached to the shared - // state, invoke, and then destroy it. Effectively calls 'setValue' - // on the underlying shared state. The behavior is undefined if the - // shared state is ready or if the promise has no shared state. - // - // Throws any exception thrown by the selected constructor of 'R', or - // any exception thrown by the attached callback. If an exception is - // thrown by 'R's constructor, this function has no effect. If an - // exception is thrown by the attached callback, the stored value stays - // initialized and the callback is destroyed. - // - // 'R' must meet the requirements of CopyConstructible as specified in - // the C++ standard. + /// Atomically store the specified `value` into the shared state as if + /// by direct-non-list-initializing an object of type `R` with + /// `bsl::move(value)` and make the state ready. If a callback is + /// attached to the shared state, invoke, and then destroy it. + /// Effectively calls `setValue` on the underlying shared state. The + /// behavior is undefined if the shared state is ready or if the promise + /// has no shared state. + /// + /// Throws any exception thrown by the selected constructor of `R`, or + /// any exception thrown by the attached callback. If an exception is + /// thrown by `R`s constructor, this function has no effect. If an + /// exception is thrown by the attached callback, the stored value stays + /// initialized and the callback is destroyed. + /// + /// `R` must meet the requirements of MoveConstructible as specified in + /// the C++ standard. void setValue(bslmf::MovableRef value); - // Atomically store the specified 'value' into the shared state as if - // by direct-non-list-initializing an object of type 'R' with - // 'bsl::move(value)' and make the state ready. If a callback is - // attached to the shared state, invoke, and then destroy it. - // Effectively calls 'setValue' on the underlying shared state. The - // behavior is undefined if the shared state is ready or if the promise - // has no shared state. - // - // Throws any exception thrown by the selected constructor of 'R', or - // any exception thrown by the attached callback. If an exception is - // thrown by 'R's constructor, this function has no effect. If an - // exception is thrown by the attached callback, the stored value stays - // initialized and the callback is destroyed. - // - // 'R' must meet the requirements of MoveConstructible as specified in - // the C++ standard. #if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES // {{{ BEGIN GENERATED CODE -// Command line: sim_cpp11_features.pl mwcex_promise.h -#ifndef MWCEX_PROMISE_VARIADIC_LIMIT -#define MWCEX_PROMISE_VARIADIC_LIMIT 9 +// Command line: sim_cpp11_features.pl bmqex_promise.h +#ifndef BMQEX_PROMISE_VARIADIC_LIMIT +#define BMQEX_PROMISE_VARIADIC_LIMIT 9 #endif -#ifndef MWCEX_PROMISE_VARIADIC_LIMIT_A -#define MWCEX_PROMISE_VARIADIC_LIMIT_A MWCEX_PROMISE_VARIADIC_LIMIT +#ifndef BMQEX_PROMISE_VARIADIC_LIMIT_A +#define BMQEX_PROMISE_VARIADIC_LIMIT_A BMQEX_PROMISE_VARIADIC_LIMIT #endif -#if MWCEX_PROMISE_VARIADIC_LIMIT_A >= 0 + +#if BMQEX_PROMISE_VARIADIC_LIMIT_A >= 0 void emplaceValue(); -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_A >= 0 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_A >= 0 -#if MWCEX_PROMISE_VARIADIC_LIMIT_A >= 1 +#if BMQEX_PROMISE_VARIADIC_LIMIT_A >= 1 template void emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1); -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_A >= 1 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_A >= 1 -#if MWCEX_PROMISE_VARIADIC_LIMIT_A >= 2 +#if BMQEX_PROMISE_VARIADIC_LIMIT_A >= 2 template void emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_2) args_2); -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_A >= 2 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_A >= 2 -#if MWCEX_PROMISE_VARIADIC_LIMIT_A >= 3 +#if BMQEX_PROMISE_VARIADIC_LIMIT_A >= 3 template void emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_2) args_2, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_3) args_3); -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_A >= 3 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_A >= 3 -#if MWCEX_PROMISE_VARIADIC_LIMIT_A >= 4 +#if BMQEX_PROMISE_VARIADIC_LIMIT_A >= 4 template void emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_2) args_2, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_3) args_3, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_4) args_4); -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_A >= 4 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_A >= 4 -#if MWCEX_PROMISE_VARIADIC_LIMIT_A >= 5 +#if BMQEX_PROMISE_VARIADIC_LIMIT_A >= 5 template = 5 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_A >= 5 -#if MWCEX_PROMISE_VARIADIC_LIMIT_A >= 6 +#if BMQEX_PROMISE_VARIADIC_LIMIT_A >= 6 template = 6 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_A >= 6 -#if MWCEX_PROMISE_VARIADIC_LIMIT_A >= 7 +#if BMQEX_PROMISE_VARIADIC_LIMIT_A >= 7 template = 7 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_A >= 7 -#if MWCEX_PROMISE_VARIADIC_LIMIT_A >= 8 +#if BMQEX_PROMISE_VARIADIC_LIMIT_A >= 8 template = 8 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_A >= 8 -#if MWCEX_PROMISE_VARIADIC_LIMIT_A >= 9 +#if BMQEX_PROMISE_VARIADIC_LIMIT_A >= 9 template = 9 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_A >= 9 #else // The generated code below is a workaround for the absence of perfect // forwarding in some compilers. + template void emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... args); // }}} END GENERATED CODE #endif #ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_EXCEPTION_HANDLING + /// Atomically store the specified `exception` pointer into the shared + /// state and make the state ready. If a callback is attached to the + /// shared state, invoke, and then destroy it. Effectively calls + /// `setException` on the underlying shared state. The behavior is + /// undefined if the shared state is ready or if the promise has no + /// shared state. + /// + /// Throws any exception thrown by the attached callback. If an + /// exception is thrown, the stored exception stays initialized and the + /// callback is destroyed. void setException(bsl::exception_ptr exception); - // Atomically store the specified 'exception' pointer into the shared - // state and make the state ready. If a callback is attached to the - // shared state, invoke, and then destroy it. Effectively calls - // 'setException' on the underlying shared state. The behavior is - // undefined if the shared state is ready or if the promise has no - // shared state. - // - // Throws any exception thrown by the attached callback. If an - // exception is thrown, the stored exception stays initialized and the - // callback is destroyed. #endif + /// Atomically store the specified `exception` object into the shared + /// state as if by direct-non-list-initializing an object of type + /// `bsl::decay_t` with `bsl::forward(EXCEPTION)` + /// and make the state ready. If a callback is attached to the shared + /// state, invoke, and then destroy it. Effectively calls + /// `setException` on the underlying shared state. The behavior is + /// undefined if the shared state is ready or if the promise has no + /// shared state. + /// + /// Throws any exception thrown by the selected constructor of + /// `bsl::decay_t`, any exception thrown by the attached + /// callback, or `bsl::bad_alloc` if memory allocation fails. If an + /// exception is thrown by `bsl::decay_t`s constructor or due + /// to memory allocation failure, this function has no effect. If an + /// exception is thrown by the attached callback, the stored exception + /// stays initialized and the callback is destroyed. + /// + /// `bsl::decay_t` must meet the requirements of Destructible + /// and CopyConstructible as specified in the C++ standard. template void setException(BSLS_COMPILERFEATURES_FORWARD_REF(EXCEPTION) exception); - // Atomically store the specified 'exception' object into the shared - // state as if by direct-non-list-initializing an object of type - // 'bsl::decay_t' with 'bsl::forward(EXCEPTION)' - // and make the state ready. If a callback is attached to the shared - // state, invoke, and then destroy it. Effectively calls - // 'setException' on the underlying shared state. The behavior is - // undefined if the shared state is ready or if the promise has no - // shared state. - // - // Throws any exception thrown by the selected constructor of - // 'bsl::decay_t', any exception thrown by the attached - // callback, or 'bsl::bad_alloc' if memory allocation fails. If an - // exception is thrown by 'bsl::decay_t's constructor or due - // to memory allocation failure, this function has no effect. If an - // exception is thrown by the attached callback, the stored exception - // stays initialized and the callback is destroyed. - // - // 'bsl::decay_t' must meet the requirements of Destructible - // and CopyConstructible as specified in the C++ standard. + /// Swap the contents of `*this` and `other`. void swap(Promise& other) BSLS_KEYWORD_NOEXCEPT; - // Swap the contents of '*this' and 'other'. public: // ACCESSORS + + /// Return a future associated with the shared state owned by `*this`. + /// The behavior is undefined unless the promise has a shared state. Future future() const BSLS_KEYWORD_NOEXCEPT; - // Return a future associated with the shared state owned by '*this'. - // The behavior is undefined unless the promise has a shared state. public: // TRAITS @@ -333,10 +332,9 @@ class Promise { // class Promise // =================== +/// Provides a specialization of `Promise` for `void` result type. template <> class Promise : private Promise { - // Provides a specialization of 'Promise' for 'void' result type. - private: // PRIVATE TYPES typedef Promise Impl; @@ -348,51 +346,51 @@ class Promise : private Promise { public: // CREATORS + + /// Same as for the non-specialized class template. explicit Promise(bslma::Allocator* basicAllocator = 0); - // Same as for the non-specialized class template. + /// Same as for the non-specialized class template. explicit Promise(bsls::SystemClockType::Enum clockType, bslma::Allocator* basicAllocator = 0); - // Same as for the non-specialized class template. + /// Same as for the non-specialized class template. Promise(bslmf::MovableRef original) BSLS_KEYWORD_NOEXCEPT; - // Same as for the non-specialized class template. - - //! ~Promise(); - // Same as for the non-specialized class template. public: // MANIPULATORS + + /// Same as for the non-specialized class template. Promise& operator=(bslmf::MovableRef rhs) BSLS_KEYWORD_NOEXCEPT; - // Same as for the non-specialized class template. + /// Atomically make the shared state ready. If a callback is attached to + /// the shared state, invoke, and then destroy it. Effectively calls + /// `setValue` on the underlying shared state. The behavior is + /// undefined if the shared state is ready or if the promise has no + /// shared state. + /// + /// Throws any exception thrown by the attached callback. If an + /// exception is thrown, the stored value stays initialized and the + /// callback is destroyed. void setValue(); - // Atomically make the shared state ready. If a callback is attached to - // the shared state, invoke, and then destroy it. Effectively calls - // 'setValue' on the underlying shared state. The behavior is - // undefined if the shared state is ready or if the promise has no - // shared state. - // - // Throws any exception thrown by the attached callback. If an - // exception is thrown, the stored value stays initialized and the - // callback is destroyed. #ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_EXCEPTION_HANDLING + /// Same as for the non-specialized class template. void setException(bsl::exception_ptr exception); - // Same as for the non-specialized class template. #endif + /// Same as for the non-specialized class template. template void setException(BSLS_COMPILERFEATURES_FORWARD_REF(EXCEPTION) exception); - // Same as for the non-specialized class template. + /// Same as for the non-specialized class template. void swap(Promise& other) BSLS_KEYWORD_NOEXCEPT; - // Same as for the non-specialized class template. public: // ACCESSORS + + /// Same as for the non-specialized class template. Future future() const BSLS_KEYWORD_NOEXCEPT; - // Same as for the non-specialized class template. public: // TRAITS @@ -404,10 +402,9 @@ class Promise : private Promise { // class Promise // ================= +/// Provides a specialization of `Promise` for reference result types. template class Promise : private Promise > { - // Provides a specialization of 'Promise' for reference result types. - private: // PRIVATE TYPES typedef Promise > Impl; @@ -419,52 +416,52 @@ class Promise : private Promise > { public: // CREATORS + + /// Same as for the non-specialized class template. explicit Promise(bslma::Allocator* basicAllocator = 0); - // Same as for the non-specialized class template. + /// Same as for the non-specialized class template. explicit Promise(bsls::SystemClockType::Enum clockType, bslma::Allocator* basicAllocator = 0); - // Same as for the non-specialized class template. + /// Same as for the non-specialized class template. Promise(bslmf::MovableRef original) BSLS_KEYWORD_NOEXCEPT; - // Same as for the non-specialized class template. - - //! ~Promise(); - // Same as for the non-specialized class template. public: // MANIPULATORS + + /// Same as for the non-specialized class template. Promise& operator=(bslmf::MovableRef rhs) BSLS_KEYWORD_NOEXCEPT; - // Same as for the non-specialized class template. + /// Atomically store the specified `value` reference into the shared + /// state and make the state ready. If a callback is attached to the + /// shared state, invoke, and then destroy it. Effectively calls + /// `setValue` on the underlying shared state. The behavior is + /// undefined if the shared state is ready or if the promise has no + /// shared state. + /// + /// Throws any exception thrown by the attached callback. If an + /// exception is thrown, the stored reference stays initialized and the + /// callback is destroyed. void setValue(R& value); - // Atomically store the specified 'value' reference into the shared - // state and make the state ready. If a callback is attached to the - // shared state, invoke, and then destroy it. Effectively calls - // 'setValue' on the underlying shared state. The behavior is - // undefined if the shared state is ready or if the promise has no - // shared state. - // - // Throws any exception thrown by the attached callback. If an - // exception is thrown, the stored reference stays initialized and the - // callback is destroyed. #ifdef BSLS_LIBRARYFEATURES_HAS_CPP11_EXCEPTION_HANDLING + /// Same as for the non-specialized class template. void setException(bsl::exception_ptr exception); - // Same as for the non-specialized class template. #endif + /// Same as for the non-specialized class template. template void setException(BSLS_COMPILERFEATURES_FORWARD_REF(EXCEPTION) exception); - // Same as for the non-specialized class template. + /// Same as for the non-specialized class template. void swap(Promise& other) BSLS_KEYWORD_NOEXCEPT; - // Same as for the non-specialized class template. public: // ACCESSORS + + /// Same as for the non-specialized class template. Future future() const BSLS_KEYWORD_NOEXCEPT; - // Same as for the non-specialized class template. public: // TRAITS @@ -476,25 +473,27 @@ class Promise : private Promise > { // class PromiseBroken // =================== +/// Provide an exception class to indicate a promise was broken. class PromiseBroken : public bsl::exception { - // Provide an exception class to indicate a promise was broken. - public: // CREATORS + + /// Create a `PromiseBroken` object. PromiseBroken() BSLS_KEYWORD_NOEXCEPT; - // Create a 'PromiseBroken' object. public: // ACCESSORS + + /// Return a pointer to the string literal "PromiseBroken", with a + /// storage duration of the lifetime of the program. const char* what() const BSLS_EXCEPTION_WHAT_NOTHROW BSLS_KEYWORD_OVERRIDE; - // Return a pointer to the string literal "PromiseBroken", with a - // storage duration of the lifetime of the program. }; // FREE OPERATORS + +/// Swap the contents of `lhs` and `rhs`. template void swap(Promise& lhs, Promise& rhs) BSLS_KEYWORD_NOEXCEPT; -// Swap the contents of 'lhs' and 'rhs'. // ============================================================================ // INLINE DEFINITIONS @@ -569,14 +568,14 @@ inline void Promise::setValue(bslmf::MovableRef value) #if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES // {{{ BEGIN GENERATED CODE -// Command line: sim_cpp11_features.pl mwcex_promise.h -#ifndef MWCEX_PROMISE_VARIADIC_LIMIT -#define MWCEX_PROMISE_VARIADIC_LIMIT 9 +// Command line: sim_cpp11_features.pl bmqex_promise.h +#ifndef BMQEX_PROMISE_VARIADIC_LIMIT +#define BMQEX_PROMISE_VARIADIC_LIMIT 9 #endif -#ifndef MWCEX_PROMISE_VARIADIC_LIMIT_B -#define MWCEX_PROMISE_VARIADIC_LIMIT_B MWCEX_PROMISE_VARIADIC_LIMIT +#ifndef BMQEX_PROMISE_VARIADIC_LIMIT_B +#define BMQEX_PROMISE_VARIADIC_LIMIT_B BMQEX_PROMISE_VARIADIC_LIMIT #endif -#if MWCEX_PROMISE_VARIADIC_LIMIT_B >= 0 +#if BMQEX_PROMISE_VARIADIC_LIMIT_B >= 0 template inline void Promise::emplaceValue() { @@ -584,9 +583,9 @@ inline void Promise::emplaceValue() d_sharedState->emplaceValue(); } -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_B >= 0 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_B >= 0 -#if MWCEX_PROMISE_VARIADIC_LIMIT_B >= 1 +#if BMQEX_PROMISE_VARIADIC_LIMIT_B >= 1 template template inline void Promise::emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) @@ -596,9 +595,9 @@ inline void Promise::emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) d_sharedState->emplaceValue(bslmf::Util::forward(args_1)); } -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_B >= 1 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_B >= 1 -#if MWCEX_PROMISE_VARIADIC_LIMIT_B >= 2 +#if BMQEX_PROMISE_VARIADIC_LIMIT_B >= 2 template template inline void @@ -610,9 +609,9 @@ Promise::emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, d_sharedState->emplaceValue(bslmf::Util::forward(args_1), bslmf::Util::forward(args_2)); } -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_B >= 2 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_B >= 2 -#if MWCEX_PROMISE_VARIADIC_LIMIT_B >= 3 +#if BMQEX_PROMISE_VARIADIC_LIMIT_B >= 3 template template inline void @@ -626,9 +625,9 @@ Promise::emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, bslmf::Util::forward(args_2), bslmf::Util::forward(args_3)); } -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_B >= 3 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_B >= 3 -#if MWCEX_PROMISE_VARIADIC_LIMIT_B >= 4 +#if BMQEX_PROMISE_VARIADIC_LIMIT_B >= 4 template template inline void @@ -644,9 +643,9 @@ Promise::emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, bslmf::Util::forward(args_3), bslmf::Util::forward(args_4)); } -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_B >= 4 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_B >= 4 -#if MWCEX_PROMISE_VARIADIC_LIMIT_B >= 5 +#if BMQEX_PROMISE_VARIADIC_LIMIT_B >= 5 template template inline void @@ -664,9 +663,9 @@ Promise::emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, bslmf::Util::forward(args_4), bslmf::Util::forward(args_5)); } -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_B >= 5 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_B >= 5 -#if MWCEX_PROMISE_VARIADIC_LIMIT_B >= 6 +#if BMQEX_PROMISE_VARIADIC_LIMIT_B >= 6 template template ::emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, bslmf::Util::forward(args_5), bslmf::Util::forward(args_6)); } -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_B >= 6 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_B >= 6 -#if MWCEX_PROMISE_VARIADIC_LIMIT_B >= 7 +#if BMQEX_PROMISE_VARIADIC_LIMIT_B >= 7 template template ::emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, bslmf::Util::forward(args_6), bslmf::Util::forward(args_7)); } -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_B >= 7 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_B >= 7 -#if MWCEX_PROMISE_VARIADIC_LIMIT_B >= 8 +#if BMQEX_PROMISE_VARIADIC_LIMIT_B >= 8 template template ::emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, bslmf::Util::forward(args_7), bslmf::Util::forward(args_8)); } -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_B >= 8 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_B >= 8 -#if MWCEX_PROMISE_VARIADIC_LIMIT_B >= 9 +#if BMQEX_PROMISE_VARIADIC_LIMIT_B >= 9 template template ::emplaceValue(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, bslmf::Util::forward(args_8), bslmf::Util::forward(args_9)); } -#endif // MWCEX_PROMISE_VARIADIC_LIMIT_B >= 9 +#endif // BMQEX_PROMISE_VARIADIC_LIMIT_B >= 9 #else // The generated code below is a workaround for the absence of perfect @@ -998,31 +997,18 @@ inline Future Promise::future() const BSLS_KEYWORD_NOEXCEPT // FREE OPERATORS template -inline void mwcex::swap(Promise& lhs, Promise& rhs) BSLS_KEYWORD_NOEXCEPT +inline void bmqex::swap(Promise& lhs, Promise& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); } } // close enterprise namespace -#else // if ! defined(DEFINED_MWCEX_PROMISE_H) -#error Not valid except when included from mwcex_promise.h -#endif // ! defined(COMPILING_MWCEX_PROMISE_H) +#else // if ! defined(DEFINED_BMQEX_PROMISE_H) +#error Not valid except when included from bmqex_promise.h +#endif // ! defined(COMPILING_BMQEX_PROMISE_H) -#endif // ! defined(INCLUDED_MWCEX_PROMISE_CPP03) +#endif // ! defined(INCLUDED_BMQEX_PROMISE_CPP03) -// ---------------------------------------------------------------------------- -// Copyright 2022-2023 Bloomberg Finance L.P. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ----------------------------- END-OF-FILE ---------------------------------- +// SCRIPT-SHA: 60926cad35f1091c31a7d8cc9d33acc38edd25e4891f3e1d41fe7c40fd6e02f5 +// SOURCE-SHA: 034094ceed9ec6bf34ec4437870a945b9af3dca32ab1d636c2d94e31681e2f94 diff --git a/src/groups/mwc/mwcex/mwcex_sequentialcontext.cpp b/src/groups/bmq/bmqex/bmqex_sequentialcontext.cpp similarity index 96% rename from src/groups/mwc/mwcex/mwcex_sequentialcontext.cpp rename to src/groups/bmq/bmqex/bmqex_sequentialcontext.cpp index e2c11daa7..2e09d0ecc 100644 --- a/src/groups/mwc/mwcex/mwcex_sequentialcontext.cpp +++ b/src/groups/bmq/bmqex/bmqex_sequentialcontext.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_sequentialcontext.cpp -*-C++-*- -#include +// bmqex_sequentialcontext.cpp -*-C++-*- +#include -#include -// MWC -#include +#include + +#include // BDE #include @@ -27,7 +27,7 @@ #include namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ----------------------------------- // struct SequentialContext_ThreadUtil @@ -109,7 +109,7 @@ SequentialContext::~SequentialContext() // MANIPULATORS int SequentialContext::start() { - return start(mwcsys::ThreadUtil::defaultAttributes()); + return start(bmqsys::ThreadUtil::defaultAttributes()); } int SequentialContext::start(const bslmt::ThreadAttributes& threadAttributes) diff --git a/src/groups/mwc/mwcex/mwcex_sequentialcontext.h b/src/groups/bmq/bmqex/bmqex_sequentialcontext.h similarity index 93% rename from src/groups/mwc/mwcex/mwcex_sequentialcontext.h rename to src/groups/bmq/bmqex/bmqex_sequentialcontext.h index 9a00dc514..0f8c68f3c 100644 --- a/src/groups/mwc/mwcex/mwcex_sequentialcontext.h +++ b/src/groups/bmq/bmqex/bmqex_sequentialcontext.h @@ -13,39 +13,39 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_sequentialcontext.h -*-C++-*- -#ifndef INCLUDED_MWCEX_SEQUENTIALCONTEXT -#define INCLUDED_MWCEX_SEQUENTIALCONTEXT +// bmqex_sequentialcontext.h -*-C++-*- +#ifndef INCLUDED_BMQEX_SEQUENTIALCONTEXT +#define INCLUDED_BMQEX_SEQUENTIALCONTEXT //@PURPOSE: Provides a single-threaded execution context. // //@CLASSES: -// mwcex::SequentialContext: a single-threaded execution context -// mwcex::SequentialContextExecutor: an executor to submit work to the context +// bmqex::SequentialContext: a single-threaded execution context +// bmqex::SequentialContextExecutor: an executor to submit work to the context // //@SEE ALSO: -// mwcex_strand +// bmqex_strand // //@DESCRIPTION: // This component provides an execution context that provides guarantees // of ordering and non-concurrency. Submitted function objects are executed in // the context of a single thread of execution owned by the execution context. // -/// Comparison to mwcex::Strand +/// Comparison to bmqex::Strand ///--------------------------- -// While 'mwcex::Strand' is an execution context adapter created on top of an -// existing execution context, 'mwcex::SequentianContext' does not require an +// While 'bmqex::Strand' is an execution context adapter created on top of an +// existing execution context, 'bmqex::SequentianContext' does not require an // underlying context to work. Otherwise, they are very similar in their // purpose and functions. // /// Thread safety ///------------- -// 'mwcex::SequentialContext' is fully thread-safe, meaning that multiple +// 'bmqex::SequentialContext' is fully thread-safe, meaning that multiple // threads may use their own instances of the class or use a shared instance // without further synchronization. // // With the exception of assignment operators, as well as the 'swap' member -// function, 'mwcex::SequentialContextExecutor' is fully thread-safe, meaning +// function, 'bmqex::SequentialContextExecutor' is fully thread-safe, meaning // that multiple threads may use their own instances of the class or use a // shared instance without further synchronization. // @@ -53,13 +53,13 @@ ///----- // Create an execution context, start it: //.. -// mwcex::SequentialContext context; +// bmqex::SequentialContext context; // int rc = context.start(); // BSLS_ASSERT(rc == 0); //.. // Obtain an executor object: //.. -// mwcex::SequentialContext::ExecutorType executor = context.executor(); +// bmqex::SequentialContext::ExecutorType executor = context.executor(); //.. // To execute a function object, call 'post' on the executor: //.. @@ -79,9 +79,7 @@ // context.join(); //.. -// MWC - -#include +#include // BDE #include @@ -108,7 +106,7 @@ namespace bslmt { class ThreadAttributes; } -namespace mwcex { +namespace bmqex { class SequentialContextExecutor; @@ -204,7 +202,7 @@ class SequentialContext { /// function objects on this execution context. Optionally specify a /// `threadAttributes` used to configure the thread. If /// `threadAttributes` is not provided, use the value of - /// `mwcsys::ThreadUtil::defaultAttributes()`. Return 0 on success, and + /// `bmqsys::ThreadUtil::defaultAttributes()`. Return 0 on success, and /// a non-zero value otherwise. On failure this function has no effect. /// The behavior is undefined unless 'threadAttributes.detachedState() /// == bslmt::ThreadAttributes::e_CREATE_JOINABLE)', or if the working @@ -402,20 +400,20 @@ SequentialContextExecutor::dispatch(BSLS_COMPILERFEATURES_FORWARD_REF(FUNCTION) // FREE OPERATORS inline bool -mwcex::operator==(const SequentialContextExecutor& lhs, +bmqex::operator==(const SequentialContextExecutor& lhs, const SequentialContextExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { return &lhs.context() == &rhs.context(); } inline bool -mwcex::operator!=(const SequentialContextExecutor& lhs, +bmqex::operator!=(const SequentialContextExecutor& lhs, const SequentialContextExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { return !(lhs == rhs); } -inline void mwcex::swap(SequentialContextExecutor& lhs, +inline void bmqex::swap(SequentialContextExecutor& lhs, SequentialContextExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); diff --git a/src/groups/mwc/mwcex/mwcex_sequentialcontext.t.cpp b/src/groups/bmq/bmqex/bmqex_sequentialcontext.t.cpp similarity index 92% rename from src/groups/mwc/mwcex/mwcex_sequentialcontext.t.cpp rename to src/groups/bmq/bmqex/bmqex_sequentialcontext.t.cpp index ba0eeaeac..c2a03c357 100644 --- a/src/groups/mwc/mwcex/mwcex_sequentialcontext.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_sequentialcontext.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_sequentialcontext.t.cpp -*-C++-*- -#include +// bmqex_sequentialcontext.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -208,18 +208,18 @@ static void test1_context_creators() // Ensure proper behavior of creator methods. // // Plan: -// Default-construct an instance of 'mwcex::SequentialContext'. Check +// Default-construct an instance of 'bmqex::SequentialContext'. Check // postconditions. Destroy the object and check that no memory is leaked. // // Testing: -// mwcex::SequentialContext's constructor -// mwcex::SequentialContext's destructor +// bmqex::SequentialContext's constructor +// bmqex::SequentialContext's destructor // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // create context - mwcex::SequentialContext ctx(&alloc); + bmqex::SequentialContext ctx(&alloc); // check postconditions ASSERT_EQ(ctx.outstandingJobs(), static_cast(0)); @@ -241,7 +241,7 @@ static void test2_context_start() // objects. // // Testing: -// mwcex::SequentialContext::start +// bmqex::SequentialContext::start // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -254,7 +254,7 @@ static void test2_context_start() continueSignal; // signaled to allow job to complete // create context - mwcex::SequentialContext ctx(&alloc); + bmqex::SequentialContext ctx(&alloc); // submit jobs for (int i = 0; i < NUM_JOBS; ++i) { @@ -291,7 +291,7 @@ static void test3_context_stop() // without executing function object #2. // // Testing: -// mwcex::SequentialContext::stop +// bmqex::SequentialContext::stop // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -309,7 +309,7 @@ static void test3_context_stop() BSLS_ASSERT_OPT(rc == 0); // create context - mwcex::SequentialContext ctx(&alloc); + bmqex::SequentialContext ctx(&alloc); // submit a function object that attaches the thread-exit handler to the // current thread @@ -363,7 +363,7 @@ static void test4_context_join() // - after 'join' completes the context working thread stops. // // Testing: -// mwcex::SequentialContext::join +// bmqex::SequentialContext::join // ------------------------------------------------------------------------ { static const int NUM_JOBS = 100; @@ -380,7 +380,7 @@ static void test4_context_join() BSLS_ASSERT_OPT(rc == 0); // create context - mwcex::SequentialContext ctx(&alloc); + bmqex::SequentialContext ctx(&alloc); // submit a function object that attaches the thread-exit handler to the // current thread @@ -423,13 +423,13 @@ static void test5_context_dropPendingJobs() // that all jobs but the executing one are removed. // // Testing: -// mwcex::SequentialContext::dropPendingJobs +// bmqex::SequentialContext::dropPendingJobs // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // create context - mwcex::SequentialContext ctx(&alloc); + bmqex::SequentialContext ctx(&alloc); // 1. drop jobs while no job is executing { @@ -484,13 +484,13 @@ static void test6_context_outstandingJobs() // Plan: // Check that 'outstandingJobs' returns a value that is the sum of: // - The number of function objects that have been added to the -// 'mwcex::SequentialContext' via the 'mwcex::SequentialContext's +// 'bmqex::SequentialContext' via the 'bmqex::SequentialContext's // executor, but not yet invoked; // - The number of function objects that are currently being invoked -// within the 'mwcex::SequentialContext'. +// within the 'bmqex::SequentialContext'. // // Testing: -// mwcex::SequentialContext::outstandingJobs +// bmqex::SequentialContext::outstandingJobs // ------------------------------------------------------------------------ { static const int NUM_JOBS = 10; @@ -501,7 +501,7 @@ static void test6_context_outstandingJobs() continueSignal; // signaled to allow the job to finish // create context - mwcex::SequentialContext ctx(&alloc); + bmqex::SequentialContext ctx(&alloc); // outstanding jobs is 0 ASSERT_EQ(ctx.outstandingJobs(), static_cast(0)); @@ -569,7 +569,7 @@ static void test7_executor_post() // submitted. // // Testing: -// mwcex::SequentialContextExecutor::post +// bmqex::SequentialContextExecutor::post // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -581,7 +581,7 @@ static void test7_executor_post() bsl::vector out(&alloc); // create context - mwcex::SequentialContext ctx(&alloc); + bmqex::SequentialContext ctx(&alloc); // submit function objects for (int i = 0; i < NUM_JOBS; ++i) { @@ -610,7 +610,7 @@ static void test7_executor_post() bsl::vector out(&alloc); // create context - mwcex::SequentialContext ctx(&alloc); + bmqex::SequentialContext ctx(&alloc); // submit function objects for (int i = 0; i < NUM_JOBS; ++i) { @@ -640,7 +640,7 @@ static void test7_executor_post() // 3. exception safety { - mwcex::SequentialContext ctx(&alloc); + bmqex::SequentialContext ctx(&alloc); // sumbit function objects #1 and #2 ctx.executor().post(NoOp()); @@ -698,7 +698,7 @@ static void test8_executor_dispatch() // in-place. // // Testing: -// mwcex::SequentialContextExecutor::dispatch +// bmqex::SequentialContextExecutor::dispatch // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -710,7 +710,7 @@ static void test8_executor_dispatch() bsl::vector out(&alloc); // create context - mwcex::SequentialContext ctx(&alloc); + bmqex::SequentialContext ctx(&alloc); // submit function objects for (int i = 0; i < NUM_JOBS; ++i) { @@ -741,7 +741,7 @@ static void test8_executor_dispatch() continueSignal; // signaled to allow job to finish // create context - mwcex::SequentialContext ctx(&alloc); + bmqex::SequentialContext ctx(&alloc); // submit function objects for (int i = 0; i < NUM_JOBS; ++i) { @@ -793,14 +793,14 @@ static void test9_executor_swap() // check that 'ex1' now refers to 'ctx2' and 'ex2' now refers to 'ctx1'. // // Testing: -// mwcex::SequentialContextExecutor::swap +// bmqex::SequentialContextExecutor::swap // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; - mwcex::SequentialContext ctx1(&alloc), ctx2(&alloc); + bmqex::SequentialContext ctx1(&alloc), ctx2(&alloc); - mwcex::SequentialContextExecutor ex1 = ctx1.executor(); - mwcex::SequentialContextExecutor ex2 = ctx2.executor(); + bmqex::SequentialContextExecutor ex1 = ctx1.executor(); + bmqex::SequentialContextExecutor ex2 = ctx2.executor(); // swap ex1.swap(ex2); @@ -823,10 +823,10 @@ static void test10_executor_runningInThisThread() // context, and 'false otherwise. // // Testing: -// mwcex::SequentialContextExecutor::runningInThisThread +// bmqex::SequentialContextExecutor::runningInThisThread // ------------------------------------------------------------------------ { - typedef mwcex::SequentialContextExecutor ExecutorType; + typedef bmqex::SequentialContextExecutor ExecutorType; bslma::TestAllocator alloc; @@ -834,7 +834,7 @@ static void test10_executor_runningInThisThread() bool result = false; // create context - mwcex::SequentialContext ctx(&alloc); + bmqex::SequentialContext ctx(&alloc); // obtain executor ExecutorType ex = ctx.executor(); @@ -866,19 +866,19 @@ static void test11_executor_context() // // Plan: // Check that 'context()' returns a reference to the executor's -// associated 'mwcex::SequentialContext' object. +// associated 'bmqex::SequentialContext' object. // // Testing: -// mwcex::SequentialContextExecutor::context +// bmqex::SequentialContextExecutor::context // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; - mwcex::SequentialContext ctx1(&alloc), ctx2(&alloc); + bmqex::SequentialContext ctx1(&alloc), ctx2(&alloc); - mwcex::SequentialContextExecutor ex1 = ctx1.executor(); + bmqex::SequentialContextExecutor ex1 = ctx1.executor(); ASSERT_EQ(&ex1.context(), &ctx1); - mwcex::SequentialContextExecutor ex2 = ctx2.executor(); + bmqex::SequentialContextExecutor ex2 = ctx2.executor(); ASSERT_EQ(&ex2.context(), &ctx2); } @@ -888,10 +888,10 @@ static void test11_executor_context() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { - // mwcex::SequentialContext + // bmqex::SequentialContext case 1: test1_context_creators(); break; case 2: test2_context_start(); break; case 3: test3_context_stop(); break; @@ -899,7 +899,7 @@ int main(int argc, char* argv[]) case 5: test5_context_dropPendingJobs(); break; case 6: test6_context_outstandingJobs(); break; - // mwcex::SequentialContextExecutor + // bmqex::SequentialContextExecutor case 7: test7_executor_post(); break; case 8: test8_executor_dispatch(); break; case 9: test9_executor_swap(); break; @@ -913,5 +913,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/mwcex_strand.cpp b/src/groups/bmq/bmqex/bmqex_strand.cpp similarity index 88% rename from src/groups/mwc/mwcex/mwcex_strand.cpp rename to src/groups/bmq/bmqex/bmqex_strand.cpp index 5ba190799..6560e29a4 100644 --- a/src/groups/mwc/mwcex/mwcex_strand.cpp +++ b/src/groups/bmq/bmqex/bmqex_strand.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_strand.cpp -*-C++-*- -#include +// bmqex_strand.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcex { +namespace bmqex { // ------------------------ // struct Strand_ThreadUtil diff --git a/src/groups/mwc/mwcex/mwcex_strand.h b/src/groups/bmq/bmqex/bmqex_strand.h similarity index 96% rename from src/groups/mwc/mwcex/mwcex_strand.h rename to src/groups/bmq/bmqex/bmqex_strand.h index 81ddff319..c4356031a 100644 --- a/src/groups/mwc/mwcex/mwcex_strand.h +++ b/src/groups/bmq/bmqex/bmqex_strand.h @@ -13,29 +13,29 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_strand.h -*-C++-*- -#ifndef INCLUDED_MWCEX_STRAND -#define INCLUDED_MWCEX_STRAND +// bmqex_strand.h -*-C++-*- +#ifndef INCLUDED_BMQEX_STRAND +#define INCLUDED_BMQEX_STRAND //@PURPOSE: Provides a strand execution context. // //@CLASSES: -// mwcex::Strand: a strand execution context -// mwcex::StrandExecutor: an executor to submit work to the strand +// bmqex::Strand: a strand execution context +// bmqex::StrandExecutor: an executor to submit work to the strand // //@DESCRIPTION: -// This component provides a mechanism, 'mwcex::Strand', that is an execution +// This component provides a mechanism, 'bmqex::Strand', that is an execution // context (see package documentation) that provides guarantees of ordering and // non-concurrency. // /// Thread safety ///------------- -// 'mwcex::Strand' is fully thread-safe, meaning that multiple threads may use +// 'bmqex::Strand' is fully thread-safe, meaning that multiple threads may use // their own instances of the class or use a shared instance without further // synchronization. // // With the exception of assignment operators, as well as the 'swap' member -// function, 'mwcex::StrandExecutor' is fully thread-safe, meaning that +// function, 'bmqex::StrandExecutor' is fully thread-safe, meaning that // multiple threads may use their own instances of the class or use a shared // instance without further synchronization. // @@ -47,10 +47,10 @@ // top of that executor: //.. // // create a strand -// mwcex::Strand strand(ex); +// bmqex::Strand strand(ex); // // // obtain an executor -// mwcex::Strand::ExecutorType strandEx = strand.executor(); +// bmqex::Strand::ExecutorType strandEx = strand.executor(); // // // start the strand // strand.start(); @@ -66,10 +66,8 @@ // // the output is always "123" //.. -// MWC - -#include -#include +#include +#include // BDE #include @@ -94,7 +92,7 @@ namespace BloombergLP { -namespace mwcex { +namespace bmqex { template class StrandExecutor; @@ -622,7 +620,7 @@ StrandExecutor::context() const BSLS_KEYWORD_NOEXCEPT // FREE OPERATORS template inline bool -mwcex::operator==(const StrandExecutor& lhs, +bmqex::operator==(const StrandExecutor& lhs, const StrandExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { return &lhs.context() == &rhs.context(); @@ -630,14 +628,14 @@ mwcex::operator==(const StrandExecutor& lhs, template inline bool -mwcex::operator!=(const StrandExecutor& lhs, +bmqex::operator!=(const StrandExecutor& lhs, const StrandExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { return !(lhs == rhs); } template -inline void mwcex::swap(StrandExecutor& lhs, +inline void bmqex::swap(StrandExecutor& lhs, StrandExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); diff --git a/src/groups/mwc/mwcex/mwcex_strand.t.cpp b/src/groups/bmq/bmqex/bmqex_strand.t.cpp similarity index 95% rename from src/groups/mwc/mwcex/mwcex_strand.t.cpp rename to src/groups/bmq/bmqex/bmqex_strand.t.cpp index d45f9c382..196040e77 100644 --- a/src/groups/mwc/mwcex/mwcex_strand.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_strand.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_strand.t.cpp -*-C++-*- -#include +// bmqex_strand.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -391,11 +391,11 @@ static void test1_strand_creators() // Ensure proper behavior of creator methods. // // Plan: -// 1. Default-construct an instance of 'mwcex::Strand'. Check +// 1. Default-construct an instance of 'bmqex::Strand'. Check // postconditions. Destroy the object and check that no memory // is leaked. // -// 2. Executor-construct an instance of 'mwcex::Strand'. Check +// 2. Executor-construct an instance of 'bmqex::Strand'. Check // postconditions. Destroy the object and check that no memory // is leaked. // @@ -403,11 +403,11 @@ static void test1_strand_creators() // objects. Destroy the strand. Check that no memory is leaked. // // Testing: -// mwcex::Strand's constructor -// mwcex::Strand's destructor +// bmqex::Strand's constructor +// bmqex::Strand's destructor // ------------------------------------------------------------------------ { - typedef mwcex::Strand Strand; + typedef bmqex::Strand Strand; // compiler hapiness { @@ -462,7 +462,7 @@ static void test1_strand_creators() // IdentifiableExecutor { - mwcex::Strand strand(&alloc); + bmqex::Strand strand(&alloc); ASSERT_OPT_FAIL(strand.innerExecutor().post(NoOp())); ASSERT_OPT_FAIL(strand.innerExecutor().dispatch(NoOp())); ASSERT(strand.innerExecutor() == strand.innerExecutor()); @@ -471,7 +471,7 @@ static void test1_strand_creators() { // ExecutorType TestExecutionContext ctx(1, &alloc); - mwcex::Strand strand( + bmqex::Strand strand( ctx.executor(), &alloc); strand.innerExecutor().dispatch(NoOp()); @@ -492,10 +492,10 @@ static void test2_strand_start() // objects. // // Testing: -// mwcex::Strand::start +// bmqex::Strand::start // ------------------------------------------------------------------------ { - typedef mwcex::Strand Strand; + typedef bmqex::Strand Strand; static const int k_NUM_THREADS = 1; static const int k_NUM_JOBS = 10; @@ -542,10 +542,10 @@ static void test3_strand_stop() // - function object #2 is not invoked. // // Testing: -// mwcex::Strand::stop +// bmqex::Strand::stop // ------------------------------------------------------------------------ { - typedef mwcex::Strand Strand; + typedef bmqex::Strand Strand; static const int k_NUM_THREADS = 4; @@ -601,10 +601,10 @@ static void test4_strand_join() // of all submitted function objects. // // Testing: -// mwcex::Strand::join +// bmqex::Strand::join // ------------------------------------------------------------------------ { - typedef mwcex::Strand Strand; + typedef bmqex::Strand Strand; static const int k_NUM_THREADS = 4; static const int k_NUM_JOBS = 100; @@ -644,10 +644,10 @@ static void test5_strand_dropPendingJobs() // that all jobs but the executing one are removed from the strand. // // Testing: -// mwcex::Strand::dropPendingJobs +// bmqex::Strand::dropPendingJobs // ------------------------------------------------------------------------ { - typedef mwcex::Strand Strand; + typedef bmqex::Strand Strand; static const int k_NUM_THREADS = 1; @@ -710,16 +710,16 @@ static void test6_strand_outstandingJobs() // Plan: // Check that 'outstandingJobs' returns a value that is the sum of: // - The number of function objects that have been added to the -// 'mwcex::Strand' via the 'mwcex::Strand's executor, but not yet +// 'bmqex::Strand' via the 'bmqex::Strand's executor, but not yet // invoked; // - The number of function objects that are currently being invoked -// within the 'mwcex::Strand'. +// within the 'bmqex::Strand'. // // Testing: -// mwcex::Strand::outstandingJobs +// bmqex::Strand::outstandingJobs // ------------------------------------------------------------------------ { - typedef mwcex::Strand Strand; + typedef bmqex::Strand Strand; static const int k_NUM_THREADS = 4; static const int k_NUM_JOBS = 10; @@ -805,10 +805,10 @@ static void test7_executor_post() // submitted. // // Testing: -// mwcex::StrandExecutor::post +// bmqex::StrandExecutor::post // ------------------------------------------------------------------------ { - typedef mwcex::Strand Strand; + typedef bmqex::Strand Strand; bslma::TestAllocator alloc; @@ -923,7 +923,7 @@ static void test7_executor_post() // 4. exception safety { // create a strand with a throwing executor - mwcex::Strand strand(ThrowingExecutor(), &alloc); + bmqex::Strand strand(ThrowingExecutor(), &alloc); // start the strand strand.start(); @@ -976,10 +976,10 @@ static void test8_executor_dispatch() // in-place. // // Testing: -// mwcex::StrandExecutor::dispatch +// bmqex::StrandExecutor::dispatch // ------------------------------------------------------------------------ { - typedef mwcex::Strand Strand; + typedef bmqex::Strand Strand; bslma::TestAllocator alloc; @@ -1080,10 +1080,10 @@ static void test9_executor_swap() // now refers to 'strand1'. // // Testing: -// mwcex::StrandExecutor::swap +// bmqex::StrandExecutor::swap // ------------------------------------------------------------------------ { - typedef mwcex::Strand Strand; + typedef bmqex::Strand Strand; bslma::TestAllocator alloc; Strand strand1(&alloc), strand2(&alloc); @@ -1112,10 +1112,10 @@ static void test10_executor_runningInThisThread() // to the executor's associated strand, and 'false otherwise. // // Testing: -// mwcex::Strand::ExecutorType::runningInThisThread +// bmqex::Strand::ExecutorType::runningInThisThread // ------------------------------------------------------------------------ { - typedef mwcex::Strand Strand; + typedef bmqex::Strand Strand; typedef Strand::ExecutorType StrandExecutor; static const int k_NUM_THREADS = 4; @@ -1173,13 +1173,13 @@ static void test11_executor_context() // // Plan: // Check that 'context()' returns a reference to the executor's -// associated 'mwcex::Strand' object. +// associated 'bmqex::Strand' object. // // Testing: -// mwcex::StrandExecutor::context +// bmqex::StrandExecutor::context // ------------------------------------------------------------------------ { - typedef mwcex::Strand Strand; + typedef bmqex::Strand Strand; bslma::TestAllocator alloc; Strand strand1(&alloc), strand2(&alloc); @@ -1197,10 +1197,10 @@ static void test11_executor_context() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { - // mwcex::Strand + // bmqex::Strand case 1: test1_strand_creators(); break; case 2: test2_strand_start(); break; case 3: test3_strand_stop(); break; @@ -1208,7 +1208,7 @@ int main(int argc, char* argv[]) case 5: test5_strand_dropPendingJobs(); break; case 6: test6_strand_outstandingJobs(); break; - // mwcex::StrandExecutor + // bmqex::StrandExecutor case 7: test7_executor_post(); break; case 8: test8_executor_dispatch(); break; case 9: test9_executor_swap(); break; @@ -1222,5 +1222,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/mwcex_systemexecutor.cpp b/src/groups/bmq/bmqex/bmqex_systemexecutor.cpp similarity index 97% rename from src/groups/mwc/mwcex/mwcex_systemexecutor.cpp rename to src/groups/bmq/bmqex/bmqex_systemexecutor.cpp index 6b4dcfa38..f6606b0af 100644 --- a/src/groups/mwc/mwcex/mwcex_systemexecutor.cpp +++ b/src/groups/bmq/bmqex/bmqex_systemexecutor.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_systemexecutor.cpp -*-C++-*- -#include +// bmqex_systemexecutor.cpp -*-C++-*- +#include -#include +#include // BDE #include #include @@ -27,7 +27,7 @@ #include namespace BloombergLP { -namespace mwcex { +namespace bmqex { namespace { @@ -285,7 +285,7 @@ SystemExecutor::threadAttributes() const BSLS_KEYWORD_NOEXCEPT } // close package namespace // FREE OPERATORS -bool mwcex::operator==(const SystemExecutor& lhs, +bool bmqex::operator==(const SystemExecutor& lhs, const SystemExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { if (lhs.threadAttributes() == rhs.threadAttributes()) { @@ -304,7 +304,7 @@ bool mwcex::operator==(const SystemExecutor& lhs, return *lhs.threadAttributes() == *rhs.threadAttributes(); } -bool mwcex::operator!=(const SystemExecutor& lhs, +bool bmqex::operator!=(const SystemExecutor& lhs, const SystemExecutor& rhs) BSLS_KEYWORD_NOEXCEPT { return !(lhs == rhs); diff --git a/src/groups/mwc/mwcex/mwcex_systemexecutor.h b/src/groups/bmq/bmqex/bmqex_systemexecutor.h similarity index 96% rename from src/groups/mwc/mwcex/mwcex_systemexecutor.h rename to src/groups/bmq/bmqex/bmqex_systemexecutor.h index e17052f09..a7bfcdfe6 100644 --- a/src/groups/mwc/mwcex/mwcex_systemexecutor.h +++ b/src/groups/bmq/bmqex/bmqex_systemexecutor.h @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_systemexecutor.h -*-C++-*- -#ifndef INCLUDED_MWCEX_SYSTEMEXECUTOR -#define INCLUDED_MWCEX_SYSTEMEXECUTOR +// bmqex_systemexecutor.h -*-C++-*- +#ifndef INCLUDED_BMQEX_SYSTEMEXECUTOR +#define INCLUDED_BMQEX_SYSTEMEXECUTOR //@PURPOSE: Provides an executor allowing functions to execute on any thread. // //@CLASSES: -// mwcex::SystemExecutor: system executor -// mwcex::SystemExecutorContextGuard: scoped system execution context guard +// bmqex::SystemExecutor: system executor +// bmqex::SystemExecutorContextGuard: scoped system execution context guard // //@DESCRIPTION: -// This component provides a mechanism 'mwcex::SystemExecutor', that is an +// This component provides a mechanism 'bmqex::SystemExecutor', that is an // executor allowed to spawn an arbitrary number of threads to execute // submitted functors. Those threads are collectively referred to as system // threads. All functors submitted via a call to the executor's 'post' function @@ -44,9 +44,9 @@ // /// Execution context ///----------------- -// All 'mwcex::SystemExecutor' objects refer to the same execution context +// All 'bmqex::SystemExecutor' objects refer to the same execution context // mechanism, that is a singleton. While the execution context itself is an -// implementation details, a guard class, 'mwcex::SystemExecutorContextGuard', +// implementation details, a guard class, 'bmqex::SystemExecutorContextGuard', // is provided, allowing to explicitly initialized the context with a custom // allocator. // @@ -55,7 +55,7 @@ // Here is a straightforward usage example demonstrating how to submit a // functor for asynchronous execution. //.. -// mwcex::SystemExecutor ex; +// bmqex::SystemExecutor ex; // ex.post([](){ bsl::cout << "I'm executed!"; }); //.. // And here is another one. This time we explicitly specify desired attributes @@ -64,7 +64,7 @@ // bslmt::ThreadAttributes threadAttr; // threadAttr.setStackSize(1024 * 1024); // -// mwcex::SystemExecutor ex(threadAttr); +// bmqex::SystemExecutor ex(threadAttr); // ex.post([](){ bsl::cout << "I'm executed!"; }); //.. // And this example demonstrates the usage of the execution context guard with @@ -74,14 +74,12 @@ // bslma::TestAllocator testAlloc; // // // initialize system execution context with test allocator -// // mwcex::SystemExecutorContextGuard sysCtxGuard(&testAlloc); +// // bmqex::SystemExecutorContextGuard sysCtxGuard(&testAlloc); // // // use the executor ... //.. -// MWC - -#include +#include // BDE #include @@ -110,7 +108,7 @@ namespace bslmt { class ThreadAttributes; } -namespace mwcex { +namespace bmqex { class SystemExecutor_Context; @@ -557,7 +555,7 @@ inline void SystemExecutor::post(BSLS_COMPILERFEATURES_FORWARD_REF(FUNCTION) SystemExecutor_Context::singleton().executeAsync( BSLS_COMPILERFEATURES_FORWARD(FUNCTION, f), d_threadAttributes ? *d_threadAttributes - : mwcsys::ThreadUtil::defaultAttributes()); + : bmqsys::ThreadUtil::defaultAttributes()); } template diff --git a/src/groups/mwc/mwcex/mwcex_systemexecutor.t.cpp b/src/groups/bmq/bmqex/bmqex_systemexecutor.t.cpp similarity index 86% rename from src/groups/mwc/mwcex/mwcex_systemexecutor.t.cpp rename to src/groups/bmq/bmqex/bmqex_systemexecutor.t.cpp index de6ede31b..57d8b266f 100644 --- a/src/groups/mwc/mwcex/mwcex_systemexecutor.t.cpp +++ b/src/groups/bmq/bmqex/bmqex_systemexecutor.t.cpp @@ -13,14 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcex_systemexecutor.t.cpp -*-C++-*- -#include +// bmqex_systemexecutor.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include -// MWC -#include +#include // BDE #include @@ -100,13 +99,13 @@ static void test1_context_singleton() // object. // // Testing: -// mwcex::SystemExecutor::singleton +// bmqex::SystemExecutor::singleton // ------------------------------------------------------------------------ { - mwcex::SystemExecutor_Context* ctx1 = - &mwcex::SystemExecutor_Context::singleton(); - mwcex::SystemExecutor_Context* ctx2 = - &mwcex::SystemExecutor_Context::singleton(); + bmqex::SystemExecutor_Context* ctx1 = + &bmqex::SystemExecutor_Context::singleton(); + bmqex::SystemExecutor_Context* ctx2 = + &bmqex::SystemExecutor_Context::singleton(); ASSERT_EQ(ctx1, ctx2); } @@ -126,8 +125,8 @@ static void test2_context_creators() // objects have completed. // // Testing: -// 'mwcex::SystemExecutor_Context's constructor -// 'mwcex::SystemExecutor_Context's destructor +// 'bmqex::SystemExecutor_Context's constructor +// 'bmqex::SystemExecutor_Context's destructor // ------------------------------------------------------------------------ { static const int k_NUM_JOBS = 10; @@ -140,8 +139,8 @@ static void test2_context_creators() BSLS_ASSERT_OPT(rc == 0); // initialize the context singleton object - mwcex::SystemExecutor_Context& context = - mwcex::SystemExecutor_Context::initSingleton(&alloc); + bmqex::SystemExecutor_Context& context = + bmqex::SystemExecutor_Context::initSingleton(&alloc); // context initialized with the test allocator ASSERT_EQ(context.allocator(), &alloc); @@ -154,11 +153,11 @@ static void test2_context_creators() bdlf::BindUtil::bind(bslmt::ThreadUtil::setSpecific, bsl::cref(tlsKey), &threadsCompleted), - mwcsys::ThreadUtil::defaultAttributes()); + bmqsys::ThreadUtil::defaultAttributes()); } // destroy context singleton object - mwcex::SystemExecutor_Context::shutdownSingleton(); + bmqex::SystemExecutor_Context::shutdownSingleton(); // all thread owned by the execution context have completed ASSERT_EQ(threadsCompleted, k_NUM_JOBS); @@ -176,24 +175,24 @@ static void test3_executor_creators() // Ensure proper behavior of creator methods. // // Plan: -// 1. Default-construct an instance of 'mwcex::SystemExecutor'. Check +// 1. Default-construct an instance of 'bmqex::SystemExecutor'. Check // postconditions. // -// 2. ThreadAttributes-construct an instance of 'mwcex::SystemExecutor'. +// 2. ThreadAttributes-construct an instance of 'bmqex::SystemExecutor'. // Check postconditions. // // Testing: -// mwcex::SystemExecutor's creators +// bmqex::SystemExecutor's creators // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // initialize the context singleton with the test allocator - mwcex::SystemExecutorContextGuard contextGuard(&alloc); + bmqex::SystemExecutorContextGuard contextGuard(&alloc); // 1. default-construct { - mwcex::SystemExecutor ex; + bmqex::SystemExecutor ex; ASSERT(!ex.threadAttributes()); } @@ -212,7 +211,7 @@ static void test3_executor_creators() attr.setThreadName("myThread"); // create executor - mwcex::SystemExecutor ex(attr, &alloc); + bmqex::SystemExecutor ex(attr, &alloc); // executor holds a copy of the thread attributes ASSERT(ex.threadAttributes()); @@ -245,7 +244,7 @@ static void test4_executor_post() // the calling one. // // Testing: -// mwcex::SystemExecutor::post +// bmqex::SystemExecutor::post // ------------------------------------------------------------------------ { static const int k_NUM_JOBS = 32; @@ -253,7 +252,7 @@ static void test4_executor_post() bslma::TestAllocator alloc; // initialize the context singleton with the test allocator - mwcex::SystemExecutorContextGuard contextGuard(&alloc); + bmqex::SystemExecutorContextGuard contextGuard(&alloc); bslmt::Semaphore sem1, sem2; int jobNo = 0; @@ -261,7 +260,7 @@ static void test4_executor_post() for (int i = 0; i < k_NUM_JOBS; ++i) { // schedule function object execution - mwcex::SystemExecutor().post( + bmqex::SystemExecutor().post( bdlf::BindUtil::bindR(AsyncTestCallback(), &sem1, &jobNo, @@ -293,7 +292,7 @@ static void test5_executor_dispatch() // thread. // // Testing: -// mwcex::SystemExecutor::dispatch +// bmqex::SystemExecutor::dispatch // ------------------------------------------------------------------------ { static const int k_NUM_JOBS = 32; @@ -301,14 +300,14 @@ static void test5_executor_dispatch() bslma::TestAllocator alloc; // initialize the context singleton with the test allocator - mwcex::SystemExecutorContextGuard contextGuard(&alloc); + bmqex::SystemExecutorContextGuard contextGuard(&alloc); int jobNo = 0; bslmt::ThreadUtil::Id threadId; for (int i = 0; i < k_NUM_JOBS; ++i) { // execute function object - mwcex::SystemExecutor().dispatch( + bmqex::SystemExecutor().dispatch( bdlf::BindUtil::bindR(InPlaceTestCallback(), &jobNo, &threadId)); @@ -343,17 +342,17 @@ static void test6_executor_comparison() // set of thread attributes. // // Testing: -// mwcex::SystemExecutor's comparison operators +// bmqex::SystemExecutor's comparison operators // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; // initialize the context singleton with the test allocator - mwcex::SystemExecutorContextGuard contextGuard(&alloc); + bmqex::SystemExecutorContextGuard contextGuard(&alloc); // 1. both executors has no attributes { - mwcex::SystemExecutor ex1, ex2; + bmqex::SystemExecutor ex1, ex2; ASSERT(!ex1.threadAttributes()); ASSERT(!ex2.threadAttributes()); @@ -364,8 +363,8 @@ static void test6_executor_comparison() // 2. both executors share same attributes { - mwcex::SystemExecutor ex1(bslmt::ThreadAttributes(), &alloc); - mwcex::SystemExecutor ex2 = ex1; + bmqex::SystemExecutor ex1(bslmt::ThreadAttributes(), &alloc); + bmqex::SystemExecutor ex2 = ex1; ASSERT(ex1.threadAttributes() == ex2.threadAttributes()); @@ -375,8 +374,8 @@ static void test6_executor_comparison() // 3. one executor has attributes, the other doesn't { - mwcex::SystemExecutor ex1(bslmt::ThreadAttributes(), &alloc); - mwcex::SystemExecutor ex2; + bmqex::SystemExecutor ex1(bslmt::ThreadAttributes(), &alloc); + bmqex::SystemExecutor ex2; ASSERT(ex1.threadAttributes()); ASSERT(!ex2.threadAttributes()); @@ -387,8 +386,8 @@ static void test6_executor_comparison() // 4. both executors has identical attributes { - mwcex::SystemExecutor ex1(bslmt::ThreadAttributes(), &alloc); - mwcex::SystemExecutor ex2(bslmt::ThreadAttributes(), &alloc); + bmqex::SystemExecutor ex1(bslmt::ThreadAttributes(), &alloc); + bmqex::SystemExecutor ex2(bslmt::ThreadAttributes(), &alloc); ASSERT(ex1.threadAttributes() && ex2.threadAttributes()); ASSERT(ex1.threadAttributes() != ex2.threadAttributes()); @@ -405,8 +404,8 @@ static void test6_executor_comparison() bslmt::ThreadAttributes attr2(&alloc); attr1.setThreadName("thread_2"); - mwcex::SystemExecutor ex1(attr1, &alloc); - mwcex::SystemExecutor ex2(attr2, &alloc); + bmqex::SystemExecutor ex1(attr1, &alloc); + bmqex::SystemExecutor ex2(attr2, &alloc); ASSERT(ex1.threadAttributes() && ex2.threadAttributes()); ASSERT(ex1.threadAttributes() != ex2.threadAttributes()); @@ -422,7 +421,7 @@ static void test6_executor_comparison() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_context_singleton(); break; @@ -439,5 +438,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcex/doc/mwcex.txt b/src/groups/bmq/bmqex/doc/bmqex.txt similarity index 56% rename from src/groups/mwc/mwcex/doc/mwcex.txt rename to src/groups/bmq/bmqex/doc/bmqex.txt index 5b44a7236..9b21f20b1 100644 --- a/src/groups/mwc/mwcex/doc/mwcex.txt +++ b/src/groups/bmq/bmqex/doc/bmqex.txt @@ -1,88 +1,88 @@ - mwcex.txt + bmqex.txt @PURPOSE: Provide executors and other async programming utilites and mechanisms -@MNEMONIC: MiddleWare Core Executors (mwcex) +@MNEMONIC: BlazingMQ Executors (bmqex) @DESCRIPTION: This package provides executors and other async programming utilites and mechanisms to be reused through various applications. /Hierarchical Synopsis /--------------------- -The 'mwcex' package currently has 17 components having 4 level of physical +The 'bmqex' package currently has 17 components having 4 level of physical dependency. The list below shows the hierarchical ordering of the components. .. - 4. mwcex_bindutil + 4. bmqex_bindutil - 3. mwcex_executionutil + 3. bmqex_executionutil - 2. mwcex_executionpolicy - mwcex_executor - mwcex_promise - mwcex_sequentialcontext - mwcex_strand + 2. bmqex_executionpolicy + bmqex_executor + bmqex_promise + bmqex_sequentialcontext + bmqex_strand - 1. mwcex_bdlmteventschedulerexecutor - mwcex_bdlmtfixedthreadpoolexecutor - mwcex_bdlmtmultiprioritythreadpoolexecutor - mwcex_bdlmtmultiqueuethreadpoolexecutor - mwcex_bdlmtthreadpoolexecutor - mwcex_executionproperty - mwcex_executortraits - mwcex_future - mwcex_job - mwcex_systemexecutor + 1. bmqex_bdlmteventschedulerexecutor + bmqex_bdlmtfixedthreadpoolexecutor + bmqex_bdlmtmultiprioritythreadpoolexecutor + bmqex_bdlmtmultiqueuethreadpoolexecutor + bmqex_bdlmtthreadpoolexecutor + bmqex_executionproperty + bmqex_executortraits + bmqex_future + bmqex_job + bmqex_systemexecutor .. /Component Synopsis /------------------ -: 'mwcex_bdlmteventschedulerexecutor': +: 'bmqex_bdlmteventschedulerexecutor': : Provides an executor adapter for 'bdlmt::EventScheduler'. : -: 'mwcex_bdlmtfixedthreadpoolexecutor': +: 'bmqex_bdlmtfixedthreadpoolexecutor': : Provides an executor adapter for 'bdlmt::FixedThreadPool'. : -: 'mwcex_bdlmtmultiprioritythreadpoolexecutor': +: 'bmqex_bdlmtmultiprioritythreadpoolexecutor': : Provides an executor adapter for 'bdlmt::MultipriorityThreadPool'. : -: 'mwcex_bdlmtmultiqueuethreadpoolexecutor': +: 'bmqex_bdlmtmultiqueuethreadpoolexecutor': : Provides an executor adapter for 'bdlmt::MultiQueueThreadPool'. : -: 'mwcex_bdlmtthreadpoolexecutor': +: 'bmqex_bdlmtthreadpoolexecutor': : Provides an executor adapter for 'bdlmt::ThreadPool'. : -: 'mwcex_bindutil': +: 'bmqex_bindutil': : Provides utility functions to bind functors to execution functions. : -: 'mwcex_executionpolicy': +: 'bmqex_executionpolicy': : Provides an execution policy to customize execution functions. : -: 'mwcex_executionproperty': -: Provides utility tag types to be used with 'mwcex::ExecutionPolicy'. +: 'bmqex_executionproperty': +: Provides utility tag types to be used with 'bmqex::ExecutionPolicy'. : -: 'mwcex_executionutil': +: 'bmqex_executionutil': : Provides utility functions to execute function objects. : -: 'mwcex_executor': +: 'bmqex_executor': : Provides a polymorphic wrapper for executor types. : -: 'mwcex_executortraits': +: 'bmqex_executortraits': : Provides a traits class to access various properties of executors. : -: 'mwcex_future': +: 'bmqex_future': : Provides a mechanism to access the result of an async operation. : -: 'mwcex_job': +: 'bmqex_job': : Provides a polymorphic function object wrapper. : -: 'mwcex_promise': +: 'bmqex_promise': : Provides a mechanism to store the result of an async operation. : -: 'mwcex_sequentialcontext': +: 'bmqex_sequentialcontext': : Provides a single-threaded execution context. : -: 'mwcex_strand': +: 'bmqex_strand': : Provides a strand execution context. : -: 'mwcex_systemexecutor': +: 'bmqex_systemexecutor': : Provides an executor allowing functions to execute on any thread. diff --git a/src/groups/bmq/bmqex/package/bmqex.dep b/src/groups/bmq/bmqex/package/bmqex.dep new file mode 100644 index 000000000..ff346683a --- /dev/null +++ b/src/groups/bmq/bmqex/package/bmqex.dep @@ -0,0 +1,3 @@ +bmqscm +bmqsys +bmqu diff --git a/src/groups/bmq/bmqex/package/bmqex.mem b/src/groups/bmq/bmqex/package/bmqex.mem new file mode 100644 index 000000000..46c676cda --- /dev/null +++ b/src/groups/bmq/bmqex/package/bmqex.mem @@ -0,0 +1,20 @@ +bmqex_bdlmteventschedulerexecutor +bmqex_bdlmtfixedthreadpoolexecutor +bmqex_bdlmtmultiprioritythreadpoolexecutor +bmqex_bdlmtmultiqueuethreadpoolexecutor +bmqex_bdlmtthreadpoolexecutor +bmqex_bindutil +bmqex_bindutil_cpp03 +bmqex_executionpolicy +bmqex_executionproperty +bmqex_executionutil +bmqex_executor +bmqex_executortraits +bmqex_future +bmqex_future_cpp03 +bmqex_job +bmqex_promise +bmqex_promise_cpp03 +bmqex_sequentialcontext +bmqex_strand +bmqex_systemexecutor diff --git a/src/groups/bmq/bmqimp/bmqimp_application.cpp b/src/groups/bmq/bmqimp/bmqimp_application.cpp index d2211eef3..05db36410 100644 --- a/src/groups/bmq/bmqimp/bmqimp_application.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_application.cpp @@ -18,30 +18,25 @@ #include // BMQ +#include +#include +#include +#include +#include +#include +#include #include #include +#include +#include +#include +#include +#include #include #include - -// MWC -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -82,11 +77,11 @@ const bsls::Types::Int64 k_CHANNEL_LOW_WATERMARK = 512 * 1024; /// Create the StatContextConfiguration to use, from the specified /// `options`, and using the specified `allocator` for memory allocations. -mwcst::StatContextConfiguration +bmqst::StatContextConfiguration statContextConfiguration(const bmqt::SessionOptions& options, bslma::Allocator* allocator) { - mwcst::StatContextConfiguration config("stats", allocator); + bmqst::StatContextConfiguration config("stats", allocator); if (options.statsDumpInterval() != bsls::TimeInterval()) { // Stats configuration: // we snapshot every second @@ -145,7 +140,7 @@ ntcCreateInterfaceConfig(const bmqt::SessionOptions& sessionOptions, // ------------------------- void Application::onChannelDown(const bsl::string& peerUri, - const mwcio::Status& status) + const bmqio::Status& status) { // executed by the *IO* thread @@ -156,7 +151,7 @@ void Application::onChannelDown(const bsl::string& peerUri, } void Application::onChannelWatermark(const bsl::string& peerUri, - mwcio::ChannelWatermarkType::Enum type) + bmqio::ChannelWatermarkType::Enum type) { // executed by the *IO* thread @@ -164,16 +159,16 @@ void Application::onChannelWatermark(const bsl::string& peerUri, d_brokerSession.handleChannelWatermark(type); } -void Application::readCb(const mwcio::Status& status, +void Application::readCb(const bmqio::Status& status, int* numNeeded, bdlbb::Blob* blob, - const bsl::shared_ptr& channel) + const bsl::shared_ptr& channel) { // executed by the *IO* thread if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!status)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - if (status.category() != mwcio::StatusCategory::e_CANCELED) { + if (status.category() != bmqio::StatusCategory::e_CANCELED) { BALL_LOG_ERROR << "#TCP_READ_ERROR " << channel->peerUri() << ": ReadCallback error [status: " << status << "]"; @@ -188,13 +183,13 @@ void Application::readCb(const mwcio::Status& status, bdlbb::Blob readBlob; - const int rc = mwcio::ChannelUtil::handleRead(&readBlob, numNeeded, blob); + const int rc = bmqio::ChannelUtil::handleRead(&readBlob, numNeeded, blob); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(rc != 0)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; BALL_LOG_ERROR << "#TCP_READ_ERROR " << channel->peerUri() << ": ReadCallback unrecoverable error " << "[status: " << status << "]:\n" - << mwcu::BlobStartHexDumper(blob); + << bmqu::BlobStartHexDumper(blob); // Nothing much we can do, close the channel channel->close(); return; // RETURN @@ -207,16 +202,16 @@ void Application::readCb(const mwcio::Status& status, } BALL_LOG_TRACE << channel->peerUri() << ": ReadCallback got a blob\n" - << mwcu::BlobStartHexDumper(&readBlob); + << bmqu::BlobStartHexDumper(&readBlob); d_brokerSession.processPacket(readBlob); } void Application::channelStateCallback( const bsl::string& endpoint, - mwcio::ChannelFactoryEvent::Enum event, - const mwcio::Status& status, - const bsl::shared_ptr& channel) + bmqio::ChannelFactoryEvent::Enum event, + const bmqio::Status& status, + const bsl::shared_ptr& channel) { // executed by the *IO* thread @@ -226,7 +221,7 @@ void Application::channelStateCallback( << "']"; switch (event) { - case mwcio::ChannelFactoryEvent::e_CHANNEL_UP: { + case bmqio::ChannelFactoryEvent::e_CHANNEL_UP: { BALL_LOG_INFO << "Session with '" << channel->peerUri() << "' is now UP"; @@ -244,7 +239,7 @@ void Application::channelStateCallback( d_brokerSession.setChannel(channel); // Initiate read flow - mwcio::Status st; + bmqio::Status st; channel->read( &st, bmqp::Protocol::k_PACKET_MIN_SIZE, @@ -266,12 +261,12 @@ void Application::channelStateCallback( // do nothing) d_scheduler.cancelEvent(&d_startTimeoutHandle); } break; // BREAK - case mwcio::ChannelFactoryEvent::e_CONNECT_ATTEMPT_FAILED: { + case bmqio::ChannelFactoryEvent::e_CONNECT_ATTEMPT_FAILED: { BALL_LOG_DEBUG << "Failed an attempt to establish a session with '" << endpoint << "' [event: " << event << ", status: " << status << "]"; } break; // BREAK - case mwcio::ChannelFactoryEvent::e_CONNECT_FAILED: { + case bmqio::ChannelFactoryEvent::e_CONNECT_FAILED: { BALL_LOG_ERROR << "Could not establish session with '" << endpoint << "' [event: " << event << ", status: " << status << "]"; @@ -284,15 +279,15 @@ void Application::channelStateCallback( } } -bslma::ManagedPtr Application::channelStatContextCreator( - BSLS_ANNOTATION_UNUSED const bsl::shared_ptr& channel, - const bsl::shared_ptr& handle) +bslma::ManagedPtr Application::channelStatContextCreator( + BSLS_ANNOTATION_UNUSED const bsl::shared_ptr& channel, + const bsl::shared_ptr& handle) { // The SDK only connects - BSLS_ASSERT_SAFE(handle->options().is()); + BSLS_ASSERT_SAFE(handle->options().is()); - mwcst::StatContextConfiguration config( - handle->options().the().endpoint()); + bmqst::StatContextConfiguration config( + handle->options().the().endpoint()); return d_channelsStatContext_mp->addSubcontext(config); } @@ -338,7 +333,7 @@ bmqt::GenericResult::Enum Application::startChannel() return bmqt::GenericResult::e_UNKNOWN; // RETURN } bdlb::ScopeExitAny tcpScopeGuard( - bdlf::BindUtil::bind(&mwcio::NtcChannelFactory::stop, + bdlf::BindUtil::bind(&bmqio::NtcChannelFactory::stop, &d_channelFactory)); rc = d_reconnectingChannelFactory.start(); @@ -348,11 +343,11 @@ bmqt::GenericResult::Enum Application::startChannel() return bmqt::GenericResult::e_UNKNOWN; // RETURN } bdlb::ScopeExitAny reconnectingScopeGuard( - bdlf::BindUtil::bind(&mwcio::ReconnectingChannelFactory::stop, + bdlf::BindUtil::bind(&bmqio::ReconnectingChannelFactory::stop, &d_reconnectingChannelFactory)); // Connect to the broker. - mwcio::TCPEndpoint endpoint(d_sessionOptions.brokerUri()); + bmqio::TCPEndpoint endpoint(d_sessionOptions.brokerUri()); if (!endpoint) { BALL_LOG_ERROR << "Invalid brokerURI '" << d_sessionOptions.brokerUri() << "'"; @@ -360,14 +355,14 @@ bmqt::GenericResult::Enum Application::startChannel() } bdlma::LocalSequentialAllocator<32> localAllocator(&d_allocator); - mwcu::MemOutStream out(&localAllocator); + bmqu::MemOutStream out(&localAllocator); out << endpoint.host() << ":" << endpoint.port(); bsls::TimeInterval attemptInterval; attemptInterval.setTotalMilliseconds(k_RECONNECT_INTERVAL_MS); - mwcio::Status status; - mwcio::ConnectOptions options; + bmqio::Status status; + bmqio::ConnectOptions options; options.setEndpoint(out.str()) .setNumAttempts(k_RECONNECT_COUNT) .setAttemptInterval(attemptInterval) @@ -438,7 +433,7 @@ void Application::printStats(bool isFinal) // executed by the *SCHEDULER* thread // (and by the *MAIN* thread (in destructor)) - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "#### stats [delta = last " << d_sessionOptions.statsDumpInterval().seconds() << " seconds] ####\n"; @@ -452,14 +447,14 @@ void Application::printStats(bool isFinal) os << ":: Allocators"; if (d_lastAllocatorSnapshot != 0) { os << " [Last snapshot was " - << mwcu::PrintUtil::prettyTimeInterval( - mwcsys::Time::highResolutionTimer() - + << bmqu::PrintUtil::prettyTimeInterval( + bmqsys::Time::highResolutionTimer() - d_lastAllocatorSnapshot) << " ago.]"; } - d_lastAllocatorSnapshot = mwcsys::Time::highResolutionTimer(); + d_lastAllocatorSnapshot = bmqsys::Time::highResolutionTimer(); - mwcma::CountingAllocatorUtil::printAllocations(os, + bmqma::CountingAllocatorUtil::printAllocations(os, *d_allocator.context()); os << "\n"; } @@ -467,18 +462,18 @@ void Application::printStats(bool isFinal) os << "::::: TCP Channels >>"; if (isFinal) { // For the final stats, no need to print the 'delta' columns - mwcst::Table table; - mwcst::BasicTableInfoProvider tip; - mwcio::StatChannelFactoryUtil::initializeStatsTable( + bmqst::Table table; + bmqst::BasicTableInfoProvider tip; + bmqio::StatChannelFactoryUtil::initializeStatsTable( &table, &tip, d_channelsStatContext_mp.get()); table.records().update(); - mwcst::TableUtil::printTable(os, tip); + bmqst::TableUtil::printTable(os, tip); } else { d_channelsTable.records().update(); - mwcst::TableUtil::printTable(os, d_channelsTip); + bmqst::TableUtil::printTable(os, d_channelsTip); } BALL_LOG_INFO << os.str(); @@ -542,7 +537,7 @@ Application::Application( const bmqp_ctrlmsg::NegotiationMessage& negotiationMessage, const EventQueue::EventHandlerCallback& eventHandlerCB, bslma::Allocator* allocator) -: d_allocatorStatContext(mwcst::StatContextConfiguration("Allocators", +: d_allocatorStatContext(bmqst::StatContextConfiguration("Allocators", allocator), allocator) , d_allocator("Application", &d_allocatorStatContext, allocator) @@ -550,7 +545,7 @@ Application::Application( , d_rootStatContext(statContextConfiguration(sessionOptions, allocator), d_allocators.get("Statistics")) , d_channelsStatContext_mp(d_rootStatContext.addSubcontext( - mwcio::StatChannelFactoryUtil::statContextConfiguration("channels", + bmqio::StatChannelFactoryUtil::statContextConfiguration("channels", -1, allocator))) , d_sessionOptions(sessionOptions, &d_allocator) @@ -563,18 +558,18 @@ Application::Application( &d_blobBufferFactory, allocator) , d_resolvingChannelFactory( - mwcio::ResolvingChannelFactoryConfig( + bmqio::ResolvingChannelFactoryConfig( &d_channelFactory, - mwcex::ExecutionPolicyUtil::oneWay().alwaysBlocking().useExecutor( - mwcex::SystemExecutor())), + bmqex::ExecutionPolicyUtil::oneWay().alwaysBlocking().useExecutor( + bmqex::SystemExecutor())), allocator) , d_reconnectingChannelFactory( - mwcio::ReconnectingChannelFactoryConfig(&d_resolvingChannelFactory, + bmqio::ReconnectingChannelFactoryConfig(&d_resolvingChannelFactory, &d_scheduler, allocator), allocator) , d_statChannelFactory( - mwcio::StatChannelFactoryConfig( + bmqio::StatChannelFactoryConfig( &d_reconnectingChannelFactory, bdlf::BindUtil::bind(&Application::channelStatContextCreator, this, @@ -617,7 +612,6 @@ Application::Application( { BALL_LOG_OUTPUT_STREAM << "Creating Application " << "[bmq: " << bmqscm::Version::version() - << ", mwc: " << mwcscm::Version::version() << "], options:\n"; d_sessionOptions.print(BALL_LOG_OUTPUT_STREAM, 1, 4); } @@ -628,7 +622,7 @@ Application::Application( bsl::srand(unsigned(bsl::time(0))); // For calls to 'rand()' in the reconnecting channel factory - mwcsys::Time::initialize(); + bmqsys::Time::initialize(); bmqp::Crc32c::initialize(); } @@ -644,7 +638,7 @@ Application::Application( // we can not call 'stop' on the scheduler from the 'finalizeCb', and // therefore have to let it stop in the application thread, i.e., from the // destructor of this object. - bslmt::ThreadAttributes attr = mwcsys::ThreadUtil::defaultAttributes(); + bslmt::ThreadAttributes attr = bmqsys::ThreadUtil::defaultAttributes(); attr.setThreadName("bmqScheduler"); int rc = d_scheduler.start(attr); if (rc != 0) { @@ -653,8 +647,8 @@ Application::Application( } // Initialize stats - mwcst::StatValue::SnapshotLocation start; - mwcst::StatValue::SnapshotLocation end; + bmqst::StatValue::SnapshotLocation start; + bmqst::StatValue::SnapshotLocation end; if (d_sessionOptions.statsDumpInterval() != bsls::TimeInterval()) { start.setLevel(1).setIndex(0); end.setLevel(1).setIndex( @@ -668,7 +662,7 @@ Application::Application( d_brokerSession.initializeStats(&d_rootStatContext, start, end); // Create the channels stat context table - mwcio::StatChannelFactoryUtil::initializeStatsTable( + bmqio::StatChannelFactoryUtil::initializeStatsTable( &d_channelsTable, &d_channelsTip, d_channelsStatContext_mp.get(), @@ -712,7 +706,7 @@ int Application::startAsync(const bsls::TimeInterval& timeout) // Schedule a timeout d_scheduler.scheduleEvent( &d_startTimeoutHandle, - mwcsys::Time::nowMonotonicClock() + timeout, + bmqsys::Time::nowMonotonicClock() + timeout, bdlf::MemFnUtil::memFn(&Application::onStartTimeout, this)); return bmqt::GenericResult::e_SUCCESS; diff --git a/src/groups/bmq/bmqimp/bmqimp_application.h b/src/groups/bmq/bmqimp/bmqimp_application.h index 664702df1..e99702919 100644 --- a/src/groups/bmq/bmqimp/bmqimp_application.h +++ b/src/groups/bmq/bmqimp/bmqimp_application.h @@ -42,18 +42,17 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -81,7 +80,7 @@ namespace bmqimp { class Application { private: // PRIVATE TYPES - typedef bslma::ManagedPtr + typedef bslma::ManagedPtr ChannelFactoryOpHandleMp; private: @@ -90,29 +89,29 @@ class Application { private: // DATA - mwcst::StatContext d_allocatorStatContext; + bmqst::StatContext d_allocatorStatContext; // Stat context for counting allocators - mwcma::CountingAllocator d_allocator; + bmqma::CountingAllocator d_allocator; // Counting allocator - mwcma::CountingAllocatorStore d_allocators; + bmqma::CountingAllocatorStore d_allocators; // Allocator store to spawn new // allocators for sub-components - mwcst::StatContext d_rootStatContext; + bmqst::StatContext d_rootStatContext; // Top level stat context for all stats - bslma::ManagedPtr d_channelsStatContext_mp; + bslma::ManagedPtr d_channelsStatContext_mp; // Top level stat context for channels bmqt::SessionOptions d_sessionOptions; // Options to configure this // application - mwcst::Table d_channelsTable; + bmqst::Table d_channelsTable; - mwcst::BasicTableInfoProvider d_channelsTip; + bmqst::BasicTableInfoProvider d_channelsTip; bdlbb::PooledBlobBufferFactory d_blobBufferFactory; // Factory for blob buffers @@ -120,13 +119,13 @@ class Application { bdlmt::EventScheduler d_scheduler; // Scheduler - mwcio::NtcChannelFactory d_channelFactory; + bmqio::NtcChannelFactory d_channelFactory; - mwcio::ResolvingChannelFactory d_resolvingChannelFactory; + bmqio::ResolvingChannelFactory d_resolvingChannelFactory; - mwcio::ReconnectingChannelFactory d_reconnectingChannelFactory; + bmqio::ReconnectingChannelFactory d_reconnectingChannelFactory; - mwcio::StatChannelFactory d_statChannelFactory; + bmqio::StatChannelFactory d_statChannelFactory; NegotiatedChannelFactory d_negotiatedChannelFactory; @@ -157,26 +156,26 @@ class Application { private: // PRIVATE MANIPULATORS void onChannelDown(const bsl::string& peerUri, - const mwcio::Status& status); + const bmqio::Status& status); void onChannelWatermark(const bsl::string& peerUri, - mwcio::ChannelWatermarkType::Enum type); + bmqio::ChannelWatermarkType::Enum type); - void readCb(const mwcio::Status& status, + void readCb(const bmqio::Status& status, int* numNeeded, bdlbb::Blob* blob, - const bsl::shared_ptr& channel); + const bsl::shared_ptr& channel); void channelStateCallback(const bsl::string& endpoint, - mwcio::ChannelFactoryEvent::Enum event, - const mwcio::Status& status, - const bsl::shared_ptr& channel); + bmqio::ChannelFactoryEvent::Enum event, + const bmqio::Status& status, + const bsl::shared_ptr& channel); /// Create and return the statContext to be used for tracking stats of /// the specified `channel` obtained from the specified `handle`. - bslma::ManagedPtr channelStatContextCreator( - const bsl::shared_ptr& channel, - const bsl::shared_ptr& handle); + bslma::ManagedPtr channelStatContextCreator( + const bsl::shared_ptr& channel, + const bsl::shared_ptr& handle); /// Method to call after the broker session has been stopped (whether /// sync or async), for cleanup of application. diff --git a/src/groups/bmq/bmqimp/bmqimp_application.t.cpp b/src/groups/bmq/bmqimp/bmqimp_application.t.cpp index 7e2f5b966..69132ba9a 100644 --- a/src/groups/bmq/bmqimp/bmqimp_application.t.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_application.t.cpp @@ -29,7 +29,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -41,7 +41,7 @@ using namespace bsl; static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // Create a default application bmqt::SessionOptions options(s_allocator_p); @@ -73,7 +73,7 @@ static void test2_startStopTest() // isStarted() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("START STOP TEST"); + bmqtst::TestHelper::printTestName("START STOP TEST"); // Create a default application, make sure it can start/stop bmqt::SessionOptions options(s_allocator_p); @@ -123,7 +123,7 @@ static void test3_startStopAsyncTest() // stopAsync() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("START STOP TEST"); + bmqtst::TestHelper::printTestName("START STOP TEST"); // Create a default application, make sure it can start/stop bmqt::SessionOptions options(s_allocator_p); @@ -176,7 +176,7 @@ static void test3_startStopAsyncTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -189,10 +189,10 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_DEFAULT); + TEST_EPILOG(bmqtst::TestHelper::e_DEFAULT); // Global: The global allocator is used to initialize the // bmqt::URIParser RegEx. - // Default: EventQueue uses mwcc::MonitoredFixedQueue, which uses + // Default: EventQueue uses bmqc::MonitoredFixedQueue, which uses // 'bdlcc::SharedObjectPool' which uses bslmt::Semaphore which // generates a unique name using an ostringstream, hence the // default allocator. diff --git a/src/groups/bmq/bmqimp/bmqimp_brokersession.cpp b/src/groups/bmq/bmqimp/bmqimp_brokersession.cpp index 57c549cde..70cf73c1b 100644 --- a/src/groups/bmq/bmqimp/bmqimp_brokersession.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_brokersession.cpp @@ -35,15 +35,14 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -391,7 +390,7 @@ BrokerSession::SessionFsm::setState(State::Enum value, FsmEvent::Enum event) void BrokerSession::SessionFsm::setStarted( FsmEvent::Enum event, - const bsl::shared_ptr& channel) + const bsl::shared_ptr& channel) { // executed by the FSM thread @@ -624,7 +623,7 @@ bmqt::GenericResult::Enum BrokerSession::SessionFsm::handleStartRequest() res = bmqt::GenericResult::e_NOT_SUPPORTED; } break; case State::e_STOPPED: { - d_beginTimestamp = mwcsys::Time::highResolutionTimer(); + d_beginTimestamp = bmqsys::Time::highResolutionTimer(); res = setStarting(event); } break; default: { @@ -709,7 +708,7 @@ void BrokerSession::SessionFsm::handleStopRequest() switch (state()) { case State::e_STARTED: { - d_beginTimestamp = mwcsys::Time::highResolutionTimer(); + d_beginTimestamp = bmqsys::Time::highResolutionTimer(); bmqt::GenericResult::Enum res = setClosingSession(event); if (res != bmqt::GenericResult::e_SUCCESS) { @@ -743,7 +742,7 @@ void BrokerSession::SessionFsm::handleStopRequest() } void BrokerSession::SessionFsm::handleChannelUp( - const bsl::shared_ptr& channel) + const bsl::shared_ptr& channel) { // executed by the FSM thread @@ -936,9 +935,9 @@ void BrokerSession::SessionFsm::logOperationTime(const char* operation) { if (d_beginTimestamp) { const bsls::Types::Int64 elapsed = - mwcsys::Time::highResolutionTimer() - d_beginTimestamp; + bmqsys::Time::highResolutionTimer() - d_beginTimestamp; BALL_LOG_INFO << operation << " took: " - << mwcu::PrintUtil::prettyTimeInterval(elapsed) << " (" + << bmqu::PrintUtil::prettyTimeInterval(elapsed) << " (" << elapsed << " nanoseconds)"; d_beginTimestamp = 0; } @@ -1184,7 +1183,7 @@ void BrokerSession::QueueFsm::actionCloseQueue( context->setGroupId(k_NON_BUFFERED_REQUEST_GROUP_ID); const bsls::TimeInterval absTimeout = - mwcsys::Time::nowMonotonicClock() + + bmqsys::Time::nowMonotonicClock() + d_session.d_sessionOptions.closeQueueTimeout(); actionCloseQueue(context, queue, absTimeout); @@ -1387,9 +1386,9 @@ void BrokerSession::QueueFsm::logOperationTime(const bsl::string& queueUri, TimestampMap::iterator it = d_timestampMap.find(queueUri); if (it != d_timestampMap.end()) { const bsls::Types::Int64 elapsed = - mwcsys::Time::highResolutionTimer() - it->second; + bmqsys::Time::highResolutionTimer() - it->second; BALL_LOG_INFO << operation << " [uri=" << queueUri << "] took: " - << mwcu::PrintUtil::prettyTimeInterval(elapsed) << " (" + << bmqu::PrintUtil::prettyTimeInterval(elapsed) << " (" << elapsed << " nanoseconds)"; // Handling of error cases causes of several operations. // Log only first one (original) and skip others. @@ -1404,7 +1403,7 @@ BrokerSession::QueueFsm::QueueFsm(BrokerSession& session) typedef QueueState S; typedef QueueFsmEvent E; QueueStateTransition table[] = { - // current state event new state + // current state event new state {S::e_CLOSED, E::e_OPEN_CMD, S::e_OPENING_OPN}, // {S::e_OPENING_OPN, E::e_RESP_OK, S::e_OPENING_CFG}, @@ -1515,7 +1514,7 @@ bmqt::OpenQueueResult::Enum BrokerSession::QueueFsm::handleOpenRequest( setQueueId(queue, context); d_timestampMap[queue->uri().asString()] = - mwcsys::Time::highResolutionTimer(); + bmqsys::Time::highResolutionTimer(); // Switch to OPENING_OPN setQueueState(queue, QueueState::e_OPENING_OPN, event); @@ -1757,7 +1756,7 @@ void BrokerSession::QueueFsm::handleReopenRequest( switch (state) { case QueueState::e_PENDING: { d_timestampMap[queue->uri().asString()] = - mwcsys::Time::highResolutionTimer(); + bmqsys::Time::highResolutionTimer(); // Set REOPENING_OPN state setQueueState(queue, QueueState::e_REOPENING_OPN, event); @@ -1817,7 +1816,7 @@ BrokerSession::QueueFsm::handleConfigureRequest( switch (state) { case QueueState::e_OPENED: { d_timestampMap[queue->uri().asString()] = - mwcsys::Time::highResolutionTimer(); + bmqsys::Time::highResolutionTimer(); // Keep the state OPENED setQueueState(queue, QueueState::e_OPENED, event); @@ -1828,7 +1827,7 @@ BrokerSession::QueueFsm::handleConfigureRequest( } break; case QueueState::e_PENDING: { d_timestampMap[queue->uri().asString()] = - mwcsys::Time::highResolutionTimer(); + bmqsys::Time::highResolutionTimer(); // Keep the state PENDING setQueueState(queue, QueueState::e_PENDING, event); @@ -1899,7 +1898,7 @@ bmqt::CloseQueueResult::Enum BrokerSession::QueueFsm::handleCloseRequest( switch (state) { case QueueState::e_OPENED: { d_timestampMap[queue->uri().asString()] = - mwcsys::Time::highResolutionTimer(); + bmqsys::Time::highResolutionTimer(); // Set CLOSING_CFG state setQueueState(queue, QueueState::e_CLOSING_CFG, event); @@ -1919,7 +1918,7 @@ bmqt::CloseQueueResult::Enum BrokerSession::QueueFsm::handleCloseRequest( queue->uri().canonical()); handleResponseOk(queue, context, - mwcsys::Time::nowMonotonicClock() + timeout); + bmqsys::Time::nowMonotonicClock() + timeout); break; // BREAK } @@ -3405,7 +3404,7 @@ void BrokerSession::processControlEvent(const bmqp::Event& event) BALL_LOG_ERROR << "Received invalid control message from broker " << "[reason: 'failed to decode', rc: " << rc << "]" << "\n" - << mwcu::BlobStartHexDumper(event.blob()); + << bmqu::BlobStartHexDumper(event.blob()); return; // RETURN } @@ -3513,7 +3512,7 @@ void BrokerSession::processPutEvent(const bmqp::Event& event) } } - const bsls::TimeInterval sentTime = mwcsys::Time::nowMonotonicClock(); + const bsls::TimeInterval sentTime = bmqsys::Time::nowMonotonicClock(); bmqp::PutMessageIterator putIter(d_bufferFactory_p, d_allocator_p); // Get PUT iterator without decompression @@ -3633,12 +3632,11 @@ void BrokerSession::processPushEvent(const bmqp::Event& event) d_allocator_p); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(rc != 0)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - BALL_LOG_ERROR << "Unable to flatten PUSH event" - << " [rc: " << rc + BALL_LOG_ERROR << "Unable to flatten PUSH event" << " [rc: " << rc << ", length: " << event.blob()->length() << ", eventMessageCount: " << eventMessageCount << "]" << bsl::endl - << mwcu::BlobStartHexDumper( + << bmqu::BlobStartHexDumper( event.blob(), e_NUM_BYTES_IN_BLOB_TO_DUMP); return; // RETURN @@ -3762,7 +3760,7 @@ void BrokerSession::processAckEvent(const bmqp::Event& event) if (ackMsg.status() != 0) { // Non-zero ack status. Log it. - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedAckMessages, BALL_LOG_ERROR << "Failed ACK for queue '" << queue->uri() @@ -3852,7 +3850,7 @@ bmqt::OpenQueueResult::Enum BrokerSession::sendOpenQueueRequest( BSLS_ASSERT_SAFE(d_fsmThreadChecker.inSameThread()); BSLS_ASSERT_SAFE(context->request().choice().isOpenQueueValue()); - const bsls::TimeInterval absTimeout = mwcsys::Time::nowMonotonicClock() + + const bsls::TimeInterval absTimeout = bmqsys::Time::nowMonotonicClock() + timeout; RequestManagerType::RequestType::ResponseCb response = @@ -4157,7 +4155,7 @@ BrokerSession::sendDeconfigureRequest(const bsl::shared_ptr& queue) closeQueueContext->setGroupId(k_NON_BUFFERED_REQUEST_GROUP_ID); const bsls::TimeInterval absTimeout = - mwcsys::Time::nowMonotonicClock() + + bmqsys::Time::nowMonotonicClock() + d_sessionOptions.configureQueueTimeout(); const ConfiguredCallback configuredCb = bdlf::BindUtil::bind( &BrokerSession::onCloseQueueConfigured, @@ -4198,7 +4196,7 @@ bmqt::ConfigureQueueResult::Enum BrokerSession::sendDeconfigureRequest( queue->uri().canonical()) == 1; // Set the configure callback - const bsls::TimeInterval absTimeout = mwcsys::Time::nowMonotonicClock() + + const bsls::TimeInterval absTimeout = bmqsys::Time::nowMonotonicClock() + timeout; const ConfiguredCallback configuredCb = bdlf::BindUtil::bind( &BrokerSession::onCloseQueueConfigured, @@ -4271,7 +4269,7 @@ void BrokerSession::doHandlePendingPutExpirationTimeout( d_messageCorrelationIdContainer.getExpiredIds( &expiredKeys, d_queueRetransmissionTimeoutMap, - mwcsys::Time::nowMonotonicClock()); + bmqsys::Time::nowMonotonicClock()); d_messageCorrelationIdContainer.iterateAndInvoke(expiredKeys, callback); // Push the final ack event if there are any messages in the builder @@ -4286,7 +4284,7 @@ void BrokerSession::doHandlePendingPutExpirationTimeout( } void BrokerSession::doHandleChannelWatermark( - mwcio::ChannelWatermarkType::Enum type, + bmqio::ChannelWatermarkType::Enum type, BSLS_ANNOTATION_UNUSED const bsl::shared_ptr& eventSp) { // executed by the FSM thread @@ -4298,7 +4296,7 @@ void BrokerSession::doHandleChannelWatermark( // HWM condition is detected by the channel 'write' result, so we do not // handle HWM here - if (type == mwcio::ChannelWatermarkType::e_HIGH_WATERMARK) { + if (type == bmqio::ChannelWatermarkType::e_HIGH_WATERMARK) { BALL_LOG_INFO << "HWM: Channel is not writable"; return; // RETURN } @@ -4311,7 +4309,7 @@ void BrokerSession::doHandleChannelWatermark( // either there is the HWM again and we will expect the next LWM event, // or the channel is down and the user threads will be released when // the channel down event is handled (see 'handleChannelDown'). - mwcio::Status status(d_allocator_p); + bmqio::Status status(d_allocator_p); d_channel_sp->write(&status, d_extensionBlobBuffer.front(), d_sessionOptions.channelHighWatermark()); @@ -5177,7 +5175,7 @@ void BrokerSession::doCloseQueue( } void BrokerSession::doSetChannel( - const bsl::shared_ptr channel, + const bsl::shared_ptr channel, BSLS_ANNOTATION_UNUSED const bsl::shared_ptr& eventSp) { // executed by the FSM thread @@ -5665,7 +5663,7 @@ BrokerSession::writeOrBuffer(const bdlbb::Blob& eventBlob, BSLS_ASSERT_SAFE(d_fsmThreadChecker.inSameThread()); BSLS_ASSERT_SAFE(d_channel_sp); - mwcio::Status status(d_allocator_p); + bmqio::Status status(d_allocator_p); bmqt::GenericResult::Enum res = bmqt::GenericResult::e_SUCCESS; if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( @@ -5686,7 +5684,7 @@ BrokerSession::writeOrBuffer(const bdlbb::Blob& eventBlob, if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!status)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - if (status.category() == mwcio::StatusCategory::e_LIMIT) { + if (status.category() == bmqio::StatusCategory::e_LIMIT) { d_extensionBlobBuffer.push_back(eventBlob); d_extensionBufferEmpty = false; } @@ -5794,7 +5792,7 @@ BrokerSession::BrokerSession( // Spawn the FSM thread bslmt::ThreadAttributes threadAttributes = - mwcsys::ThreadUtil::defaultAttributes(); + bmqsys::ThreadUtil::defaultAttributes(); threadAttributes.setThreadName("bmqFSMEvtQ"); if (bslmt::ThreadUtil::createWithAllocator( &d_fsmThread, @@ -5829,9 +5827,9 @@ BrokerSession::~BrokerSession() } void BrokerSession::initializeStats( - mwcst::StatContext* rootStatContext, - const mwcst::StatValue::SnapshotLocation& start, - const mwcst::StatValue::SnapshotLocation& end) + bmqst::StatContext* rootStatContext, + const bmqst::StatValue::SnapshotLocation& start, + const bmqst::StatValue::SnapshotLocation& end) { d_eventQueue.initializeStats(rootStatContext, start, end); @@ -5857,7 +5855,7 @@ BrokerSession::processPacket(const bdlbb::Blob& packet) if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!event.isValid())) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; BALL_LOG_ERROR << "Received an invalid packet: " - << mwcu::BlobStartHexDumper( + << bmqu::BlobStartHexDumper( &packet, e_NUM_BYTES_IN_BLOB_TO_DUMP); return bmqt::GenericResult::e_INVALID_ARGUMENT; // RETURN @@ -5875,12 +5873,12 @@ BrokerSession::processPacket(const bdlbb::Blob& packet) return enqueueFsmEvent(queueEvent); } -void BrokerSession::setChannel(const bsl::shared_ptr& channel) +void BrokerSession::setChannel(const bsl::shared_ptr& channel) { // executed by the *IO* thread - if (mwcsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { - mwcsys::ThreadUtil::setCurrentThreadNameOnce("bmqTCPIO"); + if (bmqsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { + bmqsys::ThreadUtil::setCurrentThreadNameOnce("bmqTCPIO"); } if (channel) { // We are now connected to bmqbrkr @@ -5918,7 +5916,7 @@ int BrokerSession::start(const bsls::TimeInterval& timeout) return rc; // RETURN } - rc = d_startSemaphore.timedWait(mwcsys::Time::nowMonotonicClock() + + rc = d_startSemaphore.timedWait(bmqsys::Time::nowMonotonicClock() + timeout); if (rc != 0) { // Timeout @@ -6139,7 +6137,7 @@ bmqt::ConfigureQueueResult::Enum BrokerSession::sendOpenConfigureQueue( openQueueContext, // openQueue context isReopenRequest); const bsls::TimeInterval timeout = absTimeout - - mwcsys::Time::nowMonotonicClock(); + bmqsys::Time::nowMonotonicClock(); // For reopen request do not reset pendingConfigureId which could have been // set by buffered configure request. @@ -6180,7 +6178,7 @@ bmqt::GenericResult::Enum BrokerSession::sendCloseQueue( closeQueueContext->setResponseCb(response); const bsls::TimeInterval timeout = absTimeout - - mwcsys::Time::nowMonotonicClock(); + bmqsys::Time::nowMonotonicClock(); return sendRequest(closeQueueContext, bmqp::QueueId(queue->id(), queue->subQueueId()), timeout); @@ -6643,7 +6641,7 @@ BrokerSession::nextEvent(const bsls::TimeInterval& timeout) BSLS_ASSERT_SAFE(!d_usingSessionEventHandler && "nextEvent() should be used without EventHandler"); - const bsls::TimeInterval beginTime = mwcsys::Time::nowMonotonicClock(); + const bsls::TimeInterval beginTime = bmqsys::Time::nowMonotonicClock(); bsl::shared_ptr event = d_eventQueue.timedPopFront(timeout); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( @@ -6675,7 +6673,7 @@ BrokerSession::nextEvent(const bsls::TimeInterval& timeout) // Continue waiting for next event for the duration of the remaining // timeout (if any) - const bsls::TimeInterval now = mwcsys::Time::nowMonotonicClock(); + const bsls::TimeInterval now = bmqsys::Time::nowMonotonicClock(); const bsls::TimeInterval remainingTimeout = timeout - (now - beginTime); if (remainingTimeout > bsls::TimeInterval(0, 0)) { @@ -7108,7 +7106,7 @@ bool BrokerSession::acceptUserEvent(const bdlbb::Blob& eventBlob, BSLS_PERFORMANCEHINT_UNLIKELY_HINT; const bsls::TimeInterval expireAfter = - mwcsys::Time::nowMonotonicClock() + timeout; + bmqsys::Time::nowMonotonicClock() + timeout; bslmt::LockGuard guard(&d_extensionBufferLock); // LOCK @@ -7466,7 +7464,7 @@ void BrokerSession::onPendingPutExpirationTimeout() } void BrokerSession::handleChannelWatermark( - mwcio::ChannelWatermarkType::Enum type) + bmqio::ChannelWatermarkType::Enum type) { // executed by the *IO* thread diff --git a/src/groups/bmq/bmqimp/bmqimp_brokersession.h b/src/groups/bmq/bmqimp/bmqimp_brokersession.h index c03768175..3b78c79bb 100644 --- a/src/groups/bmq/bmqimp/bmqimp_brokersession.h +++ b/src/groups/bmq/bmqimp/bmqimp_brokersession.h @@ -56,13 +56,12 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -102,7 +101,7 @@ class Queue; /// Provides an executor suitable for submitting functors on session's FSM /// thread. Note that this class conforms to the Executor concept as defined -/// in the `mwcex` package documentation. +/// in the `bmqex` package documentation. class BrokerSession_Executor { private: // PRIVATE DATA @@ -393,7 +392,7 @@ class BrokerSession BSLS_CPP11_FINAL { /// Unconditionally set STARTED state as a reaction to the specified /// `event` and store the specified `channel` pointer. void setStarted(FsmEvent::Enum event, - const bsl::shared_ptr& channel); + const bsl::shared_ptr& channel); /// Unconditionally set STOPPED state as a reaction to the specified /// `event`. If the specified `isStartTimeout` flag is `true` then @@ -443,7 +442,7 @@ class BrokerSession BSLS_CPP11_FINAL { void handleStopRequest(); /// Handle IO channel up event that provides the specified `channel` - void handleChannelUp(const bsl::shared_ptr& channel); + void handleChannelUp(const bsl::shared_ptr& channel); /// Handle IO channel down event void handleChannelDown(); @@ -704,7 +703,7 @@ class BrokerSession BSLS_CPP11_FINAL { private: // DATA - mwcma::CountingAllocatorStore d_allocators; + bmqma::CountingAllocatorStore d_allocators; // Allocator store to spawn new // allocators for sub-components @@ -722,7 +721,7 @@ class BrokerSession BSLS_CPP11_FINAL { // Raw pointer (held, not owned) to // the blob buffer factory to use. - bsl::shared_ptr d_channel_sp; + bsl::shared_ptr d_channel_sp; // Channel to use for communication, // held not owned @@ -783,7 +782,7 @@ class BrokerSession BSLS_CPP11_FINAL { bslmt::ThreadUtil::Handle d_fsmThread; // FSM thread handle - mwcu::SameThreadChecker d_fsmThreadChecker; + bmqu::SameThreadChecker d_fsmThreadChecker; // Mechanism to check if a method is // called in the FSM thread @@ -812,13 +811,13 @@ class BrokerSession BSLS_CPP11_FINAL { // resume queues that have not yet // received responses. - mwcu::ThrottledActionParams d_throttledFailedPostMessage; - // State for mwcu::ThrottledAction, + bmqu::ThrottledActionParams d_throttledFailedPostMessage; + // State for bmqu::ThrottledAction, // across all queues for when posting // fails due to BW_LIMIT. - mwcu::ThrottledActionParams d_throttledFailedAckMessages; - // State for mwcu::ThrottledAction, + bmqu::ThrottledActionParams d_throttledFailedAckMessages; + // State for bmqu::ThrottledAction, // across all queues. bmqimp::MessageDumper d_messageDumper; @@ -1339,7 +1338,7 @@ class BrokerSession BSLS_CPP11_FINAL { /// Invoked from the FSM thread as a handler to the channel status event /// specified as `eventSp` and sent by the IO thread. This method /// updates the channel status and sends related user events. - void doSetChannel(const bsl::shared_ptr channel, + void doSetChannel(const bsl::shared_ptr channel, const bsl::shared_ptr& eventSp); /// Invoked from the FSM thread as a handler to the session start @@ -1355,7 +1354,7 @@ class BrokerSession BSLS_CPP11_FINAL { /// Invoked from the FSM thread as a handler to the channel watermark /// event specified as `eventSp` with the specified watermark `type` /// sent by the IO thread. - void doHandleChannelWatermark(mwcio::ChannelWatermarkType::Enum type, + void doHandleChannelWatermark(bmqio::ChannelWatermarkType::Enum type, const bsl::shared_ptr& eventSp); /// Invoked from the FSM thread as a handler to the heartbeat event @@ -1512,9 +1511,9 @@ class BrokerSession BSLS_CPP11_FINAL { /// Configure this component to keep track of statistics: create a /// sub-context from the specified `rootStatContext`, using the /// specified `start` and `end` snapshot location. - void initializeStats(mwcst::StatContext* rootStatContext, - const mwcst::StatValue::SnapshotLocation& start, - const mwcst::StatValue::SnapshotLocation& end); + void initializeStats(bmqst::StatContext* rootStatContext, + const bmqst::StatValue::SnapshotLocation& start, + const bmqst::StatValue::SnapshotLocation& end); /// Process the specified `packet`. This method gets called each time a /// new `packet` (sent by the broker) is available on the channel. It @@ -1527,7 +1526,7 @@ class BrokerSession BSLS_CPP11_FINAL { /// bmqbrkr. If `channel` is non null, this is a newly-established /// `channel`. Otherwise, if `channel` is null, this means the /// connection with the broker was lost. - void setChannel(const bsl::shared_ptr& channel); + void setChannel(const bsl::shared_ptr& channel); /// Start the broker session and block until start result or the /// specified `timeout` is expired. Return 0 on success or non-zero on @@ -1656,7 +1655,7 @@ class BrokerSession BSLS_CPP11_FINAL { /// Return transition table of the Session FSM. bsl::vector getSessionFsmTransitionTable() const; - void handleChannelWatermark(mwcio::ChannelWatermarkType::Enum type); + void handleChannelWatermark(bmqio::ChannelWatermarkType::Enum type); // Called when the channel watermark event happens. The watermark type // is indicated by the specified 'type'. diff --git a/src/groups/bmq/bmqimp/bmqimp_brokersession.t.cpp b/src/groups/bmq/bmqimp/bmqimp_brokersession.t.cpp index 139cebe5c..1f978e03d 100644 --- a/src/groups/bmq/bmqimp/bmqimp_brokersession.t.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_brokersession.t.cpp @@ -39,11 +39,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -64,7 +63,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -401,7 +400,7 @@ struct TestSession BSLS_CPP11_FINAL { // event scheduler used in the // broker session - mwcio::TestChannel d_testChannel; + bmqio::TestChannel d_testChannel; // mocked network channel object // to be used in the broker session @@ -448,7 +447,7 @@ struct TestSession BSLS_CPP11_FINAL { // ACCESSORS bmqimp::BrokerSession& session(); - mwcio::TestChannel& channel(); + bmqio::TestChannel& channel(); bslma::Allocator* allocator(); bdlbb::BlobBufferFactory& blobBufferFactory(); @@ -762,7 +761,7 @@ struct TestSession BSLS_CPP11_FINAL { /// Called when the test channel is closed and provides the specified /// close `status`. - void onChannelClose(const mwcio::Status& status); + void onChannelClose(const bmqio::Status& status); /// Wait until stateCb is called informing about reaching the STOPPED /// state. Must be called after `session.stop()` call. Return false @@ -782,7 +781,7 @@ struct TestSession BSLS_CPP11_FINAL { /// Set the specified `writeStatus` to the test network channel and /// notify the BrokerSession about channel LWM. - void setChannelLowWaterMark(mwcio::StatusCategory::Enum writeStatus); + void setChannelLowWaterMark(bmqio::StatusCategory::Enum writeStatus); }; // CLASS DATA @@ -891,8 +890,8 @@ TestSession::TestSession(const bmqt::SessionOptions& sessionOptions, // Set peer uri for the sake of better logging d_testChannel.setPeerUri("tcp://testHost:1234"); - mwcsys::Time::shutdown(); - mwcsys::Time::initialize( + bmqsys::Time::shutdown(); + bmqsys::Time::initialize( bdlf::BindUtil::bind(&TestClock::realtimeClock, d_testClock_p), bdlf::BindUtil::bind(&TestClock::monotonicClock, d_testClock_p), bdlf::BindUtil::bind(&TestClock::highResTimer, d_testClock_p), @@ -915,7 +914,7 @@ bmqimp::BrokerSession& TestSession::session() return d_brokerSession; } -mwcio::TestChannel& TestSession::channel() +bmqio::TestChannel& TestSession::channel() { return d_testChannel; } @@ -1013,7 +1012,7 @@ void TestSession::openQueueWithError(bsl::shared_ptr queue, // open queue request is not sent if (requestType == e_REQ_OPEN_QUEUE && errorResult == e_ERR_NOT_SENT) { - mwcio::Status status(mwcio::StatusCategory::e_GENERIC_ERROR); + bmqio::Status status(bmqio::StatusCategory::e_GENERIC_ERROR); PVVV_SAFE("Set channel write status to " << status << " to reject open queue request"); d_testChannel.setWriteStatus(status); @@ -1041,7 +1040,7 @@ void TestSession::openQueueWithError(bsl::shared_ptr queue, // reset channel write status PVVV_SAFE("Reset channel write status"); - d_testChannel.setWriteStatus(mwcio::Status()); + d_testChannel.setWriteStatus(bmqio::Status()); return; // RETURN } @@ -1080,7 +1079,7 @@ void TestSession::openQueueWithError(bsl::shared_ptr queue, // configure request is not sent if (requestType == e_REQ_CONFIG_QUEUE && errorResult == e_ERR_NOT_SENT) { - mwcio::Status status(mwcio::StatusCategory::e_GENERIC_ERROR); + bmqio::Status status(bmqio::StatusCategory::e_GENERIC_ERROR); PVVV_SAFE("Set channel write status to " << status << " to reject open configure request"); d_testChannel.setWriteStatus(status); @@ -1107,7 +1106,7 @@ void TestSession::openQueueWithError(bsl::shared_ptr queue, // reset channel write status PVVV_SAFE("Reset channel write status"); - d_testChannel.setWriteStatus(mwcio::Status()); + d_testChannel.setWriteStatus(bmqio::Status()); return; // RETURN } @@ -1232,7 +1231,7 @@ void TestSession::closeQueueWithError(bsl::shared_ptr queue, // configure queue request is not sent if (requestType == e_REQ_CONFIG_QUEUE && errorResult == e_ERR_NOT_SENT) { - mwcio::Status status(mwcio::StatusCategory::e_GENERIC_ERROR); + bmqio::Status status(bmqio::StatusCategory::e_GENERIC_ERROR); PVVV_SAFE(L_ << " Set channel write status to " << status << " to reject configure queue request"); d_testChannel.setWriteStatus(status); @@ -1255,7 +1254,7 @@ void TestSession::closeQueueWithError(bsl::shared_ptr queue, // reset channel write status PVVV_SAFE(L_ << " Reset channel write status"); - d_testChannel.setWriteStatus(mwcio::Status()); + d_testChannel.setWriteStatus(bmqio::Status()); PVVV_SAFE(L_ << " Verify there is no close queue request"); ASSERT(isChannelEmpty()); @@ -1303,7 +1302,7 @@ void TestSession::closeQueueWithError(bsl::shared_ptr queue, // close request is not sent if (requestType == e_REQ_CLOSE_QUEUE && errorResult == e_ERR_NOT_SENT) { - mwcio::Status status(mwcio::StatusCategory::e_GENERIC_ERROR); + bmqio::Status status(bmqio::StatusCategory::e_GENERIC_ERROR); PVVV_SAFE(L_ << " Set channel write status to " << status << " to reject close request"); d_testChannel.setWriteStatus(status); @@ -1326,7 +1325,7 @@ void TestSession::closeQueueWithError(bsl::shared_ptr queue, // reset channel write status PVVV_SAFE(L_ << " Reset channel write status"); - d_testChannel.setWriteStatus(mwcio::Status()); + d_testChannel.setWriteStatus(bmqio::Status()); return; // RETURN } @@ -1501,7 +1500,7 @@ TestSession::reopenQueueFirstStep(bsl::shared_ptr queue) bmqp_ctrlmsg::ControlMessage currentRequest(s_allocator_p); PVVV_SAFE(L_ << " Trigger channel drop"); - session().setChannel(bsl::shared_ptr()); + session().setChannel(bsl::shared_ptr()); ASSERT(waitConnectionLostEvent()); @@ -2208,7 +2207,7 @@ bool TestSession::waitForChannelClose(const bsls::TimeInterval& timeout) d_testChannel.popCloseCall(); // Invoke the close signaler - mwcio::Status status; + bmqio::Status status; onChannelClose(status); return true; @@ -2284,7 +2283,7 @@ void TestSession::stopGracefully(bool waitForDisconnected) void TestSession::setChannel() { d_brokerSession.setChannel( - bsl::shared_ptr(&d_testChannel, + bsl::shared_ptr(&d_testChannel, bslstl::SharedPtrNilDeleter())); } @@ -2388,7 +2387,7 @@ void TestSession::getOutboundEvent(bmqp::Event* rawEvent) { ASSERT(d_testChannel.waitFor(1, true, bsls::TimeInterval(1))); - mwcio::TestChannel::WriteCall wc = d_testChannel.popWriteCall(); + bmqio::TestChannel::WriteCall wc = d_testChannel.popWriteCall(); bmqp::Event ev(&wc.d_blob, s_allocator_p, true); *rawEvent = ev; @@ -2399,7 +2398,7 @@ void TestSession::getOutboundControlMessage( { ASSERT(d_testChannel.waitFor(1, true, k_EVENT_TIMEOUT)); - mwcio::TestChannel::WriteCall wc = d_testChannel.popWriteCall(); + bmqio::TestChannel::WriteCall wc = d_testChannel.popWriteCall(); bmqp::Event ev(&wc.d_blob, s_allocator_p); ASSERT(ev.isControlEvent()); @@ -2544,10 +2543,10 @@ void TestSession::verifyOpenQueueErrorResult( } } -void TestSession::onChannelClose(const mwcio::Status& status) +void TestSession::onChannelClose(const bmqio::Status& status) { PVVV_SAFE("onChannelClose: [" << status << "] Resetting the channel"); - session().setChannel(bsl::shared_ptr()); + session().setChannel(bsl::shared_ptr()); } bool TestSession::verifySessionIsStopped() @@ -2596,16 +2595,16 @@ void TestSession::verifyCloseQueueResult( } void TestSession::setChannelLowWaterMark( - mwcio::StatusCategory::Enum writeStatus) + bmqio::StatusCategory::Enum writeStatus) { channel().setWriteStatus(writeStatus); // Notify BrokerSession session().handleChannelWatermark( - mwcio::ChannelWatermarkType::e_LOW_WATERMARK); + bmqio::ChannelWatermarkType::e_LOW_WATERMARK); } -static void test_disconnectRequestErr(mwcio::StatusCategory::Enum category) +static void test_disconnectRequestErr(bmqio::StatusCategory::Enum category) { bmqt::SessionOptions sessionOptions; bdlmt::EventScheduler scheduler(bsls::SystemClockType::e_MONOTONIC, @@ -2618,7 +2617,7 @@ static void test_disconnectRequestErr(mwcio::StatusCategory::Enum category) obj.startAndConnect(); // set channel write status - mwcio::Status status(category); + bmqio::Status status(category); PVV_SAFE("Set channel write status to " << status); obj.channel().setWriteStatus(status); @@ -2722,7 +2721,7 @@ class DTTestSpan : public bmqpi::DTSpan { // PRECONDITIONS BSLS_ASSERT_SAFE(d_eventsQueue_p); - mwcu::MemOutStream event(d_allocator_p); + bmqu::MemOutStream event(d_allocator_p); event << "START " << d_operation; bmqpi::DTSpan::Baggage::const_iterator it = baggage.begin(); @@ -2735,7 +2734,7 @@ class DTTestSpan : public bmqpi::DTSpan { ~DTTestSpan() BSLS_KEYWORD_OVERRIDE { - mwcu::MemOutStream event(d_allocator_p); + bmqu::MemOutStream event(d_allocator_p); event << "END " << d_operation; d_eventsQueue_p->pushBack(event.str()); @@ -2767,7 +2766,7 @@ class DTTestTracer : public bmqpi::DTTracer { const bsl::string_view& operation, const bmqpi::DTSpan::Baggage& baggage) const BSLS_KEYWORD_OVERRIDE { - mwcu::MemOutStream operationName(d_allocator_p); + bmqu::MemOutStream operationName(d_allocator_p); operationName << operation; if (parent) { operationName << " < " << parent->operation(); @@ -2791,7 +2790,7 @@ class DTTestTracer : public bmqpi::DTTracer { static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlmt::EventScheduler scheduler(bsls::SystemClockType::e_MONOTONIC, s_allocator_p); @@ -2854,7 +2853,7 @@ static void test2_basicAccessorsTest() // - lookupQueue // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("BASIC ACCESSORS"); + bmqtst::TestHelper::printTestName("BASIC ACCESSORS"); bmqt::Uri uri(k_URI, s_allocator_p); const bmqp::QueueId k_QUEUE_ID(0, 0); @@ -2888,7 +2887,7 @@ static void test3_nullChannelTest() // // Concerns: // 1. Check the behavior of the bmqimp::BrokerSession when null -// mwcio::Channel is provided as a connection with the broker. +// bmqio::Channel is provided as a connection with the broker. // // Plan: // 1. Create bmqimp::BrokerSession object and start the session. @@ -2900,7 +2899,7 @@ static void test3_nullChannelTest() // - setChannel // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("NULL CHANNEL"); + bmqtst::TestHelper::printTestName("NULL CHANNEL"); const int k_NUM_EVENTS = 3; bdlbb::PooledBlobBufferFactory blobBufferFactory(1024, s_allocator_p); @@ -2930,7 +2929,7 @@ static void test3_nullChannelTest() ASSERT_EQ(obj.isUsingSessionEventHandler(), true); // Should not emit CONNECTION_LOST - obj.setChannel(bsl::shared_ptr()); + obj.setChannel(bsl::shared_ptr()); // Stop without previous start is ok. DISCONNECTED will not be delivered // to the user but still stateCb will be called @@ -2951,13 +2950,13 @@ static void test3_nullChannelTest() PVV_SAFE("Resetting channel..."); // Expect no CONNECTION_LOST events if a valid channel is never being set for (int i = 0; i < k_NUM_EVENTS; i++) { - obj.setChannel(bsl::shared_ptr()); + obj.setChannel(bsl::shared_ptr()); } // Expect one stop callback due to STARTING->STOPPED transition resulting // in stopCounter == 2 which we will check at the end. - rc = eventSemaphore.timedWait(mwcsys::Time::nowRealtimeClock() + + rc = eventSemaphore.timedWait(bmqsys::Time::nowRealtimeClock() + bsls::TimeInterval(0.1)); // Timeout since there are no events @@ -2990,7 +2989,7 @@ static void test4_createEventTest() // - createEvent // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("CREATE EVENT TEST"); + bmqtst::TestHelper::printTestName("CREATE EVENT TEST"); bdlmt::EventScheduler scheduler(bsls::SystemClockType::e_MONOTONIC, s_allocator_p); @@ -3192,7 +3191,7 @@ static void test5_queueErrorsTest() // - closeQueueAsync // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("QUEUE ERRORS TEST"); + bmqtst::TestHelper::printTestName("QUEUE ERRORS TEST"); PVV_SAFE("Check READER"); queueErrorsTest(bmqt::QueueFlags::e_READ); @@ -3214,9 +3213,9 @@ static void test6_setChannelTest() // // Concerns: // 1. Check the behavior of the bmqimp::BrokerSession when a valid -// mwcio::Channel is provided as a connection with the broker. +// bmqio::Channel is provided as a connection with the broker. // 2. Check the behavior of the bmqimp::BrokerSession when a null -// mwcio::Channel is provided as a connection with the broker. +// bmqio::Channel is provided as a connection with the broker. // // Plan: // 1. Create bmqimp::BrokerSession object and start the session. @@ -3233,7 +3232,7 @@ static void test6_setChannelTest() // - setChannel // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("SET CHANNEL"); + bmqtst::TestHelper::printTestName("SET CHANNEL"); // We are going to start the session and in cycle set and reset the channel // for k_NUM_CALLS times. We expect two events on the first iteration: @@ -3250,7 +3249,7 @@ static void test6_setChannelTest() bsls::AtomicInt eventCounter(0); bsls::AtomicInt startCounter(0); bsls::AtomicInt stopCounter(0); - mwcio::TestChannel testChannel(s_allocator_p); + bmqio::TestChannel testChannel(s_allocator_p); bslmt::TimedSemaphore eventSemaphore; bdlmt::EventScheduler scheduler(bsls::SystemClockType::e_MONOTONIC, @@ -3282,9 +3281,9 @@ static void test6_setChannelTest() for (int i = 0; i < k_NUM_CALLS; i++) { obj.setChannel( - bsl::shared_ptr(&testChannel, + bsl::shared_ptr(&testChannel, bslstl::SharedPtrNilDeleter())); - obj.setChannel(bsl::shared_ptr()); + obj.setChannel(bsl::shared_ptr()); } PVV_SAFE("Stopping session..."); @@ -3344,7 +3343,7 @@ static void queueOpenTimeoutTest(bsls::Types::Uint64 queueFlags) PVV_SAFE("Step 5. Reset the channel to make the queue CLOSED"); // Reset channel to force closing of the expired queue - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); ASSERT(obj.waitForQueueState(pQueue, bmqimp::QueueState::e_CLOSED)); @@ -3428,7 +3427,7 @@ static void test7_queueOpenTimeoutTest() // - openQueueAsync // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("QUEUE OPEN TIMEOUT TEST"); + bmqtst::TestHelper::printTestName("QUEUE OPEN TIMEOUT TEST"); PVV_SAFE("Check READER"); queueOpenTimeoutTest(bmqt::QueueFlags::e_READ); @@ -3455,7 +3454,7 @@ static void test8_queueWriterConfigureTest() // // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("QUEUE WRITER CONFIGURE TEST"); + bmqtst::TestHelper::printTestName("QUEUE WRITER CONFIGURE TEST"); const bsls::TimeInterval timeout = bsls::TimeInterval(15); bmqt::SessionOptions sessionOptions; @@ -3543,7 +3542,7 @@ static void test8_queueWriterConfigureTest() static void queueOpenErrorTest(bsls::Types::Uint64 queueFlags) { - mwctst::TestHelper::printTestName("QUEUE OPEN ERROR TEST"); + bmqtst::TestHelper::printTestName("QUEUE OPEN ERROR TEST"); const bsls::TimeInterval timeout = bsls::TimeInterval(15); bmqt::SessionOptions sessionOptions; @@ -3662,7 +3661,7 @@ static void test9_queueOpenErrorTest() // - openQueueAsync // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("QUEUE OPEN ERROR TEST"); + bmqtst::TestHelper::printTestName("QUEUE OPEN ERROR TEST"); PVV_SAFE("Check READER"); queueOpenErrorTest(bmqt::QueueFlags::e_READ); @@ -3848,7 +3847,7 @@ static void test10_queueOpenCloseAsync() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("ASYNC OPEN/CLOSE QUEUE TEST"); + bmqtst::TestHelper::printTestName("ASYNC OPEN/CLOSE QUEUE TEST"); PVV_SAFE("Check READER"); queueOpenCloseAsync(bmqt::QueueFlags::e_READ); @@ -3870,7 +3869,7 @@ static void test11_disconnect() // // Concerns: // 1. Check the behavior of the bmqimp::BrokerSession when a valid -// mwcio::Channel is provided as a connection with the broker. When +// bmqio::Channel is provided as a connection with the broker. When // is being stopped it should properly send disconnect message to the // broker, receive a response and generate DISCONNECTED event. If // user is using event handler, a single DISCONNECTED event should be @@ -3891,7 +3890,7 @@ static void test11_disconnect() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DISCONNECT"); + bmqtst::TestHelper::printTestName("DISCONNECT"); bdlmt::EventScheduler scheduler(bsls::SystemClockType::e_MONOTONIC, s_allocator_p); @@ -3899,7 +3898,7 @@ static void test11_disconnect() bdlcc::Deque > eventQueue( bsls::SystemClockType::e_MONOTONIC, s_allocator_p); - mwcio::TestChannel testChannel(s_allocator_p); + bmqio::TestChannel testChannel(s_allocator_p); bsls::AtomicInt startCounter(0); bsls::AtomicInt stopCounter(0); @@ -3940,13 +3939,13 @@ static void test11_disconnect() // Set channel obj.setChannel( - bsl::shared_ptr(&testChannel, + bsl::shared_ptr(&testChannel, bslstl::SharedPtrNilDeleter())); PVV_SAFE("Waiting CONNECTED event..."); bsl::shared_ptr event; rc = eventQueue.timedPopFront(&event, - mwcsys::Time::nowMonotonicClock() + + bmqsys::Time::nowMonotonicClock() + bsls::TimeInterval(5)); ASSERT_EQ(rc, 0); ASSERT_EQ(event->statusCode(), 0); @@ -3961,14 +3960,14 @@ static void test11_disconnect() // Ensure no event is yet emitted to the user event.reset(); eventQueue.timedPopFront(&event, - mwcsys::Time::nowMonotonicClock() + + bmqsys::Time::nowMonotonicClock() + bsls::TimeInterval(0.1)); ASSERT(!event); PVV_SAFE("Ensure a disconnectMessage was sent to the broker"); bmqp_ctrlmsg::ControlMessage disconnectMessage(s_allocator_p); ASSERT(testChannel.waitFor(1, true, bsls::TimeInterval(5))); - mwcio::TestChannel::WriteCall wc = testChannel.popWriteCall(); + bmqio::TestChannel::WriteCall wc = testChannel.popWriteCall(); bmqp::Event ev(&wc.d_blob, s_allocator_p); ASSERT(ev.isControlEvent()); @@ -3989,11 +3988,11 @@ static void test11_disconnect() obj.processPacket(builder.blob()); // Reset the channel - obj.setChannel(bsl::shared_ptr()); + obj.setChannel(bsl::shared_ptr()); PVV_SAFE("Verify the user receives the DISCONNECTED event"); rc = eventQueue.timedPopFront(&event, - mwcsys::Time::nowMonotonicClock() + + bmqsys::Time::nowMonotonicClock() + bsls::TimeInterval(5)); ASSERT_EQ(rc, 0); ASSERT_EQ(event->statusCode(), 0); @@ -4003,7 +4002,7 @@ static void test11_disconnect() // Ensure no more events are delivered to the user event.reset(); eventQueue.timedPopFront(&event, - mwcsys::Time::nowMonotonicClock() + + bmqsys::Time::nowMonotonicClock() + bsls::TimeInterval(0.1)); ASSERT(!event); @@ -4040,7 +4039,7 @@ static void test11_disconnect() // Set channel obj.setChannel( - bsl::shared_ptr(&testChannel, + bsl::shared_ptr(&testChannel, bslstl::SharedPtrNilDeleter())); PVV_SAFE("Waiting CONNECTED event..."); @@ -4065,7 +4064,7 @@ static void test11_disconnect() PVV_SAFE("Ensure a disconnectMessage was sent to the broker"); bmqp_ctrlmsg::ControlMessage disconnectMessage(s_allocator_p); ASSERT(testChannel.waitFor(1, true, bsls::TimeInterval(5))); - mwcio::TestChannel::WriteCall wc = testChannel.popWriteCall(); + bmqio::TestChannel::WriteCall wc = testChannel.popWriteCall(); bmqp::Event ev(&wc.d_blob, s_allocator_p); ASSERT(ev.isControlEvent()); @@ -4086,7 +4085,7 @@ static void test11_disconnect() obj.processPacket(builder.blob()); // Reset the channel - obj.setChannel(bsl::shared_ptr()); + obj.setChannel(bsl::shared_ptr()); PVV_SAFE("Verify the user receives a DISCONNECTED event"); // Since we are using next event, we should 'infinitely' pop out @@ -4114,7 +4113,7 @@ static void test12_disconnectStatus() // // Concerns: // 1. Check the behavior of the bmqimp::BrokerSession when a valid -// mwcio::Channel is provided as a connection with the broker. +// bmqio::Channel is provided as a connection with the broker. // When is being stopped it should properly send disconnect message // to the broker, but there will be an unknown status message response // which should not break the process @@ -4132,7 +4131,7 @@ static void test12_disconnectStatus() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DISCONNECT STATUS MESSAGE"); + bmqtst::TestHelper::printTestName("DISCONNECT STATUS MESSAGE"); bdlmt::EventScheduler scheduler(bsls::SystemClockType::e_MONOTONIC, s_allocator_p); @@ -4176,7 +4175,7 @@ static void test13_disconnectTimeout() // // Concerns: // 1. Check the behavior of the bmqimp::BrokerSession when a valid -// mwcio::Channel is provided as a connection with the broker. +// bmqio::Channel is provided as a connection with the broker. // When is being stopped it should properly send disconnect message // to the broker, but there will be no response, timeout handler // should be called and the session should be stopped. @@ -4194,7 +4193,7 @@ static void test13_disconnectTimeout() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DISCONNECT TIMEOUT"); + bmqtst::TestHelper::printTestName("DISCONNECT TIMEOUT"); const bsls::TimeInterval timeout = bsls::TimeInterval(5); bmqt::SessionOptions sessionOptions; @@ -4231,7 +4230,7 @@ static void test14_disconnectRequestGenericErr() // // Concerns: // 1. Check the behavior of the bmqimp::BrokerSession when a valid -// mwcio::Channel is provided as a connection with the broker. +// bmqio::Channel is provided as a connection with the broker. // When is being stopped it should fail to send disconnect message // to the broker due to generic error, but this should not break // the process and the session should be successfully stopped @@ -4249,8 +4248,8 @@ static void test14_disconnectRequestGenericErr() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DISCONNECT FAILED REQUEST (GENERIC)"); - test_disconnectRequestErr(mwcio::StatusCategory::e_GENERIC_ERROR); + bmqtst::TestHelper::printTestName("DISCONNECT FAILED REQUEST (GENERIC)"); + test_disconnectRequestErr(bmqio::StatusCategory::e_GENERIC_ERROR); } static void test15_disconnectRequestConnection() @@ -4259,7 +4258,7 @@ static void test15_disconnectRequestConnection() // // Concerns: // 1. Check the behavior of the bmqimp::BrokerSession when a valid -// mwcio::Channel is provided as a connection with the broker. +// bmqio::Channel is provided as a connection with the broker. // When is being stopped it should fail to send disconnect message // to the broker due to connection problems, but this should not break // the process and the session should be successfully stopped @@ -4277,9 +4276,9 @@ static void test15_disconnectRequestConnection() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "DISCONNECT FAILED REQUEST (CONNECTION)"); - test_disconnectRequestErr(mwcio::StatusCategory::e_CONNECTION); + test_disconnectRequestErr(bmqio::StatusCategory::e_CONNECTION); } static void test16_disconnectRequestTimeout() @@ -4288,7 +4287,7 @@ static void test16_disconnectRequestTimeout() // // Concerns: // 1. Check the behavior of the bmqimp::BrokerSession when a valid -// mwcio::Channel is provided as a connection with the broker. +// bmqio::Channel is provided as a connection with the broker. // When is being stopped it should fail to send disconnect message // to the broker due to timeout, but this should not break // the process and the session should be successfully stopped @@ -4306,8 +4305,8 @@ static void test16_disconnectRequestTimeout() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DISCONNECT FAILED REQUEST (TIMEOUT)"); - test_disconnectRequestErr(mwcio::StatusCategory::e_TIMEOUT); + bmqtst::TestHelper::printTestName("DISCONNECT FAILED REQUEST (TIMEOUT)"); + test_disconnectRequestErr(bmqio::StatusCategory::e_TIMEOUT); } static void test17_disconnectRequestCanceled() @@ -4316,7 +4315,7 @@ static void test17_disconnectRequestCanceled() // // Concerns: // 1. Check the behavior of the bmqimp::BrokerSession when a valid -// mwcio::Channel is provided as a connection with the broker. +// bmqio::Channel is provided as a connection with the broker. // When is being stopped it should fail to send disconnect message // to the broker due to canceled request, but this should not break // the process and the session should be successfully stopped @@ -4334,8 +4333,8 @@ static void test17_disconnectRequestCanceled() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DISCONNECT FAILED REQUEST (CANCELED)"); - test_disconnectRequestErr(mwcio::StatusCategory::e_CANCELED); + bmqtst::TestHelper::printTestName("DISCONNECT FAILED REQUEST (CANCELED)"); + test_disconnectRequestErr(bmqio::StatusCategory::e_CANCELED); } static void test18_disconnectRequestLimit() @@ -4344,7 +4343,7 @@ static void test18_disconnectRequestLimit() // // Concerns: // 1. Check the behavior of the bmqimp::BrokerSession when a valid -// mwcio::Channel is provided as a connection with the broker. +// bmqio::Channel is provided as a connection with the broker. // When is being stopped it should fail to send disconnect message // to the broker due to busy channel, but this should not break // the process and the session should be successfully stopped @@ -4362,13 +4361,13 @@ static void test18_disconnectRequestLimit() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DISCONNECT FAILED REQUEST (LIMIT)"); - test_disconnectRequestErr(mwcio::StatusCategory::e_LIMIT); + bmqtst::TestHelper::printTestName("DISCONNECT FAILED REQUEST (LIMIT)"); + test_disconnectRequestErr(bmqio::StatusCategory::e_LIMIT); } static void lateOpenQueueResponse(bsls::Types::Uint64 queueFlags) { - mwctst::TestHelper::printTestName("QUEUE LATE OPEN RESPONSE TEST"); + bmqtst::TestHelper::printTestName("QUEUE LATE OPEN RESPONSE TEST"); const bsls::TimeInterval timeout = bsls::TimeInterval(15); bmqt::SessionOptions sessionOptions; @@ -4452,7 +4451,7 @@ static void test19_queueOpen_LateOpenQueueResponse() // - openQueueAsync // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("QUEUE LATE OPEN RESPONSE TEST"); + bmqtst::TestHelper::printTestName("QUEUE LATE OPEN RESPONSE TEST"); PVV_SAFE("Check READER"); lateOpenQueueResponse(bmqt::QueueFlags::e_READ); @@ -4489,7 +4488,7 @@ static void test20_queueOpen_LateConfigureQueueResponse() // - openQueueAsync // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("QUEUE LATE CONFIGURE RESPONSE TEST"); + bmqtst::TestHelper::printTestName("QUEUE LATE CONFIGURE RESPONSE TEST"); bmqt::Uri uri(k_URI, s_allocator_p); const bsls::TimeInterval timeout = bsls::TimeInterval(15); @@ -4595,7 +4594,7 @@ static void test21_post_Limit() // - post //------------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("POST CHANNEL LIMIT TEST"); + bmqtst::TestHelper::printTestName("POST CHANNEL LIMIT TEST"); const bsls::TimeInterval timeout = bsls::TimeInterval(15); const bsls::TimeInterval postTimeout = bsls::TimeInterval(0.1); @@ -4619,7 +4618,7 @@ static void test21_post_Limit() obj.openQueue(pQueue, timeout); PVV_SAFE("Step 3. Set the channel to return e_LIMIT on write"); - obj.channel().setWriteStatus(mwcio::StatusCategory::e_LIMIT); + obj.channel().setWriteStatus(bmqio::StatusCategory::e_LIMIT); PVV_SAFE("Step 4. Create and post PUT message"); bmqp::Crc32c::initialize(); @@ -4656,10 +4655,10 @@ static void test21_post_Limit() PVV_SAFE("Step 7. Schedule LWM and post PUT again"); scheduler.scheduleEvent( - mwcsys::Time::nowMonotonicClock() + postTimeout, + bmqsys::Time::nowMonotonicClock() + postTimeout, bdlf::BindUtil::bind(&TestSession::setChannelLowWaterMark, &obj, - mwcio::StatusCategory::e_SUCCESS)); + bmqio::StatusCategory::e_SUCCESS)); // Call post with a bigger timeout so that LWM event arrives before it // expires. @@ -4681,7 +4680,7 @@ static void test21_post_Limit() ASSERT_EQ(obj.channel().writeCalls().size(), 0u); PVV_SAFE("Step 9. Set the channel to return e_GENERIC_ERROR on write"); - obj.channel().setWriteStatus(mwcio::StatusCategory::e_GENERIC_ERROR); + obj.channel().setWriteStatus(bmqio::StatusCategory::e_GENERIC_ERROR); rc = obj.session().post(builder.blob(), postTimeout); @@ -4698,7 +4697,7 @@ static void test21_post_Limit() ASSERT_EQ(obj.channel().closeCalls().size(), 1u); // Set write status back to e_SUCCESS - obj.channel().setWriteStatus(mwcio::StatusCategory::e_SUCCESS); + obj.channel().setWriteStatus(bmqio::StatusCategory::e_SUCCESS); PV_SAFE("Step 11. Stop the session"); obj.stopGracefully(); @@ -4732,7 +4731,7 @@ static void test22_confirm_Limit() // - confirmMessages //------------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("CONFIRM MESSAGES CHANNEL LIMIT TEST"); + bmqtst::TestHelper::printTestName("CONFIRM MESSAGES CHANNEL LIMIT TEST"); const bsls::TimeInterval timeout = bsls::TimeInterval(15); const bsls::TimeInterval confirmTimeout = bsls::TimeInterval(0.1); @@ -4755,7 +4754,7 @@ static void test22_confirm_Limit() obj.openQueue(pQueue, timeout); PVV_SAFE("Step 3. Set the channel to return e_LIMIT on write"); - obj.channel().setWriteStatus(mwcio::StatusCategory::e_LIMIT); + obj.channel().setWriteStatus(bmqio::StatusCategory::e_LIMIT); PVV_SAFE("Step 4. Create the blob and confirm messages"); bmqp::ConfirmEventBuilder builder(&obj.blobBufferFactory(), @@ -4783,10 +4782,10 @@ static void test22_confirm_Limit() // LWM handler will set write status to e_SUCCESS scheduler.scheduleEvent( - mwcsys::Time::nowMonotonicClock() + confirmTimeout, + bmqsys::Time::nowMonotonicClock() + confirmTimeout, bdlf::BindUtil::bind(&TestSession::setChannelLowWaterMark, &obj, - mwcio::StatusCategory::e_SUCCESS)); + bmqio::StatusCategory::e_SUCCESS)); // Call confirm with a bigger timeout so that LWM event arrives before it // expires. @@ -4806,7 +4805,7 @@ static void test22_confirm_Limit() obj.channel().writeCalls().clear(); PVV_SAFE("Step 8. Set the channel to return e_GENERIC_ERROR on write"); - obj.channel().setWriteStatus(mwcio::StatusCategory::e_GENERIC_ERROR); + obj.channel().setWriteStatus(bmqio::StatusCategory::e_GENERIC_ERROR); rc = obj.session().confirmMessages(builder.blob(), confirmTimeout); @@ -4822,7 +4821,7 @@ static void test22_confirm_Limit() obj.channel().writeCalls().clear(); // Set write status back to e_SUCCESS - obj.channel().setWriteStatus(mwcio::StatusCategory::e_SUCCESS); + obj.channel().setWriteStatus(bmqio::StatusCategory::e_SUCCESS); PV_SAFE("Step 10. Stop the session"); obj.stopGracefully(); @@ -4830,7 +4829,7 @@ static void test22_confirm_Limit() static void queueCloseSync(bsls::Types::Uint64 queueFlags) { - mwctst::TestHelper::printTestName("SYNC CLOSE QUEUE TEST"); + bmqtst::TestHelper::printTestName("SYNC CLOSE QUEUE TEST"); const bsls::TimeInterval timeout = bsls::TimeInterval(500); bmqt::SessionOptions sessionOptions; @@ -4856,7 +4855,7 @@ static void queueCloseSync(bsls::Types::Uint64 queueFlags) obj.openQueue(pQueue, timeout); PVV_SAFE("Step 3. Trigger channel drop"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -4908,7 +4907,7 @@ static void test23_queueCloseSync() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("SYNC CLOSE QUEUE TEST"); + bmqtst::TestHelper::printTestName("SYNC CLOSE QUEUE TEST"); PVV_SAFE("Check READER"); queueCloseSync(bmqt::QueueFlags::e_READ); @@ -4958,7 +4957,7 @@ queueAsyncCanceled(int lineNum, obj.createQueueOnStep(queueTestStep, queueFlags, timeout); PVV_SAFE(lineNum << ": Step 3. Trigger channel drop"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); PVV_SAFE(lineNum << ": Step 4. Waiting queue operation result" << " STATE_RESTORED and CONNECTION_LOST events"); @@ -5594,7 +5593,7 @@ static void test24_queueAsyncCanceled1() // - closeQueueAsync // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("QUEUE ASYNC CANCELED TEST 1"); + bmqtst::TestHelper::printTestName("QUEUE ASYNC CANCELED TEST 1"); queueAsyncCanceled_OPEN_OPENING(); @@ -5621,7 +5620,7 @@ static void test25_sessionFsmTable() // - onStartTimeout // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("SESSION FSM TRANSITION TABLE TEST"); + bmqtst::TestHelper::printTestName("SESSION FSM TRANSITION TABLE TEST"); bdlmt::EventScheduler scheduler(bsls::SystemClockType::e_MONOTONIC, s_allocator_p); @@ -5642,7 +5641,7 @@ static void test25_sessionFsmTable() bslmt::TimedSemaphore doneSemaphore; bsls::AtomicInt tcpRc(0); - mwcio::TestChannel testChannel(s_allocator_p); + bmqio::TestChannel testChannel(s_allocator_p); testChannel.setPeerUri("tcp://testHost:1234"); // for better logging bmqimp::BrokerSession obj( @@ -5682,7 +5681,7 @@ static void test25_sessionFsmTable() // Reset the channel // STARTING -> STOPPED - obj.setChannel(bsl::shared_ptr()); + obj.setChannel(bsl::shared_ptr()); } { @@ -5716,7 +5715,7 @@ static void test25_sessionFsmTable() // Set valid channel // STARTING -> STARTED obj.setChannel( - bsl::shared_ptr(&testChannel, + bsl::shared_ptr(&testChannel, bslstl::SharedPtrNilDeleter())); // STARTED -> STARTED @@ -5725,28 +5724,28 @@ static void test25_sessionFsmTable() // Reset the channel // STARTING -> RECONNECTING - obj.setChannel(bsl::shared_ptr()); + obj.setChannel(bsl::shared_ptr()); // Set valid channel // RECONNECTING -> STARTED obj.setChannel( - bsl::shared_ptr(&testChannel, + bsl::shared_ptr(&testChannel, bslstl::SharedPtrNilDeleter())); // Generate error on disconnect request - testChannel.setWriteStatus(mwcio::StatusCategory::e_CANCELED); + testChannel.setWriteStatus(bmqio::StatusCategory::e_CANCELED); // STARTED -> CLOSING_SESSION // CLOSING_SESSION -> CLOSING_CHANNEL obj.stopAsync(); // Reset the channel // CLOSING_CHANNEL -> STOPPED - obj.setChannel(bsl::shared_ptr()); + obj.setChannel(bsl::shared_ptr()); } { // Make channel writeable - testChannel.setWriteStatus(mwcio::StatusCategory::e_SUCCESS); + testChannel.setWriteStatus(bmqio::StatusCategory::e_SUCCESS); // STOPPED -> STARTING int rc = obj.startAsync(); @@ -5755,12 +5754,12 @@ static void test25_sessionFsmTable() // Set valid channel // STARTING -> STARTED obj.setChannel( - bsl::shared_ptr(&testChannel, + bsl::shared_ptr(&testChannel, bslstl::SharedPtrNilDeleter())); // Reset the channel // STARTING -> RECONNECTING - obj.setChannel(bsl::shared_ptr()); + obj.setChannel(bsl::shared_ptr()); // RECONNECTING -> CLOSING_CHANNEL // CLOSING_CHANNEL -> STOPPED @@ -5775,7 +5774,7 @@ static void test25_sessionFsmTable() // Set valid channel // STARTING -> STARTED obj.setChannel( - bsl::shared_ptr(&testChannel, + bsl::shared_ptr(&testChannel, bslstl::SharedPtrNilDeleter())); // STARTED -> CLOSING_SESSION obj.stopAsync(); @@ -5783,7 +5782,7 @@ static void test25_sessionFsmTable() // Reset the channel // CLOSING_SESSION -> CLOSING_CHANNEL // CLOSING_CHANNEL -> STOPPED - obj.setChannel(bsl::shared_ptr()); + obj.setChannel(bsl::shared_ptr()); } { @@ -5808,7 +5807,7 @@ static void test25_sessionFsmTable() // Set valid channel // STARTING -> STARTED obj.setChannel( - bsl::shared_ptr(&testChannel, + bsl::shared_ptr(&testChannel, bslstl::SharedPtrNilDeleter())); // STARTED -> STARTED @@ -5821,7 +5820,7 @@ static void test25_sessionFsmTable() // Reset the channel // CLOSING_CHANNEL -> STOPPED - obj.setChannel(bsl::shared_ptr()); + obj.setChannel(bsl::shared_ptr()); } { @@ -5832,12 +5831,12 @@ static void test25_sessionFsmTable() // Set valid channel // STARTING -> STARTED obj.setChannel( - bsl::shared_ptr(&testChannel, + bsl::shared_ptr(&testChannel, bslstl::SharedPtrNilDeleter())); // Reset the channel // STARTING -> RECONNECTING - obj.setChannel(bsl::shared_ptr()); + obj.setChannel(bsl::shared_ptr()); monitor->setState(bmqt::HostHealthState::e_UNHEALTHY); monitor->setState(bmqt::HostHealthState::e_HEALTHY); @@ -5845,18 +5844,18 @@ static void test25_sessionFsmTable() // Set valid channel // RECONNECTING -> STARTED obj.setChannel( - bsl::shared_ptr(&testChannel, + bsl::shared_ptr(&testChannel, bslstl::SharedPtrNilDeleter())); // Generate error on disconnect request - testChannel.setWriteStatus(mwcio::StatusCategory::e_CANCELED); + testChannel.setWriteStatus(bmqio::StatusCategory::e_CANCELED); // STARTED -> CLOSING_SESSION // CLOSING_SESSION -> CLOSING_CHANNEL obj.stopAsync(); // Reset the channel // CLOSING_CHANNEL -> STOPPED - obj.setChannel(bsl::shared_ptr()); + obj.setChannel(bsl::shared_ptr()); } PVV_SAFE("Waiting for empty transition table"); @@ -5962,7 +5961,7 @@ static void test27_openCloseMultipleSubqueuesWithErrors() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "OPEN CLOSE MULTIPLE SUBQUEUES WITH ERRORS TEST"); const bsls::TimeInterval timeout = bsls::TimeInterval(15); @@ -6184,7 +6183,7 @@ queueLateAsyncCanceled(int testId, timeout); PVV_SAFE(testId << ": Step 3. Trigger channel drop"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); PVV_SAFE(testId << ": Step 4. Waiting queue operation result" << " STATE_RESTORED and CONNECTION_LOST events"); @@ -6255,7 +6254,7 @@ static void test28_queueLateAsyncCanceledReader1() // - closeQueueAsync // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED READER TEST 1"); queueLateAsyncCanceled(L_, @@ -6292,7 +6291,7 @@ static void test29_queueLateAsyncCanceledWriter1() // - closeQueueAsync // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED WRITER TEST 1"); queueLateAsyncCanceled(L_, @@ -6329,7 +6328,7 @@ static void test30_queueLateAsyncCanceledHybrid1() // - closeQueueAsync // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED HYBRID TEST 1"); bsls::Types::Uint64 flags = 0; @@ -6412,7 +6411,7 @@ static void test31_queueDoubleOpenUri() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("QUEUE DOUBLE OPEN URI TEST"); + bmqtst::TestHelper::printTestName("QUEUE DOUBLE OPEN URI TEST"); PVV_SAFE("Check READER"); queueDoubleOpenUri(bmqt::QueueFlags::e_READ); @@ -6500,7 +6499,7 @@ static void test32_queueDoubleOpenCorrelationId() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("QUEUE DOUBLE OPEN CORRELATION ID TEST"); + bmqtst::TestHelper::printTestName("QUEUE DOUBLE OPEN CORRELATION ID TEST"); PVV_SAFE("Check READER"); queueDoubleOpenCorrelationId(bmqt::QueueFlags::e_READ); @@ -6541,7 +6540,7 @@ static void test33_queueNackTest() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("QUEUE NACK TEST"); + bmqtst::TestHelper::printTestName("QUEUE NACK TEST"); const char* k_PAYLOAD = "abcdefghijklmnopqrstuvwxyz"; const int k_PAYLOAD_LEN = bsl::strlen(k_PAYLOAD); @@ -6607,7 +6606,7 @@ static void test33_queueNackTest() ASSERT(rawEvent.isPutEvent()); PVV_SAFE("Step 5. Trigger channel drop and verify no NACK event is sent"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -6629,7 +6628,7 @@ static void test33_queueNackTest() PVV_SAFE("Step 8. Trigger channel drop, close the queue and verify NACK " "event"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -6664,7 +6663,7 @@ static void test33_queueNackTest() static void reopenError(bsls::Types::Uint64 queueFlags) { - mwctst::TestHelper::printTestName("REOPEN ERROR TEST"); + bmqtst::TestHelper::printTestName("REOPEN ERROR TEST"); const bsls::TimeInterval timeout = bsls::TimeInterval(15); bmqt::SessionOptions sessionOptions; @@ -6689,7 +6688,7 @@ static void reopenError(bsls::Types::Uint64 queueFlags) obj.openQueue(queue); PVV_SAFE("Step 4. Reset the channel"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -6697,7 +6696,7 @@ static void reopenError(bsls::Types::Uint64 queueFlags) ASSERT(queue->isValid()); // Set write error condition - obj.channel().setWriteStatus(mwcio::StatusCategory::e_GENERIC_ERROR); + obj.channel().setWriteStatus(bmqio::StatusCategory::e_GENERIC_ERROR); // Restore the connection obj.setChannel(); @@ -6717,7 +6716,7 @@ static void reopenError(bsls::Types::Uint64 queueFlags) ASSERT(obj.waitForQueueRemoved(queue, timeout)); // Set normal write status - obj.channel().setWriteStatus(mwcio::StatusCategory::e_SUCCESS); + obj.channel().setWriteStatus(bmqio::StatusCategory::e_SUCCESS); } PVV_SAFE("Step 7. Check reopen 2st part error"); @@ -6726,7 +6725,7 @@ static void reopenError(bsls::Types::Uint64 queueFlags) obj.openQueue(queue); PVV_SAFE("Step 9. Reset the channel"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -6743,7 +6742,7 @@ static void reopenError(bsls::Types::Uint64 queueFlags) TestSession::e_REQ_OPEN_QUEUE); // Set write error condition - obj.channel().setWriteStatus(mwcio::StatusCategory::e_GENERIC_ERROR); + obj.channel().setWriteStatus(bmqio::StatusCategory::e_GENERIC_ERROR); PVV_SAFE("Step 11. Send reopen response"); obj.sendResponse(request); @@ -6776,7 +6775,7 @@ static void reopenError(bsls::Types::Uint64 queueFlags) } // Set normal write status - obj.channel().setWriteStatus(mwcio::StatusCategory::e_SUCCESS); + obj.channel().setWriteStatus(bmqio::StatusCategory::e_SUCCESS); } PVV_SAFE("Step 14. Stop the session"); @@ -6807,7 +6806,7 @@ static void test34_reopenError() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("REOPEN ERROR TEST"); + bmqtst::TestHelper::printTestName("REOPEN ERROR TEST"); PVV_SAFE("Check READER"); reopenError(bmqt::QueueFlags::e_READ); @@ -6858,7 +6857,7 @@ static void test35_hostHealthMonitoring() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HOST HEALTH MONITORING TEST"); + bmqtst::TestHelper::printTestName("HOST HEALTH MONITORING TEST"); ManualHostHealthMonitor* monitor = new (*s_allocator_p) ManualHostHealthMonitor(bmqt::HostHealthState::e_HEALTHY, @@ -7065,7 +7064,7 @@ static void test36_closingAfterConfigTimeout() // - stop // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLOSING AFTER CONFIGURE TIMEOUT TEST"); + bmqtst::TestHelper::printTestName("CLOSING AFTER CONFIGURE TIMEOUT TEST"); const bsls::TimeInterval timeout = bsls::TimeInterval(15); bmqt::QueueOptions queueOptions; @@ -7166,7 +7165,7 @@ static void test37_closingPendingConfig() // - stop // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLOSING WHILE PENDING CONFIGURE TEST"); + bmqtst::TestHelper::printTestName("CLOSING WHILE PENDING CONFIGURE TEST"); const bsls::TimeInterval timeout = bsls::TimeInterval(15); bmqt::QueueOptions queueOptions; @@ -7551,7 +7550,7 @@ static void test38_syncOpenConfigureCloseWithHandler() // - stop // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SYNC API WITH HANDLER TEST"); + bmqtst::TestHelper::printTestName("SYNC API WITH HANDLER TEST"); test_syncOpenConfigureClose(true); } @@ -7580,7 +7579,7 @@ static void test39_syncOpenConfigureCloseWithoutHandler() // - stop // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SYNC API WITHOUT HANDLER TEST"); + bmqtst::TestHelper::printTestName("SYNC API WITHOUT HANDLER TEST"); test_syncOpenConfigureClose(false); } @@ -7611,7 +7610,7 @@ static void test40_syncCalledFromEventHandler() // - stop // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "SYNC API CALLED FROM EVENT HANDLER TEST"); bmqt::Uri uri(k_URI, s_allocator_p); @@ -7709,7 +7708,7 @@ static void test41_asyncOpenConfigureCloseWithHandler() // - stop // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ASYNC API WITH HANDLER TEST"); + bmqtst::TestHelper::printTestName("ASYNC API WITH HANDLER TEST"); test_asyncOpenConfigureClose(true); } @@ -7739,7 +7738,7 @@ static void test42_asyncOpenConfigureCloseWithoutHandler() // - stop // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ASYNC API WITHOUT HANDLER TEST"); + bmqtst::TestHelper::printTestName("ASYNC API WITHOUT HANDLER TEST"); test_asyncOpenConfigureClose(false); } @@ -7777,7 +7776,7 @@ static void test43_hostHealthMonitoringErrors() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HOST HEALTH MONITORING ERRORS TEST"); + bmqtst::TestHelper::printTestName("HOST HEALTH MONITORING ERRORS TEST"); ManualHostHealthMonitor* monitor = new (*s_allocator_p) ManualHostHealthMonitor(bmqt::HostHealthState::e_HEALTHY, @@ -8036,7 +8035,7 @@ static void test44_hostHealthMonitoringMultipleQueues() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "HOST HEALTH MONITORING MULTIPLE QUEUES TEST"); ManualHostHealthMonitor* monitor = new (*s_allocator_p) @@ -8203,7 +8202,7 @@ static void test45_hostHealthMonitoringPendingStandalone() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "HOST HEALTH MONITORING PENDING STANDALONE TEST"); ManualHostHealthMonitor* monitor = new (*s_allocator_p) @@ -8320,7 +8319,7 @@ static void test46_hostHealthMonitoringDeferredResumeClose() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "HOST HEALTH MONITORING DEFERRED SUSPEND RESUME TEST"); ManualHostHealthMonitor* monitor = new (*s_allocator_p) @@ -8467,7 +8466,7 @@ static void test47_configureMergesQueueOptions() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CONFIGURE MERGED QUEUE OPTIONS TEST"); + bmqtst::TestHelper::printTestName("CONFIGURE MERGED QUEUE OPTIONS TEST"); bdlmt::EventScheduler scheduler(bsls::SystemClockType::e_MONOTONIC, s_allocator_p); @@ -8563,7 +8562,7 @@ static void test48_hostHealthSensitivityReconfiguration() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "HOST HEALTH SENSITIVITY RECONFIGURATION TEST"); ManualHostHealthMonitor* monitor = new (*s_allocator_p) @@ -8735,7 +8734,7 @@ static void test49_controlsBuffering() // - handleChannelWatermark //------------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("CONTROLS BUFFERING TEST"); + bmqtst::TestHelper::printTestName("CONTROLS BUFFERING TEST"); const bsls::TimeInterval timeout = bsls::TimeInterval(15); bmqt::SessionOptions sessionOptions; @@ -8767,7 +8766,7 @@ static void test49_controlsBuffering() obj.startAndConnect(); PVV_SAFE("Step 2. Set the channel to return e_LIMIT on write"); - obj.channel().setWriteStatus(mwcio::StatusCategory::e_LIMIT); + obj.channel().setWriteStatus(bmqio::StatusCategory::e_LIMIT); PVV_SAFE("Step 3. Open the queues async"); int rc = obj.session().openQueueAsync(queueFoo, timeout); @@ -8791,10 +8790,10 @@ static void test49_controlsBuffering() // LWM arrives but the channel still returns e_LIMIT scheduler.scheduleEvent( - mwcsys::Time::nowMonotonicClock(), + bmqsys::Time::nowMonotonicClock(), bdlf::BindUtil::bind(&TestSession::setChannelLowWaterMark, &obj, - mwcio::StatusCategory::e_LIMIT)); + bmqio::StatusCategory::e_LIMIT)); // Only one write attempt happened obj.verifyRequestSent(TestSession::e_REQ_OPEN_QUEUE); @@ -8804,10 +8803,10 @@ static void test49_controlsBuffering() // Set write status to e_SUCCESS scheduler.scheduleEvent( - mwcsys::Time::nowMonotonicClock(), + bmqsys::Time::nowMonotonicClock(), bdlf::BindUtil::bind(&TestSession::setChannelLowWaterMark, &obj, - mwcio::StatusCategory::e_SUCCESS)); + bmqio::StatusCategory::e_SUCCESS)); // All buffered control messages should be written obj.verifyRequestSent(TestSession::e_REQ_OPEN_QUEUE); @@ -8869,7 +8868,7 @@ static void test50_putRetransmittingTest() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("QUEUE RETRANSMITTING TEST"); + bmqtst::TestHelper::printTestName("QUEUE RETRANSMITTING TEST"); const char* k_PAYLOAD = "abcdefghijklmnopqrstuvwxyz"; const int k_PAYLOAD_LEN = bsl::strlen(k_PAYLOAD); @@ -8983,7 +8982,7 @@ static void test50_putRetransmittingTest() ASSERT_EQ(0, ackIter->next()); PVV_SAFE("Step 5. Trigger channel drop and verify no NACK event is sent"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -9029,7 +9028,7 @@ static void test50_putRetransmittingTest() ASSERT_EQ(0, putIter.next()); PVV_SAFE("Step 9. Trigger channel drop and advance the time"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -9087,7 +9086,7 @@ static void test50_putRetransmittingTest() PVV_SAFE("Step 13. " "Drop the channel, close the queue and verify NACK event"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -9153,7 +9152,7 @@ static void test51_putRetransmittingNoAckTest() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("PUT RETRANSMITTING NO ACK TEST"); + bmqtst::TestHelper::printTestName("PUT RETRANSMITTING NO ACK TEST"); const char* k_PAYLOAD = "abcdefghijklmnopqrstuvwxyz"; const int k_PAYLOAD_LEN = bsl::strlen(k_PAYLOAD); @@ -9235,7 +9234,7 @@ static void test51_putRetransmittingNoAckTest() ASSERT(rawEvent.isPutEvent()); PVV_SAFE("Step 5. Trigger channel drop and verify no NACK event is sent"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -9282,7 +9281,7 @@ static void test51_putRetransmittingNoAckTest() ASSERT_EQ(0, putIter.next()); PVV_SAFE("Step 9. Trigger channel restart once again"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -9311,7 +9310,7 @@ static void test51_putRetransmittingNoAckTest() PVV_SAFE("Step 12. " "Drop the channel, close the queue and verify NACK event"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -9373,7 +9372,7 @@ static void test52_controlRetransmission() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("CONTROL RETRANSMISSION TEST"); + bmqtst::TestHelper::printTestName("CONTROL RETRANSMISSION TEST"); const bsls::TimeInterval timeout = bsls::TimeInterval(15); bmqt::SessionOptions sessionOptions; @@ -9394,7 +9393,7 @@ static void test52_controlRetransmission() PVV_SAFE("Step 2. Reset the channel and open a queue"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); int rc = obj.session().openQueueAsync(pQueue, timeout); @@ -9429,7 +9428,7 @@ static void test52_controlRetransmission() PVV_SAFE("Step 4. Reset the channel and configure the queue"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); rc = obj.session().configureQueueAsync(pQueue, pQueue->options(), timeout); @@ -9464,7 +9463,7 @@ static void test52_controlRetransmission() PVV_SAFE("Step 6. " "Reset the channel, configure the queue, emulate timeout"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); rc = obj.session().configureQueueAsync(pQueue, pQueue->options(), timeout); @@ -9494,7 +9493,7 @@ static void test52_controlRetransmission() PVV_SAFE("Step 8. Reset the channel, configure the queue, then close it"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); rc = obj.session().configureQueueAsync(pQueue, pQueue->options(), timeout); @@ -9525,7 +9524,7 @@ static void test52_controlRetransmission() static void queueExpired(bsls::Types::Uint64 queueFlags) { - mwctst::TestHelper::printTestName("QUEUE EXPIRED TEST"); + bmqtst::TestHelper::printTestName("QUEUE EXPIRED TEST"); const bsls::TimeInterval timeout = bsls::TimeInterval(500); @@ -9547,7 +9546,7 @@ static void queueExpired(bsls::Types::Uint64 queueFlags) obj.startAndConnect(); PVV_SAFE("Step 2. Trigger channel drop"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -9589,7 +9588,7 @@ static void queueExpired(bsls::Types::Uint64 queueFlags) obj.verifyRequestSent(TestSession::e_REQ_CONFIG_QUEUE); PVV_SAFE("Step 8. Trigger channel drop"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -9617,7 +9616,7 @@ static void queueExpired(bsls::Types::Uint64 queueFlags) obj.openQueue(pQueue, timeout); PVV_SAFE("Step 12. Trigger channel drop"); - obj.session().setChannel(bsl::shared_ptr()); + obj.session().setChannel(bsl::shared_ptr()); ASSERT(obj.waitConnectionLostEvent()); @@ -9689,7 +9688,7 @@ static void test53_queueExpired() // - stop // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("QUEUE EXPIRED TEST"); + bmqtst::TestHelper::printTestName("QUEUE EXPIRED TEST"); PVV_SAFE("Check READER"); queueExpired(bmqt::QueueFlags::e_READ); @@ -9767,7 +9766,7 @@ static void test54_distributedTrace() { using namespace bdlf::PlaceHolders; - mwctst::TestHelper::printTestName("DISTRIBUTED TRACE TEST"); + bmqtst::TestHelper::printTestName("DISTRIBUTED TRACE TEST"); struct localFns { static void addSpacer(bdlcc::Deque& events) @@ -9996,7 +9995,7 @@ static void test54_distributedTrace() static void test55_queueAsyncCanceled2() { - mwctst::TestHelper::printTestName("QUEUE ASYNC CANCELED TEST 2"); + bmqtst::TestHelper::printTestName("QUEUE ASYNC CANCELED TEST 2"); queueAsyncCanceled_REOPEN_OPENING(); @@ -10005,7 +10004,7 @@ static void test55_queueAsyncCanceled2() static void test56_queueAsyncCanceled3() { - mwctst::TestHelper::printTestName("QUEUE ASYNC CANCELED TEST 3"); + bmqtst::TestHelper::printTestName("QUEUE ASYNC CANCELED TEST 3"); queueAsyncCanceled_CONFIGURING(); @@ -10014,21 +10013,21 @@ static void test56_queueAsyncCanceled3() static void test57_queueAsyncCanceled4() { - mwctst::TestHelper::printTestName("QUEUE ASYNC CANCELED TEST 4"); + bmqtst::TestHelper::printTestName("QUEUE ASYNC CANCELED TEST 4"); queueAsyncCanceled_CLOSE_CONFIGURING(); } static void test58_queueAsyncCanceled5() { - mwctst::TestHelper::printTestName("QUEUE ASYNC CANCELED TEST 5"); + bmqtst::TestHelper::printTestName("QUEUE ASYNC CANCELED TEST 5"); queueAsyncCanceled_CLOSE_CLOSING(); } static void test59_queueLateAsyncCanceledReader2() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED READER TEST 2"); queueLateAsyncCanceled(L_, @@ -10044,7 +10043,7 @@ static void test59_queueLateAsyncCanceledReader2() static void test60_queueLateAsyncCanceledReader3() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED READER TEST 3"); queueLateAsyncCanceled(L_, @@ -10060,7 +10059,7 @@ static void test60_queueLateAsyncCanceledReader3() static void test61_queueLateAsyncCanceledReader4() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED READER TEST 4"); queueLateAsyncCanceled(L_, @@ -10071,7 +10070,7 @@ static void test61_queueLateAsyncCanceledReader4() static void test62_queueLateAsyncCanceledReader5() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED READER TEST 5"); queueLateAsyncCanceled(L_, @@ -10082,7 +10081,7 @@ static void test62_queueLateAsyncCanceledReader5() static void test63_queueLateAsyncCanceledWriter2() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED WRITER TEST 2"); queueLateAsyncCanceled(L_, @@ -10098,7 +10097,7 @@ static void test63_queueLateAsyncCanceledWriter2() static void test64_queueLateAsyncCanceledWriter3() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED WRITER TEST 3"); queueLateAsyncCanceled(L_, @@ -10114,7 +10113,7 @@ static void test64_queueLateAsyncCanceledWriter3() static void test65_queueLateAsyncCanceledWriter4() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED WRITER TEST 4"); queueLateAsyncCanceled(L_, @@ -10125,7 +10124,7 @@ static void test65_queueLateAsyncCanceledWriter4() static void test66_queueLateAsyncCanceledWriter5() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED WRITER TEST 5"); queueLateAsyncCanceled(L_, @@ -10136,7 +10135,7 @@ static void test66_queueLateAsyncCanceledWriter5() static void test67_queueLateAsyncCanceledHybrid2() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED HYBRID TEST 2"); bsls::Types::Uint64 flags = 0; @@ -10156,7 +10155,7 @@ static void test67_queueLateAsyncCanceledHybrid2() static void test68_queueLateAsyncCanceledHybrid3() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED HYBRID TEST 3"); bsls::Types::Uint64 flags = 0; @@ -10176,7 +10175,7 @@ static void test68_queueLateAsyncCanceledHybrid3() static void test69_queueLateAsyncCanceledHybrid4() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED HYBRID TEST 4"); bsls::Types::Uint64 flags = 0; @@ -10191,7 +10190,7 @@ static void test69_queueLateAsyncCanceledHybrid4() static void test70_queueLateAsyncCanceledHybrid5() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "QUEUE LATE ASYNC CANCELED HYBRID TEST 5"); bsls::Types::Uint64 flags = 0; @@ -10210,9 +10209,9 @@ static void test70_queueLateAsyncCanceledHybrid5() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); - mwcsys::Time::initialize(); + bmqsys::Time::initialize(); bmqt::UriParser::initialize(s_allocator_p); bmqp::ProtocolUtil::initialize(s_allocator_p); bmqp::Crc32c::initialize(); @@ -10295,14 +10294,14 @@ int main(int argc, char* argv[]) } break; } - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); bmqt::UriParser::shutdown(); bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_DEFAULT); + TEST_EPILOG(bmqtst::TestHelper::e_DEFAULT); // Global: The global allocator is used to initialize the // bmqt::URIParser RegEx. - // Default: EventQueue uses mwcc::MonitoredFixedQueue, which uses + // Default: EventQueue uses bmqc::MonitoredFixedQueue, which uses // 'bdlcc::SharedObjectPool' which uses bslmt::Semaphore which // generates a unique name using an ostringstream, hence the // default allocator. diff --git a/src/groups/bmq/bmqimp/bmqimp_event.t.cpp b/src/groups/bmq/bmqimp/bmqimp_event.t.cpp index afa06357d..4ddff4724 100644 --- a/src/groups/bmq/bmqimp/bmqimp_event.t.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_event.t.cpp @@ -26,9 +26,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -36,7 +35,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -214,7 +213,7 @@ static unsigned int findExpectedCrc32( // New format. } - mwcu::MemOutStream error(allocator); + bmqu::MemOutStream error(allocator); int rc = bmqp::Compression::compress(&testApplicationData, bufferFactory, compressionAlgorithmType, @@ -234,7 +233,7 @@ static unsigned int findExpectedCrc32( static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqimp::Event obj(&bufferFactory, s_allocator_p); bdlbb::Blob eventBlob(&bufferFactory, s_allocator_p); @@ -316,7 +315,7 @@ static void test2_setterGetterTest() // - setDoneCallback // - insertQueue // ---------------------------------------------------------------------- - mwctst::TestHelper::printTestName("GENERAL SETTER GETTER TEST"); + bmqtst::TestHelper::printTestName("GENERAL SETTER GETTER TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqimp::Event obj(&bufferFactory, s_allocator_p); @@ -422,7 +421,7 @@ static void test3_sessionEvent_setterGetterTest() // - setCorrelationId // - setStatusCode // ------------------------------------------------------------------------ - mwctst::TestHelper::printTestName("SETTER GETTER TEST FOR SESSION EVENT"); + bmqtst::TestHelper::printTestName("SETTER GETTER TEST FOR SESSION EVENT"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqimp::Event obj(&bufferFactory, s_allocator_p); @@ -471,7 +470,7 @@ static void test4_messageEvent_setterGetterTest() // Testing manipulators: // - addCorrelationId // ------------------------------------------------------------------------ - mwctst::TestHelper::printTestName("SETTER GETTER TEST FOR MESSAGE EVENT"); + bmqtst::TestHelper::printTestName("SETTER GETTER TEST FOR MESSAGE EVENT"); PV("Configure as MesageEvent"); bmqt::CorrelationId corrId1(123); @@ -619,7 +618,7 @@ static void test5_configureAsMessageEventTest() false}}; const size_t k_NUM_DATA = sizeof(k_DATA) / sizeof(*k_DATA); - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "CONFIGURE AS MESSAGE EVENT / MESSAGE ITERATOR TEST"); // Iterate over test data grouped by message event types @@ -749,7 +748,7 @@ static void test6_comparisonOperatorTest() // - operator== // - operator!= // ---------------------------------------------------------------------- - mwctst::TestHelper::printTestName("COMPARISON OPERATORS"); + bmqtst::TestHelper::printTestName("COMPARISON OPERATORS"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqimp::Event obj1(&bufferFactory, s_allocator_p); @@ -839,12 +838,12 @@ static void test7_printing() // const bmqp::Event& rhs) // -------------------------------------------------------------------- { - // mwcu::PrintUtil::prettyTimeInterval uses default allocator + // bmqu::PrintUtil::prettyTimeInterval uses default allocator s_ignoreCheckDefAlloc = true; - mwctst::TestHelper::printTestName("PRINT"); - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqtst::TestHelper::printTestName("PRINT"); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob eventBlob(&bufferFactory, s_allocator_p); bmqp::EventHeader eventHeader; @@ -1071,23 +1070,25 @@ static void test8_putEventBuilder() // 'putIter.loadMessageProperties' allocates into a temporary blob // using the default allocator - mwctst::TestHelper::printTestName("PUT EVENT BUILDER TEST"); + bmqtst::TestHelper::printTestName("PUT EVENT BUILDER TEST"); // Initialize Crc32c bmqp::Crc32c::initialize(); - bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); + bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); +#ifdef BMQ_ENABLE_MSG_GROUPID const bmqp::Protocol::MsgGroupId k_MSG_GROUP_ID("gid:0", s_allocator_p); - const int k_PROPERTY_VAL_ENCODING = 3; - const bsl::string k_PROPERTY_VAL_ID = "myCoolId"; - const unsigned int k_CRC32 = 123; - const bsls::Types::Int64 k_TIME_STAMP = 1234567890LL; - const int k_NUM_PROPERTIES = 3; - const char* k_PAYLOAD = "abcdefghijklmnopqrstuvwxyz"; - const int k_PAYLOAD_LEN = bsl::strlen(k_PAYLOAD); - const char* k_HEX_GUID1 = "40000000000000000000000000000001"; - const char* k_HEX_GUID2 = "40000000000000000000000000000002"; - const char* k_HEX_GUID3 = "40000000000000000000000000000003"; +#endif + const int k_PROPERTY_VAL_ENCODING = 3; + const bsl::string k_PROPERTY_VAL_ID = "myCoolId"; + const unsigned int k_CRC32 = 123; + const bsls::Types::Int64 k_TIME_STAMP = 1234567890LL; + const int k_NUM_PROPERTIES = 3; + const char* k_PAYLOAD = "abcdefghijklmnopqrstuvwxyz"; + const int k_PAYLOAD_LEN = bsl::strlen(k_PAYLOAD); + const char* k_HEX_GUID1 = "40000000000000000000000000000001"; + const char* k_HEX_GUID2 = "40000000000000000000000000000002"; + const char* k_HEX_GUID3 = "40000000000000000000000000000003"; bmqp::MessageProperties msgProps(s_allocator_p); @@ -1106,8 +1107,10 @@ static void test8_putEventBuilder() builder.startMessage(); builder.setMessagePayload(k_PAYLOAD, k_PAYLOAD_LEN) - .setMessageProperties(&msgProps) - .setMsgGroupId(k_MSG_GROUP_ID); + .setMessageProperties(&msgProps); +#ifdef BMQ_ENABLE_MSG_GROUPID + builder.setMsgGroupId(k_MSG_GROUP_ID); +#endif struct Test { int d_line; @@ -1149,8 +1152,10 @@ static void test8_putEventBuilder() s_allocator_p, bmqt::CompressionAlgorithmType::e_NONE); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_EQ(builder.msgGroupId().isNull(), false); ASSERT_EQ(builder.msgGroupId().value(), k_MSG_GROUP_ID); +#endif ASSERT_EQ(builder.unpackedMessageSize(), k_PAYLOAD_LEN); @@ -1197,9 +1202,9 @@ static void test8_putEventBuilder() ASSERT(putIter.messagePayloadSize() == k_PAYLOAD_LEN); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD, k_PAYLOAD_LEN); @@ -1232,11 +1237,13 @@ static void test8_putEventBuilder() ASSERT_EQ(prop.getPropertyAsInt64("timestamp"), test.d_timeStamp); } +#ifdef BMQ_ENABLE_MSG_GROUPID bmqp::Protocol::MsgGroupId msgGroupId(s_allocator_p); ASSERT_EQ(putIter.hasMsgGroupId(), true); ASSERT_EQ(putIter.extractMsgGroupId(&msgGroupId), true); ASSERT_EQ(msgGroupId, k_MSG_GROUP_ID); ASSERT_EQ(putIter.isValid(), true); +#endif } ASSERT_EQ(true, putIter.isValid()); @@ -1270,7 +1277,7 @@ static void test9_copyTest() // Testing: // - Event::Event(const Event& other, bslma::Allocator *allocator) // ------------------------------------------------------------------------ - mwctst::TestHelper::printTestName("COPY CONSTRUCTOR TEST"); + bmqtst::TestHelper::printTestName("COPY CONSTRUCTOR TEST"); PV("Configure as MesageEvent"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -1357,7 +1364,7 @@ static void test10_assignmentTest() // Testing: // - Event& Event::operator=(const Event& rhs) // ------------------------------------------------------------------------ - mwctst::TestHelper::printTestName("ASSIGNMENT OPERATOR TEST"); + bmqtst::TestHelper::printTestName("ASSIGNMENT OPERATOR TEST"); PV("ASSIGNMENT OPERATOR - Configure as MesageEvent"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -1450,7 +1457,7 @@ static void test11_doneCallbackTest() // - setDoneCallback // - clear // ---------------------------------------------------------------------- - mwctst::TestHelper::printTestName("DONE CALLBACK TEST"); + bmqtst::TestHelper::printTestName("DONE CALLBACK TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqimp::Event obj(&bufferFactory, s_allocator_p); @@ -1502,7 +1509,7 @@ static void test12_upgradeDowngradeMessageEvent() // - downgradeMessageEventModeToRead // - upgradeMessageEventModeToWrite // ---------------------------------------------------------------------- - mwctst::TestHelper::printTestName("UPGRADE DOWNGRADE MESSAGE EVENT TEST"); + bmqtst::TestHelper::printTestName("UPGRADE DOWNGRADE MESSAGE EVENT TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -1549,7 +1556,7 @@ static void test12_upgradeDowngradeMessageEvent() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); bmqt::UriParser::initialize(s_allocator_p); @@ -1576,5 +1583,5 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqimp/bmqimp_eventqueue.cpp b/src/groups/bmq/bmqimp/bmqimp_eventqueue.cpp index 84cfd3500..1442d8fb2 100644 --- a/src/groups/bmq/bmqimp/bmqimp_eventqueue.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_eventqueue.cpp @@ -20,14 +20,13 @@ // BMQ #include -// MWC -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -89,7 +88,7 @@ bsl::shared_ptr EventQueue::getEvent() return d_eventPool_p->getObject(); } -void EventQueue::stateCallback(mwcc::MonitoredQueueState::Enum state) +void EventQueue::stateCallback(bmqc::MonitoredQueueState::Enum state) { // Because of MessageEvent that should be dropped while SessionEvent should // still be queueable, we use two highWatermark levels, with the following @@ -99,7 +98,7 @@ void EventQueue::stateCallback(mwcc::MonitoredQueueState::Enum state) //: o queueFilled: should never happen with a resizable queue switch (state) { - case mwcc::MonitoredQueueState::e_NORMAL: { + case bmqc::MonitoredQueueState::e_NORMAL: { BALL_LOG_INFO_BLOCK { BALL_LOG_OUTPUT_STREAM << "EventQueue has reached its " @@ -114,13 +113,13 @@ void EventQueue::stateCallback(mwcc::MonitoredQueueState::Enum state) bmqt::SessionEventType::e_SLOWCONSUMER_NORMAL); pushBack(event); } break; - case mwcc::MonitoredQueueState::e_HIGH_WATERMARK_REACHED: { + case bmqc::MonitoredQueueState::e_HIGH_WATERMARK_REACHED: { d_shouldEmitHighWatermark = 1; // i.e., enqueue a HIGH watermark event // Print an alarm catchable string to stderr. We can't use a // LogAlarmObserver to write to cerr because the task may not have BALL // observer. - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "BMQALARM [EVENTQUEUE::HIGH_WATERMARK]: BlazingMQ EventQueue " << "(buffer between the events delivered by the broker and the " << "application processing them in the event handler) has reached " @@ -130,13 +129,13 @@ void EventQueue::stateCallback(mwcc::MonitoredQueueState::Enum state) // Also print warning in users log BALL_LOG_WARN << os.str(); } break; - case mwcc::MonitoredQueueState::e_HIGH_WATERMARK_2_REACHED: { + case bmqc::MonitoredQueueState::e_HIGH_WATERMARK_2_REACHED: { BALL_LOG_ERROR << "EventQueue has reached an un-expected highWatermark2 state"; BSLS_ASSERT_SAFE(false && "Impossible - highWatermark2 is not reachable"); } break; - case mwcc::MonitoredQueueState::e_QUEUE_FILLED: { + case bmqc::MonitoredQueueState::e_QUEUE_FILLED: { BALL_LOG_ERROR << "EventQueue has reached an un-expected queue filled state"; // This should NEVER happen while using 'bdlcc::SingleProducerQueue'. @@ -188,7 +187,7 @@ bool EventQueue::hasPriorityEvents(bsl::shared_ptr* event) void EventQueue::afterEventPopped(const QueueItem& item) { - const bsls::Types::Int64 popOutTime = mwcsys::Time::highResolutionTimer(); + const bsls::Types::Int64 popOutTime = bmqsys::Time::highResolutionTimer(); const bsls::Types::Int64 queuedTime = popOutTime - item.d_enqueueTime; { // d_lasPoppedOutSpinLock LOCKED @@ -208,7 +207,7 @@ void EventQueue::afterEventPopped(const QueueItem& item) } BALL_LOG_OUTPUT_STREAM << " (queuedTime: " - << mwcu::PrintUtil::prettyTimeInterval(queuedTime) << ")"; + << bmqu::PrintUtil::prettyTimeInterval(queuedTime) << ")"; } // Update stats @@ -234,10 +233,10 @@ void EventQueue::printLastEventTime(bsl::ostream& stream) } else { stream << "last item was popped out " - << mwcu::PrintUtil::prettyTimeInterval( - mwcsys::Time::highResolutionTimer() - poppedOutTime) + << bmqu::PrintUtil::prettyTimeInterval( + bmqsys::Time::highResolutionTimer() - poppedOutTime) << " ago after spending " - << mwcu::PrintUtil::prettyTimeInterval(queuedTime) + << bmqu::PrintUtil::prettyTimeInterval(queuedTime) << " in the queue."; } } @@ -294,14 +293,13 @@ EventQueue::EventQueue(EventPool* eventPool, BSLS_ASSERT_OPT((eventHandler && numProcessingThreads > 0) || (!eventHandler && numProcessingThreads == 0)); - mwcu::MemOutStream outStream(d_allocator_p); - outStream << "Creating event queue with" - << " [lowWatermark: " - << mwcu::PrintUtil::prettyNumber(lowWatermark) + bmqu::MemOutStream outStream(d_allocator_p); + outStream << "Creating event queue with" << " [lowWatermark: " + << bmqu::PrintUtil::prettyNumber(lowWatermark) << ", highWatermark: " - << mwcu::PrintUtil::prettyNumber(highWatermark) + << bmqu::PrintUtil::prettyNumber(highWatermark) << ", initialCapacity: " - << mwcu::PrintUtil::prettyNumber(initialCapacity); + << bmqu::PrintUtil::prettyNumber(initialCapacity); if (eventHandler) { outStream << ", using " << d_numProcessingThreads << " threads]"; } @@ -324,9 +322,9 @@ EventQueue::~EventQueue() } void EventQueue::initializeStats( - mwcst::StatContext* rootStatContext, - const mwcst::StatValue::SnapshotLocation& start, - const mwcst::StatValue::SnapshotLocation& end) + bmqst::StatContext* rootStatContext, + const bmqst::StatValue::SnapshotLocation& start, + const bmqst::StatValue::SnapshotLocation& end) { // PRECONDITIONS BSLS_ASSERT_OPT(!d_stats_mp && "Stats already initialized"); @@ -334,8 +332,8 @@ void EventQueue::initializeStats( // Create stat sub-context bdlma::LocalSequentialAllocator<2048> localAllocator(d_allocator_p); - mwcst::StatContextConfiguration config(k_STAT_NAME, &localAllocator); - config.value("Queue").value("Time", mwcst::StatValue::e_DISCRETE); + bmqst::StatContextConfiguration config(k_STAT_NAME, &localAllocator); + config.value("Queue").value("Time", bmqst::StatValue::e_DISCRETE); d_stats_mp = rootStatContext->addSubcontext(config); // Create table @@ -344,46 +342,46 @@ void EventQueue::initializeStats( // of each stats // Configure schema - mwcst::TableSchema& schema = d_statTable.schema(); + bmqst::TableSchema& schema = d_statTable.schema(); schema.addColumn("enqueue_delta", k_STAT_QUEUE, - mwcst::StatUtil::incrementsDifference, + bmqst::StatUtil::incrementsDifference, start, end); schema.addColumn("dequeue_delta", k_STAT_QUEUE, - mwcst::StatUtil::decrementsDifference, + bmqst::StatUtil::decrementsDifference, start, end); - schema.addColumn("size", k_STAT_QUEUE, mwcst::StatUtil::value, start); + schema.addColumn("size", k_STAT_QUEUE, bmqst::StatUtil::value, start); schema.addColumn("size_max", k_STAT_QUEUE, - mwcst::StatUtil::rangeMax, + bmqst::StatUtil::rangeMax, start, end); schema.addColumn("size_absmax", k_STAT_QUEUE, - mwcst::StatUtil::absoluteMax); + bmqst::StatUtil::absoluteMax); schema.addColumn("time_min", k_STAT_TIME, - mwcst::StatUtil::rangeMin, + bmqst::StatUtil::rangeMin, start, end); schema.addColumn("time_avg", k_STAT_TIME, - mwcst::StatUtil::averagePerEvent, + bmqst::StatUtil::averagePerEvent, start, end); schema.addColumn("time_max", k_STAT_TIME, - mwcst::StatUtil::rangeMax, + bmqst::StatUtil::rangeMax, start, end); - schema.addColumn("time_absmax", k_STAT_TIME, mwcst::StatUtil::absoluteMax); + schema.addColumn("time_absmax", k_STAT_TIME, bmqst::StatUtil::absoluteMax); // Configure records - mwcst::TableRecords& records = d_statTable.records(); + bmqst::TableRecords& records = d_statTable.records(); records.setContext(d_stats_mp.get()); records.update(); @@ -448,7 +446,7 @@ int EventQueue::start() &d_threadPool_mp)); bslmt::ThreadAttributes threadAttributes = - mwcsys::ThreadUtil::defaultAttributes(); + bmqsys::ThreadUtil::defaultAttributes(); threadAttributes.setThreadName("bmqEventQueue"); d_threadPool_mp.load(new (*d_allocator_p) bdlmt::FixedThreadPool(threadAttributes, @@ -509,7 +507,7 @@ int EventQueue::pushBack(bsl::shared_ptr& event) BALL_LOG_TRACE << "Enqueuing " << *event; - QueueItem item(event, mwcsys::Time::highResolutionTimer()); + QueueItem item(event, bmqsys::Time::highResolutionTimer()); int rc = 0; { // d_pushBackSpinlock LOCKED @@ -540,7 +538,7 @@ bsl::shared_ptr EventQueue::popFront() if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(hasPriorityEvents(&event))) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; afterEventPopped( - QueueItem(event, mwcsys::Time::highResolutionTimer())); + QueueItem(event, bmqsys::Time::highResolutionTimer())); return event; // RETURN } @@ -564,7 +562,7 @@ EventQueue::timedPopFront(const bsls::TimeInterval& timeout, if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(hasPriorityEvents(&event))) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; afterEventPopped( - QueueItem(event, mwcsys::Time::highResolutionTimer())); + QueueItem(event, bmqsys::Time::highResolutionTimer())); return event; // RETURN } @@ -596,7 +594,7 @@ EventQueue::timedPopFront(const bsls::TimeInterval& timeout, rc, bmqt::CorrelationId(), errorDescription); - item.d_enqueueTime = mwcsys::Time::highResolutionTimer(); + item.d_enqueueTime = bmqsys::Time::highResolutionTimer(); item.d_event_sp = event; // Update stats ('afterEventPopped()' will decrement the counter, so we // need to manually increment it here since we artificially created an @@ -616,7 +614,7 @@ EventQueue::timedPopFront(const bsls::TimeInterval& timeout, void EventQueue::enqueuePoisonPill() { // PoisonPill has a null event - QueueItem item(0, mwcsys::Time::highResolutionTimer()); + QueueItem item(0, bmqsys::Time::highResolutionTimer()); { // d_pushBackSpinlock LOCKED bsls::SpinLockGuard guard(&d_pushBackSpinlock); @@ -635,10 +633,10 @@ void EventQueue::printStats(bsl::ostream& stream, bool includeDelta) const BSLS_ASSERT_OPT(d_stats_mp && "Stats NOT initialized"); if (includeDelta) { - mwcst::TableUtil::printTable(stream, d_statTip); + bmqst::TableUtil::printTable(stream, d_statTip); } else { - mwcst::TableUtil::printTable(stream, d_statTipNoDelta); + bmqst::TableUtil::printTable(stream, d_statTipNoDelta); } stream << "\n"; } diff --git a/src/groups/bmq/bmqimp/bmqimp_eventqueue.h b/src/groups/bmq/bmqimp/bmqimp_eventqueue.h index 450f77a22..046ab96b8 100644 --- a/src/groups/bmq/bmqimp/bmqimp_eventqueue.h +++ b/src/groups/bmq/bmqimp/bmqimp_eventqueue.h @@ -134,16 +134,14 @@ #include -// MWC -#include -#include -#include +#include +#include +#include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -210,7 +208,7 @@ class EventQueue { bsls::Types::Int64 enqueueTime); }; - typedef mwcc::MonitoredQueue > + typedef bmqc::MonitoredQueue > MonitoredEventQueue; private: @@ -260,19 +258,19 @@ class EventQueue { // Time the last popped out item // stayed in the queue. - bslma::ManagedPtr d_stats_mp; + bslma::ManagedPtr d_stats_mp; // Stat context to use - mwcst::Table d_statTable; + bmqst::Table d_statTable; // Table to use for dumping the // stats - mwcst::BasicTableInfoProvider d_statTip; + bmqst::BasicTableInfoProvider d_statTip; // Tip to use when printing stats, // include the delta stats fields // (diffs since previous print) - mwcst::BasicTableInfoProvider d_statTipNoDelta; + bmqst::BasicTableInfoProvider d_statTipNoDelta; // Tip to use when printing stats, // excluding the delta stats fields // (typically used when printing @@ -297,7 +295,7 @@ class EventQueue { /// Callback invoked by the MonitoredFixedQueue when it has changed to /// the specified `state`. - void stateCallback(mwcc::MonitoredQueueState::Enum state); + void stateCallback(bmqc::MonitoredQueueState::Enum state); /// Return true and populate the specified `event` if any prioritized /// one was pending; return false and leave `event` untouched if no @@ -344,9 +342,9 @@ class EventQueue { /// Configure this component to keep track of statistics: create a /// sub-context from the specified `rootStatContext`, using the /// specified `start` and `end` snapshot location. - void initializeStats(mwcst::StatContext* rootStatContext, - const mwcst::StatValue::SnapshotLocation& start, - const mwcst::StatValue::SnapshotLocation& end); + void initializeStats(bmqst::StatContext* rootStatContext, + const bmqst::StatValue::SnapshotLocation& start, + const bmqst::StatValue::SnapshotLocation& end); /// Start the EventQueue and return 0 on success, or a non zero code on /// error. If an `eventHandler` was provided at construction, this will @@ -369,7 +367,7 @@ class EventQueue { /// Return the front item of the queue, if the queue is not empty; or /// wait for up to the specified `timeout` in respect to the specified /// `now` - as a relative offset from between - /// `mwcsys::Time::nowMonotonicClock()` - argument for an item to be + /// `bmqsys::Time::nowMonotonicClock()` - argument for an item to be /// pushed to the queue. If no item is found after the provided /// `timeout`, the method will return a `SessionEvent` of type /// `bmqt::SessionEventType::e_TIMEOUT`. If an error occurs while diff --git a/src/groups/bmq/bmqimp/bmqimp_eventqueue.t.cpp b/src/groups/bmq/bmqimp/bmqimp_eventqueue.t.cpp index ffd509a13..f6055c4a7 100644 --- a/src/groups/bmq/bmqimp/bmqimp_eventqueue.t.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_eventqueue.t.cpp @@ -16,14 +16,12 @@ // bmqimp_eventqueue.t.cpp -*-C++-*- #include -// MWC -#include -#include -#include +#include +#include +#include -// MWC -#include -#include +#include +#include // BDE #include @@ -38,7 +36,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -123,8 +121,8 @@ void printProcessedItems(int numItems, bsls::Types::Int64 elapsedTime) const bsls::Types::Int64 itemsPerSec = numItems / numSeconds; bsl::cout << "Processed " << numItems << " items in " - << mwcu::PrintUtil::prettyTimeInterval(elapsedTime) << ". " - << mwcu::PrintUtil::prettyNumber(itemsPerSec) << "/s" + << bmqu::PrintUtil::prettyTimeInterval(elapsedTime) << ". " + << bmqu::PrintUtil::prettyNumber(itemsPerSec) << "/s" << bsl::endl; } @@ -195,7 +193,7 @@ void queuePerformance(int numReaders, static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bmqimp::EventQueue::EventHandlerCallback emptyEventHandler; bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -253,7 +251,7 @@ static void test2_capacityTest() // - timedPopFront // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("CAPACITY TEST"); + bmqtst::TestHelper::printTestName("CAPACITY TEST"); const int k_INITIAL_CAPACITY = 3; @@ -314,7 +312,7 @@ static void test2_capacityTest() static void test3_watermark() { - mwctst::TestHelper::printTestName("WATERMARK"); + bmqtst::TestHelper::printTestName("WATERMARK"); bmqimp::EventQueue::EventHandlerCallback emptyEventHandler; bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -392,7 +390,7 @@ static void test4_basicEventHandlerTest() // - timedPopFront // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("BASIC EVENT HANDLER"); + bmqtst::TestHelper::printTestName("BASIC EVENT HANDLER"); const int k_NUM_THREADS = 15; bsls::AtomicInt eventCounter; @@ -451,10 +449,10 @@ static void test5_emptyStatsTest() // - printStats // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("EMPTY STATS"); + bmqtst::TestHelper::printTestName("EMPTY STATS"); - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); expected << "\n" << " Queue | Queue Time" @@ -467,14 +465,14 @@ static void test5_emptyStatsTest() << "\n" << "\n"; - mwcst::StatContextConfiguration config("stats", s_allocator_p); + bmqst::StatContextConfiguration config("stats", s_allocator_p); config.defaultHistorySize(2); - mwcst::StatContext rootStatContext(config, s_allocator_p); + bmqst::StatContext rootStatContext(config, s_allocator_p); - mwcst::StatValue::SnapshotLocation start; - mwcst::StatValue::SnapshotLocation end; + bmqst::StatValue::SnapshotLocation start; + bmqst::StatValue::SnapshotLocation end; start.setLevel(0).setIndex(0); end.setLevel(0).setIndex(1); @@ -533,7 +531,7 @@ static void test6_workingStatsTest() // - printStats // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("EMPTY STATS"); + bmqtst::TestHelper::printTestName("EMPTY STATS"); const int k_MILL_SEC = bdlt::TimeUnitRatio::k_NANOSECONDS_PER_MILLISECOND; @@ -546,8 +544,8 @@ static void test6_workingStatsTest() // HighWatermark and another one for the LowWatermark TestClock testClock; - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqp::PutEventBuilder builder(&bufferFactory, s_allocator_p); bmqimp::EventQueue::EventPool eventPool( @@ -560,19 +558,19 @@ static void test6_workingStatsTest() bmqimp::EventQueue::EventHandlerCallback emptyEventHandler; - mwcst::StatContextConfiguration config("stats", s_allocator_p); - mwcst::StatValue::SnapshotLocation start; - mwcst::StatValue::SnapshotLocation end; + bmqst::StatContextConfiguration config("stats", s_allocator_p); + bmqst::StatValue::SnapshotLocation start; + bmqst::StatValue::SnapshotLocation end; config.defaultHistorySize(3); - mwcst::StatContext rootStatContext(config, s_allocator_p); + bmqst::StatContext rootStatContext(config, s_allocator_p); start.setLevel(0).setIndex(0); end.setLevel(0).setIndex(1); - mwcsys::Time::shutdown(); - mwcsys::Time::initialize( + bmqsys::Time::shutdown(); + bmqsys::Time::initialize( bdlf::BindUtil::bind(&TestClock::realtimeClock, &testClock), bdlf::BindUtil::bind(&TestClock::monotonicClock, &testClock), bdlf::BindUtil::bind(&TestClock::highResTimer, &testClock), @@ -634,7 +632,7 @@ static void test6_workingStatsTest() ASSERT_EQ(out.str(), expected.str()); - const mwcst::StatContext* pSubCtx = rootStatContext.getSubcontext( + const bmqst::StatContext* pSubCtx = rootStatContext.getSubcontext( "EventQueue"); ASSERT(pSubCtx != 0); @@ -642,11 +640,11 @@ static void test6_workingStatsTest() ASSERT_EQ(pSubCtx->valueName(0), "Queue"); ASSERT_EQ(pSubCtx->valueName(1), "Time"); - mwcst::StatValue valQueue = - pSubCtx->value(mwcst::StatContext::e_DIRECT_VALUE, 0); + bmqst::StatValue valQueue = + pSubCtx->value(bmqst::StatContext::e_DIRECT_VALUE, 0); - mwcst::StatValue valTime = - pSubCtx->value(mwcst::StatContext::e_DIRECT_VALUE, 1); + bmqst::StatValue valTime = + pSubCtx->value(bmqst::StatContext::e_DIRECT_VALUE, 1); ASSERT_EQ(valQueue.min(), 0); ASSERT_EQ(valQueue.max(), k_INITIAL_CAPACITY + 1); // +1 for HighWatermark @@ -709,9 +707,9 @@ static void testN1_performance() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); - mwcsys::Time::initialize(); + bmqsys::Time::initialize(); bmqt::UriParser::initialize(s_allocator_p); switch (_testCase) { @@ -730,10 +728,10 @@ int main(int argc, char* argv[]) } bmqt::UriParser::shutdown(); - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); - // Default: EventQueue uses mwcc::MonitoredFixedQueue, which uses + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); + // Default: EventQueue uses bmqc::MonitoredFixedQueue, which uses // 'bdlcc::SharedObjectPool' which uses bslmt::Semaphore which // generates a unique name using an ostringstream, hence the // default allocator. diff --git a/src/groups/bmq/bmqimp/bmqimp_eventsstats.cpp b/src/groups/bmq/bmqimp/bmqimp_eventsstats.cpp index fc834cdeb..c18945861 100644 --- a/src/groups/bmq/bmqimp/bmqimp_eventsstats.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_eventsstats.cpp @@ -17,9 +17,9 @@ #include #include -// MWC -#include -#include + +#include +#include // BDE #include @@ -75,15 +75,15 @@ EventsStats::EventsStats(bslma::Allocator* allocator) } void EventsStats::initializeStats( - mwcst::StatContext* rootStatContext, - const mwcst::StatValue::SnapshotLocation& start, - const mwcst::StatValue::SnapshotLocation& end) + bmqst::StatContext* rootStatContext, + const bmqst::StatValue::SnapshotLocation& start, + const bmqst::StatValue::SnapshotLocation& end) { bdlma::LocalSequentialAllocator<2048> localAllocator(d_allocator_p); // Create the root stat context // ---------------------------- - mwcst::StatContextConfiguration config(k_STAT_NAME, &localAllocator); + bmqst::StatContextConfiguration config(k_STAT_NAME, &localAllocator); config.isTable(true); config.value("event").value("message"); d_stat.d_statContext_mp = rootStatContext->addSubcontext(config); @@ -94,41 +94,41 @@ void EventsStats::initializeStats( const char* name = EventsStatsEventType::toAscii( static_cast(type)); d_statContexts_mp[type] = d_stat.d_statContext_mp->addSubcontext( - mwcst::StatContextConfiguration(name, &localAllocator)); + bmqst::StatContextConfiguration(name, &localAllocator)); } // Create table (with Delta stats) // ------------------------------- - mwcst::TableSchema& schema = d_stat.d_table.schema(); + bmqst::TableSchema& schema = d_stat.d_table.schema(); schema.addDefaultIdColumn("id"); schema.addColumn("messages", k_STAT_MESSAGE, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("events", k_STAT_EVENT, - mwcst::StatUtil::increments, + bmqst::StatUtil::increments, start); - schema.addColumn("bytes", k_STAT_EVENT, mwcst::StatUtil::value, start); + schema.addColumn("bytes", k_STAT_EVENT, bmqst::StatUtil::value, start); schema.addColumn("messages_delta", k_STAT_MESSAGE, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("events_delta", k_STAT_EVENT, - mwcst::StatUtil::incrementsDifference, + bmqst::StatUtil::incrementsDifference, start, end); schema.addColumn("bytes_delta", k_STAT_EVENT, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); // Configure records - mwcst::TableRecords& records = d_stat.d_table.records(); + bmqst::TableRecords& records = d_stat.d_table.records(); records.setContext(d_stat.d_statContext_mp.get()); records.setFilter(&StatUtil::filterDirectAndTopLevel); records.considerChildrenOfFilteredContexts(true); @@ -153,26 +153,26 @@ void EventsStats::initializeStats( // Create the table (without Delta stats) // -------------------------------------- // We always use current snapshot for this - mwcst::StatValue::SnapshotLocation loc(0, 0); + bmqst::StatValue::SnapshotLocation loc(0, 0); - mwcst::TableSchema& schemaNoDelta = d_stat.d_tableNoDelta.schema(); + bmqst::TableSchema& schemaNoDelta = d_stat.d_tableNoDelta.schema(); schemaNoDelta.addDefaultIdColumn("id"); schemaNoDelta.addColumn("messages", k_STAT_MESSAGE, - mwcst::StatUtil::value, + bmqst::StatUtil::value, loc); schemaNoDelta.addColumn("events", k_STAT_EVENT, - mwcst::StatUtil::increments, + bmqst::StatUtil::increments, loc); schemaNoDelta.addColumn("bytes", k_STAT_EVENT, - mwcst::StatUtil::value, + bmqst::StatUtil::value, loc); // Configure records - mwcst::TableRecords& recordsNoDelta = d_stat.d_tableNoDelta.records(); + bmqst::TableRecords& recordsNoDelta = d_stat.d_tableNoDelta.records(); recordsNoDelta.setContext(d_stat.d_statContext_mp.get()); recordsNoDelta.setFilter(&StatUtil::filterDirectAndTopLevel); recordsNoDelta.considerChildrenOfFilteredContexts(true); diff --git a/src/groups/bmq/bmqimp/bmqimp_eventsstats.h b/src/groups/bmq/bmqimp/bmqimp_eventsstats.h index d0638ecf8..bcd714e2a 100644 --- a/src/groups/bmq/bmqimp/bmqimp_eventsstats.h +++ b/src/groups/bmq/bmqimp/bmqimp_eventsstats.h @@ -35,9 +35,8 @@ #include -// MWC -#include -#include +#include +#include // BDE #include @@ -92,7 +91,7 @@ struct EventsStatsEventType { class EventsStats { private: // PRIVATE TYPES - typedef bslma::ManagedPtr StatContextMp; + typedef bslma::ManagedPtr StatContextMp; private: // DATA @@ -130,9 +129,9 @@ class EventsStats { /// correspond to stats between the specified `start` and `end` snapshot /// location. The behavior is undefined is this method is called more /// than once on the same `EventsStats` object. - void initializeStats(mwcst::StatContext* rootStatContext, - const mwcst::StatValue::SnapshotLocation& start, - const mwcst::StatValue::SnapshotLocation& end); + void initializeStats(bmqst::StatContext* rootStatContext, + const bmqst::StatValue::SnapshotLocation& start, + const bmqst::StatValue::SnapshotLocation& end); /// Reset all statistics (used when restarting the session). void resetStats(); diff --git a/src/groups/bmq/bmqimp/bmqimp_messagecorrelationidcontainer.h b/src/groups/bmq/bmqimp/bmqimp_messagecorrelationidcontainer.h index 03336df8e..9dd246014 100644 --- a/src/groups/bmq/bmqimp/bmqimp_messagecorrelationidcontainer.h +++ b/src/groups/bmq/bmqimp/bmqimp_messagecorrelationidcontainer.h @@ -40,8 +40,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -115,10 +114,10 @@ class MessageCorrelationIdContainer { /// Map of key to an object containing correlationId and queueId of a /// message. This should be an ordered container so that any local /// NAKs are generated in the order in which PUTs were posted. - typedef mwcc::OrderedHashMap + typedef bmqc::OrderedHashMap CorrelationIdsMap; - typedef mwcc::OrderedHashMap + typedef bmqc::OrderedHashMap HandleAndExpirationTimeMap; /// Map of key (queueId) to an ordered map of handle (message GUID and diff --git a/src/groups/bmq/bmqimp/bmqimp_messagecorrelationidcontainer.t.cpp b/src/groups/bmq/bmqimp/bmqimp_messagecorrelationidcontainer.t.cpp index 265d9ae99..aab7de883 100644 --- a/src/groups/bmq/bmqimp/bmqimp_messagecorrelationidcontainer.t.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_messagecorrelationidcontainer.t.cpp @@ -30,7 +30,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -83,7 +83,7 @@ struct IterateAndInvokeHelper { static void test1_addFindRemove() { - mwctst::TestHelper::printTestName("ADD FIND REMOVE"); + bmqtst::TestHelper::printTestName("ADD FIND REMOVE"); bmqimp::MessageCorrelationIdContainer container(s_allocator_p); @@ -138,7 +138,7 @@ static void test1_addFindRemove() static void test2_iterateAndInvoke() { - mwctst::TestHelper::printTestName("ITERATE AND INVOKE"); + bmqtst::TestHelper::printTestName("ITERATE AND INVOKE"); bmqimp::MessageCorrelationIdContainer container(s_allocator_p); IterateAndInvokeHelper helper(s_allocator_p); @@ -175,7 +175,7 @@ static void test2_iterateAndInvoke() static void test3_associate() { - mwctst::TestHelper::printTestName("ASSOCIATE"); + bmqtst::TestHelper::printTestName("ASSOCIATE"); bmqimp::MessageCorrelationIdContainer container(s_allocator_p); IterateAndInvokeHelper helper(s_allocator_p); @@ -219,7 +219,7 @@ static void test3_associate() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -232,5 +232,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqimp/bmqimp_messagedumper.cpp b/src/groups/bmq/bmqimp/bmqimp_messagedumper.cpp index d68b3cdf3..71ff80bce 100644 --- a/src/groups/bmq/bmqimp/bmqimp_messagedumper.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_messagedumper.cpp @@ -29,9 +29,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -148,7 +147,7 @@ void MessageDumper::processDumpMessageHelper( dumpContext->d_isEnabled = true; dumpContext->d_actionType = static_cast( bmqp_ctrlmsg::DumpActionType::E_TIME_IN_SECONDS); - dumpContext->d_actionValue = mwcsys::Time::highResolutionTimer() + + dumpContext->d_actionValue = bmqsys::Time::highResolutionTimer() + (dumpMsg.dumpActionValue() * bdlt::TimeUnitRatio::k_NS_PER_S); } break; // BREAK @@ -372,7 +371,7 @@ void MessageDumper::dumpPushEvent(bsl::ostream& out, const bmqp::Event& event) bdlbb::Blob payload(d_allocator_p); if (iter.loadMessagePayload(&payload) == 0) { - out << mwcu::BlobStartHexDumper(&payload, + out << bmqu::BlobStartHexDumper(&payload, e_NUM_BYTES_IN_BLOB_TO_DUMP); } else { @@ -471,7 +470,7 @@ void MessageDumper::dumpPutEvent(bsl::ostream& out, bdlbb::Blob payload(d_allocator_p); if (iter.loadMessagePayload(&payload) == 0) { - out << mwcu::BlobStartHexDumper(&payload, + out << bmqu::BlobStartHexDumper(&payload, e_NUM_BYTES_IN_BLOB_TO_DUMP); } else { diff --git a/src/groups/bmq/bmqimp/bmqimp_messagedumper.h b/src/groups/bmq/bmqimp/bmqimp_messagedumper.h index 457702371..07b3871a4 100644 --- a/src/groups/bmq/bmqimp/bmqimp_messagedumper.h +++ b/src/groups/bmq/bmqimp/bmqimp_messagedumper.h @@ -31,8 +31,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -278,7 +277,7 @@ inline bool MessageDumper::DumpContext::isEnabled() const d_isEnabled = (d_actionValue > 0); // Still more messages to dump } break; // BREAK case bmqp_ctrlmsg::DumpActionType::E_TIME_IN_SECONDS: { - d_isEnabled = (d_actionValue >= mwcsys::Time::highResolutionTimer()); + d_isEnabled = (d_actionValue >= bmqsys::Time::highResolutionTimer()); // Expiration time is in the future } break; // BREAK } diff --git a/src/groups/bmq/bmqimp/bmqimp_messagedumper.t.cpp b/src/groups/bmq/bmqimp/bmqimp_messagedumper.t.cpp index 52c6c05da..512d1d026 100644 --- a/src/groups/bmq/bmqimp/bmqimp_messagedumper.t.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_messagedumper.t.cpp @@ -37,10 +37,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -61,7 +60,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -228,9 +227,14 @@ struct Tester BSLS_CPP11_FINAL { /// is undefined unless a queue with the `uri` was created and inserted /// using a call to `insertQueue`, or if packing the message is /// unsuccessful. +#ifdef BMQ_ENABLE_MSG_GROUPID void packPutMessage(const bslstl::StringRef& uri, const bslstl::StringRef& payload, const bslstl::StringRef& msgGroupId = ""); +#else + void packPutMessage(const bslstl::StringRef& uri, + const bslstl::StringRef& payload); +#endif /// Append to the CONFIRM event being built a CONFIRM message associated /// with the queue corresponding to the specified `uri`. The behavior @@ -335,7 +339,7 @@ Tester::Tester(bslma::Allocator* allocator) , d_confirmEventBuilder(&d_bufferFactory, allocator) , d_allocator_p(allocator) { - mwcsys::Time::initialize( + bmqsys::Time::initialize( bdlf::BindUtil::bindS(d_allocator_p, &Tester::now, this), bdlf::BindUtil::bindS(d_allocator_p, &Tester::now, this), bdlf::BindUtil::bindS(d_allocator_p, @@ -346,7 +350,7 @@ Tester::Tester(bslma::Allocator* allocator) Tester::~Tester() { - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); } // MANIPULATORS @@ -460,9 +464,14 @@ void Tester::appendAckMessage(const bslstl::StringRef& uri, BSLS_ASSERT_OPT(rc == 0); } +#ifdef BMQ_ENABLE_MSG_GROUPID void Tester::packPutMessage(const bslstl::StringRef& uri, const bslstl::StringRef& payload, const bslstl::StringRef& msgGroupId) +#else +void Tester::packPutMessage(const bslstl::StringRef& uri, + const bslstl::StringRef& payload) +#endif { // PRECONDITIONS BSLS_ASSERT_OPT(d_queueIdsByUri.find(uri) != d_queueIdsByUri.end() && @@ -481,10 +490,12 @@ void Tester::packPutMessage(const bslstl::StringRef& uri, d_putEventBuilder.startMessage(); d_putEventBuilder.setMessageGUID(guid).setMessagePayload(&msgPayload); +#ifdef BMQ_ENABLE_MSG_GROUPID if (!msgGroupId.empty()) { bmqp::Protocol::MsgGroupId groupId(msgGroupId, d_allocator_p); d_putEventBuilder.setMsgGroupId(msgGroupId); } +#endif int rc = d_putEventBuilder.packMessage(queueId.id()); BSLS_ASSERT_OPT(rc == 0); @@ -705,7 +716,7 @@ static void test1_breathingTest() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); Tester tester(s_allocator_p); @@ -748,7 +759,7 @@ static void test2_parseCommand() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("PARSE COMMAND"); + bmqtst::TestHelper::printTestName("PARSE COMMAND"); struct Test { int d_line; @@ -1138,7 +1149,7 @@ static void test3_processDumpCommand() // processDumpCommand // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PROCESS DUMP COMMAND"); + bmqtst::TestHelper::printTestName("PROCESS DUMP COMMAND"); struct Test { int d_line; @@ -1210,7 +1221,7 @@ static void test4_processDumpCommand_invalidDumpMessage() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("PROCESS DUMP COMMAND"); + bmqtst::TestHelper::printTestName("PROCESS DUMP COMMAND"); struct Test { int d_line; @@ -1299,7 +1310,7 @@ static void test5_reset() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("PROCESS DUMP COMMAND"); + bmqtst::TestHelper::printTestName("PROCESS DUMP COMMAND"); struct Test { int d_line; @@ -1385,7 +1396,7 @@ static void test6_dumpPushEvent() // temporary string using the default allocator when performing queue // lookup by canonical URI - mwctst::TestHelper::printTestName("DUMP PUSH EVENT"); + bmqtst::TestHelper::printTestName("DUMP PUSH EVENT"); Tester tester(s_allocator_p); @@ -1446,7 +1457,7 @@ static void test6_dumpPushEvent() // 2. Dump the PUSH event and verify that the first five messages were // dumped, and that no additional messages were dumped. - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); bmqp::Event event(s_allocator_p); tester.pushEvent(&event); @@ -1529,7 +1540,7 @@ static void test7_dumpAckEvent() // temporary string using the default allocator when performing queue // lookup by canonical URI - mwctst::TestHelper::printTestName("DUMP ACK EVENT"); + bmqtst::TestHelper::printTestName("DUMP ACK EVENT"); Tester tester(s_allocator_p); @@ -1555,7 +1566,7 @@ static void test7_dumpAckEvent() // 2. Dump the ACK event and verify that the messages in the event were // dumped. - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); bmqp::Event event(s_allocator_p); tester.ackEvent(&event); @@ -1646,7 +1657,7 @@ static void test8_dumpPutEvent() // temporary string using the default allocator when performing queue // lookup by canonical URI - mwctst::TestHelper::printTestName("DUMP PUT EVENT"); + bmqtst::TestHelper::printTestName("DUMP PUT EVENT"); Tester tester(s_allocator_p); @@ -1659,14 +1670,19 @@ static void test8_dumpPutEvent() // messages. tester.processDumpCommand("PUT ON"); +#ifdef BMQ_ENABLE_MSG_GROUPID tester.packPutMessage("bmq://bmq.test.mmap.fanout/q1", "abcd", "Group 1"); tester.packPutMessage("bmq://bmq.test.mmap.fanout/q1", "abcd", "Group 2"); +#else + tester.packPutMessage("bmq://bmq.test.mmap.fanout/q1", "abcd"); + tester.packPutMessage("bmq://bmq.test.mmap.fanout/q1", "abcd"); +#endif tester.packPutMessage("bmq://bmq.test.mmap.priority/q1", "efgh"); tester.packPutMessage("bmq://bmq.test.mmap.priority/q2", "ijkl"); // 2. Dump the PUT event and verify that the PUT messages were dumped, and // that no additional messages were dumped. - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); bmqp::Event event(s_allocator_p); tester.putEvent(&event); @@ -1674,6 +1690,7 @@ static void test8_dumpPutEvent() PVV(L_ << ": PUT event dump: " << out.str()); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_EQ(regexMatch(out.str(), "PUT Message #1:.*" "queue: bmq://bmq.test.mmap.fanout/q1.*" @@ -1688,6 +1705,20 @@ static void test8_dumpPutEvent() "abcd.*", s_allocator_p), true); +#else + ASSERT_EQ(regexMatch(out.str(), + "PUT Message #1:.*" + "queue: bmq://bmq.test.mmap.fanout/q1.*" + "abcd.*", + s_allocator_p), + true); + ASSERT_EQ(regexMatch(out.str(), + "PUT Message #2:.*" + "queue: bmq://bmq.test.mmap.fanout/q1.*" + "abcd.*", + s_allocator_p), + true); +#endif ASSERT_EQ(regexMatch(out.str(), "PUT Message #3:.*" "queue: bmq://bmq.test.mmap.priority/q1.*" @@ -1751,7 +1782,7 @@ static void test9_dumpConfirmEvent() // temporary string using the default allocator when performing queue // lookup by canonical URI - mwctst::TestHelper::printTestName("DUMP CONFIRM EVENT"); + bmqtst::TestHelper::printTestName("DUMP CONFIRM EVENT"); Tester tester(s_allocator_p); @@ -1775,7 +1806,7 @@ static void test9_dumpConfirmEvent() // 2. Dump the CONFIRM event and verify that the first four messages were // dumped, and that no additional messages were dumped. - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); bmqp::Event event(s_allocator_p); tester.confirmEvent(&event); @@ -1855,7 +1886,7 @@ static void test9_dumpConfirmEvent() int main(int argc, char** argv) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); bmqt::UriParser::initialize(s_allocator_p); @@ -1883,8 +1914,8 @@ int main(int argc, char** argv) bmqt::UriParser::shutdown(); bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_DEFAULT); + TEST_EPILOG(bmqtst::TestHelper::e_DEFAULT); // For an unidentified reason, 'e_CHECK_DEF_GBL_ALLOC' fails as a - // result of initializing 'mwcsys::Time' in the constructor of + // result of initializing 'bmqsys::Time' in the constructor of // 'Tester'. } diff --git a/src/groups/bmq/bmqimp/bmqimp_negotiatedchannelfactory.cpp b/src/groups/bmq/bmqimp/bmqimp_negotiatedchannelfactory.cpp index 8213ad945..2c31f4d41 100644 --- a/src/groups/bmq/bmqimp/bmqimp_negotiatedchannelfactory.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_negotiatedchannelfactory.cpp @@ -22,11 +22,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -64,7 +63,7 @@ enum RcEnum { // ------------------------------------ NegotiatedChannelFactoryConfig::NegotiatedChannelFactoryConfig( - mwcio::ChannelFactory* base, + bmqio::ChannelFactory* base, const bmqp_ctrlmsg::NegotiationMessage& negotiationMessage, const bsls::TimeInterval& negotiationTimeout, bdlbb::BlobBufferFactory* bufferFactory, @@ -107,11 +106,11 @@ const char* NegotiatedChannelFactory::k_CHANNEL_PROPERTY_CONFIGURE_STREAM = // PRIVATE ACCESSORS void NegotiatedChannelFactory::baseResultCallback( const ResultCallback& userCb, - mwcio::ChannelFactoryEvent::Enum event, - const mwcio::Status& status, - const bsl::shared_ptr& channel) const + bmqio::ChannelFactoryEvent::Enum event, + const bmqio::Status& status, + const bsl::shared_ptr& channel) const { - if (event != mwcio::ChannelFactoryEvent::e_CHANNEL_UP) { + if (event != bmqio::ChannelFactoryEvent::e_CHANNEL_UP) { userCb(event, status, channel); return; // RETURN } @@ -120,7 +119,7 @@ void NegotiatedChannelFactory::baseResultCallback( } void NegotiatedChannelFactory::negotiate( - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const ResultCallback& cb) const { static const bmqp::EncodingType::Enum k_DEFAULT_ENCODING = @@ -133,30 +132,30 @@ void NegotiatedChannelFactory::negotiate( if (rc != 0) { BALL_LOG_ERROR << "Negotiation failed [reason: 'packet failed to " << "encode', rc: " << rc << "]"; - mwcio::Status status(mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::Status status(bmqio::StatusCategory::e_GENERIC_ERROR, "negotiationError", rc_PACKET_ENCODE_FAILURE); - cb(mwcio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); + cb(bmqio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); return; // RETURN } BALL_LOG_INFO << "Sending negotiation message to '" << channel->peerUri() << "': " << d_config.d_negotiationMessage; - mwcio::Status status; + bmqio::Status status; BALL_LOG_TRACE << "Sending blob:\n" - << mwcu::BlobStartHexDumper(&builder.blob()); + << bmqu::BlobStartHexDumper(&builder.blob()); channel->write(&status, builder.blob()); if (!status) { BALL_LOG_ERROR << "Negotiation failed [reason: 'failed sending packet'" << ", status: " << status << "]"; status.properties().set("negotiationError", rc_WRITE_FAILURE); - cb(mwcio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); + cb(bmqio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); return; // RETURN } // Initiate a read for the broker's negotiation response message - mwcio::Channel::ReadCallback readCb = bdlf::BindUtil::bind( - mwcu::WeakMemFnUtil::weakMemFn( + bmqio::Channel::ReadCallback readCb = bdlf::BindUtil::bind( + bmqu::WeakMemFnUtil::weakMemFn( &NegotiatedChannelFactory::readPacketsCb, d_self.acquireWeak()), channel, @@ -173,14 +172,14 @@ void NegotiatedChannelFactory::negotiate( BALL_LOG_ERROR << "Negotiation failed [reason: 'failed reading " << "packets', status: " << status << "]"; status.properties().set("negotiationError", rc_READ_FAILURE); - cb(mwcio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); + cb(bmqio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); } } void NegotiatedChannelFactory::readPacketsCb( - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const ResultCallback& cb, - const mwcio::Status& status, + const bmqio::Status& status, int* numNeeded, bdlbb::Blob* blob) const { @@ -188,21 +187,21 @@ void NegotiatedChannelFactory::readPacketsCb( // Read failure. BALL_LOG_ERROR << "Broker negotiation read callback failed [peer: " << channel->peerUri() << ", status: " << status << "]"; - mwcio::Status st(status); + bmqio::Status st(status); st.properties().set("negotiationError", rc_READ_CALLBACK_FAILURE); - cb(mwcio::ChannelFactoryEvent::e_CONNECT_FAILED, st, channel); + cb(bmqio::ChannelFactoryEvent::e_CONNECT_FAILED, st, channel); return; // RETURN } bdlbb::Blob packet; - const int rc = mwcio::ChannelUtil::handleRead(&packet, numNeeded, blob); + const int rc = bmqio::ChannelUtil::handleRead(&packet, numNeeded, blob); if (rc != 0) { BALL_LOG_ERROR << "Broker negotiation read callback failed [peer: " << channel->peerUri() << ", rc: " << rc << "]"; - mwcio::Status st(mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::Status st(bmqio::StatusCategory::e_GENERIC_ERROR, "negotiationError", rc_INVALID_MESSAGE_FAILURE); - cb(mwcio::ChannelFactoryEvent::e_CONNECT_FAILED, st, channel); + cb(bmqio::ChannelFactoryEvent::e_CONNECT_FAILED, st, channel); // No more packets are expected *numNeeded = 0; return; // RETURN @@ -215,36 +214,36 @@ void NegotiatedChannelFactory::readPacketsCb( // We have the whole message. *numNeeded = 0; // No more packets are expected - BALL_LOG_TRACE << "Read blob:\n" << mwcu::BlobStartHexDumper(&packet); + BALL_LOG_TRACE << "Read blob:\n" << bmqu::BlobStartHexDumper(&packet); onBrokerNegotiationResponse(packet, cb, channel); } void NegotiatedChannelFactory::onBrokerNegotiationResponse( const bdlbb::Blob& packet, const ResultCallback& cb, - const bsl::shared_ptr& channel) const + const bsl::shared_ptr& channel) const { BALL_LOG_TRACE << "Received a packet:\n" - << mwcu::BlobStartHexDumper(&packet); + << bmqu::BlobStartHexDumper(&packet); bmqp::Event event(&packet, d_config.d_allocator_p); if (!event.isValid()) { BALL_LOG_ERROR << "Invalid response from broker [reason: 'packet is " << "not a valid BlazingMQ event']: " << event; - mwcio::Status status(mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::Status status(bmqio::StatusCategory::e_GENERIC_ERROR, "negotiationError", rc_INVALID_BROKER_RESPONSE); - cb(mwcio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); + cb(bmqio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); return; // RETURN } if (!event.isControlEvent()) { BALL_LOG_ERROR << "Invalid response from broker [reason: 'packet is " << "not a control event']: " << event; - mwcio::Status status(mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::Status status(bmqio::StatusCategory::e_GENERIC_ERROR, "negotiationError", rc_INVALID_BROKER_RESPONSE); - cb(mwcio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); + cb(bmqio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); return; // RETURN } @@ -254,20 +253,20 @@ void NegotiatedChannelFactory::onBrokerNegotiationResponse( BALL_LOG_ERROR << "Invalid response from broker [reason: 'control " << "event is not a NegotiationMessage', rc: " << rc << "]: " << event; - mwcio::Status status(mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::Status status(bmqio::StatusCategory::e_GENERIC_ERROR, "negotiationError", rc_INVALID_BROKER_RESPONSE); - cb(mwcio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); + cb(bmqio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); return; // RETURN } if (!response.isBrokerResponseValue()) { BALL_LOG_ERROR << "Invalid response from broker [reason: 'control " << "event is not a brokerResponse']: " << response; - mwcio::Status status(mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::Status status(bmqio::StatusCategory::e_GENERIC_ERROR, "negotiationError", rc_INVALID_BROKER_RESPONSE); - cb(mwcio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); + cb(bmqio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); return; // RETURN } @@ -283,7 +282,7 @@ void NegotiatedChannelFactory::onBrokerNegotiationResponse( bmqp_ctrlmsg::StatusCategory::E_NOT_SUPPORTED) { bdlma::LocalSequentialAllocator<512> localAllocator( d_config.d_allocator_p); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "BMQALARM [UNSUPPORTED_SDK]: The BlazingMQ version used by " << "this client (" << bmqscm::Version::version() << ") is no longer supported. Please relink and deploy this " @@ -293,10 +292,10 @@ void NegotiatedChannelFactory::onBrokerNegotiationResponse( BALL_LOG_ERROR << os.str(); } - mwcio::Status status(mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::Status status(bmqio::StatusCategory::e_GENERIC_ERROR, "negotiationError", rc_NEGOTIATION_FAILURE); - cb(mwcio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); + cb(bmqio::ChannelFactoryEvent::e_CONNECT_FAILED, status, channel); return; // RETURN } @@ -306,7 +305,7 @@ void NegotiatedChannelFactory::onBrokerNegotiationResponse( if (response.brokerResponse().isDeprecatedSdk()) { bdlma::LocalSequentialAllocator<512> localAllocator( d_config.d_allocator_p); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "BMQALARM [DEPRECATED_SDK]: The BlazingMQ version used by this " << "client (" << bmqscm::Version::version() << ") is deprecated. " << "Please relink and deploy this task."; @@ -333,7 +332,7 @@ void NegotiatedChannelFactory::onBrokerNegotiationResponse( channel->properties().set(k_CHANNEL_PROPERTY_CONFIGURE_STREAM, 1); } - cb(mwcio::ChannelFactoryEvent::e_CHANNEL_UP, mwcio::Status(), channel); + cb(bmqio::ChannelFactoryEvent::e_CHANNEL_UP, bmqio::Status(), channel); } // CREATORS @@ -355,25 +354,25 @@ NegotiatedChannelFactory::~NegotiatedChannelFactory() // MANIPULATORS void NegotiatedChannelFactory::listen( - BSLS_ANNOTATION_UNUSED mwcio::Status* status, + BSLS_ANNOTATION_UNUSED bmqio::Status* status, BSLS_ANNOTATION_UNUSED bslma::ManagedPtr* handle, - BSLS_ANNOTATION_UNUSED const mwcio::ListenOptions& options, + BSLS_ANNOTATION_UNUSED const bmqio::ListenOptions& options, BSLS_ANNOTATION_UNUSED const ResultCallback& cb) { // PRECONDITIONS BSLS_ASSERT_OPT(false && "SDK should not be listening"); } -void NegotiatedChannelFactory::connect(mwcio::Status* status, +void NegotiatedChannelFactory::connect(bmqio::Status* status, bslma::ManagedPtr* handle, - const mwcio::ConnectOptions& options, + const bmqio::ConnectOptions& options, const ResultCallback& cb) { d_config.d_baseFactory_p->connect( status, handle, options, - bdlf::BindUtil::bind(mwcu::WeakMemFnUtil::weakMemFn( + bdlf::BindUtil::bind(bmqu::WeakMemFnUtil::weakMemFn( &NegotiatedChannelFactory::baseResultCallback, d_self.acquireWeak()), cb, diff --git a/src/groups/bmq/bmqimp/bmqimp_negotiatedchannelfactory.h b/src/groups/bmq/bmqimp/bmqimp_negotiatedchannelfactory.h index 0dc0adde1..84b648f7a 100644 --- a/src/groups/bmq/bmqimp/bmqimp_negotiatedchannelfactory.h +++ b/src/groups/bmq/bmqimp/bmqimp_negotiatedchannelfactory.h @@ -26,20 +26,19 @@ // //@DESCRIPTION: This component defines a mechanism, // 'bmqimp::NegotiatedChannelFactory', which is an implementation of the -// 'mwcio::ChannelFactory' protocol that performs initial negotiation with a -// peer on top of a channel created using a base 'mwcio::ChannelFactory'. +// 'bmqio::ChannelFactory' protocol that performs initial negotiation with a +// peer on top of a channel created using a base 'bmqio::ChannelFactory'. // BMQ #include -// MWC -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -62,7 +61,7 @@ namespace bmqimp { class NegotiatedChannelFactoryConfig { private: // PRIVATE DATA - mwcio::ChannelFactory* d_baseFactory_p; + bmqio::ChannelFactory* d_baseFactory_p; bmqp_ctrlmsg::NegotiationMessage d_negotiationMessage; bsls::TimeInterval d_negotiationTimeout; bdlbb::BlobBufferFactory* d_bufferFactory_p; @@ -78,7 +77,7 @@ class NegotiatedChannelFactoryConfig { // CREATORS NegotiatedChannelFactoryConfig( - mwcio::ChannelFactory* base, + bmqio::ChannelFactory* base, const bmqp_ctrlmsg::NegotiationMessage& negotiationMessage, const bsls::TimeInterval& negotiationTimeout, bdlbb::BlobBufferFactory* bufferFactory, @@ -95,7 +94,7 @@ class NegotiatedChannelFactoryConfig { /// `ChannelFactory` implementation that performs negotiation with the peer /// upon connection. -class NegotiatedChannelFactory : public mwcio::ChannelFactory { +class NegotiatedChannelFactory : public bmqio::ChannelFactory { public: // TYPES typedef NegotiatedChannelFactoryConfig Config; @@ -115,7 +114,7 @@ class NegotiatedChannelFactory : public mwcio::ChannelFactory { Config d_config; // Used to make sure no callback is invoked an a destroyed object. - mutable mwcu::SharedResource d_self; + mutable bmqu::SharedResource d_self; // NOT IMPLEMENTED NegotiatedChannelFactory(const NegotiatedChannelFactory&) @@ -134,23 +133,23 @@ class NegotiatedChannelFactory : public mwcio::ChannelFactory { /// Handle an event from our base ChannelFactory. void baseResultCallback(const ResultCallback& userCb, - mwcio::ChannelFactoryEvent::Enum event, - const mwcio::Status& status, - const bsl::shared_ptr& channel) const; + bmqio::ChannelFactoryEvent::Enum event, + const bmqio::Status& status, + const bsl::shared_ptr& channel) const; - void negotiate(const bsl::shared_ptr& channel, + void negotiate(const bsl::shared_ptr& channel, const ResultCallback& cb) const; - void readPacketsCb(const bsl::shared_ptr& channel, + void readPacketsCb(const bsl::shared_ptr& channel, const ResultCallback& cb, - const mwcio::Status& status, + const bmqio::Status& status, int* numNeeded, bdlbb::Blob* blob) const; void onBrokerNegotiationResponse( const bdlbb::Blob& packet, const ResultCallback& cb, - const bsl::shared_ptr& channel) const; + const bsl::shared_ptr& channel) const; public: // CREATORS @@ -161,14 +160,14 @@ class NegotiatedChannelFactory : public mwcio::ChannelFactory { public: // MANIPULATORS - void listen(mwcio::Status* status, + void listen(bmqio::Status* status, bslma::ManagedPtr* handle, - const mwcio::ListenOptions& options, + const bmqio::ListenOptions& options, const ResultCallback& cb) BSLS_KEYWORD_OVERRIDE; - void connect(mwcio::Status* status, + void connect(bmqio::Status* status, bslma::ManagedPtr* handle, - const mwcio::ConnectOptions& options, + const bmqio::ConnectOptions& options, const ResultCallback& cb) BSLS_KEYWORD_OVERRIDE; }; diff --git a/src/groups/bmq/bmqimp/bmqimp_queue.cpp b/src/groups/bmq/bmqimp/bmqimp_queue.cpp index 6797fd71b..e0866c311 100644 --- a/src/groups/bmq/bmqimp/bmqimp_queue.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_queue.cpp @@ -21,12 +21,11 @@ #include #include #include -#include +#include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -63,34 +62,34 @@ enum { }; double -calculateCompressionRatio(const mwcst::StatValue& value, - const mwcst::StatValue::SnapshotLocation& start) +calculateCompressionRatio(const bmqst::StatValue& value, + const bmqst::StatValue::SnapshotLocation& start) { - const bsls::Types::Int64 messageCount = mwcst::StatUtil::increments(value, + const bsls::Types::Int64 messageCount = bmqst::StatUtil::increments(value, start); if (messageCount == 0) { return 0.0; // RETURN } - const bsls::Types::Int64 ratioSum = mwcst::StatUtil::value(value, start); + const bsls::Types::Int64 ratioSum = bmqst::StatUtil::value(value, start); return (static_cast(ratioSum) / messageCount) / k_COMPRESSION_RATIO_PRECISION_FACTOR; } double -calculateCompressionRatio(const mwcst::StatValue& value, - const mwcst::StatValue::SnapshotLocation& start, - const mwcst::StatValue::SnapshotLocation& endPlus) +calculateCompressionRatio(const bmqst::StatValue& value, + const bmqst::StatValue::SnapshotLocation& start, + const bmqst::StatValue::SnapshotLocation& endPlus) { const bsls::Types::Int64 messageCount = - mwcst::StatUtil::incrementsDifference(value, start, endPlus); + bmqst::StatUtil::incrementsDifference(value, start, endPlus); if (messageCount == 0) { return 0.0; // RETURN } const bsls::Types::Int64 ratioSum = - mwcst::StatUtil::valueDifference(value, start, endPlus); + bmqst::StatUtil::valueDifference(value, start, endPlus); return (static_cast(ratioSum) / messageCount) / k_COMPRESSION_RATIO_PRECISION_FACTOR; @@ -151,54 +150,54 @@ const char* QueueState::toAscii(QueueState::Enum value) void QueueStatsUtil::initializeStats( Stat* stat, - mwcst::StatContext* rootStatContext, - const mwcst::StatValue::SnapshotLocation& start, - const mwcst::StatValue::SnapshotLocation& end, + bmqst::StatContext* rootStatContext, + const bmqst::StatValue::SnapshotLocation& start, + const bmqst::StatValue::SnapshotLocation& end, bslma::Allocator* allocator) { bdlma::LocalSequentialAllocator<2048> localAllocator(allocator); // Create the queues stat context // ------------------------------ - mwcst::StatContextConfiguration config(k_STAT_NAME, &localAllocator); + bmqst::StatContextConfiguration config(k_STAT_NAME, &localAllocator); config.isTable(true); config.value("in").value("out").value("compression_ratio"); stat->d_statContext_mp = rootStatContext->addSubcontext(config); // Create table (with Delta stats) // ------------------------------- - mwcst::TableSchema& schema = stat->d_table.schema(); + bmqst::TableSchema& schema = stat->d_table.schema(); schema.addDefaultIdColumn("id"); - schema.addColumn("in_bytes", k_STAT_IN, mwcst::StatUtil::value, start); + schema.addColumn("in_bytes", k_STAT_IN, bmqst::StatUtil::value, start); schema.addColumn("in_messages", k_STAT_IN, - mwcst::StatUtil::increments, + bmqst::StatUtil::increments, start); schema.addColumn("in_bytes_delta", k_STAT_IN, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("in_messages_delta", k_STAT_IN, - mwcst::StatUtil::incrementsDifference, + bmqst::StatUtil::incrementsDifference, start, end); - schema.addColumn("out_bytes", k_STAT_OUT, mwcst::StatUtil::value, start); + schema.addColumn("out_bytes", k_STAT_OUT, bmqst::StatUtil::value, start); schema.addColumn("out_messages", k_STAT_OUT, - mwcst::StatUtil::increments, + bmqst::StatUtil::increments, start); schema.addColumn("out_bytes_delta", k_STAT_OUT, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("out_messages_delta", k_STAT_OUT, - mwcst::StatUtil::incrementsDifference, + bmqst::StatUtil::incrementsDifference, start, end); schema.addColumn("out_compression_ratio", @@ -212,7 +211,7 @@ void QueueStatsUtil::initializeStats( end); // Configure records - mwcst::TableRecords& records = stat->d_table.records(); + bmqst::TableRecords& records = stat->d_table.records(); records.setContext(stat->d_statContext_mp.get()); records.setFilter(&StatUtil::filterDirect); @@ -250,34 +249,34 @@ void QueueStatsUtil::initializeStats( // Create the table (without Delta stats) // -------------------------------------- // We always use current snapshot for this - mwcst::StatValue::SnapshotLocation loc(0, 0); + bmqst::StatValue::SnapshotLocation loc(0, 0); - mwcst::TableSchema& schemaNoDelta = stat->d_tableNoDelta.schema(); + bmqst::TableSchema& schemaNoDelta = stat->d_tableNoDelta.schema(); schemaNoDelta.addDefaultIdColumn("id"); schemaNoDelta.addColumn("in_bytes", k_STAT_IN, - mwcst::StatUtil::value, + bmqst::StatUtil::value, loc); schemaNoDelta.addColumn("in_messages", k_STAT_IN, - mwcst::StatUtil::increments, + bmqst::StatUtil::increments, loc); schemaNoDelta.addColumn("out_bytes", k_STAT_OUT, - mwcst::StatUtil::value, + bmqst::StatUtil::value, loc); schemaNoDelta.addColumn("out_messages", k_STAT_OUT, - mwcst::StatUtil::increments, + bmqst::StatUtil::increments, loc); schemaNoDelta.addColumn("out_compression_ratio", k_STAT_COMPRESSION_RATIO, calculateCompressionRatio, loc); // Configure records - mwcst::TableRecords& recordsNoDelta = stat->d_tableNoDelta.records(); + bmqst::TableRecords& recordsNoDelta = stat->d_tableNoDelta.records(); recordsNoDelta.setContext(stat->d_statContext_mp.get()); recordsNoDelta.setFilter(&StatUtil::filterDirect); @@ -339,7 +338,7 @@ Queue::Queue(bslma::Allocator* allocator) .setConsumerPriority(bmqp::Protocol::k_CONSUMER_PRIORITY_INVALID); } -void Queue::registerStatContext(mwcst::StatContext* parentStatContext) +void Queue::registerStatContext(bmqst::StatContext* parentStatContext) { // PRECONDITIONS BSLS_ASSERT_SAFE( @@ -354,7 +353,7 @@ void Queue::registerStatContext(mwcst::StatContext* parentStatContext) bdlma::LocalSequentialAllocator<2048> localAllocator(d_allocator_p); d_stats_mp = parentStatContext->addSubcontext( - mwcst::StatContextConfiguration(d_uri.asString(), &localAllocator)); + bmqst::StatContextConfiguration(d_uri.asString(), &localAllocator)); } void Queue::statUpdateOnMessage(int size, bool isOut) @@ -390,7 +389,7 @@ Queue::print(bsl::ostream& stream, int level, int spacesPerLevel) const return stream; // RETURN } - mwcu::MemOutStream queueFlags(d_allocator_p); + bmqu::MemOutStream queueFlags(d_allocator_p); bmqt::QueueFlagsUtil::prettyPrint(queueFlags, d_handleParameters.flags()); bslim::Printer printer(&stream, level, spacesPerLevel); diff --git a/src/groups/bmq/bmqimp/bmqimp_queue.h b/src/groups/bmq/bmqimp/bmqimp_queue.h index 80b46a15c..c97fed3d9 100644 --- a/src/groups/bmq/bmqimp/bmqimp_queue.h +++ b/src/groups/bmq/bmqimp/bmqimp_queue.h @@ -40,9 +40,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -161,9 +160,9 @@ struct QueueStatsUtil { /// specified `allocator` for any memory allocation. static void initializeStats(Stat* stat, - mwcst::StatContext* rootStatContext, - const mwcst::StatValue::SnapshotLocation& start, - const mwcst::StatValue::SnapshotLocation& end, + bmqst::StatContext* rootStatContext, + const bmqst::StatValue::SnapshotLocation& start, + const bmqst::StatValue::SnapshotLocation& end, bslma::Allocator* allocator); }; @@ -233,7 +232,7 @@ class Queue { // User-specified correlation id of the // queue - bslma::ManagedPtr d_stats_mp; + bslma::ManagedPtr d_stats_mp; // Stats context associated to this // queue. Valid only if the queue is // open and 'registerStatContext()' has @@ -322,7 +321,7 @@ class Queue { /// `parentStatContext`. The behavior is undefined unless this method /// is called on valid queue in opened state. The behavior is also /// undefined it this method is called more than once. - void registerStatContext(mwcst::StatContext* parentStatContext); + void registerStatContext(bmqst::StatContext* parentStatContext); /// Update the stats of this queue by reporting a new message of the /// specified `size` was received (if the specified `isOut` is false) or @@ -374,7 +373,7 @@ class Queue { int pendingConfigureId() const; bsl::optional requestGroupId() const; const bmqp_ctrlmsg::QueueHandleParameters& handleParameters() const; - const mwcst::StatContext* statContext() const; + const bmqst::StatContext* statContext() const; bool isSuspended() const; /// Return the corresponding member of this object. @@ -654,7 +653,7 @@ Queue::handleParameters() const return d_handleParameters; } -inline const mwcst::StatContext* Queue::statContext() const +inline const bmqst::StatContext* Queue::statContext() const { return d_stats_mp.get(); } diff --git a/src/groups/bmq/bmqimp/bmqimp_queue.t.cpp b/src/groups/bmq/bmqimp/bmqimp_queue.t.cpp index cb0045128..ed82e42aa 100644 --- a/src/groups/bmq/bmqimp/bmqimp_queue.t.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_queue.t.cpp @@ -24,9 +24,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -34,7 +33,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -60,7 +59,7 @@ static void test1_breathingTest() // Basic functionality // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // Constants const int k_INVALID_QUEUE_ID = bmqimp::Queue::k_INVALID_QUEUE_ID; @@ -118,7 +117,7 @@ static void test2_settersTest() // Setters and getters // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("SETTERS TEST"); + bmqtst::TestHelper::printTestName("SETTERS TEST"); bmqimp::Queue obj(s_allocator_p); @@ -196,7 +195,7 @@ static void test3_printQueueStateTest() // bmqimp::QueueState::Enum value); // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("PRINT QUEUE STATE"); + bmqtst::TestHelper::printTestName("PRINT QUEUE STATE"); PV("Testing print"); @@ -229,8 +228,8 @@ static void test3_printQueueStateTest() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); expected << test.d_expected << "\n"; @@ -276,7 +275,7 @@ static void test4_printTest() // bmqimp::Queue rhs); // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); PV("Testing bmqimp::Queue print"); @@ -323,8 +322,8 @@ static void test4_printTest() "pendingConfigureId = 65432 requestGroupId = 4091 isSuspended = false " "isSuspendedWithBroker = false ]"; - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); expected << k_PATTERN; @@ -362,7 +361,7 @@ static void test5_comparisionTest() // bool operator==(const bmqimp::Queue& lhs, const bmqimp::Queue& rhs); // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("COMPARISION TEST"); + bmqtst::TestHelper::printTestName("COMPARISION TEST"); bmqimp::Queue obj1(s_allocator_p); bmqimp::Queue obj2(s_allocator_p); @@ -422,11 +421,11 @@ static void test6_statTest() { s_ignoreCheckDefAlloc = true; // Check for default allocator is explicitly disabled as - // 'mwcst::TableSchema::addColumn' used in + // 'bmqst::TableSchema::addColumn' used in // 'bmqimp::QueueStatsUtil::initializeStats' may allocate // temporaries with default allocator. - mwctst::TestHelper::printTestName("STAT TEST"); + bmqtst::TestHelper::printTestName("STAT TEST"); const char k_URI[] = "bmq://ts.trades.myapp/my.queue?id=my.app"; @@ -434,14 +433,14 @@ static void test6_statTest() bmqimp::QueueState::Enum k_STATE = bmqimp::QueueState::e_OPENED; bmqimp::Queue obj(s_allocator_p); - mwcst::StatContextConfiguration config("stats", s_allocator_p); + bmqst::StatContextConfiguration config("stats", s_allocator_p); config.defaultHistorySize(1); - mwcst::StatContext rootStatContext(config, s_allocator_p); + bmqst::StatContext rootStatContext(config, s_allocator_p); - mwcst::StatValue::SnapshotLocation start; - mwcst::StatValue::SnapshotLocation end; + bmqst::StatValue::SnapshotLocation start; + bmqst::StatValue::SnapshotLocation end; start.setLevel(0).setIndex(0); end.setLevel(0).setIndex(1); @@ -453,7 +452,7 @@ static void test6_statTest() end, s_allocator_p); - mwcst::StatContext* pStatContext = queuesStats.d_statContext_mp.get(); + bmqst::StatContext* pStatContext = queuesStats.d_statContext_mp.get(); ASSERT(pStatContext != 0); @@ -475,7 +474,7 @@ static void test6_statTest() ASSERT_EQ(rootStatContext.numSubcontexts(), 1); const char k_STAT_NAME[] = "queues"; - const mwcst::StatContext* k_pSubContext = rootStatContext.getSubcontext( + const bmqst::StatContext* k_pSubContext = rootStatContext.getSubcontext( k_STAT_NAME); ASSERT(k_pSubContext != 0); @@ -484,14 +483,14 @@ static void test6_statTest() ASSERT_EQ(k_pSubContext->valueName(1), "out"); ASSERT_EQ(k_pSubContext->valueName(2), "compression_ratio"); - const mwcst::StatValue& k_IN_VALUE = - k_pSubContext->value(mwcst::StatContext::e_TOTAL_VALUE, 0); + const bmqst::StatValue& k_IN_VALUE = + k_pSubContext->value(bmqst::StatContext::e_TOTAL_VALUE, 0); - const mwcst::StatValue& k_OUT_VALUE = - k_pSubContext->value(mwcst::StatContext::e_TOTAL_VALUE, 1); + const bmqst::StatValue& k_OUT_VALUE = + k_pSubContext->value(bmqst::StatContext::e_TOTAL_VALUE, 1); - const mwcst::StatValue& k_STAT_COMPRESSION_RATIO = - k_pSubContext->value(mwcst::StatContext::e_TOTAL_VALUE, 2); + const bmqst::StatValue& k_STAT_COMPRESSION_RATIO = + k_pSubContext->value(bmqst::StatContext::e_TOTAL_VALUE, 2); const int k_NEW_OUT_VALUE = 1024; @@ -520,7 +519,7 @@ static void test6_statTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); @@ -540,5 +539,5 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqimp/bmqimp_queuemanager.h b/src/groups/bmq/bmqimp/bmqimp_queuemanager.h index 9c515518f..d25761e8c 100644 --- a/src/groups/bmq/bmqimp/bmqimp_queuemanager.h +++ b/src/groups/bmq/bmqimp/bmqimp_queuemanager.h @@ -74,8 +74,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -175,7 +174,7 @@ class QueueManager { // PRIVATE TYPES /// ((queueId, subQueueId), correlationId) -> queueSp - typedef mwcc::TwoKeyHashMap + typedef bmqc::TwoKeyHashMap QueuesMap; /// canonicalUri -> queueInfo diff --git a/src/groups/bmq/bmqimp/bmqimp_queuemanager.t.cpp b/src/groups/bmq/bmqimp/bmqimp_queuemanager.t.cpp index 338e1ae9a..3d31542fc 100644 --- a/src/groups/bmq/bmqimp/bmqimp_queuemanager.t.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_queuemanager.t.cpp @@ -34,11 +34,10 @@ #include #include -// MWC -#include +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -56,13 +55,13 @@ void enableQueueStat(bmqimp::QueueManager::QueueSp& queueSp) bmqimp::QueueState::Enum k_STATE = bmqimp::QueueState::e_OPENED; bmqimp::Stat queuesStats(s_allocator_p); - mwcst::StatValue::SnapshotLocation start; - mwcst::StatValue::SnapshotLocation end; + bmqst::StatValue::SnapshotLocation start; + bmqst::StatValue::SnapshotLocation end; - mwcst::StatContextConfiguration config("stats", s_allocator_p); + bmqst::StatContextConfiguration config("stats", s_allocator_p); config.defaultHistorySize(2); - mwcst::StatContext rootStatContext(config, s_allocator_p); + bmqst::StatContext rootStatContext(config, s_allocator_p); start.setLevel(0).setIndex(0); end.setLevel(0).setIndex(1); @@ -73,7 +72,7 @@ void enableQueueStat(bmqimp::QueueManager::QueueSp& queueSp) end, s_allocator_p); - mwcst::StatContext* pStatContext = queuesStats.d_statContext_mp.get(); + bmqst::StatContext* pStatContext = queuesStats.d_statContext_mp.get(); queueSp->setState(k_STATE); queueSp->registerStatContext(pStatContext); @@ -100,7 +99,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bmqimp::QueueManager obj(s_allocator_p); @@ -154,7 +153,7 @@ static void test2_generateQueueIdTest() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GENERATE QUEUE ID TEST"); + bmqtst::TestHelper::printTestName("GENERATE QUEUE ID TEST"); const char k_URI[] = "bmq://ts.trades.myapp/my.queue?id=my.app"; @@ -294,7 +293,7 @@ static void test3_insertQueueTest() // const bmqimp::QueueManager::QueueSp& queue) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("INSERT QUEUE TEST"); + bmqtst::TestHelper::printTestName("INSERT QUEUE TEST"); bmqimp::QueueManager obj(s_allocator_p); @@ -378,7 +377,7 @@ static void test4_lookupQueueByUri() // bmqimp::QueueManager::lookupQueue(const bmqt::Uri uri); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LOOKUP QUEUE"); + bmqtst::TestHelper::printTestName("LOOKUP QUEUE"); bmqimp::QueueManager obj(s_allocator_p); @@ -430,7 +429,7 @@ static void test6_removeQueueTest() // const bmqimp::Queue *queue) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("REMOVE QUEUE TEST"); + bmqtst::TestHelper::printTestName("REMOVE QUEUE TEST"); bmqimp::QueueManager obj(s_allocator_p); @@ -487,7 +486,7 @@ static void test8_substreamCountTest() // QueueManager::resetSubStreamCount(const bsl::string& canonicalUri) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("RESET STATE TEST"); + bmqtst::TestHelper::printTestName("RESET STATE TEST"); bmqimp::QueueManager obj(s_allocator_p); @@ -566,7 +565,7 @@ static void test9_pushStatsTest() // bmqimp::QueueManager::updateStatsOnPushEvent // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("BASIC PUSH EVENT STATISTICS"); + bmqtst::TestHelper::printTestName("BASIC PUSH EVENT STATISTICS"); const char k_URI[] = "bmq://ts.trades.myapp/my.queue?id=my.app"; const char* buffer = "abcdefghijklmnopqrstuvwxyz"; @@ -672,7 +671,7 @@ static void test10_putStatsTest() // bmqimp::QueueManager::updateStatsOnPutEvent // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("BASIC PUT EVENT STATISTICS"); + bmqtst::TestHelper::printTestName("BASIC PUT EVENT STATISTICS"); const char k_URI[] = "bmq://ts.trades.myapp/my.queue?id=my.app"; const char* k_PAYLOAD = "abcdefghijklmnopqrstuvwxyz"; @@ -748,7 +747,7 @@ static void test10_putStatsTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); bmqt::UriParser::initialize(s_allocator_p); @@ -775,7 +774,7 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); // Check for default allocator is explicitly disabled as // 'bmqimp::QueueManager::insertQueue' may allocate diff --git a/src/groups/bmq/bmqimp/bmqimp_stat.cpp b/src/groups/bmq/bmqimp/bmqimp_stat.cpp index 8f501a76f..0b481a999 100644 --- a/src/groups/bmq/bmqimp/bmqimp_stat.cpp +++ b/src/groups/bmq/bmqimp/bmqimp_stat.cpp @@ -17,8 +17,8 @@ #include #include -// MWC -#include + +#include namespace BloombergLP { namespace bmqimp { @@ -39,12 +39,12 @@ Stat::Stat(bslma::Allocator* allocator) void Stat::printStats(bsl::ostream& stream, bool includeDelta) const { - mwcst::Table* table = (includeDelta ? &d_table : &d_tableNoDelta); - const mwcst::BasicTableInfoProvider* tip = (includeDelta ? &d_tip + bmqst::Table* table = (includeDelta ? &d_table : &d_tableNoDelta); + const bmqst::BasicTableInfoProvider* tip = (includeDelta ? &d_tip : &d_tipNoDelta); table->records().update(); - mwcst::TableUtil::printTable(stream, *tip); + bmqst::TableUtil::printTable(stream, *tip); stream << "\n"; } @@ -52,15 +52,15 @@ void Stat::printStats(bsl::ostream& stream, bool includeDelta) const // struct StatUtil // --------------- -bool StatUtil::filterDirect(const mwcst::TableRecords::Record& record) +bool StatUtil::filterDirect(const bmqst::TableRecords::Record& record) { - return record.type() == mwcst::StatContext::e_TOTAL_VALUE; + return record.type() == bmqst::StatContext::e_TOTAL_VALUE; } bool StatUtil::filterDirectAndTopLevel( - const mwcst::TableRecords::Record& record) + const bmqst::TableRecords::Record& record) { - return record.type() == mwcst::StatContext::e_TOTAL_VALUE && + return record.type() == bmqst::StatContext::e_TOTAL_VALUE && record.level() != 0; } diff --git a/src/groups/bmq/bmqimp/bmqimp_stat.h b/src/groups/bmq/bmqimp/bmqimp_stat.h index cc1d02e60..73c2bdeac 100644 --- a/src/groups/bmq/bmqimp/bmqimp_stat.h +++ b/src/groups/bmq/bmqimp/bmqimp_stat.h @@ -30,10 +30,9 @@ // BMQ -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -45,7 +44,7 @@ namespace BloombergLP { // FORWARD DECLARATION -namespace mwcst { +namespace bmqst { class StatContext; } @@ -67,19 +66,19 @@ struct Stat { public: // PUBLIC DATA - bslma::ManagedPtr d_statContext_mp; + bslma::ManagedPtr d_statContext_mp; // StatContext - mutable mwcst::Table d_table; + mutable bmqst::Table d_table; // Table with all data - mwcst::BasicTableInfoProvider d_tip; + bmqst::BasicTableInfoProvider d_tip; // Tip for all the data - mutable mwcst::Table d_tableNoDelta; + mutable bmqst::Table d_tableNoDelta; // Table without the delta data - mwcst::BasicTableInfoProvider d_tipNoDelta; + bmqst::BasicTableInfoProvider d_tipNoDelta; // Tip for the no delta data // TRAITS @@ -106,13 +105,13 @@ struct StatUtil { /// Return true if the specified `record` should be filtered-out because /// it represents a TotalValue data; or false otherwise. - static bool filterDirect(const mwcst::TableRecords::Record& record); + static bool filterDirect(const bmqst::TableRecords::Record& record); /// Return true if the specified `record` should be filtered-out because /// it represents a TotalValue data or a top level record; or false /// otherwise. static bool - filterDirectAndTopLevel(const mwcst::TableRecords::Record& record); + filterDirectAndTopLevel(const bmqst::TableRecords::Record& record); }; } // close package namespace diff --git a/src/groups/bmq/bmqimp/package/bmqimp.dep b/src/groups/bmq/bmqimp/package/bmqimp.dep index 2a2b1cf15..7db9f6251 100644 --- a/src/groups/bmq/bmqimp/package/bmqimp.dep +++ b/src/groups/bmq/bmqimp/package/bmqimp.dep @@ -1,4 +1,11 @@ +bmqc +bmqex +bmqio +bmqma bmqp bmqpi -bmqt bmqscm +bmqst +bmqsys +bmqt +bmqu diff --git a/src/groups/mwc/mwcio/mwcio_basechannelpartialimp.cpp b/src/groups/bmq/bmqio/bmqio_basechannelpartialimp.cpp similarity index 90% rename from src/groups/mwc/mwcio/mwcio_basechannelpartialimp.cpp rename to src/groups/bmq/bmqio/bmqio_basechannelpartialimp.cpp index 788bbb5ed..20cbda2af 100644 --- a/src/groups/mwc/mwcio/mwcio_basechannelpartialimp.cpp +++ b/src/groups/bmq/bmqio/bmqio_basechannelpartialimp.cpp @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_basechannelpartialimp.cpp -*-C++-*- -#include +// bmqio_basechannelpartialimp.cpp -*-C++-*- +#include -#include +#include // BDE #include #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // --------------------------- // class BaseChannelPartialImp diff --git a/src/groups/mwc/mwcio/mwcio_basechannelpartialimp.h b/src/groups/bmq/bmqio/bmqio_basechannelpartialimp.h similarity index 84% rename from src/groups/mwc/mwcio/mwcio_basechannelpartialimp.h rename to src/groups/bmq/bmqio/bmqio_basechannelpartialimp.h index b73d30d52..1da27b0ff 100644 --- a/src/groups/mwc/mwcio/mwcio_basechannelpartialimp.h +++ b/src/groups/bmq/bmqio/bmqio_basechannelpartialimp.h @@ -13,26 +13,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_basechannelpartialimp.h -*-C++-*- -#ifndef INCLUDED_MWCIO_BASECHANNELPARTIALIMP -#define INCLUDED_MWCIO_BASECHANNELPARTIALIMP +// bmqio_basechannelpartialimp.h -*-C++-*- +#ifndef INCLUDED_BMQIO_BASECHANNELPARTIALIMP +#define INCLUDED_BMQIO_BASECHANNELPARTIALIMP //@PURPOSE: Provide a partial 'Channel' imp for a 'base' channel // //@CLASSES: -// mwcio::BaseChannelPartialImp +// bmqio::BaseChannelPartialImp // //@SEE_ALSO: // //@DESCRIPTION: This component defines a partial implementation of the -// 'mwcio::Channel' protocol for a 'base' Channel', that is a channel that is +// 'bmqio::Channel' protocol for a 'base' Channel', that is a channel that is // not decorating another 'channel'. -// MWC - -#include -#include -#include +#include +#include +#include // BDE #include @@ -42,7 +40,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // =========================== // class BaseChannelPartialImp @@ -58,9 +56,9 @@ class BaseChannelPartialImp : public Channel { private: // PRIVATE DATA - CloseSignaler d_closeSignaler; - WatermarkSignaler d_watermarkSignaler; - mwct::PropertyBag d_properties; + CloseSignaler d_closeSignaler; + WatermarkSignaler d_watermarkSignaler; + bmqvt::PropertyBag d_properties; // NOT IMPLEMENTED BaseChannelPartialImp(const BaseChannelPartialImp&) BSLS_KEYWORD_DELETED; @@ -102,7 +100,7 @@ class BaseChannelPartialImp : public Channel { /// Return a reference providing modifiable access to the properties of /// this Channel. - mwct::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; + bmqvt::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; // ACCESSORS @@ -113,7 +111,7 @@ class BaseChannelPartialImp : public Channel { /// Return a reference providing modifiable access to the properties of /// this Channel. - const mwct::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; + const bmqvt::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; }; // ============================================================================ @@ -133,7 +131,7 @@ BaseChannelPartialImp::watermarkSignaler() return d_watermarkSignaler; } -inline mwct::PropertyBag& BaseChannelPartialImp::properties() +inline bmqvt::PropertyBag& BaseChannelPartialImp::properties() { return d_properties; } @@ -144,7 +142,7 @@ inline bslma::Allocator* BaseChannelPartialImp::allocator() const return d_properties.allocator(); } -inline const mwct::PropertyBag& BaseChannelPartialImp::properties() const +inline const bmqvt::PropertyBag& BaseChannelPartialImp::properties() const { return d_properties; } diff --git a/src/groups/mwc/mwcio/mwcio_channel.cpp b/src/groups/bmq/bmqio/bmqio_channel.cpp similarity index 94% rename from src/groups/mwc/mwcio/mwcio_channel.cpp rename to src/groups/bmq/bmqio/bmqio_channel.cpp index 414619042..11b3f1a4f 100644 --- a/src/groups/mwc/mwcio/mwcio_channel.cpp +++ b/src/groups/bmq/bmqio/bmqio_channel.cpp @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_channel.cpp -*-C++-*- -#include +// bmqio_channel.cpp -*-C++-*- +#include -#include +#include // BDE #include #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // --------------------------- // struct ChannelWatermarkType diff --git a/src/groups/mwc/mwcio/mwcio_channel.h b/src/groups/bmq/bmqio/bmqio_channel.h similarity index 91% rename from src/groups/mwc/mwcio/mwcio_channel.h rename to src/groups/bmq/bmqio/bmqio_channel.h index 43a35b6b3..773154443 100644 --- a/src/groups/mwc/mwcio/mwcio_channel.h +++ b/src/groups/bmq/bmqio/bmqio_channel.h @@ -13,25 +13,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_channel.h -*-C++-*- -#ifndef INCLUDED_MWCIO_CHANNEL -#define INCLUDED_MWCIO_CHANNEL +// bmqio_channel.h -*-C++-*- +#ifndef INCLUDED_BMQIO_CHANNEL +#define INCLUDED_BMQIO_CHANNEL //@PURPOSE: Provide a pure protocol for a bi-directional async channel. // //@CLASSES: -// mwcio::Channel: Interface for a bi-directional async channel. +// bmqio::Channel: Interface for a bi-directional async channel. // -//@DESCRIPTION: This component provides a pure protocol, 'mwcio::Channel', to +//@DESCRIPTION: This component provides a pure protocol, 'bmqio::Channel', to // be implemented by any transport mechanism to asynchronously send and receive // arbitrary blobs of data. // -// A 'mwcio::Channel' provides operations to asynchronously read and write data +// A 'bmqio::Channel' provides operations to asynchronously read and write data // (e.g. blobs). -// MWC - -#include +#include // BDE #include @@ -44,7 +42,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // =========================== // struct ChannelWatermarkType @@ -109,9 +107,9 @@ class Channel { /// A callback of this type is invoked for read when either the /// requested number of bytes are available, or an error occurs. The - /// callback is invoked with three arguments: (1) a `mwcio::Status` that + /// callback is invoked with three arguments: (1) a `bmqio::Status` that /// indicates the result of the read operation, and if this status is - /// equal to `MWCIO_SUCCESS`, (2) a pointer to an integer value where + /// equal to `BMQIO_SUCCESS`, (2) a pointer to an integer value where /// the callee can indicate how many more bytes are needed to complete /// the read operation, and (3) a modifiable `bdlbb::Blob` object /// containing the payload. The caller is responsible for taking @@ -169,7 +167,7 @@ class Channel { /// that can be enqueued. If `highWaterMark` is not specified then /// INT_MAX is used. Return 0 on success, and a non-zero value /// otherwise. On error, the return value may equal to one of the - /// enumerators in `mwcio_ChannelStatus::Type`. Note that success does + /// enumerators in `bmqio_ChannelStatus::Type`. Note that success does /// not imply that the data has been written or will be successfully /// written to the underlying stream used by this channel. Also note /// that in addition to `highWatermark` the enqueued portion must also @@ -181,7 +179,7 @@ class Channel { bsls::Types::Int64 watermark = bsl::numeric_limits::max()) = 0; /// Cancel all pending read requests, and invoke their read callbacks - /// with a `mwcio::ChannelStatus::e_CANCELED` status. Note that if the + /// with a `bmqio::ChannelStatus::e_CANCELED` status. Note that if the /// channel is active, the read callbacks are invoked in the thread in /// which the channel's data callbacks are invoked, else they are /// invoked in the thread calling `cancelRead`. @@ -210,7 +208,7 @@ class Channel { /// Return a reference providing modifiable access to the properties of /// this Channel. - virtual mwct::PropertyBag& properties() = 0; + virtual bmqvt::PropertyBag& properties() = 0; // VIRTUAL ACCESSORS @@ -220,7 +218,7 @@ class Channel { /// Return a reference providing modifiable access to the properties of /// this Channel. - virtual const mwct::PropertyBag& properties() const = 0; + virtual const bmqvt::PropertyBag& properties() const = 0; }; } // close package namespace @@ -233,10 +231,10 @@ class Channel { // struct ChannelWatermarkType // --------------------------- -inline bsl::ostream& mwcio::operator<<(bsl::ostream& stream, - mwcio::ChannelWatermarkType::Enum value) +inline bsl::ostream& bmqio::operator<<(bsl::ostream& stream, + bmqio::ChannelWatermarkType::Enum value) { - return mwcio::ChannelWatermarkType::print(stream, value, 0, -1); + return bmqio::ChannelWatermarkType::print(stream, value, 0, -1); } } // close enterprise namespace diff --git a/src/groups/mwc/mwcio/mwcio_channelfactory.cpp b/src/groups/bmq/bmqio/bmqio_channelfactory.cpp similarity index 93% rename from src/groups/mwc/mwcio/mwcio_channelfactory.cpp rename to src/groups/bmq/bmqio/bmqio_channelfactory.cpp index c0d003511..345033423 100644 --- a/src/groups/mwc/mwcio/mwcio_channelfactory.cpp +++ b/src/groups/bmq/bmqio/bmqio_channelfactory.cpp @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_channelfactory.cpp -*-C++-*- -#include +// bmqio_channelfactory.cpp -*-C++-*- +#include -#include +#include // BDE #include #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // -------------------------- // struct ChannelFactoryEvent diff --git a/src/groups/mwc/mwcio/mwcio_channelfactory.h b/src/groups/bmq/bmqio/bmqio_channelfactory.h similarity index 88% rename from src/groups/mwc/mwcio/mwcio_channelfactory.h rename to src/groups/bmq/bmqio/bmqio_channelfactory.h index a594102a5..b49a0cd48 100644 --- a/src/groups/mwc/mwcio/mwcio_channelfactory.h +++ b/src/groups/bmq/bmqio/bmqio_channelfactory.h @@ -13,29 +13,27 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_channelfactory.h -*-C++-*- -#ifndef INCLUDED_MWCIO_CHANNELFACTORY -#define INCLUDED_MWCIO_CHANNELFACTORY +// bmqio_channelfactory.h -*-C++-*- +#ifndef INCLUDED_BMQIO_CHANNELFACTORY +#define INCLUDED_BMQIO_CHANNELFACTORY -//@PURPOSE: Provide a protocol for a 'mwcio::Channel' factory. +//@PURPOSE: Provide a protocol for a 'bmqio::Channel' factory. // //@CLASSES: -// mwcio::ChannelFactory: protocol for a 'mwcio::Channel' factory -// mwcio::ChannelFactoryEvent: event type for connec/listen notifications +// bmqio::ChannelFactory: protocol for a 'bmqio::Channel' factory +// bmqio::ChannelFactoryEvent: event type for connec/listen notifications // //@SEE_ALSO: -// mwcio_channel -// mwcio_channeldecorator +// bmqio_channel +// bmqio_channeldecorator // //@DESCRIPTION: This component defines a pure protocol, -// 'mwcio::ChannelFactory', which is a factory of objects that implement the -// 'mwcio::Channel' protocol. It also provides an enum, -// 'mwcio::ChannelFactoryEvent' for categorizing the various events +// 'bmqio::ChannelFactory', which is a factory of objects that implement the +// 'bmqio::Channel' protocol. It also provides an enum, +// 'bmqio::ChannelFactoryEvent' for categorizing the various events // notifications resulting from an operation on the factory. -// MWC - -#include +#include // BDE #include @@ -45,7 +43,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // FORWARD DECLARATION class Channel; @@ -57,7 +55,7 @@ class ListenOptions; // ========================== /// This enum represents the type of events which can be emitted by -/// operations on the `mwcio::ChannelFactory` object. +/// operations on the `bmqio::ChannelFactory` object. struct ChannelFactoryEvent { // TYPES enum Enum { @@ -121,20 +119,20 @@ class ChannelFactoryOperationHandle { /// Return a reference providing modifiable access to the properties of /// this object. - virtual mwct::PropertyBag& properties() = 0; + virtual bmqvt::PropertyBag& properties() = 0; // ACCESSORS /// Return a reference providing const access to the properties of this /// object. - virtual const mwct::PropertyBag& properties() const = 0; + virtual const bmqvt::PropertyBag& properties() const = 0; }; // ==================== // class ChannelFactory // ==================== -/// Protocol for a factory of `mwcio::Channel` objects. +/// Protocol for a factory of `bmqio::Channel` objects. class ChannelFactory { public: // PUBLIC TYPES @@ -202,8 +200,8 @@ class ChannelFactory { // struct ChannelFactoryEvent // -------------------------- -inline bsl::ostream& mwcio::operator<<(bsl::ostream& stream, - mwcio::ChannelFactoryEvent::Enum value) +inline bsl::ostream& bmqio::operator<<(bsl::ostream& stream, + bmqio::ChannelFactoryEvent::Enum value) { return ChannelFactoryEvent::print(stream, value, 0, -1); } diff --git a/src/groups/mwc/mwcio/mwcio_channelutil.cpp b/src/groups/bmq/bmqio/bmqio_channelutil.cpp similarity index 92% rename from src/groups/mwc/mwcio/mwcio_channelutil.cpp rename to src/groups/bmq/bmqio/bmqio_channelutil.cpp index 280c03521..884b55784 100644 --- a/src/groups/mwc/mwcio/mwcio_channelutil.cpp +++ b/src/groups/bmq/bmqio/bmqio_channelutil.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_channelutil.cpp -*-C++-*- -#include +// bmqio_channelutil.cpp -*-C++-*- +#include -#include -// MWC -#include -#include +#include + +#include +#include // BDE #include @@ -38,11 +38,11 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { namespace { -BALL_LOG_SET_NAMESPACE_CATEGORY("MWCIO.CHANNELUTIL"); +BALL_LOG_SET_NAMESPACE_CATEGORY("BMQIO.CHANNELUTIL"); /// The minimum size (in bytes) of a packet. static const int k_MINIMUM_PACKET_LENGTH = sizeof(bdlb::BigEndianUint32); @@ -50,12 +50,12 @@ static const int k_MINIMUM_PACKET_LENGTH = sizeof(bdlb::BigEndianUint32); inline bool isValidPacketLength(int* packetLength, const bdlbb::Blob& inBlob, - const mwcu::BlobPosition& pos = mwcu::BlobPosition()) + const bmqu::BlobPosition& pos = bmqu::BlobPosition()) { void* offsetByte = inBlob.buffer(pos.buffer()).data() + pos.byte(); if (BSLS_PERFORMANCEHINT_PREDICT_LIKELY( - (mwcu::BlobUtil::bufferSize(inBlob, pos.buffer()) - pos.byte()) >= + (bmqu::BlobUtil::bufferSize(inBlob, pos.buffer()) - pos.byte()) >= k_MINIMUM_PACKET_LENGTH && bsls::AlignmentUtil::calculateAlignmentOffset( offsetByte, @@ -72,7 +72,7 @@ isValidPacketLength(int* packetLength, // need to memcpy. BSLS_PERFORMANCEHINT_UNLIKELY_HINT; bdlb::BigEndianUint32 lengthBE; - mwcu::BlobUtil::copyToRawBufferFromIndex( + bmqu::BlobUtil::copyToRawBufferFromIndex( reinterpret_cast(&lengthBE), inBlob, pos.buffer(), @@ -160,7 +160,7 @@ int ChannelUtil::handleRead(bsl::vector* outPackets, int packetLength = 0; // The full length of the packet, as // extracted from reading the first // bytes of the packet in 'inBlob' - mwcu::BlobPosition offset; + bmqu::BlobPosition offset; // We need at least 'k_MINIMUM_PACKET_LENGTH' bytes in the blob, since // those first bytes are encoding the full length (in bytes) of the packet. @@ -171,7 +171,7 @@ int ChannelUtil::handleRead(bsl::vector* outPackets, // length of the entire packet). More than likely, those will all be // in the same buffer of the blob, and should be aligned. const int rc = - mwcu::BlobUtil::findOffset(&offset, *inBlob, offset, packetLength); + bmqu::BlobUtil::findOffset(&offset, *inBlob, offset, packetLength); BSLS_ASSERT_OPT(rc == 0); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( @@ -222,14 +222,14 @@ bool ChannelUtil::isLocalHost(const bsl::string_view& host) { // Resolve the default address of this host bsl::string hostname; - if (mwcio::ResolveUtil::getHostname(&hostname).code() != + if (bmqio::ResolveUtil::getHostname(&hostname).code() != ntsa::Error::e_OK) { BSLS_ASSERT_OPT(false && "Failed to get local host name"); return false; // RETURN } ntsa::Ipv4Address defaultIP; - if (mwcio::ResolveUtil::getIpAddress(&defaultIP, hostname).code() != + if (bmqio::ResolveUtil::getIpAddress(&defaultIP, hostname).code() != ntsa::Error::e_OK) { BSLS_ASSERT_OPT(false && "Failed to get IP address of the host."); return false; // RETURN @@ -243,7 +243,7 @@ bool ChannelUtil::isLocalHost(const bsl::string_view& host) } ntsa::Ipv4Address ipAddress; - ntsa::Error error = mwcio::ResolveUtil::getIpAddress(&ipAddress, host); + ntsa::Error error = bmqio::ResolveUtil::getIpAddress(&ipAddress, host); if (error.code() != ntsa::Error::e_OK) { BALL_LOG_WARN << "#TCP_IPRESOLUTION_FAILURE " << "Failed resolving ipAddress for '" << host @@ -268,7 +268,7 @@ bool ChannelUtil::isLocalHost(const ntsa::IpAddress& ip) // Pass 'bslma::NewDeleteAllocator' in order to prevent using of // default allocator. - ntsa::Error error = mwcio::ResolveUtil::getLocalIpAddress( + ntsa::Error error = bmqio::ResolveUtil::getLocalIpAddress( &s_localAddresses); BSLS_ASSERT_OPT(error.code() == ntsa::Error::e_OK && "Unable to obtain local addresses"); diff --git a/src/groups/mwc/mwcio/mwcio_channelutil.h b/src/groups/bmq/bmqio/bmqio_channelutil.h similarity index 91% rename from src/groups/mwc/mwcio/mwcio_channelutil.h rename to src/groups/bmq/bmqio/bmqio_channelutil.h index cd116d820..98b1843d2 100644 --- a/src/groups/mwc/mwcio/mwcio_channelutil.h +++ b/src/groups/bmq/bmqio/bmqio_channelutil.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_channelutil.h -*-C++-*- -#ifndef INCLUDED_MWCIO_CHANNELUTIL -#define INCLUDED_MWCIO_CHANNELUTIL +// bmqio_channelutil.h -*-C++-*- +#ifndef INCLUDED_BMQIO_CHANNELUTIL +#define INCLUDED_BMQIO_CHANNELUTIL //@PURPOSE: Provide utility functions related to channel manipulation. // //@CLASSES: -// mwcio::ChannelUtil: namespace for channel manipulation utility functions. +// bmqio::ChannelUtil: namespace for channel manipulation utility functions. // -//@DESCRIPTION: 'mwcio::ChannelUtil' provides a utility namespace for channel +//@DESCRIPTION: 'bmqio::ChannelUtil' provides a utility namespace for channel // manipulation functions. // BDE @@ -34,7 +34,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ================== // struct ChannelUtil diff --git a/src/groups/mwc/mwcio/mwcio_channelutil.t.cpp b/src/groups/bmq/bmqio/bmqio_channelutil.t.cpp similarity index 89% rename from src/groups/mwc/mwcio/mwcio_channelutil.t.cpp rename to src/groups/bmq/bmqio/bmqio_channelutil.t.cpp index 2704fb415..b6971bf12 100644 --- a/src/groups/mwc/mwcio/mwcio_channelutil.t.cpp +++ b/src/groups/bmq/bmqio/bmqio_channelutil.t.cpp @@ -13,14 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_channelutil.t.cpp -*-C++-*- -#include +// bmqio_channelutil.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include -// MWC -#include +#include // BDE #include @@ -40,7 +39,7 @@ // CONVENIENCE using namespace BloombergLP; using namespace bsl; -using namespace mwcio; +using namespace bmqio; // ============================================================================ // TEST HELPERS UTILITY @@ -97,7 +96,7 @@ void appendToInputBlob(bdlbb::Blob* out, size_t length, size_t blobSize) static void test1_handleRead_singlePacket() { - mwctst::TestHelper::printTestName("HANDLE READ - SINGLE PACKET"); + bmqtst::TestHelper::printTestName("HANDLE READ - SINGLE PACKET"); { PVV("INVALID BLOB - NO HEADER"); @@ -106,7 +105,7 @@ static void test1_handleRead_singlePacket() bdlbb::Blob input(&bufferFactory, s_allocator_p); int numNeeded = 0; - const int rc = mwcio::ChannelUtil::handleRead(&packet, + const int rc = bmqio::ChannelUtil::handleRead(&packet, &numNeeded, &input); ASSERT_EQ(rc, 0); @@ -124,7 +123,7 @@ static void test1_handleRead_singlePacket() const int totalLength = k_MINIMUM_PACKET_LENGTH + 12; appendToInputBlob(&input, 3, totalLength); - const int rc = mwcio::ChannelUtil::handleRead(&packet, + const int rc = bmqio::ChannelUtil::handleRead(&packet, &numNeeded, &input); ASSERT_EQ(rc, -1); @@ -142,7 +141,7 @@ static void test1_handleRead_singlePacket() const int totalLength = k_MINIMUM_PACKET_LENGTH + 12; appendToInputBlob(&input, totalLength, totalLength - 1); - const int rc = mwcio::ChannelUtil::handleRead(&packet, + const int rc = bmqio::ChannelUtil::handleRead(&packet, &numNeeded, &input); ASSERT_EQ(rc, 0); @@ -160,7 +159,7 @@ static void test1_handleRead_singlePacket() const int totalLength = k_MINIMUM_PACKET_LENGTH + 12; appendToInputBlob(&input, totalLength, totalLength); - const int rc = mwcio::ChannelUtil::handleRead(&packet, + const int rc = bmqio::ChannelUtil::handleRead(&packet, &numNeeded, &input); ASSERT_EQ(rc, 0); @@ -178,7 +177,7 @@ static void test1_handleRead_singlePacket() const int totalLength = k_MINIMUM_PACKET_LENGTH + 12; appendToInputBlob(&input, totalLength, totalLength); - const int rc = mwcio::ChannelUtil::handleRead(&packet, + const int rc = bmqio::ChannelUtil::handleRead(&packet, &numNeeded, &input); ASSERT_EQ(rc, 0); @@ -190,7 +189,7 @@ static void test1_handleRead_singlePacket() static void test2_handleRead_multiplePackets() { - mwctst::TestHelper::printTestName("HANDLE READ - MULTIPLE PACKETS"); + bmqtst::TestHelper::printTestName("HANDLE READ - MULTIPLE PACKETS"); { PVV("INVALID BLOB - NO HEADER"); @@ -201,7 +200,7 @@ static void test2_handleRead_multiplePackets() const int totalLength = k_MINIMUM_PACKET_LENGTH + 12; appendToInputBlob(&input, totalLength, totalLength); - const int rc = mwcio::ChannelUtil::handleRead(&packets, + const int rc = bmqio::ChannelUtil::handleRead(&packets, &numNeeded, &input); ASSERT_EQ(rc, 0); @@ -221,7 +220,7 @@ static void test2_handleRead_multiplePackets() const int totalLength = k_MINIMUM_PACKET_LENGTH + 12; appendToInputBlob(&input, totalLength, totalLength); appendToInputBlob(&input, 3, totalLength); - const int rc = mwcio::ChannelUtil::handleRead(&packets, + const int rc = bmqio::ChannelUtil::handleRead(&packets, &numNeeded, &input); ASSERT_EQ(rc, -1); @@ -241,7 +240,7 @@ static void test2_handleRead_multiplePackets() const int totalLength = k_MINIMUM_PACKET_LENGTH + 12; appendToInputBlob(&input, totalLength, totalLength); appendToInputBlob(&input, totalLength, totalLength - 1); - const int rc = mwcio::ChannelUtil::handleRead(&packets, + const int rc = bmqio::ChannelUtil::handleRead(&packets, &numNeeded, &input); ASSERT_EQ(rc, 0); @@ -262,7 +261,7 @@ static void test2_handleRead_multiplePackets() appendToInputBlob(&input, totalLength, totalLength); appendToInputBlob(&input, totalLength - 1, totalLength - 1); appendToInputBlob(&input, totalLength - 2, totalLength - 2); - const int rc = mwcio::ChannelUtil::handleRead(&packets, + const int rc = bmqio::ChannelUtil::handleRead(&packets, &numNeeded, &input); ASSERT_EQ(rc, 0); @@ -284,7 +283,7 @@ static void test2_handleRead_multiplePackets() const int totalLength = k_MINIMUM_PACKET_LENGTH + 12; appendToInputBlob(&input, totalLength, totalLength); appendToInputBlob(&input, totalLength - 2, totalLength - 2); - const int rc = mwcio::ChannelUtil::handleRead(&packets, + const int rc = bmqio::ChannelUtil::handleRead(&packets, &numNeeded, &input); ASSERT_EQ(rc, 0); @@ -305,7 +304,7 @@ static void test2_handleRead_multiplePackets() const int totalLength = k_MINIMUM_PACKET_LENGTH + 12; appendToInputBlob(&input, totalLength, totalLength); appendToInputBlob(&input, totalLength, k_MINIMUM_PACKET_LENGTH); - const int rc = mwcio::ChannelUtil::handleRead(&packets, + const int rc = bmqio::ChannelUtil::handleRead(&packets, &numNeeded, &input); ASSERT_EQ(rc, 0); @@ -318,32 +317,32 @@ static void test2_handleRead_multiplePackets() static void test3_isLocalHost() { - mwctst::TestHelper::printTestName("IS LOCAL HOST - BREATHING TEST"); + bmqtst::TestHelper::printTestName("IS LOCAL HOST - BREATHING TEST"); - // mwcio::ChannelUtil::isLocalHost(const ntsa::IpAddress&) internally uses + // bmqio::ChannelUtil::isLocalHost(const ntsa::IpAddress&) internally uses // default allocator s_ignoreCheckDefAlloc = true; { PVV("'LOCALHOST' - TRUE"); - ASSERT(mwcio::ChannelUtil::isLocalHost("localhost")); - ASSERT(mwcio::ChannelUtil::isLocalHost("LoCaLhOsT")); + ASSERT(bmqio::ChannelUtil::isLocalHost("localhost")); + ASSERT(bmqio::ChannelUtil::isLocalHost("LoCaLhOsT")); PVV("'WWW.WIKIPEDIA.ORG' - FALSE") - ASSERT(!mwcio::ChannelUtil::isLocalHost("www.wikipedia.org")); + ASSERT(!bmqio::ChannelUtil::isLocalHost("www.wikipedia.org")); } { PVV("'LOCAL IP ADDRESSES' - TRUE"); bsl::vector localIPs(s_allocator_p); - ASSERT_EQ(mwcio::ResolveUtil::getLocalIpAddress(&localIPs).code(), + ASSERT_EQ(bmqio::ResolveUtil::getLocalIpAddress(&localIPs).code(), ntsa::Error::e_OK); bsl::vector::const_iterator it; for (it = localIPs.begin(); it != localIPs.end(); ++it) { PVV(*it); - ASSERT(mwcio::ChannelUtil::isLocalHost(*it)); + ASSERT(bmqio::ChannelUtil::isLocalHost(*it)); } } } @@ -354,7 +353,7 @@ static void test3_isLocalHost() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -367,5 +366,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcio/mwcio_connectoptions.cpp b/src/groups/bmq/bmqio/bmqio_connectoptions.cpp similarity index 93% rename from src/groups/mwc/mwcio/mwcio_connectoptions.cpp rename to src/groups/bmq/bmqio/bmqio_connectoptions.cpp index 60aed1fa9..2b01950db 100644 --- a/src/groups/mwc/mwcio/mwcio_connectoptions.cpp +++ b/src/groups/bmq/bmqio/bmqio_connectoptions.cpp @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_connectoptions.cpp -*-C++-*- -#include +// bmqio_connectoptions.cpp -*-C++-*- +#include -#include +#include // BDE #include #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // -------------------- // class ConnectOptions diff --git a/src/groups/mwc/mwcio/mwcio_connectoptions.h b/src/groups/bmq/bmqio/bmqio_connectoptions.h similarity index 89% rename from src/groups/mwc/mwcio/mwcio_connectoptions.h rename to src/groups/bmq/bmqio/bmqio_connectoptions.h index 84782ddab..6848971de 100644 --- a/src/groups/mwc/mwcio/mwcio_connectoptions.h +++ b/src/groups/bmq/bmqio/bmqio_connectoptions.h @@ -13,22 +13,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_connectoptions.h -*-C++-*- -#ifndef INCLUDED_MWCIO_CONNECTOPTIONS -#define INCLUDED_MWCIO_CONNECTOPTIONS +// bmqio_connectoptions.h -*-C++-*- +#ifndef INCLUDED_BMQIO_CONNECTOPTIONS +#define INCLUDED_BMQIO_CONNECTOPTIONS //@PURPOSE: Provide a type encapsulating options for 'ChannelFactory::connect'. // //@CLASSES: -// mwcio::ConnectOptions: type encapsulating 'ChannelFactory::connect' options +// bmqio::ConnectOptions: type encapsulating 'ChannelFactory::connect' options // //@DESCRIPTION: This component defines a value-semantic type, -// 'mwcio::ConnectOptions', which encapsulates various connection options -// passed to 'mwcio::ChannelFactory::connect'. +// 'bmqio::ConnectOptions', which encapsulates various connection options +// passed to 'bmqio::ChannelFactory::connect'. -// MWC - -#include +#include // BDE #include @@ -41,13 +39,13 @@ namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ==================== // class ConnectOptions // ==================== -/// Connection options used when calling `mwcio::ChannelFactory::connect`. +/// Connection options used when calling `bmqio::ChannelFactory::connect`. class ConnectOptions { private: // DATA @@ -64,7 +62,7 @@ class ConnectOptions { bool d_autoReconnect; // should this connection be // auto-reconnected when it goes down - mwct::PropertyBag d_properties; // additional properties + bmqvt::PropertyBag d_properties; // additional properties public: // TRAITS @@ -106,7 +104,7 @@ class ConnectOptions { /// Return a reference providing modifiable access to the `properties` /// property of this object. - mwct::PropertyBag& properties(); + bmqvt::PropertyBag& properties(); // ACCESSORS @@ -126,7 +124,7 @@ class ConnectOptions { /// Return a reference providing const access to the `properties` /// property of this object. - const mwct::PropertyBag& properties() const; + const bmqvt::PropertyBag& properties() const; /// Format this object to the specified output `stream` at the (absolute /// value of) the optionally specified indentation `level` and return a @@ -202,7 +200,7 @@ inline ConnectOptions& ConnectOptions::setAutoReconnect(bool value) return *this; } -inline mwct::PropertyBag& ConnectOptions::properties() +inline bmqvt::PropertyBag& ConnectOptions::properties() { return d_properties; } @@ -228,7 +226,7 @@ inline bool ConnectOptions::autoReconnect() const return d_autoReconnect; } -inline const mwct::PropertyBag& ConnectOptions::properties() const +inline const bmqvt::PropertyBag& ConnectOptions::properties() const { return d_properties; } @@ -236,8 +234,8 @@ inline const mwct::PropertyBag& ConnectOptions::properties() const } // close package namespace // FREE OPERATORS -inline bsl::ostream& mwcio::operator<<(bsl::ostream& stream, - const mwcio::ConnectOptions& obj) +inline bsl::ostream& bmqio::operator<<(bsl::ostream& stream, + const bmqio::ConnectOptions& obj) { return obj.print(stream, 0, -1); } diff --git a/src/groups/mwc/mwcio/mwcio_decoratingchannelpartialimp.cpp b/src/groups/bmq/bmqio/bmqio_decoratingchannelpartialimp.cpp similarity index 88% rename from src/groups/mwc/mwcio/mwcio_decoratingchannelpartialimp.cpp rename to src/groups/bmq/bmqio/bmqio_decoratingchannelpartialimp.cpp index 157423e96..a797572a1 100644 --- a/src/groups/mwc/mwcio/mwcio_decoratingchannelpartialimp.cpp +++ b/src/groups/bmq/bmqio/bmqio_decoratingchannelpartialimp.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_decoratingchannelpartialimp.cpp -*-C++-*- -#include +// bmqio_decoratingchannelpartialimp.cpp -*-C++-*- +#include -#include +#include // BDE #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // --------------------------------- // class DecoratingChannelPartialImp diff --git a/src/groups/mwc/mwcio/mwcio_decoratingchannelpartialimp.h b/src/groups/bmq/bmqio/bmqio_decoratingchannelpartialimp.h similarity index 85% rename from src/groups/mwc/mwcio/mwcio_decoratingchannelpartialimp.h rename to src/groups/bmq/bmqio/bmqio_decoratingchannelpartialimp.h index b25968033..d3a211e1f 100644 --- a/src/groups/mwc/mwcio/mwcio_decoratingchannelpartialimp.h +++ b/src/groups/bmq/bmqio/bmqio_decoratingchannelpartialimp.h @@ -13,26 +13,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_decoratingchannelpartialimp.h -*-C++-*- -#ifndef INCLUDED_MWCIO_DECORATINGCHANNELPARTIALIMP -#define INCLUDED_MWCIO_DECORATINGCHANNELPARTIALIMP +// bmqio_decoratingchannelpartialimp.h -*-C++-*- +#ifndef INCLUDED_BMQIO_DECORATINGCHANNELPARTIALIMP +#define INCLUDED_BMQIO_DECORATINGCHANNELPARTIALIMP -//@PURPOSE: Provide a partial imp of 'mwcio::Channel' for decorating channels +//@PURPOSE: Provide a partial imp of 'bmqio::Channel' for decorating channels // //@CLASSES: -// mwcio::DecoratingChannelPartialImp +// bmqio::DecoratingChannelPartialImp // //@SEE_ALSO: // //@DESCRIPTION: This component defines a partial implementation, -// 'mwcio::DecoratingChannelPartialImp', of the 'mwcio::Channel' protocol for -// 'mwcio::Channel' implementations that decorate an underlying -// 'mwcio::Channel'. It mostly handles forwarding the most logical methods to -// the underlying 'mwcio::Channel'. +// 'bmqio::DecoratingChannelPartialImp', of the 'bmqio::Channel' protocol for +// 'bmqio::Channel' implementations that decorate an underlying +// 'bmqio::Channel'. It mostly handles forwarding the most logical methods to +// the underlying 'bmqio::Channel'. -// MWC - -#include +#include // BDE #include @@ -42,7 +40,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ================================= // class DecoratingChannelPartialImp @@ -91,7 +89,7 @@ class DecoratingChannelPartialImp : public Channel { onWatermark(const WatermarkFn& cb) BSLS_KEYWORD_OVERRIDE; /// Forward to the underlying base `Channel`. - mwct::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; + bmqvt::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; // ACCESSORS @@ -103,7 +101,7 @@ class DecoratingChannelPartialImp : public Channel { const bsl::string& peerUri() const BSLS_KEYWORD_OVERRIDE; /// Forward to the underlying base `Channel`. - const mwct::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; + const bmqvt::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; }; // ============================================================================ @@ -154,7 +152,7 @@ DecoratingChannelPartialImp::onWatermark(const WatermarkFn& cb) return d_base->onWatermark(cb); } -inline mwct::PropertyBag& DecoratingChannelPartialImp::properties() +inline bmqvt::PropertyBag& DecoratingChannelPartialImp::properties() { return d_base->properties(); } @@ -170,7 +168,8 @@ inline const bsl::string& DecoratingChannelPartialImp::peerUri() const return d_base->peerUri(); } -inline const mwct::PropertyBag& DecoratingChannelPartialImp::properties() const +inline const bmqvt::PropertyBag& +DecoratingChannelPartialImp::properties() const { return d_base->properties(); } diff --git a/src/groups/mwc/mwcio/mwcio_listenoptions.cpp b/src/groups/bmq/bmqio/bmqio_listenoptions.cpp similarity index 91% rename from src/groups/mwc/mwcio/mwcio_listenoptions.cpp rename to src/groups/bmq/bmqio/bmqio_listenoptions.cpp index 770dbaae0..f267860d0 100644 --- a/src/groups/mwc/mwcio/mwcio_listenoptions.cpp +++ b/src/groups/bmq/bmqio/bmqio_listenoptions.cpp @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_listenoptions.cpp -*-C++-*- -#include +// bmqio_listenoptions.cpp -*-C++-*- +#include -#include +#include // BDE #include #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ------------------- // class ListenOptions diff --git a/src/groups/mwc/mwcio/mwcio_listenoptions.h b/src/groups/bmq/bmqio/bmqio_listenoptions.h similarity index 84% rename from src/groups/mwc/mwcio/mwcio_listenoptions.h rename to src/groups/bmq/bmqio/bmqio_listenoptions.h index fcb3a9dc4..68c004f4f 100644 --- a/src/groups/mwc/mwcio/mwcio_listenoptions.h +++ b/src/groups/bmq/bmqio/bmqio_listenoptions.h @@ -13,22 +13,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_listenoptions.h -*-C++-*- -#ifndef INCLUDED_MWCIO_LISTENOPTIONS -#define INCLUDED_MWCIO_LISTENOPTIONS +// bmqio_listenoptions.h -*-C++-*- +#ifndef INCLUDED_BMQIO_LISTENOPTIONS +#define INCLUDED_BMQIO_LISTENOPTIONS //@PURPOSE: Provide a type encapsulating options for 'ChannelFactory::listen'. // //@CLASSES: -// mwcio::ListenOptions: type encapsulating 'ChannelFactory::listen' options +// bmqio::ListenOptions: type encapsulating 'ChannelFactory::listen' options // //@DESCRIPTION: This component defines a value-semantic type, -// 'mwcio::ListenOptions', which encapsulates various listen options -// passed to 'mwcio::ChannelFactory::listen'. +// 'bmqio::ListenOptions', which encapsulates various listen options +// passed to 'bmqio::ChannelFactory::listen'. -// MWC - -#include +#include // BDE #include @@ -40,20 +38,20 @@ namespace BloombergLP { -namespace mwcio { +namespace bmqio { // =================== // class ListenOptions // =================== -/// Listen options used when calling `mwcio::ChannelFactory::listen`. +/// Listen options used when calling `bmqio::ChannelFactory::listen`. class ListenOptions { private: // DATA bsl::string d_endpoint; // implementation-defined endpoint // to listen on - mwct::PropertyBag d_properties; // additional properties + bmqvt::PropertyBag d_properties; // additional properties public: // TRAITS @@ -79,7 +77,7 @@ class ListenOptions { /// Return a reference providing modifiable access to the `properties` /// property of this object. - mwct::PropertyBag& properties(); + bmqvt::PropertyBag& properties(); // ACCESSORS @@ -89,7 +87,7 @@ class ListenOptions { /// Return a reference providing const access to the `properties` /// property of this object. - const mwct::PropertyBag& properties() const; + const bmqvt::PropertyBag& properties() const; /// Format this object to the specified output `stream` at the (absolute /// value of) the optionally specified indentation `level` and return a @@ -140,7 +138,7 @@ ListenOptions::setEndpoint(const bslstl::StringRef& value) return *this; } -inline mwct::PropertyBag& ListenOptions::properties() +inline bmqvt::PropertyBag& ListenOptions::properties() { return d_properties; } @@ -151,7 +149,7 @@ inline const bsl::string& ListenOptions::endpoint() const return d_endpoint; } -inline const mwct::PropertyBag& ListenOptions::properties() const +inline const bmqvt::PropertyBag& ListenOptions::properties() const { return d_properties; } @@ -159,8 +157,8 @@ inline const mwct::PropertyBag& ListenOptions::properties() const } // close package namespace // FREE OPERATORS -inline bsl::ostream& mwcio::operator<<(bsl::ostream& stream, - const mwcio::ListenOptions& obj) +inline bsl::ostream& bmqio::operator<<(bsl::ostream& stream, + const bmqio::ListenOptions& obj) { return obj.print(stream, 0, -1); } diff --git a/src/groups/mwc/mwcio/mwcio_ntcchannel.cpp b/src/groups/bmq/bmqio/bmqio_ntcchannel.cpp similarity index 82% rename from src/groups/mwc/mwcio/mwcio_ntcchannel.cpp rename to src/groups/bmq/bmqio/bmqio_ntcchannel.cpp index 84e369efe..a5099ce95 100644 --- a/src/groups/mwc/mwcio/mwcio_ntcchannel.cpp +++ b/src/groups/bmq/bmqio/bmqio_ntcchannel.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_ntcchannel.cpp -*-C++-*- -#include +// bmqio_ntcchannel.cpp -*-C++-*- +#include -#include -// MWC -#include +#include + +#include // NTF #include @@ -39,31 +39,31 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { namespace { -BALL_LOG_SET_NAMESPACE_CATEGORY("MWCIO.NTCCHANNEL"); +BALL_LOG_SET_NAMESPACE_CATEGORY("BMQIO.NTCCHANNEL"); /// Maximum number of bytes to dump when in read/write. const int k_MAX_BYTES_DUMP = 512; #if defined(BSLS_PLATFORM_CPU_64_BIT) -#define MWCIO_ADDRESS_WIDTH 16 +#define BMQIO_ADDRESS_WIDTH 16 #else -#define MWCIO_ADDRESS_WIDTH 8 +#define BMQIO_ADDRESS_WIDTH 8 #endif -#define MWCIO_UNUSED(parameter) (void)(parameter) +#define BMQIO_UNUSED(parameter) (void)(parameter) // Define and set to 1 to enable resolution of a listener's source endpoint // through the asynchronous bind operation, but note that this implementation // must artificially block until the asynchronous bind operation completes, -// because the contract of mwcio::ChannelFactory::listen is expected to +// because the contract of bmqio::ChannelFactory::listen is expected to // bind and listen synchronously. This configuration option should be set to // 0 until the channel factory supports some notion of a listener starting // asynchronously. -#define MWCIO_NTCLISTENER_BIND_ASYNC 0 +#define BMQIO_NTCLISTENER_BIND_ASYNC 0 struct AddressFormatter { void* d_address_p; @@ -79,7 +79,7 @@ struct AddressFormatter { char fill = stream.fill(); stream << bsl::hex << bsl::showbase << bsl::internal - << bsl::setfill('0') << bsl::setw(MWCIO_ADDRESS_WIDTH) + << bsl::setfill('0') << bsl::setw(BMQIO_ADDRESS_WIDTH) << object.d_address_p; stream.flags(flags); @@ -90,7 +90,7 @@ struct AddressFormatter { } }; -#define MWCIO_NTCCHANNEL_LOG_CONNECT_START(address, \ +#define BMQIO_NTCCHANNEL_LOG_CONNECT_START(address, \ streamSocket, \ remoteEndpoint) \ do { \ @@ -99,7 +99,7 @@ struct AddressFormatter { << " connection initiated" << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_CONNECT_COMPLETE(address, streamSocket, event) \ +#define BMQIO_NTCCHANNEL_LOG_CONNECT_COMPLETE(address, streamSocket, event) \ do { \ BALL_LOG_TRACE << "NTC channel " << AddressFormatter(address) \ << " at " << (streamSocket)->sourceEndpoint() \ @@ -108,7 +108,7 @@ struct AddressFormatter { << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_CONNECT_FAILED(address, \ +#define BMQIO_NTCCHANNEL_LOG_CONNECT_FAILED(address, \ streamSocket, \ remoteEndpoint, \ event) \ @@ -118,7 +118,7 @@ struct AddressFormatter { << " connection failed: " << (event) << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_RECEIVE_WOULD_BLOCK(address, streamSocket) \ +#define BMQIO_NTCCHANNEL_LOG_RECEIVE_WOULD_BLOCK(address, streamSocket) \ do { \ BALL_LOG_TRACE << "NTC channel " << AddressFormatter(address) \ << " at " << (streamSocket)->sourceEndpoint() \ @@ -126,7 +126,7 @@ struct AddressFormatter { << " receive WOULD_BLOCK" << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_RECEIVE_EOF(address, streamSocket) \ +#define BMQIO_NTCCHANNEL_LOG_RECEIVE_EOF(address, streamSocket) \ do { \ BALL_LOG_TRACE << "NTC channel " << AddressFormatter(address) \ << " at " << (streamSocket)->sourceEndpoint() \ @@ -134,7 +134,7 @@ struct AddressFormatter { << " receive EOF" << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_RECEIVE_FAILED(address, streamSocket, error) \ +#define BMQIO_NTCCHANNEL_LOG_RECEIVE_FAILED(address, streamSocket, error) \ do { \ BALL_LOG_TRACE << "NTC channel " << AddressFormatter(address) \ << " at " << (streamSocket)->sourceEndpoint() \ @@ -142,7 +142,7 @@ struct AddressFormatter { << " receive failed: " << (event) << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_READ_CACHE_FILLED(address, \ +#define BMQIO_NTCCHANNEL_LOG_READ_CACHE_FILLED(address, \ streamSocket, \ readCache) \ do { \ @@ -152,12 +152,12 @@ struct AddressFormatter { << " read cache filled to " << (readCache).length() \ << ((readCache).length() == 1 ? " byte" : " bytes") \ << ":\n" \ - << mwcu::BlobStartHexDumper(&(readCache), \ + << bmqu::BlobStartHexDumper(&(readCache), \ k_MAX_BYTES_DUMP) \ << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_READ_CACHE_DRAINED(address, \ +#define BMQIO_NTCCHANNEL_LOG_READ_CACHE_DRAINED(address, \ streamSocket, \ readCache) \ do { \ @@ -167,12 +167,12 @@ struct AddressFormatter { << " read cache drained to " << (readCache).length() \ << ((readCache).length() == 1 ? " byte" : " bytes") \ << ":\n" \ - << mwcu::BlobStartHexDumper(&(readCache), \ + << bmqu::BlobStartHexDumper(&(readCache), \ k_MAX_BYTES_DUMP) \ << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_READ_START(address, \ +#define BMQIO_NTCCHANNEL_LOG_READ_START(address, \ streamSocket, \ read, \ numBytes) \ @@ -186,7 +186,7 @@ struct AddressFormatter { << " started" << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_READ_SATISFIED(address, \ +#define BMQIO_NTCCHANNEL_LOG_READ_SATISFIED(address, \ streamSocket, \ read, \ readCache) \ @@ -203,7 +203,7 @@ struct AddressFormatter { << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_READ_COMPLETE(address, streamSocket, read) \ +#define BMQIO_NTCCHANNEL_LOG_READ_COMPLETE(address, streamSocket, read) \ do { \ BALL_LOG_TRACE << "NTC channel " << AddressFormatter(address) \ << " at " << (streamSocket)->sourceEndpoint() \ @@ -212,7 +212,7 @@ struct AddressFormatter { << " is complete" << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_READ_MORE(address, \ +#define BMQIO_NTCCHANNEL_LOG_READ_MORE(address, \ streamSocket, \ read, \ numNeeded) \ @@ -226,7 +226,7 @@ struct AddressFormatter { << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_READ_CAUSED_CLOSE(address, streamSocket, read) \ +#define BMQIO_NTCCHANNEL_LOG_READ_CAUSED_CLOSE(address, streamSocket, read) \ do { \ BALL_LOG_TRACE << "NTC channel " << AddressFormatter(address) \ << " at " << (streamSocket)->sourceEndpoint() \ @@ -236,7 +236,7 @@ struct AddressFormatter { << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_WRITE(address, streamSocket, blob) \ +#define BMQIO_NTCCHANNEL_LOG_WRITE(address, streamSocket, blob) \ do { \ BALL_LOG_TRACE << "NTC channel " << AddressFormatter(address) \ << " at " << (streamSocket)->sourceEndpoint() \ @@ -244,11 +244,11 @@ struct AddressFormatter { << " write of " << (blob).length() \ << ((blob.length()) == 1 ? " byte" : " bytes") \ << " started:\n" \ - << mwcu::BlobStartHexDumper(&(blob), k_MAX_BYTES_DUMP) \ + << bmqu::BlobStartHexDumper(&(blob), k_MAX_BYTES_DUMP) \ << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_WRITE_WOULD_BLOCK(address, streamSocket, blob) \ +#define BMQIO_NTCCHANNEL_LOG_WRITE_WOULD_BLOCK(address, streamSocket, blob) \ do { \ BALL_LOG_TRACE << "NTC channel " << AddressFormatter(address) \ << " at " << (streamSocket)->sourceEndpoint() \ @@ -258,7 +258,7 @@ struct AddressFormatter { << " WOULD_BLOCK" << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_WRITE_FAILED(address, streamSocket, blob, error) \ +#define BMQIO_NTCCHANNEL_LOG_WRITE_FAILED(address, streamSocket, blob, error) \ do { \ BALL_LOG_TRACE << "NTC channel " << AddressFormatter(address) \ << " at " << (streamSocket)->sourceEndpoint() \ @@ -268,7 +268,7 @@ struct AddressFormatter { << " failed: " << (error) << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_EVENT(address, streamSocket, type, event) \ +#define BMQIO_NTCCHANNEL_LOG_EVENT(address, streamSocket, type, event) \ do { \ BALL_LOG_TRACE << "NTC channel " << AddressFormatter(address) \ << " at " << (streamSocket)->sourceEndpoint() \ @@ -276,7 +276,7 @@ struct AddressFormatter { << (type) << " event: " << (event) << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_CLOSING(address, streamSocket) \ +#define BMQIO_NTCCHANNEL_LOG_CLOSING(address, streamSocket) \ do { \ BALL_LOG_TRACE << "NTC channel " << AddressFormatter(address) \ << " at " << (streamSocket)->sourceEndpoint() \ @@ -284,7 +284,7 @@ struct AddressFormatter { << " closing" << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCCHANNEL_LOG_CLOSED(address, streamSocket, status) \ +#define BMQIO_NTCCHANNEL_LOG_CLOSED(address, streamSocket, status) \ do { \ BALL_LOG_TRACE << "NTC channel " << AddressFormatter(address) \ << " at " << (streamSocket)->sourceEndpoint() \ @@ -292,9 +292,9 @@ struct AddressFormatter { << " closed: " << (status) << BALL_LOG_END; \ } while (false) -#if MWCIO_NTCLISTENER_BIND_ASYNC +#if BMQIO_NTCLISTENER_BIND_ASYNC -#define MWCIO_NTCLISTENER_LOG_BIND_START(address, \ +#define BMQIO_NTCLISTENER_LOG_BIND_START(address, \ listenerSocket, \ sourceEndpoint) \ do { \ @@ -303,14 +303,14 @@ struct AddressFormatter { << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCLISTENER_LOG_BIND_COMPLETE(address, listenerSocket, event) \ +#define BMQIO_NTCLISTENER_LOG_BIND_COMPLETE(address, listenerSocket, event) \ do { \ BALL_LOG_TRACE << "NTC listener " << AddressFormatter(address) \ << " at " << (listenerSocket)->sourceEndpoint() \ << " bind complete: " << (event) << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCLISTENER_LOG_BIND_FAILED(address, \ +#define BMQIO_NTCLISTENER_LOG_BIND_FAILED(address, \ listenerSocket, \ sourceEndpoint, \ event) \ @@ -322,7 +322,7 @@ struct AddressFormatter { #else -#define MWCIO_NTCLISTENER_LOG_RESOLVE_FAILED(address, endpointString, error) \ +#define BMQIO_NTCLISTENER_LOG_RESOLVE_FAILED(address, endpointString, error) \ do { \ BALL_LOG_TRACE << "NTC listener " << AddressFormatter(address) \ << " resolution of '" << (endpointString) \ @@ -331,7 +331,7 @@ struct AddressFormatter { #endif -#define MWCIO_NTCLISTENER_LOG_ACCEPT_COMPLETE(address, streamSocket, event) \ +#define BMQIO_NTCLISTENER_LOG_ACCEPT_COMPLETE(address, streamSocket, event) \ do { \ BALL_LOG_TRACE << "NTC listener " << AddressFormatter(address) \ << " at " << (streamSocket)->sourceEndpoint() \ @@ -339,21 +339,21 @@ struct AddressFormatter { << " accept complete: " << (event) << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCLISTENER_LOG_ACCEPT_FAILED(address, listenerSocket, event) \ +#define BMQIO_NTCLISTENER_LOG_ACCEPT_FAILED(address, listenerSocket, event) \ do { \ BALL_LOG_TRACE << "NTC listener " << AddressFormatter(address) \ << " at " << (listenerSocket)->sourceEndpoint() \ << " accept failed: " << (event) << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCLISTENER_LOG_CLOSING(address, listenerSocket) \ +#define BMQIO_NTCLISTENER_LOG_CLOSING(address, listenerSocket) \ do { \ BALL_LOG_TRACE << "NTC listener " << AddressFormatter(address) \ << " at " << (listenerSocket)->sourceEndpoint() \ << " closing" << BALL_LOG_END; \ } while (false) -#define MWCIO_NTCLISTENER_LOG_CLOSED(address, listenerSocket, status) \ +#define BMQIO_NTCLISTENER_LOG_CLOSED(address, listenerSocket, status) \ do { \ BALL_LOG_TRACE << "NTC listener " << AddressFormatter(address) \ << " at " << (listenerSocket)->sourceEndpoint() \ @@ -390,7 +390,7 @@ int parseEndpoint(bsl::string* host, // ------------- // CREATORS -NtcRead::NtcRead(const mwcio::Channel::ReadCallback& callback, +NtcRead::NtcRead(const bmqio::Channel::ReadCallback& callback, int numNeeded, bslma::Allocator* basicAllocator) : d_callback(bsl::allocator_arg, basicAllocator, callback) @@ -448,7 +448,7 @@ void NtcRead::clear() d_numNeeded = 0; d_complete = true; - d_callback = mwcio::Channel::ReadCallback(); + d_callback = bmqio::Channel::ReadCallback(); } // ACCESSORS @@ -462,7 +462,7 @@ bool NtcRead::isComplete() const return d_complete; } -const mwcio::Channel::ReadCallback& NtcRead::callback() const +const bmqio::Channel::ReadCallback& NtcRead::callback() const { return d_callback; } @@ -489,12 +489,12 @@ NtcReadQueue::~NtcReadQueue() } // MANIPULATORS -void NtcReadQueue::append(const bsl::shared_ptr& operation) +void NtcReadQueue::append(const bsl::shared_ptr& operation) { d_list.push_back(operation); } -void NtcReadQueue::remove(const bsl::shared_ptr& operation) +void NtcReadQueue::remove(const bsl::shared_ptr& operation) { for (List::iterator it = d_list.begin(); it != d_list.end(); ++it) { if (*it == operation) { @@ -509,13 +509,13 @@ void NtcReadQueue::pop() d_list.pop_front(); } -void NtcReadQueue::pop(bsl::shared_ptr* operation) +void NtcReadQueue::pop(bsl::shared_ptr* operation) { *operation = d_list.front(); d_list.pop_front(); } -bsl::shared_ptr NtcReadQueue::front() +bsl::shared_ptr NtcReadQueue::front() { return d_list.front(); } @@ -540,7 +540,7 @@ void NtcChannel::processConnect( const bsl::shared_ptr& connector, const ntca::ConnectEvent& event) { - MWCIO_UNUSED(connector); + BMQIO_UNUSED(connector); bsl::shared_ptr self = this->shared_from_this(); @@ -551,11 +551,11 @@ void NtcChannel::processConnect( } if (!event.context().error()) { - MWCIO_NTCCHANNEL_LOG_CONNECT_COMPLETE(this, d_streamSocket_sp, event); + BMQIO_NTCCHANNEL_LOG_CONNECT_COMPLETE(this, d_streamSocket_sp, event); d_streamSocket_sp->registerSession(self); - mwcio::ChannelFactory::ResultCallback resultCallback( + bmqio::ChannelFactory::ResultCallback resultCallback( bsl::allocator_arg, d_allocator_p); resultCallback.swap(d_resultCallback); @@ -565,37 +565,37 @@ void NtcChannel::processConnect( lock.release()->unlock(); if (resultCallback) { - resultCallback(mwcio::ChannelFactoryEvent::e_CHANNEL_UP, - mwcio::Status(), + resultCallback(bmqio::ChannelFactoryEvent::e_CHANNEL_UP, + bmqio::Status(), self); } } else { - MWCIO_NTCCHANNEL_LOG_CONNECT_FAILED(this, + BMQIO_NTCCHANNEL_LOG_CONNECT_FAILED(this, d_streamSocket_sp, d_options.endpoint(), event); - mwcio::Status status; + bmqio::Status status; NtcChannelUtil::fail(&status, - mwcio::StatusCategory::e_CONNECTION, + bmqio::StatusCategory::e_CONNECTION, "connect", event.context().error()); if (event.context().attemptsRemaining() > 0) { - mwcio::ChannelFactory::ResultCallback resultCallback = + bmqio::ChannelFactory::ResultCallback resultCallback = d_resultCallback; if (resultCallback) { lock.release()->unlock(); resultCallback( - mwcio::ChannelFactoryEvent::e_CONNECT_ATTEMPT_FAILED, + bmqio::ChannelFactoryEvent::e_CONNECT_ATTEMPT_FAILED, status, - bsl::shared_ptr()); + bsl::shared_ptr()); } } else { - mwcio::ChannelFactory::ResultCallback resultCallback( + bmqio::ChannelFactory::ResultCallback resultCallback( bsl::allocator_arg, d_allocator_p); @@ -603,16 +603,16 @@ void NtcChannel::processConnect( if (resultCallback) { bslmt::UnLockGuard unlock(&d_mutex); - resultCallback(mwcio::ChannelFactoryEvent::e_CONNECT_FAILED, + resultCallback(bmqio::ChannelFactoryEvent::e_CONNECT_FAILED, status, - bsl::shared_ptr()); + bsl::shared_ptr()); } if (d_state != e_STATE_OPEN) { return; } - MWCIO_NTCCHANNEL_LOG_CLOSING(this, d_streamSocket_sp); + BMQIO_NTCCHANNEL_LOG_CLOSING(this, d_streamSocket_sp); d_state = e_STATE_CLOSING; @@ -623,12 +623,12 @@ void NtcChannel::processConnect( } void NtcChannel::processReadTimeout( - const bsl::shared_ptr& read, + const bsl::shared_ptr& read, const bsl::shared_ptr& timer, const ntca::TimerEvent& event) { - MWCIO_UNUSED(timer); - MWCIO_UNUSED(event); + BMQIO_UNUSED(timer); + BMQIO_UNUSED(event); bslmt::LockGuard lock(&d_mutex); @@ -645,7 +645,7 @@ void NtcChannel::processReadTimeout( return; } - mwcio::Channel::ReadCallback readCallback = read->callback(); + bmqio::Channel::ReadCallback readCallback = read->callback(); read->clear(); lock.release()->unlock(); @@ -653,13 +653,13 @@ void NtcChannel::processReadTimeout( int numNeeded = 0; bdlbb::Blob blob; - readCallback(mwcio::Status(mwcio::StatusCategory::e_TIMEOUT), + readCallback(bmqio::Status(bmqio::StatusCategory::e_TIMEOUT), &numNeeded, &blob); } void NtcChannel::processReadCancelled( - const bsl::shared_ptr& read) + const bsl::shared_ptr& read) { bslmt::LockGuard lock(&d_mutex); @@ -676,7 +676,7 @@ void NtcChannel::processReadCancelled( return; } - mwcio::Channel::ReadCallback readCallback = read->callback(); + bmqio::Channel::ReadCallback readCallback = read->callback(); read->clear(); lock.release()->unlock(); @@ -684,7 +684,7 @@ void NtcChannel::processReadCancelled( int numNeeded = 0; bdlbb::Blob blob; - readCallback(mwcio::Status(mwcio::StatusCategory::e_CANCELED), + readCallback(bmqio::Status(bmqio::StatusCategory::e_CANCELED), &numNeeded, &blob); } @@ -693,13 +693,13 @@ void NtcChannel::processReadQueueLowWatermark( const bsl::shared_ptr& streamSocket, const ntca::ReadQueueEvent& event) { - MWCIO_UNUSED(streamSocket); + BMQIO_UNUSED(streamSocket); ntsa::Error error; bslmt::LockGuard lock(&d_mutex); - MWCIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "read queue", event); + BMQIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "read queue", event); bool close = false; @@ -708,7 +708,7 @@ void NtcChannel::processReadQueueLowWatermark( break; } - bsl::shared_ptr read = d_readQueue.front(); + bsl::shared_ptr read = d_readQueue.front(); if (read->numNeeded() == 0 || read->isComplete()) { read->setComplete(); @@ -726,18 +726,18 @@ void NtcChannel::processReadQueueLowWatermark( receiveOptions); if (error) { if (error == ntsa::Error(ntsa::Error::e_WOULD_BLOCK)) { - MWCIO_NTCCHANNEL_LOG_RECEIVE_WOULD_BLOCK( + BMQIO_NTCCHANNEL_LOG_RECEIVE_WOULD_BLOCK( this, d_streamSocket_sp); break; } else if (error == ntsa::Error(ntsa::Error::e_EOF)) { - MWCIO_NTCCHANNEL_LOG_RECEIVE_EOF(this, d_streamSocket_sp); + BMQIO_NTCCHANNEL_LOG_RECEIVE_EOF(this, d_streamSocket_sp); close = true; break; } else { - MWCIO_NTCCHANNEL_LOG_RECEIVE_FAILED(this, + BMQIO_NTCCHANNEL_LOG_RECEIVE_FAILED(this, d_streamSocket_sp, error); close = true; @@ -745,31 +745,31 @@ void NtcChannel::processReadQueueLowWatermark( } } - MWCIO_NTCCHANNEL_LOG_READ_CACHE_FILLED(this, + BMQIO_NTCCHANNEL_LOG_READ_CACHE_FILLED(this, d_streamSocket_sp, d_readCache); } if (read->numNeeded() <= d_readCache.length()) { - MWCIO_NTCCHANNEL_LOG_READ_SATISFIED(this, + BMQIO_NTCCHANNEL_LOG_READ_SATISFIED(this, d_streamSocket_sp, read, d_readCache); int numNeeded = 0; { - mwcio::Channel::ReadCallback readCallback = read->callback(); + bmqio::Channel::ReadCallback readCallback = read->callback(); bslmt::UnLockGuard unlock(&d_mutex); - readCallback(mwcio::Status(), &numNeeded, &d_readCache); + readCallback(bmqio::Status(), &numNeeded, &d_readCache); } - MWCIO_NTCCHANNEL_LOG_READ_CACHE_DRAINED(this, + BMQIO_NTCCHANNEL_LOG_READ_CACHE_DRAINED(this, d_streamSocket_sp, d_readCache); if (numNeeded == 0) { - MWCIO_NTCCHANNEL_LOG_READ_COMPLETE(this, + BMQIO_NTCCHANNEL_LOG_READ_COMPLETE(this, d_streamSocket_sp, read); read->setComplete(); @@ -778,14 +778,14 @@ void NtcChannel::processReadQueueLowWatermark( continue; } else if (numNeeded < 0) { - MWCIO_NTCCHANNEL_LOG_READ_CAUSED_CLOSE(this, + BMQIO_NTCCHANNEL_LOG_READ_CAUSED_CLOSE(this, d_streamSocket_sp, read); close = true; break; } else { - MWCIO_NTCCHANNEL_LOG_READ_MORE(this, + BMQIO_NTCCHANNEL_LOG_READ_MORE(this, d_streamSocket_sp, read, numNeeded); @@ -799,14 +799,14 @@ void NtcChannel::processReadQueueLowWatermark( bsl::shared_ptr self = this->shared_from_this(); while (!d_readQueue.empty()) { - bsl::shared_ptr read; + bsl::shared_ptr read; d_readQueue.pop(&read); bool isComplete = read->isComplete(); read->setComplete(); if (!isComplete) { - mwcio::Channel::ReadCallback readCallback = read->callback(); + bmqio::Channel::ReadCallback readCallback = read->callback(); read->clear(); bslmt::UnLockGuard unlock(&d_mutex); @@ -814,7 +814,7 @@ void NtcChannel::processReadQueueLowWatermark( int numNeeded = 0; bdlbb::Blob blob; - readCallback(mwcio::Status(mwcio::StatusCategory::e_CANCELED), + readCallback(bmqio::Status(bmqio::StatusCategory::e_CANCELED), &numNeeded, &blob); } @@ -824,14 +824,14 @@ void NtcChannel::processReadQueueLowWatermark( return; } - MWCIO_NTCCHANNEL_LOG_CLOSING(this, d_streamSocket_sp); + BMQIO_NTCCHANNEL_LOG_CLOSING(this, d_streamSocket_sp); d_state = e_STATE_CLOSING; d_streamSocket_sp->close( bdlf::BindUtil::bind(&NtcChannel::processClose, self, - mwcio::Status())); + bmqio::Status())); } } @@ -839,59 +839,59 @@ void NtcChannel::processWriteQueueLowWatermark( const bsl::shared_ptr& streamSocket, const ntca::WriteQueueEvent& event) { - MWCIO_UNUSED(streamSocket); + BMQIO_UNUSED(streamSocket); - MWCIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "write queue", event); + BMQIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "write queue", event); - d_watermarkSignaler(mwcio::ChannelWatermarkType::e_LOW_WATERMARK); + d_watermarkSignaler(bmqio::ChannelWatermarkType::e_LOW_WATERMARK); } void NtcChannel::processWriteQueueHighWatermark( const bsl::shared_ptr& streamSocket, const ntca::WriteQueueEvent& event) { - MWCIO_UNUSED(streamSocket); + BMQIO_UNUSED(streamSocket); - MWCIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "write queue", event); + BMQIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "write queue", event); - d_watermarkSignaler(mwcio::ChannelWatermarkType::e_HIGH_WATERMARK); + d_watermarkSignaler(bmqio::ChannelWatermarkType::e_HIGH_WATERMARK); } void NtcChannel::processShutdownInitiated( const bsl::shared_ptr& streamSocket, const ntca::ShutdownEvent& event) { - MWCIO_UNUSED(streamSocket); + BMQIO_UNUSED(streamSocket); - MWCIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "shutdown", event); + BMQIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "shutdown", event); } void NtcChannel::processShutdownReceive( const bsl::shared_ptr& streamSocket, const ntca::ShutdownEvent& event) { - MWCIO_UNUSED(streamSocket); + BMQIO_UNUSED(streamSocket); - MWCIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "shutdown", event); + BMQIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "shutdown", event); bslmt::LockGuard lock(&d_mutex); while (!d_readQueue.empty()) { - bsl::shared_ptr read; + bsl::shared_ptr read; d_readQueue.pop(&read); bool isComplete = read->isComplete(); read->setComplete(); if (!isComplete) { - mwcio::Channel::ReadCallback readCallback = read->callback(); + bmqio::Channel::ReadCallback readCallback = read->callback(); read->clear(); bslmt::UnLockGuard unlock(&d_mutex); - mwcio::Status status; + bmqio::Status status; NtcChannelUtil::fail(&status, - mwcio::StatusCategory::e_CONNECTION, + bmqio::StatusCategory::e_CONNECTION, "shutdown", ntsa::Error(ntsa::Error::e_EOF)); @@ -907,18 +907,18 @@ void NtcChannel::processShutdownSend( const bsl::shared_ptr& streamSocket, const ntca::ShutdownEvent& event) { - MWCIO_UNUSED(streamSocket); + BMQIO_UNUSED(streamSocket); - MWCIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "shutdown", event); + BMQIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "shutdown", event); } void NtcChannel::processShutdownComplete( const bsl::shared_ptr& streamSocket, const ntca::ShutdownEvent& event) { - MWCIO_UNUSED(streamSocket); + BMQIO_UNUSED(streamSocket); - MWCIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "shutdown", event); + BMQIO_NTCCHANNEL_LOG_EVENT(this, d_streamSocket_sp, "shutdown", event); bsl::shared_ptr self = this->shared_from_this(); @@ -928,16 +928,16 @@ void NtcChannel::processShutdownComplete( return; } - MWCIO_NTCCHANNEL_LOG_CLOSING(this, d_streamSocket_sp); + BMQIO_NTCCHANNEL_LOG_CLOSING(this, d_streamSocket_sp); d_state = e_STATE_CLOSING; d_streamSocket_sp->close(bdlf::BindUtil::bind(&NtcChannel::processClose, self, - mwcio::Status())); + bmqio::Status())); } -void NtcChannel::processClose(const mwcio::Status& status) +void NtcChannel::processClose(const bmqio::Status& status) { bslmt::LockGuard lock(&d_mutex); @@ -945,14 +945,14 @@ void NtcChannel::processClose(const mwcio::Status& status) return; } - MWCIO_NTCCHANNEL_LOG_CLOSED(this, d_streamSocket_sp, status); + BMQIO_NTCCHANNEL_LOG_CLOSED(this, d_streamSocket_sp, status); d_state = e_STATE_CLOSED; d_streamSocket_sp.reset(); d_interface_sp.reset(); - d_resultCallback = mwcio::ChannelFactory::ResultCallback(); + d_resultCallback = bmqio::ChannelFactory::ResultCallback(); lock.release()->unlock(); @@ -965,7 +965,7 @@ void NtcChannel::processClose(const mwcio::Status& status) // CREATORS NtcChannel::NtcChannel( const bsl::shared_ptr& interface, - const mwcio::ChannelFactory::ResultCallback& resultCallback, + const bmqio::ChannelFactory::ResultCallback& resultCallback, bslma::Allocator* basicAllocator) : d_mutex() , d_interface_sp(interface) @@ -990,8 +990,8 @@ NtcChannel::~NtcChannel() } // MANIPULATORS -int NtcChannel::connect(mwcio::Status* status, - const mwcio::ConnectOptions& options) +int NtcChannel::connect(bmqio::Status* status, + const bmqio::ConnectOptions& options) { ntsa::Error error; @@ -1004,16 +1004,16 @@ int NtcChannel::connect(mwcio::Status* status, bsl::shared_ptr self = this->shared_from_this(); if (d_state != e_STATE_DEFAULT) { - mwcio::NtcChannelUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcChannelUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "state", ntsa::Error(ntsa::Error::e_INVALID)); return 1; } if (options.autoReconnect()) { - mwcio::NtcChannelUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcChannelUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "autoReconnectNotSupported", ntsa::Error(ntsa::Error::e_INVALID)); return 2; @@ -1066,8 +1066,8 @@ int NtcChannel::connect(mwcio::Status* status, bsl::string port; int rc = parseEndpoint(&host, &port, options.endpoint()); if (rc != 0) { - mwcio::NtcChannelUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcChannelUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "connect", ntsa::Error(ntsa::Error::e_INVALID)); return 2; @@ -1090,14 +1090,14 @@ int NtcChannel::connect(mwcio::Status* status, bdlf::PlaceHolders::_1, bdlf::PlaceHolders::_2); - MWCIO_NTCCHANNEL_LOG_CONNECT_START(this, streamSocket, endpointString); + BMQIO_NTCCHANNEL_LOG_CONNECT_START(this, streamSocket, endpointString); error = streamSocket->connect(endpointString, connectOptions, connectCallback); if (error) { - mwcio::NtcChannelUtil::fail(status, - mwcio::StatusCategory::e_CONNECTION, + bmqio::NtcChannelUtil::fail(status, + bmqio::StatusCategory::e_CONNECTION, "connect", error); return 3; @@ -1141,17 +1141,17 @@ void NtcChannel::read(Status* status, bslmt::LockGuard lock(&d_mutex); if (d_state != e_STATE_OPEN) { - mwcio::NtcChannelUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcChannelUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "state", ntsa::Error(ntsa::Error::e_INVALID)); return; } - bsl::shared_ptr read; + bsl::shared_ptr read; read.createInplace(d_allocator_p, readCallback, numBytes, d_allocator_p); - MWCIO_NTCCHANNEL_LOG_READ_START(this, d_streamSocket_sp, read, numBytes); + BMQIO_NTCCHANNEL_LOG_READ_START(this, d_streamSocket_sp, read, numBytes); bsl::shared_ptr timer; if (timeout != bsls::TimeInterval()) { @@ -1186,8 +1186,8 @@ void NtcChannel::read(Status* status, error = d_streamSocket_sp->relaxFlowControl( ntca::FlowControlType::e_RECEIVE); if (error) { - mwcio::NtcChannelUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcChannelUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "relaxFlowControl", error); @@ -1198,8 +1198,8 @@ void NtcChannel::read(Status* status, if (timer) { error = timer->schedule(timer->currentTime() + timeout); if (error) { - mwcio::NtcChannelUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcChannelUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "schedule", error); @@ -1225,14 +1225,14 @@ void NtcChannel::write(Status* status, bslmt::LockGuard lock(&d_mutex); if (d_state != e_STATE_OPEN) { - mwcio::NtcChannelUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcChannelUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "state", ntsa::Error(ntsa::Error::e_INVALID)); return; } - MWCIO_NTCCHANNEL_LOG_WRITE(this, d_streamSocket_sp, blob); + BMQIO_NTCCHANNEL_LOG_WRITE(this, d_streamSocket_sp, blob); ntca::SendOptions sendOptions; if (watermark != bsl::numeric_limits::max()) { @@ -1242,21 +1242,21 @@ void NtcChannel::write(Status* status, error = d_streamSocket_sp->send(blob, sendOptions); if (error) { if (error == ntsa::Error::e_WOULD_BLOCK) { - MWCIO_NTCCHANNEL_LOG_WRITE_WOULD_BLOCK(this, + BMQIO_NTCCHANNEL_LOG_WRITE_WOULD_BLOCK(this, d_streamSocket_sp, blob); NtcChannelUtil::fail(status, - mwcio::StatusCategory::e_LIMIT, + bmqio::StatusCategory::e_LIMIT, "send", error); } else { - MWCIO_NTCCHANNEL_LOG_WRITE_FAILED(this, + BMQIO_NTCCHANNEL_LOG_WRITE_FAILED(this, d_streamSocket_sp, blob, error); NtcChannelUtil::fail(status, - mwcio::StatusCategory::e_CONNECTION, + bmqio::StatusCategory::e_CONNECTION, "send", error); } @@ -1273,11 +1273,11 @@ void NtcChannel::cancel() return; } - MWCIO_NTCCHANNEL_LOG_CLOSING(this, d_streamSocket_sp); + BMQIO_NTCCHANNEL_LOG_CLOSING(this, d_streamSocket_sp); d_state = e_STATE_CLOSING; - mwcio::Status status(mwcio::StatusCategory::e_CANCELED); + bmqio::Status status(bmqio::StatusCategory::e_CANCELED); d_streamSocket_sp->close( bdlf::BindUtil::bind(&NtcChannel::processClose, self, status)); } @@ -1293,7 +1293,7 @@ void NtcChannel::cancelRead() } while (!d_readQueue.empty()) { - bsl::shared_ptr read; + bsl::shared_ptr read; d_readQueue.pop(&read); read->setTimer(bsl::shared_ptr()); @@ -1316,14 +1316,14 @@ void NtcChannel::close(const Status& status) } while (!d_readQueue.empty()) { - bsl::shared_ptr read; + bsl::shared_ptr read; d_readQueue.pop(&read); read->setComplete(); read->clear(); } - MWCIO_NTCCHANNEL_LOG_CLOSING(this, d_streamSocket_sp); + BMQIO_NTCCHANNEL_LOG_CLOSING(this, d_streamSocket_sp); d_state = e_STATE_CLOSING; @@ -1352,7 +1352,7 @@ bdlmt::SignalerConnection NtcChannel::onWatermark(const WatermarkFn& cb) return d_watermarkSignaler.connect(cb); } -mwct::PropertyBag& NtcChannel::properties() +bmqvt::PropertyBag& NtcChannel::properties() { return d_properties; } @@ -1399,7 +1399,7 @@ const bsl::string& NtcChannel::peerUri() const return d_peerUri; } -const mwct::PropertyBag& NtcChannel::properties() const +const bmqvt::PropertyBag& NtcChannel::properties() const { return d_properties; } @@ -1421,7 +1421,7 @@ const ntci::StreamSocket& NtcChannel::streamSocket() const // CLASS METHODS void NtcChannelUtil::fail(Status* status, - mwcio::StatusCategory::Enum category, + bmqio::StatusCategory::Enum category, const bslstl::StringRef& operation, const ntsa::Error& error) { @@ -1457,13 +1457,13 @@ void NtcListener::processAccept( } if (!event.context().error()) { - bsl::shared_ptr channel; + bsl::shared_ptr channel; channel.createInplace(d_allocator_p, d_interface_sp, d_resultCallback, d_allocator_p); - MWCIO_NTCLISTENER_LOG_ACCEPT_COMPLETE(channel.get(), + BMQIO_NTCLISTENER_LOG_ACCEPT_COMPLETE(channel.get(), streamSocket, event); @@ -1471,8 +1471,8 @@ void NtcListener::processAccept( { bslmt::UnLockGuard unlock(&d_mutex); - d_resultCallback(mwcio::ChannelFactoryEvent::e_CHANNEL_UP, - mwcio::Status(), + d_resultCallback(bmqio::ChannelFactoryEvent::e_CHANNEL_UP, + bmqio::Status(), channel); } @@ -1488,13 +1488,13 @@ void NtcListener::processAccept( bdlf::PlaceHolders::_2, bdlf::PlaceHolders::_3)); if (error) { - mwcio::Status status; + bmqio::Status status; NtcChannelUtil::fail(&status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::StatusCategory::e_GENERIC_ERROR, "accept", error); - MWCIO_NTCLISTENER_LOG_CLOSING(this, d_listenerSocket_sp); + BMQIO_NTCLISTENER_LOG_CLOSING(this, d_listenerSocket_sp); d_state = e_STATE_CLOSING; @@ -1505,15 +1505,15 @@ void NtcListener::processAccept( } } else { - MWCIO_NTCLISTENER_LOG_ACCEPT_FAILED(this, d_listenerSocket_sp, event); + BMQIO_NTCLISTENER_LOG_ACCEPT_FAILED(this, d_listenerSocket_sp, event); - mwcio::Status status; + bmqio::Status status; NtcChannelUtil::fail(&status, - mwcio::StatusCategory::e_CONNECTION, + bmqio::StatusCategory::e_CONNECTION, "accept", event.context().error()); - MWCIO_NTCLISTENER_LOG_CLOSING(this, d_listenerSocket_sp); + BMQIO_NTCLISTENER_LOG_CLOSING(this, d_listenerSocket_sp); d_state = e_STATE_CLOSING; @@ -1522,7 +1522,7 @@ void NtcListener::processAccept( } } -void NtcListener::processClose(const mwcio::Status& status) +void NtcListener::processClose(const bmqio::Status& status) { bslmt::LockGuard lock(&d_mutex); @@ -1530,14 +1530,14 @@ void NtcListener::processClose(const mwcio::Status& status) return; } - MWCIO_NTCLISTENER_LOG_CLOSED(this, d_listenerSocket_sp, status); + BMQIO_NTCLISTENER_LOG_CLOSED(this, d_listenerSocket_sp, status); d_state = e_STATE_CLOSED; d_listenerSocket_sp.reset(); d_interface_sp.reset(); - d_resultCallback = mwcio::ChannelFactory::ResultCallback(); + d_resultCallback = bmqio::ChannelFactory::ResultCallback(); lock.release()->unlock(); @@ -1549,7 +1549,7 @@ void NtcListener::processClose(const mwcio::Status& status) // CREATORS NtcListener::NtcListener( const bsl::shared_ptr& interface, - const mwcio::ChannelFactory::ResultCallback& resultCallback, + const bmqio::ChannelFactory::ResultCallback& resultCallback, bslma::Allocator* basicAllocator) : d_mutex() , d_interface_sp(interface) @@ -1569,8 +1569,8 @@ NtcListener::~NtcListener() } // MANIPULATORS -int NtcListener::listen(mwcio::Status* status, - const mwcio::ListenOptions& options) +int NtcListener::listen(bmqio::Status* status, + const bmqio::ListenOptions& options) { ntsa::Error error; @@ -1583,8 +1583,8 @@ int NtcListener::listen(mwcio::Status* status, bsl::shared_ptr self = this->shared_from_this(); if (d_state != e_STATE_DEFAULT) { - mwcio::NtcListenerUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcListenerUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "state", ntsa::Error(ntsa::Error::e_INVALID)); return 1; @@ -1605,9 +1605,9 @@ int NtcListener::listen(mwcio::Status* status, bsl::string port; int rc = parseEndpoint(&host, &port, options.endpoint()); if (rc != 0) { - mwcio::NtcListenerUtil::fail( + bmqio::NtcListenerUtil::fail( status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::StatusCategory::e_GENERIC_ERROR, "bind", ntsa::Error(ntsa::Error::e_INVALID)); return 2; @@ -1630,7 +1630,7 @@ int NtcListener::listen(mwcio::Status* status, listenerSocketOptions.setKeepHalfOpen(false); listenerSocketOptions.setBacklog(backlog); -#if MWCIO_NTCLISTENER_BIND_ASYNC == 0 +#if BMQIO_NTCLISTENER_BIND_ASYNC == 0 bsl::shared_ptr resolver = ntsf::System::createResolver(); @@ -1639,10 +1639,10 @@ int NtcListener::listen(mwcio::Status* status, error = resolver->getEndpoint(&endpoint, endpointString, endpointOptions); if (error) { - MWCIO_NTCLISTENER_LOG_RESOLVE_FAILED(this, options.endpoint(), error); + BMQIO_NTCLISTENER_LOG_RESOLVE_FAILED(this, options.endpoint(), error); - mwcio::NtcListenerUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcListenerUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "resolve", error); return 3; @@ -1660,16 +1660,16 @@ int NtcListener::listen(mwcio::Status* status, error = listenerSocket->open(); if (error) { - mwcio::NtcListenerUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcListenerUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "open", error); return 4; } -#if MWCIO_NTCLISTENER_BIND_ASYNC +#if BMQIO_NTCLISTENER_BIND_ASYNC - MWCIO_NTCLISTENER_LOG_BIND_START(this, listenerSocket, endpointString); + BMQIO_NTCLISTENER_LOG_BIND_START(this, listenerSocket, endpointString); ntca::BindOptions bindOptions; bindOptions.setIpAddressType(ntsa::IpAddressType::e_V4); @@ -1678,8 +1678,8 @@ int NtcListener::listen(mwcio::Status* status, error = listenerSocket->bind(endpointString, bindOptions, bindFuture); if (error) { - mwcio::NtcListenerUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcListenerUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "bind", error); return 5; @@ -1688,27 +1688,27 @@ int NtcListener::listen(mwcio::Status* status, ntci::BindResult bindResult; error = bindFuture.wait(&bindResult); if (error) { - mwcio::NtcListenerUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcListenerUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "bind", error); return 6; } if (bindResult.event().context().error()) { - MWCIO_NTCLISTENER_LOG_BIND_FAILED(this, + BMQIO_NTCLISTENER_LOG_BIND_FAILED(this, listenerSocket, options.endpoint(), bindResult.event()); - mwcio::NtcListenerUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcListenerUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "bind", bindResult.event().context().error()); return 7; } - MWCIO_NTCLISTENER_LOG_BIND_COMPLETE(this, + BMQIO_NTCLISTENER_LOG_BIND_COMPLETE(this, listenerSocket, bindResult.event()); @@ -1716,8 +1716,8 @@ int NtcListener::listen(mwcio::Status* status, error = listenerSocket->listen(backlog); if (error) { - mwcio::NtcListenerUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcListenerUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "listen", error); return 8; @@ -1725,14 +1725,14 @@ int NtcListener::listen(mwcio::Status* status, endpoint = listenerSocket->sourceEndpoint(); if (!endpoint.isIp() && !endpoint.ip().host().isV4()) { - mwcio::NtcListenerUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcListenerUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "bind", ntsa::Error(ntsa::Error::e_INVALID)); return 9; } - d_properties.set(mwcio::NtcListenerUtil::listenPortProperty(), + d_properties.set(bmqio::NtcListenerUtil::listenPortProperty(), static_cast(endpoint.ip().port())); ntci::AcceptFunction acceptCallback = bdlf::BindUtil::bind( @@ -1744,8 +1744,8 @@ int NtcListener::listen(mwcio::Status* status, error = listenerSocket->accept(ntca::AcceptOptions(), acceptCallback); if (error) { - mwcio::NtcListenerUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcListenerUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "accept", ntsa::Error(ntsa::Error::e_INVALID)); return 10; @@ -1771,11 +1771,11 @@ void NtcListener::cancel() return; } - MWCIO_NTCLISTENER_LOG_CLOSING(this, d_listenerSocket_sp); + BMQIO_NTCLISTENER_LOG_CLOSING(this, d_listenerSocket_sp); d_state = e_STATE_CLOSING; - mwcio::Status status(mwcio::StatusCategory::e_CANCELED); + bmqio::Status status(bmqio::StatusCategory::e_CANCELED); d_listenerSocket_sp->close( bdlf::BindUtil::bind(&NtcListener::processClose, self, status)); } @@ -1790,7 +1790,7 @@ bdlmt::SignalerConnection NtcListener::onClose(const CloseFn& cb, int group) return d_closeSignaler.connect(cb, group); } -mwct::PropertyBag& NtcListener::properties() +bmqvt::PropertyBag& NtcListener::properties() { return d_properties; } @@ -1801,7 +1801,7 @@ const bsl::string& NtcListener::localUri() const return d_localUri; } -const mwct::PropertyBag& NtcListener::properties() const +const bmqvt::PropertyBag& NtcListener::properties() const { return d_properties; } @@ -1827,7 +1827,7 @@ bslstl::StringRef NtcListenerUtil::listenPortProperty() } void NtcListenerUtil::fail(Status* status, - mwcio::StatusCategory::Enum category, + bmqio::StatusCategory::Enum category, const bslstl::StringRef& operation, const ntsa::Error& error) { diff --git a/src/groups/mwc/mwcio/mwcio_ntcchannel.h b/src/groups/bmq/bmqio/bmqio_ntcchannel.h similarity index 88% rename from src/groups/mwc/mwcio/mwcio_ntcchannel.h rename to src/groups/bmq/bmqio/bmqio_ntcchannel.h index 0ccd613a3..0f28079d1 100644 --- a/src/groups/mwc/mwcio/mwcio_ntcchannel.h +++ b/src/groups/bmq/bmqio/bmqio_ntcchannel.h @@ -13,27 +13,25 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_ntcchannel.h -*-C++-*- -#ifndef INCLUDED_MWCIO_NTCCHANNEL -#define INCLUDED_MWCIO_NTCCHANNEL +// bmqio_ntcchannel.h -*-C++-*- +#ifndef INCLUDED_BMQIO_NTCCHANNEL +#define INCLUDED_BMQIO_NTCCHANNEL -//@PURPOSE: Provide a a bi-directional async channel implemented using NTC. +//@PURPOSE: Provide a bi-directional async channel implemented using NTC. // //@CLASSES: -// mwcio::Channel: Interface for a NTC-based bi-directional async channel. +// bmqio::Channel: Interface for a NTC-based bi-directional async channel. // -//@DESCRIPTION: This component provides a mechanism, 'mwcio::NtcChannel', +//@DESCRIPTION: This component provides a mechanism, 'bmqio::NtcChannel', // implemented by NTC to asynchronously send and receive arbitrary blobs of // data. -// MWC - -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // NTC #include @@ -55,7 +53,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ============= // class NtcRead @@ -65,7 +63,7 @@ namespace mwcio { /// is not thread safe. class NtcRead { // INSTANCE DATA - mwcio::Channel::ReadCallback d_callback; + bmqio::Channel::ReadCallback d_callback; bsl::shared_ptr d_timer_sp; int d_numNeeded; bool d_complete; @@ -86,7 +84,7 @@ class NtcRead { /// the specified `numNeeded` bytes are available. Optionally specify /// a basicAllocator used to supply memory. If `basicAllocator` is 0, /// the currently installed default allocator is used. - NtcRead(const mwcio::Channel::ReadCallback& callback, + NtcRead(const bmqio::Channel::ReadCallback& callback, int numNeeded, bslma::Allocator* basicAllocator = 0); @@ -116,7 +114,7 @@ class NtcRead { bool isComplete() const; /// Return the read callback. - const mwcio::Channel::ReadCallback& callback() const; + const bmqio::Channel::ReadCallback& callback() const; /// Return the allocator this object was created with. bslma::Allocator* allocator() const; @@ -132,7 +130,7 @@ class NtcReadQueue { // PRIVATE TYPES /// This typedef defines a linked list of read operations. - typedef bsl::list > List; + typedef bsl::list > List; // INSTANCE DATA List d_list; @@ -160,20 +158,20 @@ class NtcReadQueue { // MANIPULATORS /// Append the specified `operation` to the back of the queue. - void append(const bsl::shared_ptr& operation); + void append(const bsl::shared_ptr& operation); /// Remove the specified `operation` from the queue. - void remove(const bsl::shared_ptr& operation); + void remove(const bsl::shared_ptr& operation); /// Pop the front of the queue. void pop(); /// Pop the front of the queue and load the result into the specified /// `operation`. - void pop(bsl::shared_ptr* operation); + void pop(bsl::shared_ptr* operation); /// Return the front of the queue. - bsl::shared_ptr front(); + bsl::shared_ptr front(); // ACCESSORS @@ -189,8 +187,8 @@ class NtcReadQueue { // ================ /// Mechanism for a bi-directional async channel implemented using NTC. -class NtcChannel : public mwcio::Channel, - public mwcio::ChannelFactoryOperationHandle, +class NtcChannel : public bmqio::Channel, + public bmqio::ChannelFactoryOperationHandle, public ntci::StreamSocketSession, public bsl::enable_shared_from_this { // PRIVATE TYPES @@ -205,16 +203,16 @@ class NtcChannel : public mwcio::Channel, bslmt::Mutex d_mutex; bsl::shared_ptr d_interface_sp; bsl::shared_ptr d_streamSocket_sp; - mwcio::NtcReadQueue d_readQueue; + bmqio::NtcReadQueue d_readQueue; bdlbb::Blob d_readCache; int d_channelId; bsl::string d_peerUri; State d_state; - mwcio::ConnectOptions d_options; - mwct::PropertyBag d_properties; + bmqio::ConnectOptions d_options; + bmqvt::PropertyBag d_properties; bdlmt::Signaler d_watermarkSignaler; bdlmt::Signaler d_closeSignaler; - mwcio::ChannelFactory::ResultCallback d_resultCallback; + bmqio::ChannelFactory::ResultCallback d_resultCallback; bslma::Allocator* d_allocator_p; private: @@ -232,12 +230,12 @@ class NtcChannel : public mwcio::Channel, /// Process the timeout of the specified `read` operation by the /// specified `timer` according to the specified `event`. - void processReadTimeout(const bsl::shared_ptr& read, + void processReadTimeout(const bsl::shared_ptr& read, const bsl::shared_ptr& timer, const ntca::TimerEvent& event); /// Process the cancellation of the specified `read`. - void processReadCancelled(const bsl::shared_ptr& read); + void processReadCancelled(const bsl::shared_ptr& read); /// Process the condition that the size of the read queue is greater /// than or equal to the read queue low watermark. @@ -286,7 +284,7 @@ class NtcChannel : public mwcio::Channel, const ntca::ShutdownEvent& event) BSLS_KEYWORD_OVERRIDE; /// Process the closure of the socket. - void processClose(const mwcio::Status& status); + void processClose(const bmqio::Status& status); public: // TRAITS @@ -300,7 +298,7 @@ class NtcChannel : public mwcio::Channel, /// is used. explicit NtcChannel( const bsl::shared_ptr& interface, - const mwcio::ChannelFactory::ResultCallback& resultCallback, + const bmqio::ChannelFactory::ResultCallback& resultCallback, bslma::Allocator* basicAllocator = 0); /// Destroy this object. @@ -321,7 +319,7 @@ class NtcChannel : public mwcio::Channel, /// `options.autoReconnect()` is `true` and the implementing /// `ChannelFactory` doesn't provide this behavior, it must fail the /// connection immediately. - int connect(mwcio::Status* status, const mwcio::ConnectOptions& options); + int connect(bmqio::Status* status, const bmqio::ConnectOptions& options); /// Import the specified `streamSocket` and invoke the underlying result /// callback. @@ -348,7 +346,7 @@ class NtcChannel : public mwcio::Channel, /// that can be enqueued. If `highWaterMark` is not specified then /// INT_MAX is used. Return 0 on success, and a non-zero value /// otherwise. On error, the return value may equal to one of the - /// enumerators in `mwcio_ChannelStatus::Type`. Note that success does + /// enumerators in `bmqio_ChannelStatus::Type`. Note that success does /// not imply that the data has been written or will be successfully /// written to the underlying stream used by this channel. Also note /// that in addition to `highWatermark` the enqueued portion must also @@ -362,7 +360,7 @@ class NtcChannel : public mwcio::Channel, void cancel() BSLS_KEYWORD_OVERRIDE; /// Cancel all pending read requests, and invoke their read callbacks - /// with a `mwcio::ChannelStatus::e_CANCELED` status. Note that if the + /// with a `bmqio::ChannelStatus::e_CANCELED` status. Note that if the /// channel is active, the read callbacks are invoked in the thread in /// which the channel's data callbacks are invoked, else they are /// invoked in the thread calling `cancelRead`. @@ -398,7 +396,7 @@ class NtcChannel : public mwcio::Channel, /// Return a reference providing modifiable access to the properties of /// this Channel. - mwct::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; + bmqvt::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; /// Set the channel ID to the specified `channelId`. void setChannelId(int channelId); @@ -426,7 +424,7 @@ class NtcChannel : public mwcio::Channel, /// Return a reference providing modifiable access to the properties of /// this Channel. - const mwct::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; + const bmqvt::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; /// Return the allocator this object was created with. bslma::Allocator* allocator() const; @@ -448,7 +446,7 @@ struct NtcChannelUtil { /// the specified `error` assigned to the specified `category` that /// was detected when performing the specified `operation`. static void fail(Status* status, - mwcio::StatusCategory::Enum category, + bmqio::StatusCategory::Enum category, const bslstl::StringRef& operation, const ntsa::Error& error); }; @@ -459,14 +457,14 @@ struct NtcChannelUtil { /// This class provides a handle to an ongoing `listen` operation of /// a channel factory. -class NtcListener : public mwcio::ChannelFactoryOperationHandle, +class NtcListener : public bmqio::ChannelFactoryOperationHandle, public bsl::enable_shared_from_this { public: // TYPES /// This typedef defines the signature of a function invoked when the /// listener is closed. - typedef void CloseFnType(const mwcio::Status& status); + typedef void CloseFnType(const bmqio::Status& status); /// This typedef defins a function invoked when the listener is closed. typedef bsl::function CloseFn; @@ -486,10 +484,10 @@ class NtcListener : public mwcio::ChannelFactoryOperationHandle, bsl::shared_ptr d_listenerSocket_sp; bsl::string d_localUri; State d_state; - mwcio::ListenOptions d_options; - mwct::PropertyBag d_properties; + bmqio::ListenOptions d_options; + bmqvt::PropertyBag d_properties; bdlmt::Signaler d_closeSignaler; - mwcio::ChannelFactory::ResultCallback d_resultCallback; + bmqio::ChannelFactory::ResultCallback d_resultCallback; bslma::Allocator* d_allocator_p; private: @@ -507,7 +505,7 @@ class NtcListener : public mwcio::ChannelFactoryOperationHandle, const ntca::AcceptEvent& event); /// Process the closure of the socket. - void processClose(const mwcio::Status& status); + void processClose(const bmqio::Status& status); public: // TRAITS @@ -522,7 +520,7 @@ class NtcListener : public mwcio::ChannelFactoryOperationHandle, /// used. explicit NtcListener( const bsl::shared_ptr& interface, - const mwcio::ChannelFactory::ResultCallback& resultCallback, + const bmqio::ChannelFactory::ResultCallback& resultCallback, bslma::Allocator* basicAllocator = 0); /// Destroy this object. @@ -535,7 +533,7 @@ class NtcListener : public mwcio::ChannelFactoryOperationHandle, /// callback when they are accepted. Return `e_SUCCESS` on success or /// a failure StatusCategory on error, populating the /// optionally-specified `status` with more detailed error information. - int listen(mwcio::Status* status, const mwcio::ListenOptions& options); + int listen(bmqio::Status* status, const bmqio::ListenOptions& options); /// Cancel the operation. void cancel() BSLS_KEYWORD_OVERRIDE; @@ -553,7 +551,7 @@ class NtcListener : public mwcio::ChannelFactoryOperationHandle, /// Return a reference providing modifiable access to the properties of /// this object. - mwct::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; + bmqvt::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; // ACCESSORS @@ -563,7 +561,7 @@ class NtcListener : public mwcio::ChannelFactoryOperationHandle, /// Return a reference providing const access to the properties of this /// object. - const mwct::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; + const bmqvt::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; /// Return the allocator this object was created with. bslma::Allocator* allocator() const; @@ -592,7 +590,7 @@ struct NtcListenerUtil { /// the specified `error` assigned to the specified `category` that /// was detected when performing the specified `operation`. static void fail(Status* status, - mwcio::StatusCategory::Enum category, + bmqio::StatusCategory::Enum category, const bslstl::StringRef& operation, const ntsa::Error& error); }; diff --git a/src/groups/mwc/mwcio/mwcio_ntcchannelfactory.cpp b/src/groups/bmq/bmqio/bmqio_ntcchannelfactory.cpp similarity index 87% rename from src/groups/mwc/mwcio/mwcio_ntcchannelfactory.cpp rename to src/groups/bmq/bmqio/bmqio_ntcchannelfactory.cpp index 308a6e677..6a2ea6977 100644 --- a/src/groups/mwc/mwcio/mwcio_ntcchannelfactory.cpp +++ b/src/groups/bmq/bmqio/bmqio_ntcchannelfactory.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_ntcchannelfactory.cpp -*-C++-*- -#include +// bmqio_ntcchannelfactory.cpp -*-C++-*- +#include -#include +#include // NTF #include #include @@ -35,16 +35,16 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { namespace { -BALL_LOG_SET_NAMESPACE_CATEGORY("MWCIO.NTCCHANNELFACTORY"); +BALL_LOG_SET_NAMESPACE_CATEGORY("BMQIO.NTCCHANNELFACTORY"); #if defined(BSLS_PLATFORM_CPU_64_BIT) -#define MWCIO_ADDRESS_WIDTH 16 +#define BMQIO_ADDRESS_WIDTH 16 #else -#define MWCIO_ADDRESS_WIDTH 8 +#define BMQIO_ADDRESS_WIDTH 8 #endif const int k_CLOSE_GROUP = bsl::numeric_limits::max(); @@ -63,7 +63,7 @@ struct AddressFormatter { char fill = stream.fill(); stream << bsl::hex << bsl::showbase << bsl::internal - << bsl::setfill('0') << bsl::setw(MWCIO_ADDRESS_WIDTH) + << bsl::setfill('0') << bsl::setw(BMQIO_ADDRESS_WIDTH) << object.d_address_p; stream.flags(flags); @@ -78,17 +78,17 @@ struct AddressFormatter { // PRIVATE MANIPULATORS void NtcChannelFactory::processListenerResult( - mwcio::ChannelFactoryEvent::Enum event, - const mwcio::Status& status, - const bsl::shared_ptr& channel, - const mwcio::ChannelFactory::ResultCallback& callback) + bmqio::ChannelFactoryEvent::Enum event, + const bmqio::Status& status, + const bsl::shared_ptr& channel, + const bmqio::ChannelFactory::ResultCallback& callback) { BALL_LOG_TRACE << "NTC factory event " << event << " status " << status << BALL_LOG_END; - if (event == mwcio::ChannelFactoryEvent::e_CHANNEL_UP) { + if (event == bmqio::ChannelFactoryEvent::e_CHANNEL_UP) { if (channel) { - bsl::shared_ptr alias; + bsl::shared_ptr alias; bslstl::SharedPtrUtil::dynamicCast(&alias, channel); if (alias) { int catalogHandle = d_channels.add(alias); @@ -114,7 +114,7 @@ void NtcChannelFactory::processListenerResult( void NtcChannelFactory::processListenerClosed(int handle) { - bsl::shared_ptr listener; + bsl::shared_ptr listener; int rc = d_listeners.remove(handle, &listener); if (rc == 0) { BALL_LOG_TRACE << "NTC listener " << AddressFormatter(listener.get()) @@ -135,17 +135,17 @@ void NtcChannelFactory::processListenerClosed(int handle) } void NtcChannelFactory::processChannelResult( - mwcio::ChannelFactoryEvent::Enum event, - const mwcio::Status& status, - const bsl::shared_ptr& channel, - const mwcio::ChannelFactory::ResultCallback& callback) + bmqio::ChannelFactoryEvent::Enum event, + const bmqio::Status& status, + const bsl::shared_ptr& channel, + const bmqio::ChannelFactory::ResultCallback& callback) { BALL_LOG_TRACE << "NTC factory event " << event << " status " << status << BALL_LOG_END; - if (event == mwcio::ChannelFactoryEvent::e_CHANNEL_UP) { + if (event == bmqio::ChannelFactoryEvent::e_CHANNEL_UP) { if (channel) { - bsl::shared_ptr alias; + bsl::shared_ptr alias; bslstl::SharedPtrUtil::dynamicCast(&alias, channel); if (alias) { d_createSignaler(alias, alias); @@ -158,7 +158,7 @@ void NtcChannelFactory::processChannelResult( void NtcChannelFactory::processChannelClosed(int handle) { - bsl::shared_ptr channel; + bsl::shared_ptr channel; int rc = d_channels.remove(handle, &channel); if (rc == 0) { BALL_LOG_TRACE << "NTC channel " << AddressFormatter(channel.get()) @@ -281,7 +281,7 @@ void NtcChannelFactory::stop() { ChannelIterator iterator(d_channels); while (iterator) { - iterator.value()->close(mwcio::Status()); + iterator.value()->close(bmqio::Status()); ++iterator; } } @@ -328,8 +328,8 @@ void NtcChannelFactory::listen(Status* status, bslmt::LockGuard lock(&d_stateMutex); // LOCKED if (d_state != e_STATE_STARTED) { - mwcio::NtcListenerUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcListenerUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "state", ntsa::Error(ntsa::Error::e_INVALID)); return; // RETURN @@ -343,7 +343,7 @@ void NtcChannelFactory::listen(Status* status, bdlf::PlaceHolders::_3, cb); - bsl::shared_ptr listener; + bsl::shared_ptr listener; listener.createInplace(d_allocator_p, d_interface_sp, resultCallbackProxy, @@ -364,7 +364,7 @@ void NtcChannelFactory::listen(Status* status, } if (handle) { - bslma::ManagedPtr alias(listener.managedPtr()); + bslma::ManagedPtr alias(listener.managedPtr()); handle->loadAlias(alias, listener.get()); } @@ -392,8 +392,8 @@ void NtcChannelFactory::connect(Status* status, bslmt::LockGuard lock(&d_stateMutex); // LOCKED if (d_state != e_STATE_STARTED) { - mwcio::NtcChannelUtil::fail(status, - mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::NtcChannelUtil::fail(status, + bmqio::StatusCategory::e_GENERIC_ERROR, "state", ntsa::Error(ntsa::Error::e_INVALID)); return; // RETURN @@ -407,7 +407,7 @@ void NtcChannelFactory::connect(Status* status, bdlf::PlaceHolders::_3, cb); - bsl::shared_ptr channel; + bsl::shared_ptr channel; channel.createInplace(d_allocator_p, d_interface_sp, resultCallbackProxy, @@ -430,7 +430,7 @@ void NtcChannelFactory::connect(Status* status, } if (handle) { - bslma::ManagedPtr alias(channel.managedPtr()); + bslma::ManagedPtr alias(channel.managedPtr()); handle->loadAlias(alias, channel.get()); } @@ -450,7 +450,7 @@ bdlmt::SignalerConnection NtcChannelFactory::onLimit(const LimitFn& cb) } int NtcChannelFactory::lookupChannel( - bsl::shared_ptr* result, + bsl::shared_ptr* result, int channelId) { return d_channels.find(channelId, result); @@ -463,12 +463,12 @@ int NtcChannelFactory::lookupChannel( // CLASS METHODS bslstl::StringRef NtcChannelFactoryUtil::listenBacklogProperty() { - return mwcio::NtcListenerUtil::listenBacklogProperty(); + return bmqio::NtcListenerUtil::listenBacklogProperty(); } bslstl::StringRef NtcChannelFactoryUtil::listenPortProperty() { - return mwcio::NtcListenerUtil::listenPortProperty(); + return bmqio::NtcListenerUtil::listenPortProperty(); } } // close package namespace diff --git a/src/groups/mwc/mwcio/mwcio_ntcchannelfactory.h b/src/groups/bmq/bmqio/bmqio_ntcchannelfactory.h similarity index 85% rename from src/groups/mwc/mwcio/mwcio_ntcchannelfactory.h rename to src/groups/bmq/bmqio/bmqio_ntcchannelfactory.h index d70b3dcb4..b5bcd1687 100644 --- a/src/groups/mwc/mwcio/mwcio_ntcchannelfactory.h +++ b/src/groups/bmq/bmqio/bmqio_ntcchannelfactory.h @@ -13,28 +13,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_ntcchannelfactory.h -*-C++-*- -#ifndef INCLUDED_MWCIO_NTCCHANNELFACTORY -#define INCLUDED_MWCIO_NTCCHANNELFACTORY +// bmqio_ntcchannelfactory.h -*-C++-*- +#ifndef INCLUDED_BMQIO_NTCCHANNELFACTORY +#define INCLUDED_BMQIO_NTCCHANNELFACTORY -//@PURPOSE: Provide a 'mwcio::NtcChannel' factory. +//@PURPOSE: Provide a 'bmqio::NtcChannel' factory. // //@CLASSES: -// mwcio::NtcChannelFactory: Factory for mwcio::NtcChannel' objects +// bmqio::NtcChannelFactory: Factory for bmqio::NtcChannel' objects // //@SEE_ALSO: -// mwcio_channelfactory +// bmqio_channelfactory // -//@DESCRIPTION: This component defines a mechanism, 'mwcio::NtcChannelFactory', -// that implements the 'mwcio::ChannelFactory' protocol to produce and manage -// 'mwcio::NtcChannel' objects that implement the 'mwcio::Channel' protocol. +//@DESCRIPTION: This component defines a mechanism, 'bmqio::NtcChannelFactory', +// that implements the 'bmqio::ChannelFactory' protocol to produce and manage +// 'bmqio::NtcChannel' objects that implement the 'bmqio::Channel' protocol. -// MWC - -#include -#include -#include -#include +#include +#include +#include +#include // NTF #include @@ -50,22 +48,22 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ======================= // class NtcChannelFactory // ======================= -/// This class provides a factory of `mwcio::NtcChannel` objects. -class NtcChannelFactory : public mwcio::ChannelFactory { +/// This class provides a factory of `bmqio::NtcChannel` objects. +class NtcChannelFactory : public bmqio::ChannelFactory { public: // TYPES /// This typedef defines the signature of a function invoked when a /// channel has been created. typedef void CreateFnType( - const bsl::shared_ptr& channel, - const bsl::shared_ptr& handle); + const bsl::shared_ptr& channel, + const bsl::shared_ptr& handle); /// This typedef defines a function invoked when a channel has been /// created. @@ -83,7 +81,7 @@ class NtcChannelFactory : public mwcio::ChannelFactory { // PRIVATE TYPES /// This typedef defines an entry in a catalog of listeners. - typedef bsl::shared_ptr ListenerEntry; + typedef bsl::shared_ptr ListenerEntry; /// This typedef defines a catalog of listeners. typedef bdlcc::ObjectCatalog ListenerCatalog; @@ -92,7 +90,7 @@ class NtcChannelFactory : public mwcio::ChannelFactory { typedef bdlcc::ObjectCatalogIter ListenerIterator; /// This typedef defines an entry in a catalog of channels. - typedef bsl::shared_ptr ChannelEntry; + typedef bsl::shared_ptr ChannelEntry; /// This typedef defines a catalog of channels. typedef bdlcc::ObjectCatalog ChannelCatalog; @@ -131,10 +129,10 @@ class NtcChannelFactory : public mwcio::ChannelFactory { /// Process the specified `event` having the specified `status` for /// the specified `channel` and invoke the specified `callback`. void processListenerResult( - mwcio::ChannelFactoryEvent::Enum event, - const mwcio::Status& status, - const bsl::shared_ptr& channel, - const mwcio::ChannelFactory::ResultCallback& callback); + bmqio::ChannelFactoryEvent::Enum event, + const bmqio::Status& status, + const bsl::shared_ptr& channel, + const bmqio::ChannelFactory::ResultCallback& callback); /// Process the closure of the channel identified by the specified /// `handle`. @@ -143,10 +141,10 @@ class NtcChannelFactory : public mwcio::ChannelFactory { /// Process the specified `event` having the specified `status` for /// the specified `channel` and invoke the specified `callback`. void processChannelResult( - mwcio::ChannelFactoryEvent::Enum event, - const mwcio::Status& status, - const bsl::shared_ptr& channel, - const mwcio::ChannelFactory::ResultCallback& callback); + bmqio::ChannelFactoryEvent::Enum event, + const bmqio::Status& status, + const bsl::shared_ptr& channel, + const bmqio::ChannelFactory::ResultCallback& callback); /// Process the closure of the listener identified by the specified /// `handle`. @@ -157,7 +155,7 @@ class NtcChannelFactory : public mwcio::ChannelFactory { /// This typedef defines an operation handle for an operation on a /// channel factory. - typedef mwcio::ChannelFactoryOperationHandle OpHandle; + typedef bmqio::ChannelFactoryOperationHandle OpHandle; // CREATORS @@ -237,12 +235,12 @@ class NtcChannelFactory : public mwcio::ChannelFactory { /// Load into the specified `result` the channel having the specified /// `channelId`. Return 0 on success and a non-zero value otherwise. - int lookupChannel(bsl::shared_ptr* result, + int lookupChannel(bsl::shared_ptr* result, int channelId); /// Invoke the specified `visitor` once for every currently active /// channel managed by this object. The `visitor` will be invoked with - /// a single argument, `const bsl::shared_ptr&`. + /// a single argument, `const bsl::shared_ptr&`. /// Note that it is unspecified whether channels created or closed /// during the execution of this function will be included. template @@ -277,7 +275,7 @@ struct NtcChannelFactoryUtil { template void NtcChannelFactory::visitChannels(VISITOR& visitor) { - typedef bsl::vector > ChannelVector; + typedef bsl::vector > ChannelVector; ChannelVector channels; { diff --git a/src/groups/mwc/mwcio/mwcio_ntcchannelfactory.t.cpp b/src/groups/bmq/bmqio/bmqio_ntcchannelfactory.t.cpp similarity index 98% rename from src/groups/mwc/mwcio/mwcio_ntcchannelfactory.t.cpp rename to src/groups/bmq/bmqio/bmqio_ntcchannelfactory.t.cpp index 13dc4d72f..ceafeea57 100644 --- a/src/groups/mwc/mwcio/mwcio_ntcchannelfactory.t.cpp +++ b/src/groups/bmq/bmqio/bmqio_ntcchannelfactory.t.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_ntcchannelfactory.t.cpp -*-C++-*- -#include +// bmqio_ntcchannelfactory.t.cpp -*-C++-*- +#include -#include +#include #include #include @@ -37,15 +37,15 @@ #include #include -#include +#include // CONVENIENCE using namespace BloombergLP; using namespace bsl; -using namespace mwcio; +using namespace bmqio; // IMPLEMENTATION NOTES: This test driver is nearly identical to the test -// driver for mwcio_tcpchannelfactory with the following differences: +// driver for bmqio_tcpchannelfactory with the following differences: // // 1) There is no resolution map or reliance on a process-wide mechanism to // override the results of name resolution. NTC supports object-specific @@ -348,7 +348,7 @@ class Tester { connect(int line, const bslstl::StringRef& handleName, const bslstl::StringRef& endpointOrServer, - const mwcio::ConnectOptions& options, + const bmqio::ConnectOptions& options, StatusCategory::Enum resultStatus = StatusCategory::e_SUCCESS); void connect(int line, @@ -650,7 +650,7 @@ void Tester::listen(int line, void Tester::connect(int line, const bslstl::StringRef& handleName, const bslstl::StringRef& endpointOrServer, - const mwcio::ConnectOptions& options, + const bmqio::ConnectOptions& options, StatusCategory::Enum resultStatus) { bsl::string handleNameStr(handleName, s_allocator_p); @@ -707,7 +707,7 @@ void Tester::connect(int line, connect(line, handleName, endpointOrServer, - mwcio::ConnectOptions(), + bmqio::ConnectOptions(), resultStatus); } @@ -823,9 +823,9 @@ void Tester::readChannel(int line, bsl::string readString(s_allocator_p); readString.resize(data.length(), '7'); - mwcu::BlobUtil::readNBytes(&readString.front(), + bmqu::BlobUtil::readNBytes(&readString.front(), info.d_readData, - mwcu::BlobPosition(), + bmqu::BlobPosition(), data.length()); bdlbb::BlobUtil::erase(&info.d_readData, 0, data.length()); @@ -1055,7 +1055,7 @@ static void test6_preCreationCbTest() // NtcChannelFactory // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Pre Creation Cb Test"); + bmqtst::TestHelper::printTestName("Pre Creation Cb Test"); Tester t(s_allocator_p); @@ -1090,7 +1090,7 @@ static void test5_visitChannelsTest() // channels. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Cancel Handle Test"); + bmqtst::TestHelper::printTestName("Cancel Handle Test"); Tester t(s_allocator_p); @@ -1130,7 +1130,7 @@ static void test4_cancelHandleTest() // connection from being established // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Cancel Handle Test"); + bmqtst::TestHelper::printTestName("Cancel Handle Test"); Tester t(s_allocator_p); @@ -1184,7 +1184,7 @@ static void test3_watermarkTest() // low watermark event. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Watermark Test"); + bmqtst::TestHelper::printTestName("Watermark Test"); Tester t(s_allocator_p); @@ -1222,7 +1222,7 @@ static void test2_connectListenFailTest() // c) Connecting with 'autoReconnect' fails as expected // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Connect Listen Fail Test"); + bmqtst::TestHelper::printTestName("Connect Listen Fail Test"); Tester t(s_allocator_p); t.init(L_); @@ -1256,7 +1256,7 @@ static void test2_connectListenFailTest() // Concern 'c' - mwcio::ConnectOptions options; + bmqio::ConnectOptions options; options.setAutoReconnect(true); t.connect(L_, "h", "127.0.0.1:0", options, CAT_GENERIC); } @@ -1273,7 +1273,7 @@ static void test1_breathingTest() // d) Resolving a hostname to listen on works. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Breathing Test"); + bmqtst::TestHelper::printTestName("Breathing Test"); Tester t(s_allocator_p); t.init(L_); @@ -1314,7 +1314,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); // ntcf::System::initialize(); diff --git a/src/groups/mwc/mwcio/mwcio_reconnectingchannelfactory.cpp b/src/groups/bmq/bmqio/bmqio_reconnectingchannelfactory.cpp similarity index 95% rename from src/groups/mwc/mwcio/mwcio_reconnectingchannelfactory.cpp rename to src/groups/bmq/bmqio/bmqio_reconnectingchannelfactory.cpp index e858703eb..ac09723e3 100644 --- a/src/groups/mwc/mwcio/mwcio_reconnectingchannelfactory.cpp +++ b/src/groups/bmq/bmqio/bmqio_reconnectingchannelfactory.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_reconnectingchannelfactory.cpp -*-C++-*- -#include +// bmqio_reconnectingchannelfactory.cpp -*-C++-*- +#include -#include -// MWC -#include -#include -#include -#include +#include + +#include +#include +#include +#include // BDE #include @@ -45,11 +45,11 @@ #endif namespace BloombergLP { -namespace mwcio { +namespace bmqio { namespace { -BALL_LOG_SET_NAMESPACE_CATEGORY("MWCIO.RECONNECTINGCHANNELFACTORY"); +BALL_LOG_SET_NAMESPACE_CATEGORY("BMQIO.RECONNECTINGCHANNELFACTORY"); } // close unnamed namespace @@ -165,12 +165,12 @@ void ReconnectingChannelFactory_ConnectHandle::cancel() } } -mwct::PropertyBag& ReconnectingChannelFactory_ConnectHandle::properties() +bmqvt::PropertyBag& ReconnectingChannelFactory_ConnectHandle::properties() { return d_baseConnectHandle->properties(); } -const mwct::PropertyBag& +const bmqvt::PropertyBag& ReconnectingChannelFactory_ConnectHandle::properties() const { return d_baseConnectHandle->properties(); @@ -219,7 +219,7 @@ void ReconnectingChannelFactory::scheduleConnect( } else { timeSinceLastConnect.setTotalNanoseconds( - mwcsys::Time::highResolutionTimer() - + bmqsys::Time::highResolutionTimer() - handle->d_lastConnectAttemptTime); } @@ -243,7 +243,7 @@ void ReconnectingChannelFactory::scheduleConnect( void ReconnectingChannelFactory::doConnect(Status* status, const ConnectHandlePtr& handle) { - handle->d_lastConnectAttemptTime = mwcsys::Time::highResolutionTimer(); + handle->d_lastConnectAttemptTime = bmqsys::Time::highResolutionTimer(); if (handle->d_endpoints.empty()) { // We haven't yet resolved endpoints, or we tried them all already. @@ -262,7 +262,7 @@ void ReconnectingChannelFactory::doConnect(Status* status, // to multiple hosts, at least one should succeed at first attempt. BALL_LOG_INFO << "Resolved endpoint '" << handle->d_options.endpoint() << "' to: " - << mwcu::PrintUtil::printer(handle->d_endpoints); + << bmqu::PrintUtil::printer(handle->d_endpoints); } bsl::reverse(handle->d_endpoints.begin(), handle->d_endpoints.end()); @@ -328,7 +328,7 @@ void ReconnectingChannelFactory::doConnect(Status* status, void ReconnectingChannelFactory::connectTimerCb(const ConnectHandlePtr& handle) { - mwcu::AtomicValidatorGuard guard(&handle->d_validator); + bmqu::AtomicValidatorGuard guard(&handle->d_validator); if (!guard.isValid()) { return; // RETURN } @@ -355,7 +355,7 @@ void ReconnectingChannelFactory::connectResultCb( const Status& status, const bsl::shared_ptr& channel) { - mwcu::AtomicValidatorGuard guard(&handle->d_validator); + bmqu::AtomicValidatorGuard guard(&handle->d_validator); if (!guard.isValid()) { return; // RETURN @@ -430,7 +430,7 @@ void ReconnectingChannelFactory::connectResultCb( void ReconnectingChannelFactory::onChannelDown(const ConnectHandlePtr& handle) { - mwcu::AtomicValidatorGuard guard(&handle->d_validator); + bmqu::AtomicValidatorGuard guard(&handle->d_validator); if (!guard.isValid()) { return; // RETURN } @@ -501,7 +501,7 @@ void ReconnectingChannelFactory::listen(Status* status, const ListenOptions& options, const ResultCallback& cb) { - mwcu::AtomicValidatorGuard valGuard(&d_validator); + bmqu::AtomicValidatorGuard valGuard(&d_validator); if (!valGuard.isValid()) { if (status) { status->reset(StatusCategory::e_CANCELED); @@ -518,7 +518,7 @@ void ReconnectingChannelFactory::connect(Status* status, const ConnectOptions& options, const ResultCallback& cb) { - mwcu::AtomicValidatorGuard valGuard(&d_validator); + bmqu::AtomicValidatorGuard valGuard(&d_validator); if (!valGuard.isValid()) { if (status) { status->reset(StatusCategory::e_CANCELED); @@ -596,7 +596,7 @@ void ReconnectingChannelFactoryUtil::resolveEndpointFn( &arena); bsl::vector addresses(&arena); - ntsa::Error error = mwcio::ResolveUtil::getIpAddress(&addresses, host); + ntsa::Error error = bmqio::ResolveUtil::getIpAddress(&addresses, host); if (error.code() != ntsa::Error::e_OK) { BALL_LOG_ERROR << "Unable to resolve addresses from host '" << host << "' (error: " << error << ")"; @@ -608,7 +608,7 @@ void ReconnectingChannelFactoryUtil::resolveEndpointFn( it != addresses.end(); ++it) { bsl::string hostname(&arena); - error = mwcio::ResolveUtil::getDomainName(&hostname, *it); + error = bmqio::ResolveUtil::getDomainName(&hostname, *it); if (error.code() != ntsa::Error::e_OK) { // If we fail to resolve, log an error and skip this entry BALL_LOG_ERROR << "Unable to resolve hostname of address " @@ -617,7 +617,7 @@ void ReconnectingChannelFactoryUtil::resolveEndpointFn( continue; // CONTINUE } - mwcu::MemOutStream os(&arena); + bmqu::MemOutStream os(&arena); os << hostname << ":" << port; out->push_back(os.str()); } diff --git a/src/groups/mwc/mwcio/mwcio_reconnectingchannelfactory.h b/src/groups/bmq/bmqio/bmqio_reconnectingchannelfactory.h similarity index 94% rename from src/groups/mwc/mwcio/mwcio_reconnectingchannelfactory.h rename to src/groups/bmq/bmqio/bmqio_reconnectingchannelfactory.h index eb53f695f..3bc6d0de5 100644 --- a/src/groups/mwc/mwcio/mwcio_reconnectingchannelfactory.h +++ b/src/groups/bmq/bmqio/bmqio_reconnectingchannelfactory.h @@ -13,22 +13,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_reconnectingchannelfactory.h -*-C++-*- -#ifndef INCLUDED_MWCIO_RECONNECTINGCHANNELFACTORY -#define INCLUDED_MWCIO_RECONNECTINGCHANNELFACTORY +// bmqio_reconnectingchannelfactory.h -*-C++-*- +#ifndef INCLUDED_BMQIO_RECONNECTINGCHANNELFACTORY +#define INCLUDED_BMQIO_RECONNECTINGCHANNELFACTORY //@PURPOSE: Provide an auto-reconnecting ChannelFactory decorator // //@CLASSES: -// mwcio::ReconnectingChannelFactory -// mwcio::ReconnectingChannelFactoryConfig -// mwcio::ReconnectingChannelFactoryUtil +// bmqio::ReconnectingChannelFactory +// bmqio::ReconnectingChannelFactoryConfig +// bmqio::ReconnectingChannelFactoryUtil // //@SEE_ALSO: // //@DESCRIPTION: This component defines a mechanism, -// 'mwcio::ReconnectingChannelFactory', which is a decorator of a base -// 'mwcio::ChannelFactory' that gives it the ability to automatically retry a +// 'bmqio::ReconnectingChannelFactory', which is a decorator of a base +// 'bmqio::ChannelFactory' that gives it the ability to automatically retry a // connection if it goes down, using a pool of many available endpoints which // have been resolved. // @@ -38,12 +38,10 @@ // 'CONNECT_ATTEMPT_FAILED' event after failing to connect to all of them and // decrementing the maxConnectAttempt by one. -// MWC - -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -57,7 +55,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // FORWARD DECLARATIONS class ReconnectingChannelFactory; @@ -177,7 +175,7 @@ struct ReconnectingChannelFactory_ConnectHandle : public ChannelFactory::OpHandle { public: // PUBLIC DATA - mwcu::AtomicValidator d_validator; + bmqu::AtomicValidator d_validator; // The validator is used to prevent calling the // 'd_resultCallback' if the user has canceled the // connect. This is also used to prevent earlier @@ -218,10 +216,10 @@ struct ReconnectingChannelFactory_ConnectHandle /// existing Channel). void cancel() BSLS_KEYWORD_OVERRIDE; - mwct::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; + bmqvt::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; // ACCESSORS - const mwct::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; + const bmqvt::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; }; // ================================ @@ -245,7 +243,7 @@ class ReconnectingChannelFactory : public ChannelFactory { ConnectHandleMap; // DATA - mwcu::AtomicValidator d_validator; + bmqu::AtomicValidator d_validator; Config d_config; ConnectHandleMap d_handles; bslmt::Mutex d_mutex; diff --git a/src/groups/mwc/mwcio/mwcio_reconnectingchannelfactory.t.cpp b/src/groups/bmq/bmqio/bmqio_reconnectingchannelfactory.t.cpp similarity index 98% rename from src/groups/mwc/mwcio/mwcio_reconnectingchannelfactory.t.cpp rename to src/groups/bmq/bmqio/bmqio_reconnectingchannelfactory.t.cpp index 966a35f5c..d520f1b85 100644 --- a/src/groups/mwc/mwcio/mwcio_reconnectingchannelfactory.t.cpp +++ b/src/groups/bmq/bmqio/bmqio_reconnectingchannelfactory.t.cpp @@ -13,17 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_reconnectingchannelfactory.t.cpp -*-C++-*- -#include +// bmqio_reconnectingchannelfactory.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -41,7 +40,7 @@ // CONVENIENCE using namespace BloombergLP; using namespace bsl; -using namespace mwcio; +using namespace bmqio; // ============================================================================ // TEST HELPERS UTILITY @@ -59,7 +58,7 @@ static const int k_INTERVAL_RESET_LIMIT = 200; // class Tester // ------------ -class Tester : public mwctst::Test { +class Tester : public bmqtst::Test { private: // TYPES @@ -78,7 +77,7 @@ class Tester : public mwctst::Test { }; // DATA - mwcsys::MockTime d_mockTime; + bmqsys::MockTime d_mockTime; bdlmt::EventScheduler d_scheduler; bdlmt::EventSchedulerTestTimeSource d_timeSource; TestChannelFactory d_baseFactory; @@ -202,7 +201,7 @@ void Tester::resolverFn(bsl::vector* out, const ConnectOptions& options) { PVV("Resolving '" << options.endpoint() << "' to '" - << mwcu::PrintUtil::printer(d_resolverResults) << "'"); + << bmqu::PrintUtil::printer(d_resolverResults) << "'"); *out = d_resolverResults; } @@ -255,7 +254,7 @@ Tester::~Tester() obj().stop(); d_reconnectingFactory.object() - .mwcio::ReconnectingChannelFactory ::~ReconnectingChannelFactory(); + .bmqio::ReconnectingChannelFactory ::~ReconnectingChannelFactory(); d_scheduler.stop(); } @@ -938,9 +937,9 @@ TEST(DefaultConnectIntervalFn) int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); - mwctst::runTest(_testCase); + bmqtst::runTest(_testCase); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcio/mwcio_resolveutil.cpp b/src/groups/bmq/bmqio/bmqio_resolveutil.cpp similarity index 96% rename from src/groups/mwc/mwcio/mwcio_resolveutil.cpp rename to src/groups/bmq/bmqio/bmqio_resolveutil.cpp index 9ceb0b1bc..83dbb59fb 100644 --- a/src/groups/mwc/mwcio/mwcio_resolveutil.cpp +++ b/src/groups/bmq/bmqio/bmqio_resolveutil.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_resolveutil.cpp -*-C++-*- -#include +// bmqio_resolveutil.cpp -*-C++-*- +#include -#include +#include // BDE #include #include @@ -28,7 +28,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ------------------ // struct ResolveUtil diff --git a/src/groups/mwc/mwcio/mwcio_resolveutil.h b/src/groups/bmq/bmqio/bmqio_resolveutil.h similarity index 89% rename from src/groups/mwc/mwcio/mwcio_resolveutil.h rename to src/groups/bmq/bmqio/bmqio_resolveutil.h index 8371b2313..2b18429ca 100644 --- a/src/groups/mwc/mwcio/mwcio_resolveutil.h +++ b/src/groups/bmq/bmqio/bmqio_resolveutil.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_resolveutil.h -*-C++-*- -#ifndef INCLUDED_MWCIO_RESOLVEUTIL -#define INCLUDED_MWCIO_RESOLVEUTIL +// bmqio_resolveutil.h -*-C++-*- +#ifndef INCLUDED_BMQIO_RESOLVEUTIL +#define INCLUDED_BMQIO_RESOLVEUTIL //@PURPOSE: Provide utilities to resolve names to IP addresses. // //@CLASSES: -// mwcio::ResolveUtil: Utility to resolve names to IP addresses. +// bmqio::ResolveUtil: Utility to resolve names to IP addresses. // -//@DESCRIPTION: This component provides an utility, 'mwcio::ResolveUtil', to +//@DESCRIPTION: This component provides an utility, 'bmqio::ResolveUtil', to // resolve names to IP addresses. // /// Thread Safety @@ -38,7 +38,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ================== // struct ResolveUtil diff --git a/src/groups/mwc/mwcio/mwcio_resolveutil.t.cpp b/src/groups/bmq/bmqio/bmqio_resolveutil.t.cpp similarity index 85% rename from src/groups/mwc/mwcio/mwcio_resolveutil.t.cpp rename to src/groups/bmq/bmqio/bmqio_resolveutil.t.cpp index 6ab12b9b1..2c445b007 100644 --- a/src/groups/mwc/mwcio/mwcio_resolveutil.t.cpp +++ b/src/groups/bmq/bmqio/bmqio_resolveutil.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_resolveutil.t.cpp -*-C++-*- -#include +// bmqio_resolveutil.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -31,7 +31,7 @@ // CONVENIENCE using namespace BloombergLP; using namespace bsl; -using namespace mwcio; +using namespace bmqio; // ============================================================================ // TESTS @@ -39,7 +39,7 @@ using namespace mwcio; static void test1_breathingTest() { - mwctst::TestHelper::printTestName("RESOLVE UTILITIES - BREATHING TEST"); + bmqtst::TestHelper::printTestName("RESOLVE UTILITIES - BREATHING TEST"); bsl::string hostname(s_allocator_p); ntsa::Ipv4Address hostIp; @@ -49,7 +49,7 @@ static void test1_breathingTest() { PVV("GET HOSTNAME"); - ntsa::Error error = mwcio::ResolveUtil::getHostname(&hostname); + ntsa::Error error = bmqio::ResolveUtil::getHostname(&hostname); ASSERT_EQ(error.code(), ntsa::Error::e_OK); ASSERT(!hostname.empty()); @@ -60,7 +60,7 @@ static void test1_breathingTest() { PVV("GET PRIMARY ADDRESS"); - ntsa::Error error = mwcio::ResolveUtil::getIpAddress(&hostIp, + ntsa::Error error = bmqio::ResolveUtil::getIpAddress(&hostIp, hostname); ASSERT_EQ(error.code(), ntsa::Error::e_OK); @@ -73,7 +73,7 @@ static void test1_breathingTest() PVV("GET DOMAIN NAME"); bsl::string domainName(s_allocator_p); - ntsa::Error error = mwcio::ResolveUtil::getDomainName( + ntsa::Error error = bmqio::ResolveUtil::getDomainName( &domainName, ntsa::IpAddress(hostIp)); ASSERT_EQ(error.code(), ntsa::Error::e_OK); @@ -87,7 +87,7 @@ static void test1_breathingTest() bsl::vector addresses(s_allocator_p); ntsa::Error error = - mwcio::ResolveUtil::getIpAddress(&addresses, "www.wikipedia.org"); + bmqio::ResolveUtil::getIpAddress(&addresses, "www.wikipedia.org"); ASSERT_EQ(error.code(), ntsa::Error::e_OK); ASSERT_GT(addresses.size(), 0U); @@ -104,7 +104,7 @@ static void test1_breathingTest() PVV("GET LOCAL ADDRESSES") bsl::vector addresses(s_allocator_p); - ntsa::Error error = mwcio::ResolveUtil::getLocalIpAddress(&addresses); + ntsa::Error error = bmqio::ResolveUtil::getLocalIpAddress(&addresses); ASSERT_EQ(error.code(), ntsa::Error::e_OK); ASSERT_GT(addresses.size(), 0U); @@ -132,7 +132,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -145,5 +145,5 @@ int main(int argc, char* argv[]) // Internally, 'ntsu::ResolverUtil::getIpAddress()' rountine uses vector // with default allocator so we can check here only for global allocations. - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcio/mwcio_resolvingchannelfactory.cpp b/src/groups/bmq/bmqio/bmqio_resolvingchannelfactory.cpp similarity index 93% rename from src/groups/mwc/mwcio/mwcio_resolvingchannelfactory.cpp rename to src/groups/bmq/bmqio/bmqio_resolvingchannelfactory.cpp index ba23fa59b..99c799ccc 100644 --- a/src/groups/mwc/mwcio/mwcio_resolvingchannelfactory.cpp +++ b/src/groups/bmq/bmqio/bmqio_resolvingchannelfactory.cpp @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_resolvingchannelfactory.cpp -*-C++-*- -#include +// bmqio_resolvingchannelfactory.cpp -*-C++-*- +#include -#include -// MWC -#include -#include -#include +#include + +#include +#include +#include // BDE #include @@ -34,9 +34,9 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { -BALL_LOG_SET_NAMESPACE_CATEGORY("MWCIO.RESOLVINGCHANNELFACTORY") +BALL_LOG_SET_NAMESPACE_CATEGORY("BMQIO.RESOLVINGCHANNELFACTORY") // ----------------------------------- // class ResolvingChannelFactoryConfig @@ -54,7 +54,7 @@ ResolvingChannelFactoryConfig::ResolvingChannelFactoryConfig( bdlf::BindUtil::bind(&ResolvingChannelFactoryUtil::defaultResolutionFn, bdlf::PlaceHolders::_1, bdlf::PlaceHolders::_2, - &mwcio::ResolveUtil::getDomainName, + &bmqio::ResolveUtil::getDomainName, true)) , d_executionPolicy(executionPolicy) , d_allocator_p(bslma::Default::allocator(basicAllocator)) @@ -151,9 +151,9 @@ void ResolvingChannelFactory::baseResultCallback( channel, d_config.d_allocator_p); - mwcex::ExecutionUtil::execute( + bmqex::ExecutionUtil::execute( d_config.d_executionPolicy, - bdlf::BindUtil::bind(mwcu::WeakMemFnUtil::weakMemFn( + bdlf::BindUtil::bind(bmqu::WeakMemFnUtil::weakMemFn( &ResolvingChannelFactory::resolveUriFn, d_self.acquireWeak()), newChannel)); @@ -188,7 +188,7 @@ void ResolvingChannelFactory::listen(Status* status, status, handle, options, - bdlf::BindUtil::bind(mwcu::WeakMemFnUtil::weakMemFn( + bdlf::BindUtil::bind(bmqu::WeakMemFnUtil::weakMemFn( &ResolvingChannelFactory::baseResultCallback, d_self.acquireWeak()), cb, @@ -206,7 +206,7 @@ void ResolvingChannelFactory::connect(Status* status, status, handle, options, - bdlf::BindUtil::bind(mwcu::WeakMemFnUtil::weakMemFn( + bdlf::BindUtil::bind(bmqu::WeakMemFnUtil::weakMemFn( &ResolvingChannelFactory::baseResultCallback, d_self.acquireWeak()), cb, diff --git a/src/groups/mwc/mwcio/mwcio_resolvingchannelfactory.h b/src/groups/bmq/bmqio/bmqio_resolvingchannelfactory.h similarity index 90% rename from src/groups/mwc/mwcio/mwcio_resolvingchannelfactory.h rename to src/groups/bmq/bmqio/bmqio_resolvingchannelfactory.h index 6aacdc78b..73e868888 100644 --- a/src/groups/mwc/mwcio/mwcio_resolvingchannelfactory.h +++ b/src/groups/bmq/bmqio/bmqio_resolvingchannelfactory.h @@ -13,31 +13,29 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_resolvingchannelfactory.h -*-C++-*- -#ifndef INCLUDED_MWCIO_RESOLVINGCHANNELFACTORY -#define INCLUDED_MWCIO_RESOLVINGCHANNELFACTORY +// bmqio_resolvingchannelfactory.h -*-C++-*- +#ifndef INCLUDED_BMQIO_RESOLVINGCHANNELFACTORY +#define INCLUDED_BMQIO_RESOLVINGCHANNELFACTORY //@PURPOSE: Provide a 'ChannelFactory' that resolves the URIs of its channels // //@CLASSES: -// mwcio::ResolvingChannelFactory +// bmqio::ResolvingChannelFactory // //@SEE_ALSO: // //@DESCRIPTION: This component defines a mechanism, -// 'mwcio::ResolvingChannelFactory', which is an implementation of the -// 'mwcio::ChannelFactory' protocol that resolves the 'peerUri' of the channels -// created by a base 'mwcio::ChannelFactory' and updates them on its channels +// 'bmqio::ResolvingChannelFactory', which is an implementation of the +// 'bmqio::ChannelFactory' protocol that resolves the 'peerUri' of the channels +// created by a base 'bmqio::ChannelFactory' and updates them on its channels // dynamically. -// MWC - -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -55,7 +53,7 @@ namespace BloombergLP { -namespace mwcio { +namespace bmqio { // =================================== // class ResolvingChannelFactoryConfig @@ -78,8 +76,8 @@ class ResolvingChannelFactoryConfig { /// An execution policy defining how the resolution callback is to be /// executed. - typedef mwcex::ExecutionPolicy + typedef bmqex::ExecutionPolicy ExecutionPolicy; private: @@ -127,7 +125,7 @@ class ResolvingChannelFactoryConfig { /// 'ResolvingChannelFactoryUtil::defaultResolutionFn( /// _1, /// _2, - /// mwcio::ResolveUtil::getDomainName, + /// bmqio::ResolveUtil::getDomainName, /// true)'. ResolvingChannelFactoryConfig& resolutionFn(const ResolutionFn& value); }; @@ -204,7 +202,7 @@ class ResolvingChannelFactory : public ChannelFactory { Config d_config; // Used to make sure no callback is invoked an a destroyed object. - mutable mwcu::SharedResource d_self; + mutable bmqu::SharedResource d_self; private: // NOT IMPLEMENTED @@ -277,7 +275,7 @@ struct ResolvingChannelFactoryUtil { /// Assume the `peerUri` of the specified `baseChannel` is of the form /// `:`. If the `` can be resolved using - /// `mwcio::ResolveUtil::getDomainName` then load into the specified + /// `bmqio::ResolveUtil::getDomainName` then load into the specified /// `resolvedUri` a string of the form /// `():`. If there's an error, /// return without modifying `resolvedUri` and if the specified diff --git a/src/groups/mwc/mwcio/mwcio_resolvingchannelfactory.t.cpp b/src/groups/bmq/bmqio/bmqio_resolvingchannelfactory.t.cpp similarity index 94% rename from src/groups/mwc/mwcio/mwcio_resolvingchannelfactory.t.cpp rename to src/groups/bmq/bmqio/bmqio_resolvingchannelfactory.t.cpp index 413610d05..851d964bb 100644 --- a/src/groups/mwc/mwcio/mwcio_resolvingchannelfactory.t.cpp +++ b/src/groups/bmq/bmqio/bmqio_resolvingchannelfactory.t.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_resolvingchannelfactory.t.cpp -*-C++-*- -#include +// bmqio_resolvingchannelfactory.t.cpp -*-C++-*- +#include #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -29,7 +29,7 @@ // CONVENIENCE using namespace BloombergLP; using namespace bsl; -using namespace mwcio; +using namespace bmqio; // FUNCTIONS static ntsa::Error @@ -100,7 +100,7 @@ class TestExecutor { bool operator==(const TestExecutor& rhs) const { // NOTE: The executor needs to be equality-comparable to satisfy the - // Executor concept as defined in 'mwcex' package documentation. + // Executor concept as defined in 'bmqex' package documentation. return d_store_p == rhs.d_store_p; } }; @@ -130,7 +130,7 @@ static void test1_defaultResolutionFn() &retHosts, &expectedAddresses); - mwcio::TestChannel base(s_allocator_p); + bmqio::TestChannel base(s_allocator_p); bsl::string ret(s_allocator_p); // No ':' @@ -201,7 +201,7 @@ static void test2_channelFactory() ResolvingChannelFactoryConfig cfg( &baseFactory, - mwcex::ExecutionPolicyUtil::oneWay().neverBlocking().useExecutor( + bmqex::ExecutionPolicyUtil::oneWay().neverBlocking().useExecutor( TestExecutor(&execStore)), s_allocator_p); cfg.resolutionFn( @@ -271,7 +271,7 @@ static void test2_channelFactory() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -283,5 +283,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcio/mwcio_statchannel.cpp b/src/groups/bmq/bmqio/bmqio_statchannel.cpp similarity index 93% rename from src/groups/mwc/mwcio/mwcio_statchannel.cpp rename to src/groups/bmq/bmqio/bmqio_statchannel.cpp index a57c6e3d5..e1d054cfd 100644 --- a/src/groups/mwc/mwcio/mwcio_statchannel.cpp +++ b/src/groups/bmq/bmqio/bmqio_statchannel.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_statchannel.cpp -*-C++-*- -#include +// bmqio_statchannel.cpp -*-C++-*- +#include -#include -// MWC -#include +#include + +#include // BDE #include @@ -28,7 +28,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ----------------------- // class StatChannelConfig @@ -36,8 +36,8 @@ namespace mwcio { // CREATORS StatChannelConfig::StatChannelConfig( - const bsl::shared_ptr& channel, - const bsl::shared_ptr& statContext, + const bsl::shared_ptr& channel, + const bsl::shared_ptr& statContext, BSLS_ANNOTATION_UNUSED bslma::Allocator* basicAllocator) : d_channel_sp(channel) , d_statContext_sp(statContext) diff --git a/src/groups/mwc/mwcio/mwcio_statchannel.h b/src/groups/bmq/bmqio/bmqio_statchannel.h similarity index 83% rename from src/groups/mwc/mwcio/mwcio_statchannel.h rename to src/groups/bmq/bmqio/bmqio_statchannel.h index 3e0d777f8..e677f7e8f 100644 --- a/src/groups/mwc/mwcio/mwcio_statchannel.h +++ b/src/groups/bmq/bmqio/bmqio_statchannel.h @@ -13,28 +13,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_statchannel.h -*-C++-*- -#ifndef INCLUDED_MWCIO_STATCHANNEL -#define INCLUDED_MWCIO_STATCHANNEL +// bmqio_statchannel.h -*-C++-*- +#ifndef INCLUDED_BMQIO_STATCHANNEL +#define INCLUDED_BMQIO_STATCHANNEL -//@PURPOSE: Provide a 'mwcio::Channel' that collects stats. +//@PURPOSE: Provide a 'bmqio::Channel' that collects stats. // //@CLASSES: -// mwcio::StatChannel -// mwcio::StatChannelConfig +// bmqio::StatChannel +// bmqio::StatChannelConfig // //@SEE_ALSO: // -//@DESCRIPTION: This component defines a mechanism, 'mwcio::StatChannel', which -// is a concrete implementation of the 'mwcio::Channel' protocol that collects +//@DESCRIPTION: This component defines a mechanism, 'bmqio::StatChannel', which +// is a concrete implementation of the 'bmqio::Channel' protocol that collects // stats. -// MWC - -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -45,7 +43,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // FORWARD DECLARE class StatChannel; @@ -61,7 +59,7 @@ class StatChannelConfig { bsl::shared_ptr d_channel_sp; // underlying Channel - bsl::shared_ptr d_statContext_sp; + bsl::shared_ptr d_statContext_sp; // stat conext for this channel // FRIENDS @@ -74,7 +72,7 @@ class StatChannelConfig { // CREATORS StatChannelConfig(const bsl::shared_ptr& channel, - const bsl::shared_ptr& statContext, + const bsl::shared_ptr& statContext, bslma::Allocator* basicAllocator = 0); StatChannelConfig(const StatChannelConfig& other, bslma::Allocator* basicAllocator = 0); @@ -95,7 +93,7 @@ class StatChannel : public DecoratingChannelPartialImp { /// /// NOTE: The values in this enum must match and be in the same order as /// the stat context configuration used (see - /// `mwcio::StatChannelFactory`). + /// `bmqio::StatChannelFactory`). struct Stat { // TYPES enum Enum { e_BYTES_IN = 0, e_BYTES_OUT = 1, e_CONNECTIONS = 2 }; diff --git a/src/groups/mwc/mwcio/mwcio_statchannelfactory.cpp b/src/groups/bmq/bmqio/bmqio_statchannelfactory.cpp similarity index 82% rename from src/groups/mwc/mwcio/mwcio_statchannelfactory.cpp rename to src/groups/bmq/bmqio/bmqio_statchannelfactory.cpp index 53955e724..9fd7e3dc1 100644 --- a/src/groups/mwc/mwcio/mwcio_statchannelfactory.cpp +++ b/src/groups/bmq/bmqio/bmqio_statchannelfactory.cpp @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_statchannelfactory.cpp -*-C++-*- -#include +// bmqio_statchannelfactory.cpp -*-C++-*- +#include -#include -// MWC -#include -#include -#include -#include -#include +#include + +#include +#include +#include +#include +#include // BDE #include @@ -33,7 +33,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ------------------------------ // class StatChannelFactoryConfig @@ -87,7 +87,7 @@ void StatChannelFactoryHandle::cancel() } } -mwct::PropertyBag& StatChannelFactoryHandle::properties() +bmqvt::PropertyBag& StatChannelFactoryHandle::properties() { return d_baseConnectHandle->properties(); } @@ -99,7 +99,7 @@ StatChannelFactoryHandle::options() const } // ACCESSORS -const mwct::PropertyBag& StatChannelFactoryHandle::properties() const +const bmqvt::PropertyBag& StatChannelFactoryHandle::properties() const { return d_baseConnectHandle->properties(); } @@ -123,7 +123,7 @@ void StatChannelFactory::baseResultCallback( } // Create a StatContext for this channel - bsl::shared_ptr statContext( + bsl::shared_ptr statContext( d_config.d_statContextCreator(channel, handleSp)); // Create the channel and notify user bsl::shared_ptr newChannel; @@ -211,12 +211,12 @@ void StatChannelFactory::connect(Status* status, // struct StatChannelFactoryUtil // ----------------------------- -mwcst::StatContextConfiguration +bmqst::StatContextConfiguration StatChannelFactoryUtil::statContextConfiguration(const bsl::string& name, int historySize, bslma::Allocator* allocator) { - mwcst::StatContextConfiguration config(name, allocator); + bmqst::StatContextConfiguration config(name, allocator); config.isTable(true); config.value("in_bytes") .value("out_bytes") @@ -230,14 +230,14 @@ StatChannelFactoryUtil::statContextConfiguration(const bsl::string& name, return config; } -bslma::ManagedPtr +bslma::ManagedPtr StatChannelFactoryUtil::createStatContext(const bsl::string& name, int historySize, bslma::Allocator* allocator) { - bslma::ManagedPtr rootStatContext; + bslma::ManagedPtr rootStatContext; rootStatContext.load( - new (*allocator) mwcst::StatContext( + new (*allocator) bmqst::StatContext( statContextConfiguration(name, historySize, allocator), allocator), allocator); @@ -246,11 +246,11 @@ StatChannelFactoryUtil::createStatContext(const bsl::string& name, } void StatChannelFactoryUtil::initializeStatsTable( - mwcst::Table* table, - mwcst::BasicTableInfoProvider* tip, - mwcst::StatContext* rootStatContext, - const mwcst::StatValue::SnapshotLocation& start, - const mwcst::StatValue::SnapshotLocation& end) + bmqst::Table* table, + bmqst::BasicTableInfoProvider* tip, + bmqst::StatContext* rootStatContext, + const bmqst::StatValue::SnapshotLocation& start, + const bmqst::StatValue::SnapshotLocation& end) { // PRECONDITIONS BSLS_ASSERT_SAFE(table); @@ -258,48 +258,48 @@ void StatChannelFactoryUtil::initializeStatsTable( BSLS_ASSERT_SAFE(rootStatContext); // Schema - mwcst::TableSchema& schema = table->schema(); + bmqst::TableSchema& schema = table->schema(); schema.addDefaultIdColumn("id"); schema.addColumn("in_bytes", StatChannel::Stat::e_BYTES_IN, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("out_bytes", StatChannel::Stat::e_BYTES_OUT, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("connections", StatChannel::Stat::e_CONNECTIONS, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); - if (!(end == mwcst::StatValue::SnapshotLocation())) { + if (!(end == bmqst::StatValue::SnapshotLocation())) { schema.addColumn("in_bytes_delta", StatChannel::Stat::e_BYTES_IN, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("out_bytes_delta", StatChannel::Stat::e_BYTES_OUT, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("connections_delta", StatChannel::Stat::e_CONNECTIONS, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); } // Configure records - mwcst::TableRecords& records = table->records(); + bmqst::TableRecords& records = table->records(); records.setContext(rootStatContext); struct local { - static bool filterDirect(const mwcst::TableRecords::Record& record) + static bool filterDirect(const bmqst::TableRecords::Record& record) { - return record.type() == mwcst::StatContext::e_TOTAL_VALUE; + return record.type() == bmqst::StatContext::e_TOTAL_VALUE; } }; @@ -312,7 +312,7 @@ void StatChannelFactoryUtil::initializeStatsTable( tip->addColumn("id", "").justifyLeft(); tip->setColumnGroup("In"); - if (!(end == mwcst::StatValue::SnapshotLocation())) { + if (!(end == bmqst::StatValue::SnapshotLocation())) { tip->addColumn("in_bytes_delta", "delta") .zeroString("") .printAsMemory(); @@ -320,7 +320,7 @@ void StatChannelFactoryUtil::initializeStatsTable( tip->addColumn("in_bytes", "total").zeroString("").printAsMemory(); tip->setColumnGroup("Out"); - if (!(end == mwcst::StatValue::SnapshotLocation())) { + if (!(end == bmqst::StatValue::SnapshotLocation())) { tip->addColumn("out_bytes_delta", "delta") .zeroString("") .printAsMemory(); @@ -328,7 +328,7 @@ void StatChannelFactoryUtil::initializeStatsTable( tip->addColumn("out_bytes", "total").zeroString("").printAsMemory(); tip->setColumnGroup("Connections"); - if (!(end == mwcst::StatValue::SnapshotLocation())) { + if (!(end == bmqst::StatValue::SnapshotLocation())) { tip->addColumn("connections_delta", "delta") .zeroString("") .setPrecision(0); @@ -337,23 +337,23 @@ void StatChannelFactoryUtil::initializeStatsTable( } bsls::Types::Int64 -StatChannelFactoryUtil::getValue(const mwcst::StatContext& context, +StatChannelFactoryUtil::getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat) { // invoked from the SNAPSHOT thread - const mwcst::StatValue::SnapshotLocation latestSnapshot(0, 0); - const mwcst::StatValue::SnapshotLocation oldestSnapshot(0, snapshotId); + const bmqst::StatValue::SnapshotLocation latestSnapshot(0, 0); + const bmqst::StatValue::SnapshotLocation oldestSnapshot(0, snapshotId); #define STAT_SINGLE(OPERATION, STAT) \ - mwcst::StatUtil::OPERATION( \ - context.value(mwcst::StatContext::e_TOTAL_VALUE, STAT), \ + bmqst::StatUtil::OPERATION( \ + context.value(bmqst::StatContext::e_TOTAL_VALUE, STAT), \ latestSnapshot) #define STAT_RANGE(OPERATION, STAT) \ - mwcst::StatUtil::OPERATION( \ - context.value(mwcst::StatContext::e_TOTAL_VALUE, STAT), \ + bmqst::StatUtil::OPERATION( \ + context.value(bmqst::StatContext::e_TOTAL_VALUE, STAT), \ latestSnapshot, \ oldestSnapshot) diff --git a/src/groups/mwc/mwcio/mwcio_statchannelfactory.h b/src/groups/bmq/bmqio/bmqio_statchannelfactory.h similarity index 85% rename from src/groups/mwc/mwcio/mwcio_statchannelfactory.h rename to src/groups/bmq/bmqio/bmqio_statchannelfactory.h index e451b940b..3f7d2e340 100644 --- a/src/groups/mwc/mwcio/mwcio_statchannelfactory.h +++ b/src/groups/bmq/bmqio/bmqio_statchannelfactory.h @@ -13,38 +13,36 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_statchannelfactory.h -*-C++-*- -#ifndef INCLUDED_MWCIO_STATCHANNELFACTORY -#define INCLUDED_MWCIO_STATCHANNELFACTORY +// bmqio_statchannelfactory.h -*-C++-*- +#ifndef INCLUDED_BMQIO_STATCHANNELFACTORY +#define INCLUDED_BMQIO_STATCHANNELFACTORY //@PURPOSE: Provide a ChannelFactory decorator for channels collecting stats // //@CLASSES: -// mwcio::StatChannelFactory -// mwcio::StatChannelFactoryConfig -// mwcio::StatChannelFactoryHandle -// mwcio::StatChannelFactoryUtil +// bmqio::StatChannelFactory +// bmqio::StatChannelFactoryConfig +// bmqio::StatChannelFactoryHandle +// bmqio::StatChannelFactoryUtil // //@SEE_ALSO: // //@DESCRIPTION: This component defines a mechanism, -// 'mwcio::StatChannelFactory', which is a decorator of a base -// 'mwcio::ChannelFactory' that gives it the ability to create channels that +// 'bmqio::StatChannelFactory', which is a decorator of a base +// 'bmqio::ChannelFactory' that gives it the ability to create channels that // collect stats. A stat context is associated with every channel. If the // channel was obtained through a call to a reconnecting connect, its // associated stat context is preserved on connection lost and restored upon // reconnection. -// MWC - -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -59,7 +57,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // FORWARD DECLARATIONS class StatChannelFactory; @@ -77,7 +75,7 @@ class StatChannelFactoryConfig { /// Signature of the callback to create and return the statContext to be /// used for tracking stats of the specified `channel` obtained from the /// specified `handle`. - typedef bsl::function( + typedef bsl::function( const bsl::shared_ptr& channel, const bsl::shared_ptr& handle)> StatContextCreatorFn; @@ -157,10 +155,10 @@ struct StatChannelFactoryHandle : public ChannelFactory::OpHandle { /// existing Channel). void cancel() BSLS_KEYWORD_OVERRIDE; - mwct::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; + bmqvt::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; // ACCESSORS - const mwct::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; + const bmqvt::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; const OptionsVariant& options() const; }; @@ -258,14 +256,14 @@ struct StatChannelFactoryUtil { /// Return the stat context configuration to use for the stats managed /// by the factory. - static mwcst::StatContextConfiguration + static bmqst::StatContextConfiguration statContextConfiguration(const bsl::string& name, int historySize = -1, bslma::Allocator* allocator = 0); /// Create and return a root "channels" stat context with the specified /// `name` and `historySize` using the specified `allocator`. - static bslma::ManagedPtr + static bslma::ManagedPtr createStatContext(const bsl::string& name, int historySize, bslma::Allocator* allocator = 0); @@ -276,13 +274,13 @@ struct StatChannelFactoryUtil { /// between the specified `stat` and `end` are printed, otherwise only /// the current ones are. static void - initializeStatsTable(mwcst::Table* table, - mwcst::BasicTableInfoProvider* tip, - mwcst::StatContext* rootStatContext, - const mwcst::StatValue::SnapshotLocation& start = - mwcst::StatValue::SnapshotLocation(), - const mwcst::StatValue::SnapshotLocation& end = - mwcst::StatValue::SnapshotLocation()); + initializeStatsTable(bmqst::Table* table, + bmqst::BasicTableInfoProvider* tip, + bmqst::StatContext* rootStatContext, + const bmqst::StatValue::SnapshotLocation& start = + bmqst::StatValue::SnapshotLocation(), + const bmqst::StatValue::SnapshotLocation& end = + bmqst::StatValue::SnapshotLocation()); /// Get the value of the specified `stat` reported to the channel /// represented by its associated specified `context` as the @@ -291,7 +289,7 @@ struct StatChannelFactoryUtil { /// snapshots ago. /// /// THREAD: This method can only be invoked from the `snapshot` thread. - static bsls::Types::Int64 getValue(const mwcst::StatContext& context, + static bsls::Types::Int64 getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat); }; diff --git a/src/groups/mwc/mwcio/mwcio_status.cpp b/src/groups/bmq/bmqio/bmqio_status.cpp similarity index 94% rename from src/groups/mwc/mwcio/mwcio_status.cpp rename to src/groups/bmq/bmqio/bmqio_status.cpp index 7c600f264..becd1bf34 100644 --- a/src/groups/mwc/mwcio/mwcio_status.cpp +++ b/src/groups/bmq/bmqio/bmqio_status.cpp @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_status.cpp -*-C++-*- -#include +// bmqio_status.cpp -*-C++-*- +#include -#include +#include // BDE #include #include #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // --------------------- // struct StatusCategory diff --git a/src/groups/mwc/mwcio/mwcio_status.h b/src/groups/bmq/bmqio/bmqio_status.h similarity index 91% rename from src/groups/mwc/mwcio/mwcio_status.h rename to src/groups/bmq/bmqio/bmqio_status.h index f6f4c366e..f6bea1c2a 100644 --- a/src/groups/mwc/mwcio/mwcio_status.h +++ b/src/groups/bmq/bmqio/bmqio_status.h @@ -13,25 +13,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_status.h -*-C++-*- -#ifndef INCLUDED_MWCIO_STATUS -#define INCLUDED_MWCIO_STATUS +// bmqio_status.h -*-C++-*- +#ifndef INCLUDED_BMQIO_STATUS +#define INCLUDED_BMQIO_STATUS //@PURPOSE: Provide an object representing the result of an I/O operation. // //@CLASSES: -// mwcio::Status +// bmqio::Status // -//@DESCRIPTION: This component defines a value semantic type, 'mwcio::Status', +//@DESCRIPTION: This component defines a value semantic type, 'bmqio::Status', // which represents the result of a read/write operation or a connection // attempt. Its salient attributes are a status category defining a broad // category of error (enum), an error code (integer), a source id indicating // in what component the error happened (integer), and an optional error // message. -// MWC - -#include +#include // BDE #include @@ -41,7 +39,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ===================== // struct StatusCategory @@ -106,7 +104,7 @@ class Status { StatusCategory::Enum d_category; // Broad category of the error. - mutable bdlb::NullableValue d_properties; + mutable bdlb::NullableValue d_properties; // Optional associated // properties @@ -155,12 +153,12 @@ class Status { /// Return a reference providing modifiable access to the properties of /// this object. - mwct::PropertyBag& properties(); + bmqvt::PropertyBag& properties(); // ACCESSORS /// Return `true` if this `Status` represents a success result, (i.e. - /// `category() == Status::MWCIO_SUCCESS`) and `false` otherwise. + /// `category() == Status::BMQIO_SUCCESS`) and `false` otherwise. operator bool() const; /// Return the status category. @@ -168,7 +166,7 @@ class Status { /// Return a reference providing const access to the properties of this /// object. - const mwct::PropertyBag& properties() const; + const bmqvt::PropertyBag& properties() const; /// Format this object to the specified output `stream` at the (absolute /// value of) the optionally specified indentation `level` and return a @@ -265,7 +263,7 @@ inline Status& Status::setCategory(StatusCategory::Enum value) return *this; } -inline mwct::PropertyBag& Status::properties() +inline bmqvt::PropertyBag& Status::properties() { if (d_properties.isNull()) { d_properties.makeValue(); @@ -285,7 +283,7 @@ inline StatusCategory::Enum Status::category() const return d_category; } -inline const mwct::PropertyBag& Status::properties() const +inline const bmqvt::PropertyBag& Status::properties() const { if (d_properties.isNull()) { d_properties.makeValue(); @@ -297,14 +295,14 @@ inline const mwct::PropertyBag& Status::properties() const } // close package namespace // FREE OPERATORS -inline bsl::ostream& mwcio::operator<<(bsl::ostream& stream, - mwcio::StatusCategory::Enum value) +inline bsl::ostream& bmqio::operator<<(bsl::ostream& stream, + bmqio::StatusCategory::Enum value) { return StatusCategory::print(stream, value, 0, -1); } -inline bsl::ostream& mwcio::operator<<(bsl::ostream& stream, - const mwcio::Status& value) +inline bsl::ostream& bmqio::operator<<(bsl::ostream& stream, + const bmqio::Status& value) { return value.print(stream, 0, -1); } diff --git a/src/groups/mwc/mwcio/mwcio_tcpendpoint.cpp b/src/groups/bmq/bmqio/bmqio_tcpendpoint.cpp similarity index 92% rename from src/groups/mwc/mwcio/mwcio_tcpendpoint.cpp rename to src/groups/bmq/bmqio/bmqio_tcpendpoint.cpp index d284f8e23..ec7a28ace 100644 --- a/src/groups/mwc/mwcio/mwcio_tcpendpoint.cpp +++ b/src/groups/bmq/bmqio/bmqio_tcpendpoint.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_tcpendpoint.cpp -*-C++-*- -#include +// bmqio_tcpendpoint.cpp -*-C++-*- +#include -#include -// MWC -#include -#include +#include + +#include +#include // BDE #include @@ -30,7 +30,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { namespace { const char k_SCHEME[] = "tcp://"; @@ -72,7 +72,7 @@ bool TCPEndpoint::fromUri(const bsl::string& uri) d_uri.clear(); // Check 'uri' starts by the proper expected scheme - if (!mwcu::StringUtil::startsWith(uri, k_SCHEME)) { + if (!bmqu::StringUtil::startsWith(uri, k_SCHEME)) { return false; // RETURN } @@ -116,7 +116,7 @@ void TCPEndpoint::fromUriRaw(const bsl::string& uri) TCPEndpoint& TCPEndpoint::assign(const bslstl::StringRef& host, int port) { bdlma::LocalSequentialAllocator<128> localAllocator; - mwcu::MemOutStream ss(&localAllocator); + bmqu::MemOutStream ss(&localAllocator); ss << k_SCHEME << host << ":" << port; const bool res = fromUri(ss.str()); diff --git a/src/groups/mwc/mwcio/mwcio_tcpendpoint.h b/src/groups/bmq/bmqio/bmqio_tcpendpoint.h similarity index 90% rename from src/groups/mwc/mwcio/mwcio_tcpendpoint.h rename to src/groups/bmq/bmqio/bmqio_tcpendpoint.h index bfc12afdc..266ffe70c 100644 --- a/src/groups/mwc/mwcio/mwcio_tcpendpoint.h +++ b/src/groups/bmq/bmqio/bmqio_tcpendpoint.h @@ -13,20 +13,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_tcpendpoint.h -*-C++-*- -#ifndef INCLUDED_MWCIO_TCPENDPOINT -#define INCLUDED_MWCIO_TCPENDPOINT +// bmqio_tcpendpoint.h -*-C++-*- +#ifndef INCLUDED_BMQIO_TCPENDPOINT +#define INCLUDED_BMQIO_TCPENDPOINT -//@PURPOSE: Value-semantic type representing endpoints for 'mwcio' channels +//@PURPOSE: Value-semantic type representing endpoints for 'bmqio' channels // //@CLASSES: -// mwcio::TCPEndpoint +// bmqio::TCPEndpoint // //@SEE_ALSO: // //@DESCRIPTION: This component represents a value-semantic type, -// 'mwcio::TCPEndpoint', to convert between a URI ('tcp://host:port') -// representation and a { host, port } pair, to use with the 'mwcio' channels. +// 'bmqio::TCPEndpoint', to convert between a URI ('tcp://host:port') +// representation and a { host, port } pair, to use with the 'bmqio' channels. // This is simply a convenient utility object to create a URI from an host and // port. Note that the URI format must be of the form 'tcp://:int' (the host // is optional, but the port is not; host can either be an IP address or a host @@ -37,8 +37,6 @@ // is an implementation detail of 'dmp' and 'mbs' and is *not* intended for // direct client use. It is subject to change without notice. -// MWC - // BDE #include #include @@ -48,7 +46,7 @@ namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ================= // class TCPEndpoint @@ -158,8 +156,8 @@ inline const bsl::string& TCPEndpoint::uri() const } // close package namespace // FREE OPERATORS -inline bsl::ostream& mwcio::operator<<(bsl::ostream& stream, - const mwcio::TCPEndpoint& endpoint) +inline bsl::ostream& bmqio::operator<<(bsl::ostream& stream, + const bmqio::TCPEndpoint& endpoint) { return endpoint.print(stream, 0, -1); } diff --git a/src/groups/mwc/mwcio/mwcio_testchannel.cpp b/src/groups/bmq/bmqio/bmqio_testchannel.cpp similarity index 96% rename from src/groups/mwc/mwcio/mwcio_testchannel.cpp rename to src/groups/bmq/bmqio/bmqio_testchannel.cpp index 4725218f7..36a9663bc 100644 --- a/src/groups/mwc/mwcio/mwcio_testchannel.cpp +++ b/src/groups/bmq/bmqio/bmqio_testchannel.cpp @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_testchannel.cpp -*-C++-*- -#include +// bmqio_testchannel.cpp -*-C++-*- +#include -#include +#include // BDE #include #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ----------------- // class TestChannel @@ -192,7 +192,7 @@ bdlmt::SignalerConnection TestChannel::onWatermark(const WatermarkFn& cb) return conn; } -mwct::PropertyBag& TestChannel::properties() +bmqvt::PropertyBag& TestChannel::properties() { return d_properties; } @@ -202,7 +202,7 @@ const bsl::string& TestChannel::peerUri() const return d_peerUri; } -const mwct::PropertyBag& TestChannel::properties() const +const bmqvt::PropertyBag& TestChannel::properties() const { return d_properties; } diff --git a/src/groups/mwc/mwcio/mwcio_testchannel.h b/src/groups/bmq/bmqio/bmqio_testchannel.h similarity index 93% rename from src/groups/mwc/mwcio/mwcio_testchannel.h rename to src/groups/bmq/bmqio/bmqio_testchannel.h index 8910c4448..42cb32ce1 100644 --- a/src/groups/mwc/mwcio/mwcio_testchannel.h +++ b/src/groups/bmq/bmqio/bmqio_testchannel.h @@ -13,25 +13,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_testchannel.h -*-C++-*- -#ifndef INCLUDED_MWCIO_TESTCHANNEL -#define INCLUDED_MWCIO_TESTCHANNEL +// bmqio_testchannel.h -*-C++-*- +#ifndef INCLUDED_BMQIO_TESTCHANNEL +#define INCLUDED_BMQIO_TESTCHANNEL //@PURPOSE: Provide an implementation of the Channel protocol for test drivers // //@CLASSES: -// mwcio::TestChannel +// bmqio::TestChannel // //@SEE_ALSO: // -//@DESCRIPTION: This component defines a mechanism, 'mwcio::TestChannel', -// which is a test implementation of the 'mwcio::Channel' protocol for use in +//@DESCRIPTION: This component defines a mechanism, 'bmqio::TestChannel', +// which is a test implementation of the 'bmqio::Channel' protocol for use in // test drivers. It allows the user to set the return values of its // functions, and stores the arguments used to call its methods. -// MWC - -#include +#include +#include // BDE #include @@ -41,7 +40,7 @@ #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // ================= // class TestChannel @@ -182,7 +181,7 @@ class TestChannel : public Channel { bsl::deque d_executeCalls; bsl::deque d_onCloseCalls; bsl::deque d_onWatermarkCalls; - mwct::PropertyBag d_properties; + bmqvt::PropertyBag d_properties; bsl::string d_peerUri; mutable bslmt::Mutex d_mutex; bslmt::Condition d_condition; @@ -280,12 +279,12 @@ class TestChannel : public Channel { bdlmt::SignalerConnection onClose(const CloseFn& cb) BSLS_KEYWORD_OVERRIDE; bdlmt::SignalerConnection onWatermark(const WatermarkFn& cb) BSLS_KEYWORD_OVERRIDE; - mwct::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; + bmqvt::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; // ACCESSORS // Channel - const bsl::string& peerUri() const BSLS_KEYWORD_OVERRIDE; - const mwct::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; + const bsl::string& peerUri() const BSLS_KEYWORD_OVERRIDE; + const bmqvt::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; }; } // close package namespace diff --git a/src/groups/mwc/mwcio/mwcio_testchannelfactory.cpp b/src/groups/bmq/bmqio/bmqio_testchannelfactory.cpp similarity index 91% rename from src/groups/mwc/mwcio/mwcio_testchannelfactory.cpp rename to src/groups/bmq/bmqio/bmqio_testchannelfactory.cpp index ae259c376..b59114062 100644 --- a/src/groups/mwc/mwcio/mwcio_testchannelfactory.cpp +++ b/src/groups/bmq/bmqio/bmqio_testchannelfactory.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_testchannelfactory.cpp -*-C++-*- -#include +// bmqio_testchannelfactory.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcio { +namespace bmqio { // -------------------------------- // class TestChannelFactoryOpHandle @@ -45,12 +45,12 @@ void TestChannelFactoryOpHandle::cancel() d_factory_p->d_handleCancelCalls.emplace_back(d_cancelToken); } -mwct::PropertyBag& TestChannelFactoryOpHandle::properties() +bmqvt::PropertyBag& TestChannelFactoryOpHandle::properties() { return d_properties; } -const mwct::PropertyBag& TestChannelFactoryOpHandle::properties() const +const bmqvt::PropertyBag& TestChannelFactoryOpHandle::properties() const { return d_properties; } @@ -90,7 +90,7 @@ void TestChannelFactory::setConnectStatus(const Status& status) d_connectStatus = status; } -mwct::PropertyBag& TestChannelFactory::newHandleProperties() +bmqvt::PropertyBag& TestChannelFactory::newHandleProperties() { return d_newHandleProperties; } diff --git a/src/groups/mwc/mwcio/mwcio_testchannelfactory.h b/src/groups/bmq/bmqio/bmqio_testchannelfactory.h similarity index 90% rename from src/groups/mwc/mwcio/mwcio_testchannelfactory.h rename to src/groups/bmq/bmqio/bmqio_testchannelfactory.h index 7479b1ffa..6279138d6 100644 --- a/src/groups/mwc/mwcio/mwcio_testchannelfactory.h +++ b/src/groups/bmq/bmqio/bmqio_testchannelfactory.h @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcio_testchannelfactory.h -*-C++-*- -#ifndef INCLUDED_MWCIO_TESTCHANNELFACTORY -#define INCLUDED_MWCIO_TESTCHANNELFACTORY +// bmqio_testchannelfactory.h -*-C++-*- +#ifndef INCLUDED_BMQIO_TESTCHANNELFACTORY +#define INCLUDED_BMQIO_TESTCHANNELFACTORY //@PURPOSE: Provide a test imp of the 'ChannelFactory' protocol // //@CLASSES: -// mwcio::TestChannelFactory +// bmqio::TestChannelFactory // //@SEE_ALSO: // @@ -29,17 +29,15 @@ // drivers. It stores the calls made to it, and allows the user to inspect // them. -// MWC - -#include -#include -#include +#include +#include +#include // BDE #include namespace BloombergLP { -namespace mwcio { +namespace bmqio { class TestChannelFactory; @@ -53,7 +51,7 @@ class TestChannelFactoryOpHandle : public ChannelFactoryOperationHandle { // DATA TestChannelFactory* d_factory_p; bsl::shared_ptr d_cancelToken; - mwct::PropertyBag d_properties; + bmqvt::PropertyBag d_properties; // NOT IMPLEMENTED TestChannelFactoryOpHandle(const TestChannelFactoryOpHandle&); @@ -77,12 +75,12 @@ class TestChannelFactoryOpHandle : public ChannelFactoryOperationHandle { bsl::shared_ptr& token(); // ChannelFactoryOperationHandle - void cancel() BSLS_KEYWORD_OVERRIDE; - mwct::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; + void cancel() BSLS_KEYWORD_OVERRIDE; + bmqvt::PropertyBag& properties() BSLS_KEYWORD_OVERRIDE; // ACCESSORS // ChannelFactoryOperationHandle - const mwct::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; + const bmqvt::PropertyBag& properties() const BSLS_KEYWORD_OVERRIDE; }; // ======================== @@ -155,7 +153,7 @@ class TestChannelFactory : public ChannelFactory { // DATA Status d_listenStatus; Status d_connectStatus; - mwct::PropertyBag d_newHandleProperties; + bmqvt::PropertyBag d_newHandleProperties; bsl::deque d_listenCalls; bsl::deque d_connectCalls; bsl::deque d_handleCancelCalls; @@ -190,7 +188,7 @@ class TestChannelFactory : public ChannelFactory { /// Return a reference providing modifiable access to the new Handle /// properties of this object. These are the properties that will be /// set on new `OpHandles` produced by this object. - mwct::PropertyBag& newHandleProperties(); + bmqvt::PropertyBag& newHandleProperties(); bsl::deque& listenCalls(); bsl::deque& connectCalls(); diff --git a/src/groups/bmq/bmqio/doc/bmqio.txt b/src/groups/bmq/bmqio/doc/bmqio.txt new file mode 100644 index 000000000..f8e28917f --- /dev/null +++ b/src/groups/bmq/bmqio/doc/bmqio.txt @@ -0,0 +1,84 @@ + bmqio.txt + +@PURPOSE: Provide network related components.. + +@MNEMONIC: BlazingMQ IO (bmqio) + +@DESCRIPTION: This package provides interfaces and concrete implementations related to TCP communication. + +/Hierarchical Synopsis +/--------------------- +The 'bmqio' package currently has 13 components having 5 levels of physical +dependency. The list below shows the hierarchal ordering of the components. +.. + 5. bmqio_tcpchannelfactory + + 4. bmqio_resolvingchannelfactory + bmqio_tcpchannel + + 3. bmqio_basechannelpartialimp + bmqio_decoratingchannelpartialimp + bmqio_reconnectingchannelfactory + bmqio_testchannel + bmqio_testchannelfactory + + 2. bmqio_channel + bmqio_channelfactory + + 1. bmqio_connectoptions + bmqio_listenoptions + bmqio_status +.. + +/Component Synopsis +/------------------ +: 'bmqio_basechannelpartialimp': +: Provide a partial 'Channel' imp for a 'base' channel +: +: 'bmqio_channel': +: Provide a pure protocol for a bi-directional async channel. +: +: 'bmqio_channelfactory': +: Provide a protocol for a 'bmqio::Channel' factory. +: +: 'bmqio_channelutil': +: Provide utility functions related to channel manipulation. +: +: 'bmqio_connectoptions': +: Provide a type encapsulating options for 'ChannelFactory::connect'. +: +: 'bmqio_decoratingchannelpartialimp': +: Provide a partial imp of 'bmqio::Channel' for decorating channels. +: +: 'bmqio_listenoptions': +: Provide a type encapsulating options for 'ChannelFactory::listen'. +: +: 'bmqio_reconnectingchannelfactory': +: Provide an auto-reconnecting ChannelFactory decorator. +: +: 'bmqio_resolvingchannelfactory': +: Provide a 'ChannelFactory' that resolves the URIs of its channels. +: +: 'bmqio_statchannel': +: Provide a 'bmqio::Channel' that collects stats. +: +: 'bmqio_statchannelfactory': +: Provide a ChannelFactory decorator for channels collecting stats. +: +: 'bmqio_status': +: Provide an object representing the result of an I/O operation. +: +: 'bmqio_tcpchannel': +: Provide a 'bmqio::Channel' using a 'btemt_ChannelPoolChannel'. +: +: 'bmqio_tcpchannelfactory': +: Provide a 'bmqio::ChannelFactory' using a 'btemt::ChannelPool'. +: +: 'bmqio_tcpendpoint': +: Provide Value-semantic type representing endpoints for 'bmqio' channels. +: +: 'bmqio_testchannel': +: Provide an implementation of the Channel protocol for test drivers. +: +: 'bmqio_testchannelfactory': +: Provide a test imp of the 'ChannelFactory' protocol. diff --git a/src/groups/bmq/bmqio/package/bmqio.dep b/src/groups/bmq/bmqio/package/bmqio.dep new file mode 100644 index 000000000..547c34af4 --- /dev/null +++ b/src/groups/bmq/bmqio/package/bmqio.dep @@ -0,0 +1,7 @@ +bmqex +bmqscm +bmqst +bmqsys +bmqt +bmqu +bmqvt diff --git a/src/groups/bmq/bmqio/package/bmqio.mem b/src/groups/bmq/bmqio/package/bmqio.mem new file mode 100644 index 000000000..6aa0127bc --- /dev/null +++ b/src/groups/bmq/bmqio/package/bmqio.mem @@ -0,0 +1,18 @@ +bmqio_basechannelpartialimp +bmqio_channel +bmqio_channelfactory +bmqio_channelutil +bmqio_connectoptions +bmqio_decoratingchannelpartialimp +bmqio_listenoptions +bmqio_ntcchannel +bmqio_ntcchannelfactory +bmqio_reconnectingchannelfactory +bmqio_resolveutil +bmqio_resolvingchannelfactory +bmqio_statchannel +bmqio_statchannelfactory +bmqio_status +bmqio_tcpendpoint +bmqio_testchannel +bmqio_testchannelfactory diff --git a/src/groups/mwc/mwcma/mwcma_countingallocator.cpp b/src/groups/bmq/bmqma/bmqma_countingallocator.cpp similarity index 84% rename from src/groups/mwc/mwcma/mwcma_countingallocator.cpp rename to src/groups/bmq/bmqma/bmqma_countingallocator.cpp index 421d95d41..478a424d9 100644 --- a/src/groups/mwc/mwcma/mwcma_countingallocator.cpp +++ b/src/groups/bmq/bmqma/bmqma_countingallocator.cpp @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcma_countingallocator.cpp -*-C++-*- -#include - -#include -// MWC -#include -#include -#include -#include -#include -#include +// bmqma_countingallocator.cpp -*-C++-*- +#include + +#include + +#include +#include +#include +#include +#include +#include // BDE #include @@ -35,7 +35,7 @@ #include namespace BloombergLP { -namespace mwcma { +namespace bmqma { namespace { @@ -46,32 +46,32 @@ namespace { const unsigned int k_MAGIC = 0xabcdabcd; // FUNCTIONS -bool statFilter(const mwcst::StatContext* context, - mwcst::StatContext::ValueType valueType, +bool statFilter(const bmqst::StatContext* context, + bmqst::StatContext::ValueType valueType, BSLS_ANNOTATION_UNUSED int level) { return (context->isDeleted() && - valueType == mwcst::StatContext::e_TOTAL_VALUE) || - (mwcst::StatUtil::value(context->value(valueType, 0), 0) > 0); + valueType == bmqst::StatContext::e_TOTAL_VALUE) || + (bmqst::StatUtil::value(context->value(valueType, 0), 0) > 0); } -bool statFilter2(const mwcst::TableRecords::Record& rec) +bool statFilter2(const bmqst::TableRecords::Record& rec) { - const bool isTotal = (rec.type() == mwcst::StatContext::e_TOTAL_VALUE); + const bool isTotal = (rec.type() == bmqst::StatContext::e_TOTAL_VALUE); return (rec.context().isDeleted() && isTotal) || - (mwcst::StatUtil::increments(rec.context().value(rec.type(), 0), + (bmqst::StatUtil::increments(rec.context().value(rec.type(), 0), 0) > 0); } -bool statSort(const mwcst::StatContext* lhs, const mwcst::StatContext* rhs) +bool statSort(const bmqst::StatContext* lhs, const bmqst::StatContext* rhs) { - const mwcst::StatValue& lhsTotalValue = - lhs->value(mwcst::StatContext::e_TOTAL_VALUE, 0); - const mwcst::StatValue& rhsTotalValue = - rhs->value(mwcst::StatContext::e_TOTAL_VALUE, 0); + const bmqst::StatValue& lhsTotalValue = + lhs->value(bmqst::StatContext::e_TOTAL_VALUE, 0); + const bmqst::StatValue& rhsTotalValue = + rhs->value(bmqst::StatContext::e_TOTAL_VALUE, 0); - return mwcst::StatUtil::value(lhsTotalValue, 0) > - mwcst::StatUtil::value(rhsTotalValue, 0); + return bmqst::StatUtil::value(lhsTotalValue, 0) > + bmqst::StatUtil::value(rhsTotalValue, 0); } // STRUCTS @@ -102,9 +102,9 @@ union Header { // CLASS METHODS void CountingAllocator::configureStatContextTableInfoProvider( - mwcst::StatContextTableInfoProvider* tableInfoProvider) + bmqst::StatContextTableInfoProvider* tableInfoProvider) { - typedef mwcst::StatUtil SU; + typedef bmqst::StatUtil SU; tableInfoProvider->setFilter(&statFilter); tableInfoProvider->setComparator(&statSort); @@ -123,22 +123,22 @@ void CountingAllocator::configureStatContextTableInfoProvider( } void CountingAllocator::configureStatContextTableInfoProvider( - mwcst::Table* table, - mwcst::BasicTableInfoProvider* basicTableInfoProvider, - const mwcst::StatValue::SnapshotLocation& startSnapshot, - const mwcst::StatValue::SnapshotLocation& endSnapshot) + bmqst::Table* table, + bmqst::BasicTableInfoProvider* basicTableInfoProvider, + const bmqst::StatValue::SnapshotLocation& startSnapshot, + const bmqst::StatValue::SnapshotLocation& endSnapshot) { - typedef mwcst::StatUtil SU; + typedef bmqst::StatUtil SU; if (!table) { return; // RETURN } - const mwcst::StatValue::SnapshotLocation& cur = startSnapshot; - const mwcst::StatValue::SnapshotLocation& end = endSnapshot; + const bmqst::StatValue::SnapshotLocation& cur = startSnapshot; + const bmqst::StatValue::SnapshotLocation& end = endSnapshot; // Configure schema - mwcst::TableSchema* schema = &table->schema(); + bmqst::TableSchema* schema = &table->schema(); schema->addDefaultIdColumn("id"); schema->addColumn("numAllocated", 0, SU::value, cur); @@ -158,7 +158,7 @@ void CountingAllocator::configureStatContextTableInfoProvider( end); // Configure records - mwcst::TableRecords* records = &table->records(); + bmqst::TableRecords* records = &table->records(); records->setFilter(&statFilter2); records->setSort(&statSort); @@ -224,14 +224,14 @@ CountingAllocator::CountingAllocator(const bslstl::StringRef& name, d_allocator_p = ca->d_allocator_p; if (ca->d_statContext_mp) { d_statContext_mp = ca->d_statContext_mp->addSubcontext( - mwcst::StatContextConfiguration(name, allocator)); + bmqst::StatContextConfiguration(name, allocator)); d_parentCounting_p = ca; } } } CountingAllocator::CountingAllocator(const bslstl::StringRef& name, - mwcst::StatContext* parentStatContext, + bmqst::StatContext* parentStatContext, bslma::Allocator* allocator) : d_statContext_mp() , d_allocator_p(bslma::Default::allocator(allocator)) @@ -250,13 +250,13 @@ CountingAllocator::CountingAllocator(const bslstl::StringRef& name, if (parentStatContext) { if (parentStatContext->hasDefaultHistorySize()) { d_statContext_mp = parentStatContext->addSubcontext( - mwcst::StatContextConfiguration(name, allocator) + bmqst::StatContextConfiguration(name, allocator) .isTable(true) .value("Memory")); } else { d_statContext_mp = parentStatContext->addSubcontext( - mwcst::StatContextConfiguration(name, allocator) + bmqst::StatContextConfiguration(name, allocator) .isTable(true) .value("Memory", 2)); } diff --git a/src/groups/mwc/mwcma/mwcma_countingallocator.h b/src/groups/bmq/bmqma/bmqma_countingallocator.h similarity index 84% rename from src/groups/mwc/mwcma/mwcma_countingallocator.h rename to src/groups/bmq/bmqma/bmqma_countingallocator.h index 7ee7f59b3..7f0b99dcd 100644 --- a/src/groups/mwc/mwcma/mwcma_countingallocator.h +++ b/src/groups/bmq/bmqma/bmqma_countingallocator.h @@ -13,34 +13,34 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcma_countingallocator.h -*-C++-*- -#ifndef INCLUDED_MWCMA_COUNTINGALLOCATOR -#define INCLUDED_MWCMA_COUNTINGALLOCATOR +// bmqma_countingallocator.h -*-C++-*- +#ifndef INCLUDED_BMQMA_COUNTINGALLOCATOR +#define INCLUDED_BMQMA_COUNTINGALLOCATOR -//@PURPOSE: Provide a 'bslma::Allocator' reporting to a 'mwcst::StatContext'. +//@PURPOSE: Provide a 'bslma::Allocator' reporting to a 'bmqst::StatContext'. // //@CLASSES: -// mwcma::CountingAllocator : instrumented allocator adaptor. +// bmqma::CountingAllocator : instrumented allocator adaptor. // -//@SEE_ALSO: mwcma_countingallocatorstore -// mwcma_countingallocatorutil -// mwcst_statcontext +//@SEE_ALSO: bmqma_countingallocatorstore +// bmqma_countingallocatorutil +// bmqst_statcontext // -//@DESCRIPTION: This component defines a mechanism, 'mwcma::CountingAllocator' +//@DESCRIPTION: This component defines a mechanism, 'bmqma::CountingAllocator' // which implements the 'bslma::Allocator' protocol and which reports its usage -// to a 'mwcst::StatContext'. The 'mwcma::CountingAllocator' keeps track of +// to a 'bmqst::StatContext'. The 'bmqma::CountingAllocator' keeps track of // how many bytes were allocated and how many allocations were made. // -// The 'mwcma::CountingAllocator' can report memory usage in an hierarchical +// The 'bmqma::CountingAllocator' can report memory usage in an hierarchical // manner if the 'allocator' provided in the constructor is actually a -// 'mwcma::CountingAllocator' (as determined by 'dynamic_cast'). If so, the +// 'bmqma::CountingAllocator' (as determined by 'dynamic_cast'). If so, the // new allocator adds itself as a sub-table of the provided allocator's // context. If the allocator provided at construction is not a -// 'mwcma::CountingAllocator' or doesn't hold a 'mwcst::StatContext' the calls +// 'bmqma::CountingAllocator' or doesn't hold a 'bmqst::StatContext' the calls // to 'allocate 'and 'deallocate' are simply passed through with minimal // overhead. // -// See 'mwcma_countingallocatorstore' for how to collect allocation statistics +// See 'bmqma_countingallocatorstore' for how to collect allocation statistics // when necessary while incurring no runtime overhead otherwise. // /// Allocation Limit @@ -64,9 +64,7 @@ //: should be fine as we usually only instantiate a small handful of such //: objects -// MWC - -#include +#include // BDE #include @@ -86,27 +84,27 @@ namespace BloombergLP { // FORWARD DECLARE -namespace mwcst { +namespace bmqst { class StatContext; } -namespace mwcst { +namespace bmqst { class StatContextTableInfoProvider; } -namespace mwcst { +namespace bmqst { class Table; } -namespace mwcst { +namespace bmqst { class BasicTableInfoProvider; } -namespace mwcma { +namespace bmqma { // ======================= // class CountingAllocator // ======================= /// An allocator reporting its allocations and deallocations to a -/// `mwcst::StatContext`. +/// `bmqst::StatContext`. class CountingAllocator BSLS_KEYWORD_FINAL : public bslma::Allocator { public: // PUBLIC TYPES @@ -119,11 +117,11 @@ class CountingAllocator BSLS_KEYWORD_FINAL : public bslma::Allocator { private: // CLASS-SCOPE CATEGORY - BALL_LOG_SET_CLASS_CATEGORY("MWCMA.COUNTINGALLOCATOR"); + BALL_LOG_SET_CLASS_CATEGORY("BMQMA.COUNTINGALLOCATOR"); private: // DATA - bslma::ManagedPtr d_statContext_mp; + bslma::ManagedPtr d_statContext_mp; bslma::Allocator* d_allocator_p; @@ -169,10 +167,10 @@ class CountingAllocator BSLS_KEYWORD_FINAL : public bslma::Allocator { /// Configure the specified `tableInfoProvider` with a filter, a /// comparator, and columns to print the statistics generated by this - /// `mwcma::CountingAllocator`. @DEPRECATED: use the version taking a - /// `mwcst::Table` and `mwcs::BasicTableInfoProvider` instead. + /// `bmqma::CountingAllocator`. @DEPRECATED: use the version taking a + /// `bmqst::Table` and `bmqst::BasicTableInfoProvider` instead. static void configureStatContextTableInfoProvider( - mwcst::StatContextTableInfoProvider* tableInfoProvider); + bmqst::StatContextTableInfoProvider* tableInfoProvider); /// Configure the specified `table` with a default set of columns for a /// stat table for a stat context created by a `CountingAllocator` using @@ -182,10 +180,10 @@ class CountingAllocator BSLS_KEYWORD_FINAL : public bslma::Allocator { /// to the `table` and configure it to display this table in a default /// format. static void configureStatContextTableInfoProvider( - mwcst::Table* table, - mwcst::BasicTableInfoProvider* basicTableInfoProvider, - const mwcst::StatValue::SnapshotLocation& startSnapshot, - const mwcst::StatValue::SnapshotLocation& endSnapshot); + bmqst::Table* table, + bmqst::BasicTableInfoProvider* basicTableInfoProvider, + const bmqst::StatValue::SnapshotLocation& startSnapshot, + const bmqst::StatValue::SnapshotLocation& endSnapshot); private: // PRIVATE MANIPULATORS @@ -215,7 +213,7 @@ class CountingAllocator BSLS_KEYWORD_FINAL : public bslma::Allocator { /// not a null pointer, the stat context is created as a child of /// `context`; otherwise no stat context is created. CountingAllocator(const bslstl::StringRef& name, - mwcst::StatContext* parentStatContext, + bmqst::StatContext* parentStatContext, bslma::Allocator* allocator = 0); /// Destroy this object. @@ -253,10 +251,10 @@ class CountingAllocator BSLS_KEYWORD_FINAL : public bslma::Allocator { virtual void deallocate(void* address) BSLS_KEYWORD_OVERRIDE; // ACCESSORS - // (specific to mwcma::CountingAllocator) + // (specific to bmqma::CountingAllocator) /// Return the stat context associated with this allocator, if any. - const mwcst::StatContext* context() const; + const bmqst::StatContext* context() const; }; // ============================================================================ @@ -268,8 +266,8 @@ class CountingAllocator BSLS_KEYWORD_FINAL : public bslma::Allocator { // ----------------------- // ACCESSORS -// (specific to mwcma::CountingAllocator) -inline const mwcst::StatContext* CountingAllocator::context() const +// (specific to bmqma::CountingAllocator) +inline const bmqst::StatContext* CountingAllocator::context() const { return d_statContext_mp.ptr(); } diff --git a/src/groups/mwc/mwcma/mwcma_countingallocator.t.cpp b/src/groups/bmq/bmqma/bmqma_countingallocator.t.cpp similarity index 84% rename from src/groups/mwc/mwcma/mwcma_countingallocator.t.cpp rename to src/groups/bmq/bmqma/bmqma_countingallocator.t.cpp index d5df7f7f5..8b2877b35 100644 --- a/src/groups/mwc/mwcma/mwcma_countingallocator.t.cpp +++ b/src/groups/bmq/bmqma/bmqma_countingallocator.t.cpp @@ -13,17 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcma_countingallocator.t.cpp -*-C++-*- -#include - -// MWC -#include -#include -#include -#include -#include -#include -#include +// bmqma_countingallocator.t.cpp -*-C++-*- +#include + +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -35,7 +34,7 @@ #include // TEST DRIVER -#include +#include // BENCHMARKING LIBRARY #ifdef BSLS_PLATFORM_OS_LINUX @@ -92,11 +91,11 @@ static void test1_breathingTest() // CountingAllocator(const bslstl::StringRef& name, // bslma::Allocator *allocator = 0); // CountingAllocator(const bslstl::StringRef& name, -// mwcst::StatContext *parentStatContext, +// bmqst::StatContext *parentStatContext, // bslma::Allocator *allocator = 0); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // CONSTANTS const char* k_NAME = "Test"; @@ -104,16 +103,16 @@ static void test1_breathingTest() { PV("Constructor - no 'parentStatContext'"); - mwcma::CountingAllocator obj(k_NAME, s_allocator_p); + bmqma::CountingAllocator obj(k_NAME, s_allocator_p); ASSERT(obj.context() == 0); } { PV("Constructor - with 'parentStatContext'"); - mwcst::StatContextConfiguration config("test", s_allocator_p); - mwcst::StatContext parentStatContext(config, s_allocator_p); - mwcma::CountingAllocator obj(k_NAME, + bmqst::StatContextConfiguration config("test", s_allocator_p); + bmqst::StatContext parentStatContext(config, s_allocator_p); + bmqma::CountingAllocator obj(k_NAME, &parentStatContext, s_allocator_p); parentStatContext.snapshot(); @@ -141,13 +140,13 @@ static void test2_allocate() // allocate // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ALLOCATE"); + bmqtst::TestHelper::printTestName("ALLOCATE"); // CONSTANTS const bsls::Types::size_type k_SIZE_ALLOC = 1024; char* buf = 0; - mwcma::CountingAllocator obj("Test", s_allocator_p); + bmqma::CountingAllocator obj("Test", s_allocator_p); // 1. Allocate with 'size' of 0 and verify the returned address is 0. buf = static_cast(obj.allocate(0)); @@ -188,7 +187,7 @@ static void test3_deallocate() s_ignoreCheckDefAlloc = true; // Logging infrastructure allocates using the default allocator and // that is beyond the control of this function - mwctst::TestHelper::printTestName("DEALLOCATE"); + bmqtst::TestHelper::printTestName("DEALLOCATE"); // This test twice-deallocates the same block of memory, to verify that // such an operation fails. If we're running under MemorySanitizer, @@ -222,9 +221,9 @@ static void test3_deallocate() // CONSTANTS const bsls::Types::size_type k_SIZE_ALLOC = 1024; - mwcst::StatContextConfiguration config("test", s_allocator_p); - mwcst::StatContext parentStatContext(config, s_allocator_p); - mwcma::CountingAllocator obj("Test", &parentStatContext, s_allocator_p); + bmqst::StatContextConfiguration config("test", s_allocator_p); + bmqst::StatContext parentStatContext(config, s_allocator_p); + bmqma::CountingAllocator obj("Test", &parentStatContext, s_allocator_p); char* buf = 0; @@ -239,7 +238,7 @@ static void test3_deallocate() // 3. Deallocate previously deallocated memory and verify failure, as // well as ensure that an error is logged. - mwctst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); + bmqtst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); ASSERT_SAFE_FAIL(obj.deallocate(buf)); ASSERT_EQ(logObserver.records().size(), 1U); } @@ -250,7 +249,7 @@ static void test4_allocationLimit() // allocation limit; and that it only gets invoked once. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("allocationLimit"); + bmqtst::TestHelper::printTestName("allocationLimit"); /// Increment the integer at the specified `value` struct local { @@ -260,7 +259,7 @@ static void test4_allocationLimit() { PV("AllocationLimitCB is not enabled when no statContext"); int cbInvocationCount = 0; - mwcma::CountingAllocator obj("Test", s_allocator_p); + bmqma::CountingAllocator obj("Test", s_allocator_p); obj.setAllocationLimit(10, bdlf::BindUtil::bind(local::incrementInteger, @@ -274,11 +273,11 @@ static void test4_allocationLimit() PV("AllocationLimitCB fires once when crossing limit"); int cbInvocationCount = 0; - mwcst::StatContext statContext( - mwcst::StatContextConfiguration("myAllocatorStatContext"), + bmqst::StatContext statContext( + bmqst::StatContextConfiguration("myAllocatorStatContext"), s_allocator_p); ; - mwcma::CountingAllocator obj("Test", &statContext, s_allocator_p); + bmqma::CountingAllocator obj("Test", &statContext, s_allocator_p); // Note that when using a stat-context enabled counting allocator, // there is an allocation overhead for the Header struct, and the @@ -321,11 +320,11 @@ static void test4_allocationLimit() // the third one triggers crossing the limit { int cbInvocationCount = 0; - mwcst::StatContext statContext( - mwcst::StatContextConfiguration("myAllocatorStatContext"), + bmqst::StatContext statContext( + bmqst::StatContextConfiguration("myAllocatorStatContext"), s_allocator_p); ; - mwcma::CountingAllocator obj("Test", &statContext, s_allocator_p); + bmqma::CountingAllocator obj("Test", &statContext, s_allocator_p); obj.setAllocationLimit( 1024, @@ -349,11 +348,11 @@ static void test4_allocationLimit() // trigger the limit, but the second should { int cbInvocationCount = 0; - mwcst::StatContext statContext( - mwcst::StatContextConfiguration("myAllocatorStatContext"), + bmqst::StatContext statContext( + bmqst::StatContextConfiguration("myAllocatorStatContext"), s_allocator_p); ; - mwcma::CountingAllocator obj("Test", &statContext, s_allocator_p); + bmqma::CountingAllocator obj("Test", &statContext, s_allocator_p); obj.setAllocationLimit( 1024, @@ -384,7 +383,7 @@ static void test5_allocationLimitHierarchical() // the 'upstream' one, eventually invoking its allocation limit. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("allocationLimitHierarchical"); + bmqtst::TestHelper::printTestName("allocationLimitHierarchical"); int cbInvocationCount = 0; @@ -394,11 +393,11 @@ static void test5_allocationLimitHierarchical() }; // Create the 'top' allocator, with a limit set - mwcst::StatContext statContext( - mwcst::StatContextConfiguration("myAllocatorStatContext"), + bmqst::StatContext statContext( + bmqst::StatContextConfiguration("myAllocatorStatContext"), s_allocator_p); ; - mwcma::CountingAllocator topAlloc("Top", &statContext, s_allocator_p); + bmqma::CountingAllocator topAlloc("Top", &statContext, s_allocator_p); // Note that when using a stat-context enabled counting allocator, there is // an allocation overhead for the Header struct, and the allocation size is @@ -411,8 +410,8 @@ static void test5_allocationLimitHierarchical() &cbInvocationCount)); // Create the 'bottom1' allocator, children of 'topAlloc' - mwcma::CountingAllocator bottomAlloc1("bottom1", &topAlloc); - mwcma::CountingAllocator bottomAlloc2("bottom2", &bottomAlloc1); + bmqma::CountingAllocator bottomAlloc1("bottom1", &topAlloc); + bmqma::CountingAllocator bottomAlloc2("bottom2", &bottomAlloc1); ASSERT_EQ(cbInvocationCount, 0); @@ -448,16 +447,16 @@ static void test6_configureStatContextTableInfoProvider_part1() // // Testing: // configureStatContextTableInfoProvider( -// mwcst::StatContextTableInfoProvider *tableInfoProvider); +// bmqst::StatContextTableInfoProvider *tableInfoProvider); // ------------------------------------------------------------------------ { s_ignoreCheckDefAlloc = true; - mwctst::TestHelper::printTestName("configureStatContextTableInfoProvider" + bmqtst::TestHelper::printTestName("configureStatContextTableInfoProvider" " - part 1"); - mwcst::StatContextTableInfoProvider tableInfoProvider(s_allocator_p); + bmqst::StatContextTableInfoProvider tableInfoProvider(s_allocator_p); - mwcma::CountingAllocator::configureStatContextTableInfoProvider( + bmqma::CountingAllocator::configureStatContextTableInfoProvider( &tableInfoProvider); ASSERT_EQ(tableInfoProvider.hasTitle(), false); @@ -489,28 +488,28 @@ static void test7_configureStatContextTableInfoProvider_part2() // // Testing: // configureStatContextTableInfoProvider( -// mwcst::Table *table, -// mwcst::BasicTableInfoProvider *basicTableInfoProvider, -// const mwcst::StatValue::SnapshotLocation& startSnapshot, -// const mwcst::StatValue::SnapshotLocation& endSnapshot); +// bmqst::Table *table, +// bmqst::BasicTableInfoProvider *basicTableInfoProvider, +// const bmqst::StatValue::SnapshotLocation& startSnapshot, +// const bmqst::StatValue::SnapshotLocation& endSnapshot); // ------------------------------------------------------------------------ { s_ignoreCheckDefAlloc = true; // The method // 'CountingAllocator::configureStatContextTableInfoProvider' allocates // using the default allocator (specifically, because of calls to - // 'mwcst::TableSchema::addColumn', and that allocation is outside of + // 'bmqst::TableSchema::addColumn', and that allocation is outside of // the control of this function. - mwctst::TestHelper::printTestName("configureStatContextTableInfoProvider" + bmqtst::TestHelper::printTestName("configureStatContextTableInfoProvider" " - part 2"); - mwcst::Table table(s_allocator_p); - mwcst::BasicTableInfoProvider basicTableInfoProvider(s_allocator_p); - mwcst::StatValue::SnapshotLocation start; - mwcst::StatValue::SnapshotLocation end; + bmqst::Table table(s_allocator_p); + bmqst::BasicTableInfoProvider basicTableInfoProvider(s_allocator_p); + bmqst::StatValue::SnapshotLocation start; + bmqst::StatValue::SnapshotLocation end; - mwcma::CountingAllocator::configureStatContextTableInfoProvider( + bmqma::CountingAllocator::configureStatContextTableInfoProvider( &table, &basicTableInfoProvider, start, @@ -536,22 +535,22 @@ static void testN1_performance_allocation() // PERFORMANCE - allocation (microbenchmark) // // Concerns: -// Make sure the extra book-keeping in mwcma::CountingAllocator for each +// Make sure the extra book-keeping in bmqma::CountingAllocator for each // allocation are does not impact performance. // // Plan: // 1. Run a microbenchmark, making about 1 million allocations for sizes // starting at 1 up to (and including) 8192, repeatedly, for -// mwcma::CountingAllocator and bslma::Default::defaultAllocator. +// bmqma::CountingAllocator and bslma::Default::defaultAllocator. // // Testing: -// Compare allocation performance of mwcma::CountingAllocator vs +// Compare allocation performance of bmqma::CountingAllocator vs // bslma::Default::defaultAllocator. { s_ignoreCheckDefAlloc = true; // We're microbenching against the default allocator. - mwctst::TestHelper::printTestName("PERFORMANCE - allocation" + bmqtst::TestHelper::printTestName("PERFORMANCE - allocation" " (microbenchmark)"); const size_t k_MILLION = 1000000; @@ -566,12 +565,12 @@ static void testN1_performance_allocation() bsls::Types::Int64 timeCountingAlloc = 0; { PV("--------------------------------"); - PV("mwcma::CountingAllocator"); + PV("bmqma::CountingAllocator"); PV("--------------------------------"); - mwcst::StatContextConfiguration config("test", s_allocator_p); - mwcst::StatContext parentStatContext(config, s_allocator_p); - mwcma::CountingAllocator countingAlloc("CountingAlloc", + bmqst::StatContextConfiguration config("test", s_allocator_p); + bmqst::StatContext parentStatContext(config, s_allocator_p); + bmqma::CountingAllocator countingAlloc("CountingAlloc", &parentStatContext, bslma::Default::allocator()); @@ -589,7 +588,7 @@ static void testN1_performance_allocation() timeCountingAlloc = end - start; bsl::cout << " " << k_NUM_ALLOCATIONS << " allocations in " - << mwcu::PrintUtil::prettyTimeInterval(end - start) + << bmqu::PrintUtil::prettyTimeInterval(end - start) << " (average of " << timeCountingAlloc / k_NUM_ALLOCATIONS << " nano seconds per call).\n"; @@ -617,7 +616,7 @@ static void testN1_performance_allocation() timeDefaultAlloc = end - start; bsl::cout << " " << k_NUM_ALLOCATIONS << " allocations in " - << mwcu::PrintUtil::prettyTimeInterval(end - start) + << bmqu::PrintUtil::prettyTimeInterval(end - start) << " (average of " << timeDefaultAlloc / k_NUM_ALLOCATIONS << " nano seconds per call).\n"; @@ -627,9 +626,8 @@ static void testN1_performance_allocation() } PV(""); - bsl::cout << "TIME(mwcma::CountingAllocator) " - << "/ TIME(bslma::Default::defaultALlocator)" - << ": " + bsl::cout << "TIME(bmqma::CountingAllocator) " + << "/ TIME(bslma::Default::defaultALlocator)" << ": " << (static_cast(timeCountingAlloc) / static_cast(timeDefaultAlloc)) << '\n'; @@ -642,21 +640,21 @@ testN1_bslmaperformance_allocation_GoogleBenchmark(benchmark::State& state) // PERFORMANCE - allocation (microbenchmark) // // Concerns: -// Make sure the extra book-keeping in mwcma::CountingAllocator for each +// Make sure the extra book-keeping in bmqma::CountingAllocator for each // allocation are does not impact performance. // // Plan: // 1. Run a microbenchmark, making about 1 million allocations for sizes // starting at 1 up to (and including) 8192, repeatedly, for -// mwcma::CountingAllocator. +// bmqma::CountingAllocator. // // Testing: -// Allocation performance of mwcma::CountingAllocator +// Allocation performance of bmqma::CountingAllocator { s_ignoreCheckDefAlloc = true; // We're microbenching against the default allocator. - mwctst::TestHelper::printTestName("PERFORMANCE - allocation" + bmqtst::TestHelper::printTestName("PERFORMANCE - allocation" " (microbenchmark)"); const size_t k_MILLION = 1000000; @@ -694,7 +692,7 @@ testN1_defaultperformance_allocation_GoogleBenchmark(benchmark::State& state) // PERFORMANCE - allocation (microbenchmark) // // Concerns: -// Make sure the extra book-keeping in mwcma::CountingAllocator for each +// Make sure the extra book-keeping in bmqma::CountingAllocator for each // allocation are does not impact performance. // // Plan: @@ -708,7 +706,7 @@ testN1_defaultperformance_allocation_GoogleBenchmark(benchmark::State& state) s_ignoreCheckDefAlloc = true; // We're microbenching against the default allocator. - mwctst::TestHelper::printTestName("PERFORMANCE - allocation" + bmqtst::TestHelper::printTestName("PERFORMANCE - allocation" " (microbenchmark)"); const size_t k_MILLION = 1000000; @@ -722,12 +720,12 @@ testN1_defaultperformance_allocation_GoogleBenchmark(benchmark::State& state) { PV("--------------------------------"); - PV("mwcma::CountingAllocator"); + PV("bmqma::CountingAllocator"); PV("--------------------------------"); - mwcst::StatContextConfiguration config("test", s_allocator_p); - mwcst::StatContext parentStatContext(config, s_allocator_p); - mwcma::CountingAllocator countingAlloc("CountingAlloc", + bmqst::StatContextConfiguration config("test", s_allocator_p); + bmqst::StatContext parentStatContext(config, s_allocator_p); + bmqma::CountingAllocator countingAlloc("CountingAlloc", &parentStatContext, bslma::Default::allocator()); @@ -754,7 +752,7 @@ testN1_defaultperformance_allocation_GoogleBenchmark(benchmark::State& state) int main(int argc, char** argv) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -783,7 +781,7 @@ int main(int argc, char** argv) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } // --------------------------------------------------------------------------- diff --git a/src/groups/mwc/mwcma/mwcma_countingallocatorstore.cpp b/src/groups/bmq/bmqma/bmqma_countingallocatorstore.cpp similarity index 85% rename from src/groups/mwc/mwcma/mwcma_countingallocatorstore.cpp rename to src/groups/bmq/bmqma/bmqma_countingallocatorstore.cpp index 613364e3e..fdafdd597 100644 --- a/src/groups/mwc/mwcma/mwcma_countingallocatorstore.cpp +++ b/src/groups/bmq/bmqma/bmqma_countingallocatorstore.cpp @@ -13,19 +13,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcma_countingallocatorstore.cpp -*-C++-*- -#include +// bmqma_countingallocatorstore.cpp -*-C++-*- +#include -#include -// MWC -#include +#include + +#include // BDE #include #include namespace BloombergLP { -namespace mwcma { +namespace bmqma { // ---------------------------- // class CountingAllocatorStore @@ -53,7 +53,7 @@ bslma::Allocator* CountingAllocatorStore::baseAllocator() bslma::Allocator* CountingAllocatorStore::get(const bsl::string& name) { - if (!dynamic_cast(d_allocator_p)) { + if (!dynamic_cast(d_allocator_p)) { return d_allocator_p; // RETURN } @@ -66,8 +66,8 @@ bslma::Allocator* CountingAllocatorStore::get(const bsl::string& name) } // Allocator with this name does not exist, so create one and insert it. - mwcma::CountingAllocator* newAlloc = new (*d_allocator_p) - mwcma::CountingAllocator(name, d_allocator_p); + bmqma::CountingAllocator* newAlloc = new (*d_allocator_p) + bmqma::CountingAllocator(name, d_allocator_p); const bsl::pair insertRC = d_allocators.emplace(name, newAlloc); diff --git a/src/groups/mwc/mwcma/mwcma_countingallocatorstore.h b/src/groups/bmq/bmqma/bmqma_countingallocatorstore.h similarity index 83% rename from src/groups/mwc/mwcma/mwcma_countingallocatorstore.h rename to src/groups/bmq/bmqma/bmqma_countingallocatorstore.h index 798cc494c..05b5559e0 100644 --- a/src/groups/mwc/mwcma/mwcma_countingallocatorstore.h +++ b/src/groups/bmq/bmqma/bmqma_countingallocatorstore.h @@ -13,30 +13,30 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcma_countingallocatorstore.h -*-C++-*- -#ifndef INCLUDED_MWCMA_COUNTINGALLOCATORSTORE -#define INCLUDED_MWCMA_COUNTINGALLOCATORSTORE +// bmqma_countingallocatorstore.h -*-C++-*- +#ifndef INCLUDED_BMQMA_COUNTINGALLOCATORSTORE +#define INCLUDED_BMQMA_COUNTINGALLOCATORSTORE -//@PURPOSE: Provide a collection of 'mwcma::CountingAllocator' objects. +//@PURPOSE: Provide a collection of 'bmqma::CountingAllocator' objects. // //@CLASSES: -// mwcma::CountingAllocatorStore: a collection of 'mwcma::CountingAllocator' +// bmqma::CountingAllocatorStore: a collection of 'bmqma::CountingAllocator' // -//@SEE_ALSO: mwcma::CountingAllocator +//@SEE_ALSO: bmqma::CountingAllocator // //@DESCRIPTION: This component defines a mechanism, -// 'mwcma::CountingAllocatorStore' which can be used for creating and -// dispensing 'mwcma::CountingAllocator' objects sharing a common ancestor -// allocator. Using 'mwcma::CountingAllocatorStore' objects consistently +// 'bmqma::CountingAllocatorStore' which can be used for creating and +// dispensing 'bmqma::CountingAllocator' objects sharing a common ancestor +// allocator. Using 'bmqma::CountingAllocatorStore' objects consistently // allows an application to determine at program start time whether to collect // allocator statistics or not, and to incur no runtime overhead in this case. // -// If the 'mwcma::CountingAllocatorStore' is created with a -// 'mwcma::CountingAllocator' (as determined by 'dynamic_cast') then a call to -// 'get' will return a 'mwcma::CountingAllocator' with the specified name, +// If the 'bmqma::CountingAllocatorStore' is created with a +// 'bmqma::CountingAllocator' (as determined by 'dynamic_cast') then a call to +// 'get' will return a 'bmqma::CountingAllocator' with the specified name, // creating it if necessary and keeping it alive until the -// 'mwcma::CountingAllocatorStore' is cleared or destroyed. If the allocator -// provided at construction is not a 'mwcma::CountingAllocator' then calls to +// 'bmqma::CountingAllocatorStore' is cleared or destroyed. If the allocator +// provided at construction is not a 'bmqma::CountingAllocator' then calls to // 'get' will simply return this allocator. // /// Usage Example @@ -45,10 +45,10 @@ // application, typically inside the 'main' function. The following lines of // code will take care of it: //.. -// mwcst::StatContext allocatorContext(mwcst::StatContextConfiguration("test") +// bmqst::StatContext allocatorContext(bmqst::StatContextConfiguration("test") // .defaultHistorySize(2)); // -// mwcma::CountingAllocator topAllocator("Allocators", &allocatorContext); +// bmqma::CountingAllocator topAllocator("Allocators", &allocatorContext); // //.. // This creates a stat context named 'test' and a counting allocator named @@ -66,12 +66,12 @@ // // DATA // bslma::Allocator *d_allocator_p; // -// mwcma::CountingAllocatorStore d_allocators; +// bmqma::CountingAllocatorStore d_allocators; // // Container for counting // // allocators created at the // // application's level. // -// mwcst::StatContext *d_globalStatContext_p; +// bmqst::StatContext *d_globalStatContext_p; // // Held, not owned. // // ErrantSubsystem d_errantSubsystem; @@ -80,7 +80,7 @@ // // public: // // CREATORS -// Application(mwcst::StatContext *globalStatContext, +// Application(bmqst::StatContext *globalStatContext, // bslma::Allocator *allocator); // // ~Application(); @@ -98,7 +98,7 @@ // For the sake of simplicity, our application only has one static object, of // type 'ErrantSubsystem'. The application class also holds a pointer to the // global stat context created by 'initGlobalAllocators'. Finally, the -// application class uses a 'mwcma::CountingAllocatorStore' initialized with +// application class uses a 'bmqma::CountingAllocatorStore' initialized with // the top-level counting allocator. This store allows us to create a new // level of counting allocators. // @@ -108,7 +108,7 @@ // to each subsystem using this method, in order to track memory usage for each // of them. //.. -// Application::Application(mwcst::StatContext *globalStatContext, +// Application::Application(bmqst::StatContext *globalStatContext, // bslma::Allocator *allocator) // : d_allocator_p(allocator) // , d_allocators(d_allocator_p) @@ -130,7 +130,7 @@ // // DATA // bslma::Allocator *d_allocator_p; // -// mwcma::CountingAllocatorStore d_allocators; +// bmqma::CountingAllocatorStore d_allocators; // // Container for counting // // allocators created at the // // subsystem level. @@ -202,15 +202,15 @@ // // Second, print a pretty table. // stream << "\n==================== ALLOCATORS ======================\n"; // -// const mwcst::StatContext *allocatorStatContext = +// const bmqst::StatContext *allocatorStatContext = // d_globalStatContext_p->getSubcontext("Allocators"); // -// mwcst::StatContextTableInfoProvider tip; -// mwcma::CountingAllocator::configureStatContextTableInfoProvider(&tip); +// bmqst::StatContextTableInfoProvider tip; +// bmqma::CountingAllocator::configureStatContextTableInfoProvider(&tip); // tip.setContext(allocatorStatContext); // tip.update(); // -// mwcst::TableUtil::printTable(stream, tip); +// bmqst::TableUtil::printTable(stream, tip); // stream << bsl::endl; // } //.. @@ -238,8 +238,6 @@ ///------------- // Thread safe. -// MWC - // BDE #include #include @@ -249,7 +247,7 @@ #include namespace BloombergLP { -namespace mwcma { +namespace bmqma { // FORWARD DECLARATIONS class CountingAllocator; @@ -258,14 +256,14 @@ class CountingAllocator; // class CountingAllocatorStore // ============================ -/// Factory and container for `mwcma::CountingAllocator` objects created +/// Factory and container for `bmqma::CountingAllocator` objects created /// from a common allocator. class CountingAllocatorStore BSLS_KEYWORD_FINAL { private: // PRIVATE TYPES /// name -> countingAllocator - typedef bsl::unordered_map + typedef bsl::unordered_map AllocatorMap; // DATA @@ -290,8 +288,8 @@ class CountingAllocatorStore BSLS_KEYWORD_FINAL { /// Create a counting allocator store initialized with the specified /// `allocator`. If `allocator` is a null pointer, use the default - /// allocator. If `allocator` is of type `mwcma::CountingAllocator`, a - /// call to `get` will return a `mwcma::CountingAllocator`; otherwise + /// allocator. If `allocator` is of type `bmqma::CountingAllocator`, a + /// call to `get` will return a `bmqma::CountingAllocator`; otherwise /// `get` will simply return `allocator`. explicit CountingAllocatorStore(bslma::Allocator* allocator = 0); @@ -303,13 +301,13 @@ class CountingAllocatorStore BSLS_KEYWORD_FINAL { /// Return the base allocator used by this component, i.e., the one /// supplied at construction of this object (or the by then installed /// default allocator if none was provided). If this allocator was an - /// instance of `mwcma::CountingAllocator`, it then corresponds to the + /// instance of `bmqma::CountingAllocator`, it then corresponds to the /// parent of all allocators created by a call to `get`. bslma::Allocator* baseAllocator(); /// If the `allocator` provided at construction was not a - /// `mwcma::CountingAllocator`, simply return that allocator. Otherwise - /// return a `mwcma::CountingAllocator` descended from that allocator, + /// `bmqma::CountingAllocator`, simply return that allocator. Otherwise + /// return a `bmqma::CountingAllocator` descended from that allocator, /// creating it if necessary' with the specified `name`. bslma::Allocator* get(const bsl::string& name); diff --git a/src/groups/mwc/mwcma/mwcma_countingallocatorstore.t.cpp b/src/groups/bmq/bmqma/bmqma_countingallocatorstore.t.cpp similarity index 80% rename from src/groups/mwc/mwcma/mwcma_countingallocatorstore.t.cpp rename to src/groups/bmq/bmqma/bmqma_countingallocatorstore.t.cpp index a5b1aac9f..3c931222b 100644 --- a/src/groups/mwc/mwcma/mwcma_countingallocatorstore.t.cpp +++ b/src/groups/bmq/bmqma/bmqma_countingallocatorstore.t.cpp @@ -13,14 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcma_countingallocatorstore.t.cpp -*-C++-*- -#include +// bmqma_countingallocatorstore.t.cpp -*-C++-*- +#include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -31,7 +30,7 @@ #include // TEST DRIVER -#include +#include using namespace BloombergLP; using namespace bsl; @@ -60,7 +59,7 @@ static void test1_breathingTest() // Probe that functionality to discover basic errors. // // Plan: -// 1. Supply a 'mwcma::CountingAllocator' ancestor allocator and retrieve +// 1. Supply a 'bmqma::CountingAllocator' ancestor allocator and retrieve // multiple allocators from the allocator store using the 'get' // method, verifying that the returned allocators distinct if they // have different names and the same if they have the same name. @@ -69,10 +68,10 @@ static void test1_breathingTest() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); - mwcma::CountingAllocator topAllocator("Top Allocator", s_allocator_p); - mwcma::CountingAllocatorStore allocatorStore(&topAllocator); + bmqma::CountingAllocator topAllocator("Top Allocator", s_allocator_p); + bmqma::CountingAllocatorStore allocatorStore(&topAllocator); ASSERT_EQ(allocatorStore.baseAllocator(), &topAllocator); @@ -90,12 +89,12 @@ static void test2_ancestorNotCountingAllocator() // // Concerns: // If the allocator provided at construction is not a -// 'mwcma::CountingAllocator' then calls to 'get' will simply return that +// 'bmqma::CountingAllocator' then calls to 'get' will simply return that // allocator. // // Plan: // 1. Supply an ancestor allocator that is not a -// 'mwcma::CountingAllocator' and retrieve multiple allocators from +// 'bmqma::CountingAllocator' and retrieve multiple allocators from // the allocator store using the 'get' method, verifying that the // returned allocators are the ancestor allocator provided at // construction. @@ -105,14 +104,14 @@ static void test2_ancestorNotCountingAllocator() // get // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ANCESTOR NOT COUNTING ALLOCATOR"); + bmqtst::TestHelper::printTestName("ANCESTOR NOT COUNTING ALLOCATOR"); - BSLS_ASSERT_OPT(!dynamic_cast(s_allocator_p) && + BSLS_ASSERT_OPT(!dynamic_cast(s_allocator_p) && "Test allocator is assumed to not be a" - " 'mwcma::CountingAllocator'"); + " 'bmqma::CountingAllocator'"); bslma::Allocator* topAllocator_p = s_allocator_p; - mwcma::CountingAllocatorStore allocatorStore(topAllocator_p); + bmqma::CountingAllocatorStore allocatorStore(topAllocator_p); ASSERT_EQ(allocatorStore.baseAllocator(), topAllocator_p); @@ -129,7 +128,7 @@ static void test2_ancestorNotCountingAllocator() int main(int argc, char** argv) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -141,5 +140,5 @@ int main(int argc, char** argv) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcma/mwcma_countingallocatorutil.cpp b/src/groups/bmq/bmqma/bmqma_countingallocatorutil.cpp similarity index 70% rename from src/groups/mwc/mwcma/mwcma_countingallocatorutil.cpp rename to src/groups/bmq/bmqma/bmqma_countingallocatorutil.cpp index 0b0eb78e1..98b97c50e 100644 --- a/src/groups/mwc/mwcma/mwcma_countingallocatorutil.cpp +++ b/src/groups/bmq/bmqma/bmqma_countingallocatorutil.cpp @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcma_countingallocatorutil.cpp -*-C++-*- -#include +// bmqma_countingallocatorutil.cpp -*-C++-*- +#include -#include -// MWC -#include -#include -#include -#include -#include +#include + +#include +#include +#include +#include +#include // BDE #include @@ -35,19 +35,19 @@ #include namespace BloombergLP { -namespace mwcma { +namespace bmqma { namespace { /// statContext of the main counting allocator -bsls::ObjectBuffer g_statContext; +bsls::ObjectBuffer g_statContext; /// Main counting allocator; provided to the top allocator store -bsls::ObjectBuffer g_topAllocator; +bsls::ObjectBuffer g_topAllocator; -/// Top-level allocator store providing `mwcma::CountingAllocator` objects +/// Top-level allocator store providing `bmqma::CountingAllocator` objects /// created from the main counting allocator. -bsls::ObjectBuffer g_topAllocatorStore; +bsls::ObjectBuffer g_topAllocatorStore; /// Atomic flag to keep track of whether `initGlobalAllocators` has been /// called. If the value is `false`, then it has not been called, otherwise @@ -65,7 +65,7 @@ bsls::AtomicBool g_initialized(false); // CLASS METHODS void CountingAllocatorUtil::initGlobalAllocators( - const mwcst::StatContextConfiguration& globalStatContextConfiguration, + const bmqst::StatContextConfiguration& globalStatContextConfiguration, const bslstl::StringRef& topAllocatorName) { // PRECONDITIONS @@ -77,18 +77,18 @@ void CountingAllocatorUtil::initGlobalAllocators( // Here we create the main CountingAllocator and its StatContext. new (g_statContext.buffer()) - mwcst::StatContext(globalStatContextConfiguration, alloc); - mwcst::StatContext& stats = g_statContext.object(); + bmqst::StatContext(globalStatContextConfiguration, alloc); + bmqst::StatContext& stats = g_statContext.object(); new (g_topAllocator.buffer()) - mwcma::CountingAllocator(topAllocatorName, &stats, alloc); + bmqma::CountingAllocator(topAllocatorName, &stats, alloc); // Create the topAllocatorStore and the default and global allocators - mwcma::CountingAllocator& topAllocator = g_topAllocator.object(); + bmqma::CountingAllocator& topAllocator = g_topAllocator.object(); new (g_topAllocatorStore.buffer()) - mwcma::CountingAllocatorStore(&topAllocator); + bmqma::CountingAllocatorStore(&topAllocator); - mwcma::CountingAllocatorStore& topStore = g_topAllocatorStore.object(); + bmqma::CountingAllocatorStore& topStore = g_topAllocatorStore.object(); bslma::Default::setGlobalAllocator(topStore.get("Global Allocator")); bslma::Default::setDefaultAllocatorRaw(topStore.get("Default Allocator")); } @@ -98,11 +98,11 @@ void CountingAllocatorUtil::initGlobalAllocators( const bslstl::StringRef& topAllocatorName) { initGlobalAllocators( - mwcst::StatContextConfiguration(globalStatContextName), + bmqst::StatContextConfiguration(globalStatContextName), topAllocatorName); } -mwcst::StatContext* CountingAllocatorUtil::globalStatContext() +bmqst::StatContext* CountingAllocatorUtil::globalStatContext() { // PRECONDITIONS BSLS_ASSERT_SAFE(g_initialized); @@ -110,7 +110,7 @@ mwcst::StatContext* CountingAllocatorUtil::globalStatContext() return &g_statContext.object(); } -mwcma::CountingAllocatorStore& CountingAllocatorUtil::topAllocatorStore() +bmqma::CountingAllocatorStore& CountingAllocatorUtil::topAllocatorStore() { // PRECONDITIONS BSLS_ASSERT_SAFE(g_initialized); @@ -119,16 +119,16 @@ mwcma::CountingAllocatorStore& CountingAllocatorUtil::topAllocatorStore() } void CountingAllocatorUtil::printAllocations(bsl::ostream& stream, - const mwcst::StatContext& context) + const bmqst::StatContext& context) { bdlma::LocalSequentialAllocator<2048> localAllocator; - mwcst::StatContextTableInfoProvider tip(&localAllocator); + bmqst::StatContextTableInfoProvider tip(&localAllocator); CountingAllocator::configureStatContextTableInfoProvider(&tip); tip.setContext(&context); tip.update(); - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } } // close package namespace diff --git a/src/groups/mwc/mwcma/mwcma_countingallocatorutil.h b/src/groups/bmq/bmqma/bmqma_countingallocatorutil.h similarity index 76% rename from src/groups/mwc/mwcma/mwcma_countingallocatorutil.h rename to src/groups/bmq/bmqma/bmqma_countingallocatorutil.h index b1c59efb3..8925abe84 100644 --- a/src/groups/mwc/mwcma/mwcma_countingallocatorutil.h +++ b/src/groups/bmq/bmqma/bmqma_countingallocatorutil.h @@ -13,26 +13,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcma_countingallocatorutil.h -*-C++-*- -#ifndef INCLUDED_MWCMA_COUNTINGALLOCATORUTIL -#define INCLUDED_MWCMA_COUNTINGALLOCATORUTIL +// bmqma_countingallocatorutil.h -*-C++-*- +#ifndef INCLUDED_BMQMA_COUNTINGALLOCATORUTIL +#define INCLUDED_BMQMA_COUNTINGALLOCATORUTIL -//@PURPOSE: Provide a utility for installing 'mwcma::CountingAllocator'. +//@PURPOSE: Provide a utility for installing 'bmqma::CountingAllocator'. // //@CLASSES: -// mwcma::CountingAllocatorUtil : utility functions. +// bmqma::CountingAllocatorUtil : utility functions. // -//@SEE_ALSO: mwcma_countingallocatorstore +//@SEE_ALSO: bmqma_countingallocatorstore // //@DESCRIPTION: This component defines a utility, -// 'mwcma::CountingAllocatorUtil' which provides useful functions for using -// 'mwcma::CountingAllocator' objects in an application. +// 'bmqma::CountingAllocatorUtil' which provides useful functions for using +// 'bmqma::CountingAllocator' objects in an application. // -// The function 'mwcma::CountingAllocatorUtil::initGlobalAllocator' should be +// The function 'bmqma::CountingAllocatorUtil::initGlobalAllocator' should be // called in 'main' to install counting allocators. Refer to the usage example -// in 'mwcma_countingallocatorstore'. - -// MWC +// in 'bmqma_countingallocatorstore'. // BDE #include @@ -41,14 +39,14 @@ namespace BloombergLP { // FORWARD DECLARE -namespace mwcst { +namespace bmqst { class StatContext; } -namespace mwcst { +namespace bmqst { class StatContextConfiguration; } -namespace mwcma { +namespace bmqma { // FORWARD DECLARE class CountingAllocatorStore; @@ -58,7 +56,7 @@ class CountingAllocatorStore; // ============================ /// Container for utility functions for working with counting allocators -/// (`mwcma::CountingAllocator`). +/// (`bmqma::CountingAllocator`). struct CountingAllocatorUtil { // CLASS METHODS @@ -72,7 +70,7 @@ struct CountingAllocatorUtil { /// be called once in `main`. The behavior is undefined if this /// function is called more than once. static void initGlobalAllocators( - const mwcst::StatContextConfiguration& globalStatContextConfiguration, + const bmqst::StatContextConfiguration& globalStatContextConfiguration, const bslstl::StringRef& topAllocatorName); static void initGlobalAllocators(const bslstl::StringRef& globalStatContextName, @@ -80,19 +78,19 @@ struct CountingAllocatorUtil { /// Return the stat context created by `initGlobalAllocators`. The /// behavior is undefined unless `initGlobalAllocators` has been called. - static mwcst::StatContext* globalStatContext(); + static bmqst::StatContext* globalStatContext(); /// Return the top-level allocator store created by /// `initGlobalAllocators`. Any allocator retrieved from this store is /// guaranteed to remain valid until the end of the program. The /// behavior is undefined unless `initGlobalAllocators` has been called. - static mwcma::CountingAllocatorStore& topAllocatorStore(); + static bmqma::CountingAllocatorStore& topAllocatorStore(); /// Print to the specified `stream` the allocator statistics captured by /// the specified `context`, which must correspond to a /// `CountingAllocator` configured StatContext. static void printAllocations(bsl::ostream& stream, - const mwcst::StatContext& context); + const bmqst::StatContext& context); }; } // close package namespace diff --git a/src/groups/mwc/mwcma/mwcma_countingallocatorutil.t.cpp b/src/groups/bmq/bmqma/bmqma_countingallocatorutil.t.cpp similarity index 68% rename from src/groups/mwc/mwcma/mwcma_countingallocatorutil.t.cpp rename to src/groups/bmq/bmqma/bmqma_countingallocatorutil.t.cpp index 730b07b70..0a4913c32 100644 --- a/src/groups/mwc/mwcma/mwcma_countingallocatorutil.t.cpp +++ b/src/groups/bmq/bmqma/bmqma_countingallocatorutil.t.cpp @@ -13,17 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcma_countingallocatorutil.t.cpp -*-C++-*- -#include - -// MWC -#include -#include -#include -#include -#include -#include -#include +// bmqma_countingallocatorutil.t.cpp -*-C++-*- +#include + +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -31,7 +30,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -59,20 +58,20 @@ static void test1_breathingTest() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // Prior to initialization, calling the accessors is undefined behavior. - ASSERT_SAFE_FAIL(mwcma::CountingAllocatorUtil::globalStatContext()); - ASSERT_SAFE_FAIL(mwcma::CountingAllocatorUtil::topAllocatorStore()); + ASSERT_SAFE_FAIL(bmqma::CountingAllocatorUtil::globalStatContext()); + ASSERT_SAFE_FAIL(bmqma::CountingAllocatorUtil::topAllocatorStore()); - mwcma::CountingAllocatorUtil::initGlobalAllocators("testStatContext", + bmqma::CountingAllocatorUtil::initGlobalAllocators("testStatContext", "testAllocatorName"); - ASSERT_SAFE_FAIL(mwcma::CountingAllocatorUtil::initGlobalAllocators( + ASSERT_SAFE_FAIL(bmqma::CountingAllocatorUtil::initGlobalAllocators( "testStatContext", "testAllocatorName")); - ASSERT(mwcma::CountingAllocatorUtil::globalStatContext() != 0); - ASSERT_EQ(mwcma::CountingAllocatorUtil::globalStatContext()->name(), + ASSERT(bmqma::CountingAllocatorUtil::globalStatContext() != 0); + ASSERT_EQ(bmqma::CountingAllocatorUtil::globalStatContext()->name(), "testStatContext"); } @@ -83,10 +82,10 @@ static void test2_initGlobalAllocators() // Concerns: // 1. Ensure that 'initGlobalAllocators' creates a top-level allocator, // top-level statContext, and top-level -// 'mwcma::CountingAllocatorStore'. +// 'bmqma::CountingAllocatorStore'. // 2. Ensure that 'initGlobalAllocators' sets the default and global // allocators to counting allocators created from the top-level -// 'mwcma::CountingAllocatorStore' and having the names "Default +// 'bmqma::CountingAllocatorStore' and having the names "Default // Allocator" and "Global Allocator", respectively. // // Testing: @@ -95,30 +94,30 @@ static void test2_initGlobalAllocators() // topAllocatorStore // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("INITIALIZE GLOBAL ALLOCATORS"); + bmqtst::TestHelper::printTestName("INITIALIZE GLOBAL ALLOCATORS"); // 1. Ensure that 'initGlobalAllocators' creates a top-level allocator, - // top-level statContext, and top-level 'mwcma::CountingAllocatorStore'. - mwcma::CountingAllocatorUtil::initGlobalAllocators("testStatContext", + // top-level statContext, and top-level 'bmqma::CountingAllocatorStore'. + bmqma::CountingAllocatorUtil::initGlobalAllocators("testStatContext", "testAllocatorName"); - ASSERT(mwcma::CountingAllocatorUtil::globalStatContext() != 0); - ASSERT_EQ(mwcma::CountingAllocatorUtil::globalStatContext()->name(), + ASSERT(bmqma::CountingAllocatorUtil::globalStatContext() != 0); + ASSERT_EQ(bmqma::CountingAllocatorUtil::globalStatContext()->name(), "testStatContext"); - mwcma::CountingAllocatorStore& topAllocatorStore = - mwcma::CountingAllocatorUtil::topAllocatorStore(); + bmqma::CountingAllocatorStore& topAllocatorStore = + bmqma::CountingAllocatorUtil::topAllocatorStore(); // 2. Ensure that 'initGlobalAllocators' sets the default and global // allocators to counting allocators created from the top-level - // 'mwcma::CountingAllocatorStore' and having the names "Default Allocator" + // 'bmqma::CountingAllocatorStore' and having the names "Default Allocator" // and "Global Allocator", respectively. bslma::Allocator* globalAlloc = topAllocatorStore.get("Global Allocator"); bslma::Allocator* defaultAlloc = topAllocatorStore.get( "Default Allocator"); - ASSERT(dynamic_cast(globalAlloc) != 0); - ASSERT(dynamic_cast(defaultAlloc) != 0); + ASSERT(dynamic_cast(globalAlloc) != 0); + ASSERT(dynamic_cast(defaultAlloc) != 0); ASSERT_EQ(globalAlloc, bslma::Default::globalAllocator()); ASSERT_EQ(defaultAlloc, bslma::Default::defaultAllocator()); @@ -126,19 +125,19 @@ static void test2_initGlobalAllocators() // Check that the corresponding statContexts have been properly registered // under the top-level counting allocator for the default and global // allocators. - mwcma::CountingAllocatorUtil::globalStatContext()->snapshot(); + bmqma::CountingAllocatorUtil::globalStatContext()->snapshot(); - const mwcst::StatContext* topAllocatorStatContext = - mwcma::CountingAllocatorUtil::globalStatContext()->getSubcontext( + const bmqst::StatContext* topAllocatorStatContext = + bmqma::CountingAllocatorUtil::globalStatContext()->getSubcontext( "testAllocatorName"); ASSERT(topAllocatorStatContext != 0); ASSERT_EQ(topAllocatorStatContext->numSubcontexts(), 2); ASSERT_EQ( topAllocatorStatContext->getSubcontext("Default Allocator"), - dynamic_cast(defaultAlloc)->context()); + dynamic_cast(defaultAlloc)->context()); ASSERT_EQ(topAllocatorStatContext->getSubcontext("Global Allocator"), - dynamic_cast(globalAlloc)->context()); + dynamic_cast(globalAlloc)->context()); } //============================================================================= @@ -147,7 +146,7 @@ static void test2_initGlobalAllocators() int main(int argc, char** argv) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -159,5 +158,5 @@ int main(int argc, char** argv) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcma/doc/mwcma.txt b/src/groups/bmq/bmqma/doc/mwcma.txt similarity index 50% rename from src/groups/mwc/mwcma/doc/mwcma.txt rename to src/groups/bmq/bmqma/doc/mwcma.txt index 11b1673be..4080e0578 100644 --- a/src/groups/mwc/mwcma/doc/mwcma.txt +++ b/src/groups/bmq/bmqma/doc/mwcma.txt @@ -1,31 +1,31 @@ - mwcma.txt + bmqma.txt @PURPOSE: Provide allocators and other memory-management tools -@MNEMONIC: MiddleWare Core Memory Allocators (mwcma) +@MNEMONIC: BlazingMQ Memory Allocators (bmqma) @DESCRIPTION: This package provides miscellaneous allocators and utility components for memory-management to be reused through various applications. /Hierarchical Synopsis /--------------------- -The 'mwcma' package currently has 3 components having 3 level of physical +The 'bmqma' package currently has 3 components having 3 level of physical dependency. The list below shows the hierarchical ordering of the components. .. - 3. mwcma_countingallocatorutil + 3. bmqma_countingallocatorutil - 2. mwcma_countingallocatorstore + 2. bmqma_countingallocatorstore - 1. mwcma_countingallocator + 1. bmqma_countingallocator .. /Component Synopsis /------------------ -: 'mwcma_countingallocator': +: 'bmqma_countingallocator': : Provide an instrumented allocator adaptor. : -: 'mwcma_countingallocatorstore': -: Provide a collection of 'mwcma::CountingAllocator' objects. +: 'bmqma_countingallocatorstore': +: Provide a collection of 'bmqma::CountingAllocator' objects. : -: 'mwcma_countingallocatorutil': -: Provide a utility for installing 'mwcma::CountingAllocator'. +: 'bmqma_countingallocatorutil': +: Provide a utility for installing 'bmqma::CountingAllocator'. diff --git a/src/groups/bmq/bmqma/package/bmqma.dep b/src/groups/bmq/bmqma/package/bmqma.dep new file mode 100644 index 000000000..f2b2c1e69 --- /dev/null +++ b/src/groups/bmq/bmqma/package/bmqma.dep @@ -0,0 +1,2 @@ +bmqscm +bmqst \ No newline at end of file diff --git a/src/groups/bmq/bmqma/package/bmqma.mem b/src/groups/bmq/bmqma/package/bmqma.mem new file mode 100644 index 000000000..f68061971 --- /dev/null +++ b/src/groups/bmq/bmqma/package/bmqma.mem @@ -0,0 +1,3 @@ +bmqma_countingallocator +bmqma_countingallocatorstore +bmqma_countingallocatorutil diff --git a/src/groups/bmq/bmqp/bmqp_ackeventbuilder.cpp b/src/groups/bmq/bmqp/bmqp_ackeventbuilder.cpp index 9a2b559f7..ddf116113 100644 --- a/src/groups/bmq/bmqp/bmqp_ackeventbuilder.cpp +++ b/src/groups/bmq/bmqp/bmqp_ackeventbuilder.cpp @@ -20,9 +20,8 @@ // BMQ #include -// MWC -#include -#include +#include +#include // BDE #include @@ -82,10 +81,10 @@ AckEventBuilder::appendMessage(int status, } // Resize the blob to have space for an 'AckMessage' at the end ... - mwcu::BlobPosition offset; - mwcu::BlobUtil::reserve(&offset, &d_blob, sizeof(AckMessage)); + bmqu::BlobPosition offset; + bmqu::BlobUtil::reserve(&offset, &d_blob, sizeof(AckMessage)); - mwcu::BlobObjectProxy ackMessage(&d_blob, + bmqu::BlobObjectProxy ackMessage(&d_blob, offset, false, // no read true); // write mode diff --git a/src/groups/bmq/bmqp/bmqp_ackeventbuilder.t.cpp b/src/groups/bmq/bmqp/bmqp_ackeventbuilder.t.cpp index 75e8e3de1..1fdb67dc9 100644 --- a/src/groups/bmq/bmqp/bmqp_ackeventbuilder.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_ackeventbuilder.t.cpp @@ -22,8 +22,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -36,7 +35,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -136,7 +135,7 @@ static void verifyContent(const bmqp::AckEventBuilder& builder, static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(256, s_allocator_p); bmqp::AckEventBuilder obj(&bufferFactory, s_allocator_p); @@ -157,7 +156,7 @@ static void test1_breathingTest() static void test2_multiMessage() { - mwctst::TestHelper::printTestName("MULTI MESSAGE"); + bmqtst::TestHelper::printTestName("MULTI MESSAGE"); // Create an ACK event with multiple ACK messages. Iterate and verify. const int k_NUM_MSGS = 1000; @@ -175,7 +174,7 @@ static void test2_multiMessage() static void test3_reset() { - mwctst::TestHelper::printTestName("RESET"); + bmqtst::TestHelper::printTestName("RESET"); // Verifying reset: add two messages, reset, and add another message. bdlbb::PooledBlobBufferFactory bufferFactory(256, s_allocator_p); @@ -203,7 +202,7 @@ static void test3_reset() static void test4_capacity() { - mwctst::TestHelper::printTestName("CAPACITY"); + bmqtst::TestHelper::printTestName("CAPACITY"); // Verify that once the event is full, AppendMessage returns error. int rc; @@ -256,13 +255,13 @@ static void testN1_decodeFromFile() // with expected properties. // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DECODE FROM FILE"); + bmqtst::TestHelper::printTestName("DECODE FROM FILE"); bdlbb::PooledBlobBufferFactory bufferFactory(256, s_allocator_p); bmqp::AckEventBuilder obj(&bufferFactory, s_allocator_p); bsl::vector messages(s_allocator_p); bdlbb::Blob outBlob(&bufferFactory, s_allocator_p); - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); bdlb::Guid guid = bdlb::GuidUtil::generate(); const int k_NUM_MSGS = 10; const int k_SIZE = 256; @@ -348,7 +347,7 @@ static void testN1_decodeFromFile() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -363,5 +362,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_ackmessageiterator.cpp b/src/groups/bmq/bmqp/bmqp_ackmessageiterator.cpp index 3c39feb6a..ec19bc5f7 100644 --- a/src/groups/bmq/bmqp/bmqp_ackmessageiterator.cpp +++ b/src/groups/bmq/bmqp/bmqp_ackmessageiterator.cpp @@ -125,7 +125,7 @@ int AckMessageIterator::reset(const bdlbb::Blob* blob, // header }; - d_blobIter.reset(blob, mwcu::BlobPosition(), blob->length(), true); + d_blobIter.reset(blob, bmqu::BlobPosition(), blob->length(), true); // Skip the EventHeader to point to the AckHeader const bool rc = d_blobIter.advance(eventHeader.headerWords() * @@ -204,7 +204,7 @@ void AckMessageIterator::dumpBlob(bsl::ostream& stream) // For now, print only the beginning of the blob.. we may later on print // also the bytes around the current position if (d_blobIter.blob()) { - stream << mwcu::BlobStartHexDumper(d_blobIter.blob(), + stream << bmqu::BlobStartHexDumper(d_blobIter.blob(), k_MAX_BYTES_DUMP); } else { diff --git a/src/groups/bmq/bmqp/bmqp_ackmessageiterator.h b/src/groups/bmq/bmqp/bmqp_ackmessageiterator.h index 41cadf1f7..3cf0130c5 100644 --- a/src/groups/bmq/bmqp/bmqp_ackmessageiterator.h +++ b/src/groups/bmq/bmqp/bmqp_ackmessageiterator.h @@ -57,10 +57,9 @@ #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -79,14 +78,14 @@ namespace bmqp { class AckMessageIterator { private: // DATA - mwcu::BlobIterator d_blobIter; + bmqu::BlobIterator d_blobIter; // Blob iterator pointing to the current // message in the blob. - mwcu::BlobObjectProxy d_header; + bmqu::BlobObjectProxy d_header; // Header - mwcu::BlobObjectProxy d_message; + bmqu::BlobObjectProxy d_message; // Current message int d_advanceLength; @@ -181,7 +180,7 @@ class AckMessageIterator { // CREATORS inline AckMessageIterator::AckMessageIterator() -: d_blobIter(0, mwcu::BlobPosition(), 0, true) +: d_blobIter(0, bmqu::BlobPosition(), 0, true) , d_advanceLength(0) { // NOTHING @@ -189,14 +188,14 @@ inline AckMessageIterator::AckMessageIterator() inline AckMessageIterator::AckMessageIterator(const bdlbb::Blob* blob, const EventHeader& eventHeader) -: d_blobIter(0, mwcu::BlobPosition(), 0, true) // no def ctor - set in reset +: d_blobIter(0, bmqu::BlobPosition(), 0, true) // no def ctor - set in reset { reset(blob, eventHeader); } inline AckMessageIterator::AckMessageIterator(const AckMessageIterator& src) : d_blobIter(0, - mwcu::BlobPosition(), + bmqu::BlobPosition(), 0, true) // no def ctor - set in copyFrom { @@ -213,7 +212,7 @@ AckMessageIterator::operator=(const AckMessageIterator& rhs) inline void AckMessageIterator::clear() { - d_blobIter.reset(0, mwcu::BlobPosition(), 0, true); + d_blobIter.reset(0, bmqu::BlobPosition(), 0, true); d_header.reset(); d_message.reset(); d_advanceLength = 0; diff --git a/src/groups/bmq/bmqp/bmqp_ackmessageiterator.t.cpp b/src/groups/bmq/bmqp/bmqp_ackmessageiterator.t.cpp index 0b2446214..bd519b7e4 100644 --- a/src/groups/bmq/bmqp/bmqp_ackmessageiterator.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_ackmessageiterator.t.cpp @@ -29,11 +29,10 @@ #include #include -// MWC -#include +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -182,7 +181,7 @@ static void test1_breathingTest() // Basic functionality // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -314,7 +313,7 @@ static void test1_breathingTest() // Verify dumping the blob const char* k_NO_BLOB_STR = "/no blob/"; - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); iter2.dumpBlob(out); ASSERT_NE(out.str(), k_NO_BLOB_STR); @@ -341,7 +340,7 @@ static void test1_breathingTest() /// Test iterating over ACK event having multiple ACK messages static void test2_ackEventWithMultipleMessages() { - mwctst::TestHelper::printTestName("ACK EVENT WITH MULTIPLE MESSAGES"); + bmqtst::TestHelper::printTestName("ACK EVENT WITH MULTIPLE MESSAGES"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob eventBlob(&bufferFactory, s_allocator_p); @@ -396,7 +395,7 @@ static void test3_nextMethod() // Testing: // int next(); // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("NEXT METHOD"); + bmqtst::TestHelper::printTestName("NEXT METHOD"); // Test iterating over ACK event having multiple ACK messages @@ -487,7 +486,7 @@ static void test4_resetMethod() // Testing: // int reset(); // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("RESET METHOD"); + bmqtst::TestHelper::printTestName("RESET METHOD"); // Default values for event header // Populate blob @@ -583,7 +582,7 @@ static void test5_dumpBlob() // Testing: // void dumpBlob(bsl::ostream& stream); // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("DUMB BLOB"); + bmqtst::TestHelper::printTestName("DUMB BLOB"); // Test iterator dump contains expected value @@ -596,7 +595,7 @@ static void test5_dumpBlob() bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob blob(&bufferFactory, s_allocator_p); bmqp::EventHeader eventHeader; - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); // Populate blob populateBlob(&blob, @@ -648,7 +647,7 @@ static void test5_dumpBlob() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -663,5 +662,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_compression.cpp b/src/groups/bmq/bmqp/bmqp_compression.cpp index 09ed128d1..501b5e4e8 100644 --- a/src/groups/bmq/bmqp/bmqp_compression.cpp +++ b/src/groups/bmq/bmqp/bmqp_compression.cpp @@ -17,8 +17,8 @@ #include #include -// MWC -#include + +#include // BDE #include @@ -170,14 +170,14 @@ bool ZLib::advanceInput(bdlbb::BlobBuffer* inBuffer, ++(*index); *inBuffer = input.buffer(*index); - stream->avail_in = mwcu::BlobUtil::bufferSize(input, *index); + stream->avail_in = bmqu::BlobUtil::bufferSize(input, *index); stream->next_in = reinterpret_cast(inBuffer->data()); } else { // Advance the 'next_in' pointer to the next region of unconsumed data // in the buffer. - const ptrdiff_t offset = mwcu::BlobUtil::bufferSize(input, *index) - + const ptrdiff_t offset = bmqu::BlobUtil::bufferSize(input, *index) - stream->avail_in; stream->next_in = reinterpret_cast(inBuffer->data() + offset); diff --git a/src/groups/bmq/bmqp/bmqp_compression.t.cpp b/src/groups/bmq/bmqp/bmqp_compression.t.cpp index 9ef9a86da..427694738 100644 --- a/src/groups/bmq/bmqp/bmqp_compression.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_compression.t.cpp @@ -17,17 +17,16 @@ #include // TEST DRIVER -#include +#include // BMQ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -115,14 +114,14 @@ static void printRecord(bsl::ostream& out, // NOTE: we can't just bsl::setw(colWidth) << PrintUtil::pretty... because // internal PrintUtil uses setw, so instead print in a temp buffer - mwcu::MemOutStream bytesStream; - mwcu::MemOutStream compressStream; - mwcu::MemOutStream decompressStream; + bmqu::MemOutStream bytesStream; + bmqu::MemOutStream compressStream; + bmqu::MemOutStream decompressStream; - bytesStream << mwcu::PrintUtil::prettyBytes(record.d_size); - compressStream << mwcu::PrintUtil::prettyTimeInterval( + bytesStream << bmqu::PrintUtil::prettyBytes(record.d_size); + compressStream << bmqu::PrintUtil::prettyTimeInterval( record.d_compressionTime); - decompressStream << mwcu::PrintUtil::prettyTimeInterval( + decompressStream << bmqu::PrintUtil::prettyTimeInterval( record.d_decompressionTime); // size @@ -141,11 +140,11 @@ static void printRecord(bsl::ostream& out, // NOTE: we can't just bsl::setw(colWidth) << PrintUtil::pretty... because // internal PrintUtil uses setw, so instead print in a temp buffer - mwcu::MemOutStream inputSizeStream; - mwcu::MemOutStream compressedSizeStream; + bmqu::MemOutStream inputSizeStream; + bmqu::MemOutStream compressedSizeStream; - inputSizeStream << mwcu::PrintUtil::prettyBytes(record.d_inputSize); - compressedSizeStream << mwcu::PrintUtil::prettyBytes( + inputSizeStream << bmqu::PrintUtil::prettyBytes(record.d_inputSize); + compressedSizeStream << bmqu::PrintUtil::prettyBytes( record.d_compressedSize); // input size @@ -175,7 +174,7 @@ static void printTableRows(bsl::ostream& out, // PRECONDITIONS BSLS_ASSERT_SAFE(headerCols.size() == 3); - mwcu::OutStreamFormatSaver fmtSaver(out); + bmqu::OutStreamFormatSaver fmtSaver(out); out << bsl::right << bsl::fixed; @@ -201,7 +200,7 @@ printTableRows(bsl::ostream& out, // PRECONDITIONS BSLS_ASSERT_SAFE(headerCols.size() == 3); - mwcu::OutStreamFormatSaver fmtSaver(out); + bmqu::OutStreamFormatSaver fmtSaver(out); out << bsl::right << bsl::fixed; @@ -249,7 +248,7 @@ static void eZlibCompressDecompressHelper( const char* expectedCompressed, const bmqt::CompressionAlgorithmType::Enum& algorithm) { - mwcu::MemOutStream error(s_allocator_p); + bmqu::MemOutStream error(s_allocator_p); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob input(&bufferFactory, s_allocator_p); bdlbb::Blob compressed(&bufferFactory, s_allocator_p); @@ -271,7 +270,7 @@ static void eZlibCompressDecompressHelper( // get compressed data and compare with expected_compressed BSLS_ASSERT_SAFE(compressed.numDataBuffers() == 1); - int bufferSize = mwcu::BlobUtil::bufferSize(compressed, 0); + int bufferSize = bmqu::BlobUtil::bufferSize(compressed, 0); char* receivedBuffer = compressed.buffer(0).data(); ASSERT_EQ(bsl::memcmp(expectedCompressed, receivedBuffer, bufferSize), 0); @@ -295,7 +294,7 @@ eZlibCompressDecompressHelper(bsls::Types::Int64* compressionTime, bsls::Types::Int64* decompressionTime, const D& data) { - mwcu::MemOutStream error(s_allocator_p); + bmqu::MemOutStream error(s_allocator_p); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob input(&bufferFactory, s_allocator_p); bdlbb::Blob compressed(&bufferFactory, s_allocator_p); @@ -332,7 +331,7 @@ static void eZlibCompressionRatioHelper(bsls::Types::Int64* inputSize, const D& data, int level) { - mwcu::MemOutStream error(s_allocator_p); + bmqu::MemOutStream error(s_allocator_p); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob input(&bufferFactory, s_allocator_p); bdlbb::Blob compressed(&bufferFactory, s_allocator_p); @@ -389,7 +388,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { PV("NONEMPTY BUFFER"); @@ -485,7 +484,7 @@ static void test1_breathingTest() PV("NULL BUFFER"); // Test edge case of null buffer - mwcu::MemOutStream error(s_allocator_p); + bmqu::MemOutStream error(s_allocator_p); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob input(&bufferFactory, s_allocator_p); bdlbb::Blob compressed(&bufferFactory, s_allocator_p); @@ -503,7 +502,7 @@ static void test1_breathingTest() // get compressed data and compare with expected_compressed BSLS_ASSERT_SAFE(compressed.numDataBuffers() == 1); - int bufferSize = mwcu::BlobUtil::bufferSize(compressed, 0); + int bufferSize = bmqu::BlobUtil::bufferSize(compressed, 0); char* receivedBuffer = compressed.buffer(0).data(); ASSERT_EQ(bsl::memcmp(expectedCompressed, receivedBuffer, bufferSize), @@ -522,7 +521,7 @@ static void test1_breathingTest() PV("MULTIPLE BUFFERS"); // Test edge case of multiple buffers appended to a blob - mwcu::MemOutStream error(s_allocator_p); + bmqu::MemOutStream error(s_allocator_p); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob input(&bufferFactory, s_allocator_p); bdlbb::Blob compressed(&bufferFactory, s_allocator_p); @@ -559,7 +558,7 @@ static void test1_breathingTest() // get compressed data and compare with expected_compressed BSLS_ASSERT_SAFE(compressed.numDataBuffers() == 1); - int bufferSize = mwcu::BlobUtil::bufferSize(compressed, 0); + int bufferSize = bmqu::BlobUtil::bufferSize(compressed, 0); char* receivedBuffer = compressed.buffer(0).data(); ASSERT_EQ(bsl::memcmp(expectedCompressed, receivedBuffer, bufferSize), @@ -598,7 +597,7 @@ static void test2_compression_cluster_message() PV("BUFFER WITH CLUSTER MESSAGE"); // Test case with cluster message as input data - mwcu::MemOutStream error(s_allocator_p); + bmqu::MemOutStream error(s_allocator_p); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob input(&bufferFactory, s_allocator_p); bdlbb::Blob compressed(&bufferFactory, s_allocator_p); @@ -663,7 +662,7 @@ static void test3_compression_decompression_none() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("NONE TYPE ALGORITHM TEST"); + bmqtst::TestHelper::printTestName("NONE TYPE ALGORITHM TEST"); { PV("BUFFERS WITH NONEMPTY STRINGS"); @@ -737,7 +736,7 @@ static void testN1_performanceCompressionDecompressionDefault() // The default allocator check fails in this test case because the // printTable method utilizes the global allocator. - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "PERFORMANCE: COMPRESS/DECOMPRESS ON BUFFER"); const int k_NUM_ITERS = 1; @@ -751,7 +750,7 @@ static void testN1_performanceCompressionDecompressionDefault() const int length = data[i].size(); bsl::cout << "-----------------------\n" - << " SIZE = " << mwcu::PrintUtil::prettyBytes(length) + << " SIZE = " << bmqu::PrintUtil::prettyBytes(length) << '\n' << " ITERATIONS = " << k_NUM_ITERS << '\n'; @@ -783,10 +782,10 @@ static void testN1_performanceCompressionDecompressionDefault() bsl::cout << "Average Time:\n" << " Compression : " - << mwcu::PrintUtil::prettyTimeInterval(record.d_compressionTime) + << bmqu::PrintUtil::prettyTimeInterval(record.d_compressionTime) << '\n' << " Decompression : " - << mwcu::PrintUtil::prettyTimeInterval(record.d_decompressionTime) + << bmqu::PrintUtil::prettyTimeInterval(record.d_decompressionTime) << "\n\n"; } @@ -837,45 +836,45 @@ static void testN2_calculateThroughput() // cout << "=========================\n"; - cout << "For a payload of length " << mwcu::PrintUtil::prettyBytes(length) + cout << "For a payload of length " << bmqu::PrintUtil::prettyBytes(length) << ", completed " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(k_NUM_ITERS)) << " compression iterations in " - << mwcu::PrintUtil::prettyTimeInterval(compressionTotalTime) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(compressionTotalTime) << ".\n" << "Above implies that 1 compression iteration was calculated in " - << mwcu::PrintUtil::prettyTimeInterval(compressionTotalTime / + << bmqu::PrintUtil::prettyTimeInterval(compressionTotalTime / k_NUM_ITERS) << ".\nIn other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ITERS * bdlt::TimeUnitRatio::k_NS_PER_S) / compressionTotalTime)) << " iterations per second.\n" << "Compression throughput: " - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( (k_NUM_ITERS * bdlt::TimeUnitRatio::k_NS_PER_S * length) / compressionTotalTime) << " per second.\n" << endl; cout << "=========================\n"; - cout << "For a payload of length " << mwcu::PrintUtil::prettyBytes(length) + cout << "For a payload of length " << bmqu::PrintUtil::prettyBytes(length) << ", completed " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(k_NUM_ITERS)) << " decompression iterations in " - << mwcu::PrintUtil::prettyTimeInterval(decompressionTotalTime) + << bmqu::PrintUtil::prettyTimeInterval(decompressionTotalTime) << ".\nAbove implies that 1 decompression iteration was calculated " << "in " - << mwcu::PrintUtil::prettyTimeInterval(decompressionTotalTime / + << bmqu::PrintUtil::prettyTimeInterval(decompressionTotalTime / k_NUM_ITERS) << ".\nIn other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ITERS * bdlt::TimeUnitRatio::k_NS_PER_S) / decompressionTotalTime)) << " iterations per second.\n" << "Decompression throughput: " - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( (k_NUM_ITERS * bdlt::TimeUnitRatio::k_NS_PER_S * length) / decompressionTotalTime) << " per second.\n" @@ -904,7 +903,7 @@ static void testN3_performanceCompressionRatio() // The default allocator check fails in this test case because the // printTable method utilizes the global allocator. - mwctst::TestHelper::printTestName("BENCHMARK: COMPRESSION RATIO"); + bmqtst::TestHelper::printTestName("BENCHMARK: COMPRESSION RATIO"); bsl::vector data(s_allocator_p); populateData(&data); @@ -919,7 +918,7 @@ static void testN3_performanceCompressionRatio() const int length = data[i].size(); bsl::cout << "---------------------\n" - << " SIZE = " << mwcu::PrintUtil::prettyBytes(length) + << " SIZE = " << bmqu::PrintUtil::prettyBytes(length) << '\n' << "---------------------\n"; @@ -945,10 +944,10 @@ static void testN3_performanceCompressionRatio() tableRecords.push_back(record); bsl::cout << "Input Size : " - << mwcu::PrintUtil::prettyBytes(record.d_inputSize) + << bmqu::PrintUtil::prettyBytes(record.d_inputSize) << '\n' << "Compressed Size : " - << mwcu::PrintUtil::prettyBytes(record.d_compressedSize) + << bmqu::PrintUtil::prettyBytes(record.d_compressedSize) << '\n' << "Compression Ratio : " << record.d_compressionRatio << "\n\n"; @@ -989,7 +988,7 @@ static void testN1_performanceCompressionDecompressionDefault_GoogleBenchmark( // The default allocator check fails in this test case because the // printTable method utilizes the global allocator. - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE: " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE: " "COMPRESS/DECOMPRESS ON BUFFER"); const int length = state.range(0); bsl::string str("", s_allocator_p); @@ -1026,7 +1025,7 @@ static void testN2_calculateThroughput_GoogleBenchmark(benchmark::State& state) // implementation in a single thread environment. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK THROUGHPUT: " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK THROUGHPUT: " "COMPRESS/DECOMPRESS ON BUFFER"); size_t length = 1024; // 1 Ki @@ -1050,7 +1049,7 @@ static void testN2_calculateThroughput_GoogleBenchmark(benchmark::State& state) int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -1058,17 +1057,17 @@ int main(int argc, char* argv[]) case 2: test2_compression_cluster_message(); break; case 3: test3_compression_decompression_none(); break; case -1: - MWC_BENCHMARK_WITH_ARGS( + BMQTST_BENCHMARK_WITH_ARGS( testN1_performanceCompressionDecompressionDefault, Unit(benchmark::kMillisecond) ->RangeMultiplier(2) ->Range(2, 1073741824)); // 2^30 break; case -2: - MWC_BENCHMARK_WITH_ARGS(testN2_calculateThroughput, - RangeMultiplier(10) - ->Range(100, 1000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN2_calculateThroughput, + RangeMultiplier(10) + ->Range(100, 1000000) + ->Unit(benchmark::kMillisecond)); break; case -3: testN3_performanceCompressionRatio(); break; default: { @@ -1082,7 +1081,7 @@ int main(int argc, char* argv[]) benchmark::RunSpecifiedBenchmarks(); } #endif - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } // ---------------------------------------------------------------------------- diff --git a/src/groups/bmq/bmqp/bmqp_confirmeventbuilder.cpp b/src/groups/bmq/bmqp/bmqp_confirmeventbuilder.cpp index 51886d0cb..ceadeec7d 100644 --- a/src/groups/bmq/bmqp/bmqp_confirmeventbuilder.cpp +++ b/src/groups/bmq/bmqp/bmqp_confirmeventbuilder.cpp @@ -20,9 +20,8 @@ // BMQ #include -// MWC -#include -#include +#include +#include // BDE #include @@ -87,10 +86,10 @@ ConfirmEventBuilder::appendMessage(int queueId, } // Resize the blob to have space for an 'ConfirmMessage' at the end ... - mwcu::BlobPosition offset; - mwcu::BlobUtil::reserve(&offset, &d_blob, sizeof(ConfirmMessage)); + bmqu::BlobPosition offset; + bmqu::BlobUtil::reserve(&offset, &d_blob, sizeof(ConfirmMessage)); - mwcu::BlobObjectProxy confirmMessage(&d_blob, + bmqu::BlobObjectProxy confirmMessage(&d_blob, offset, false, // no read true); // write mode diff --git a/src/groups/bmq/bmqp/bmqp_confirmeventbuilder.t.cpp b/src/groups/bmq/bmqp/bmqp_confirmeventbuilder.t.cpp index 5a0d4a8ca..22684b06d 100644 --- a/src/groups/bmq/bmqp/bmqp_confirmeventbuilder.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_confirmeventbuilder.t.cpp @@ -22,8 +22,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -36,7 +35,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -133,7 +132,7 @@ static void verifyContent(const bmqp::ConfirmEventBuilder& builder, static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(256, s_allocator_p); bmqp::ConfirmEventBuilder obj(&bufferFactory, s_allocator_p); @@ -154,7 +153,7 @@ static void test1_breathingTest() static void test2_multiMessage() { - mwctst::TestHelper::printTestName("MULTI MESSAGE"); + bmqtst::TestHelper::printTestName("MULTI MESSAGE"); // Create a ConfirmEvent with multiple messages. Iterate and verify. const int k_NUM_MSGS = 1000; @@ -172,7 +171,7 @@ static void test2_multiMessage() static void test3_reset() { - mwctst::TestHelper::printTestName("RESET"); + bmqtst::TestHelper::printTestName("RESET"); // Verifying reset: add two messages, reset, and add another message. bdlbb::PooledBlobBufferFactory bufferFactory(256, s_allocator_p); @@ -200,7 +199,7 @@ static void test3_reset() static void test4_capacity() { - mwctst::TestHelper::printTestName("CAPACITY"); + bmqtst::TestHelper::printTestName("CAPACITY"); // Verify that once the event is full, AppendMessage returns error. int rc; @@ -255,13 +254,13 @@ static void testN1_decodeFromFile() // with expected properties. // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DECODE FROM FILE"); + bmqtst::TestHelper::printTestName("DECODE FROM FILE"); bdlbb::PooledBlobBufferFactory bufferFactory(256, s_allocator_p); bmqp::ConfirmEventBuilder obj(&bufferFactory, s_allocator_p); bsl::vector messages(s_allocator_p); bdlbb::Blob outBlob(&bufferFactory, s_allocator_p); - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); bdlb::Guid guid = bdlb::GuidUtil::generate(); const int k_NUM_MSGS = 10; @@ -350,7 +349,7 @@ static void testN1_decodeFromFile() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -365,5 +364,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_confirmmessageiterator.cpp b/src/groups/bmq/bmqp/bmqp_confirmmessageiterator.cpp index 7963144b4..864636b0d 100644 --- a/src/groups/bmq/bmqp/bmqp_confirmmessageiterator.cpp +++ b/src/groups/bmq/bmqp/bmqp_confirmmessageiterator.cpp @@ -136,7 +136,7 @@ int ConfirmMessageIterator::reset(const bdlbb::Blob* blob, // in the header }; - d_blobIter.reset(blob, mwcu::BlobPosition(), blob->length(), true); + d_blobIter.reset(blob, bmqu::BlobPosition(), blob->length(), true); // Skip the EventHeader to point to the ConfirmHeader bool rc = d_blobIter.advance(eventHeader.headerWords() * @@ -210,7 +210,7 @@ void ConfirmMessageIterator::dumpBlob(bsl::ostream& stream) // For now, print only the beginning of the blob.. we may later on print // also the bytes around the current position if (d_blobIter.blob()) { - stream << mwcu::BlobStartHexDumper(d_blobIter.blob(), + stream << bmqu::BlobStartHexDumper(d_blobIter.blob(), k_MAX_BYTES_DUMP); } else { diff --git a/src/groups/bmq/bmqp/bmqp_confirmmessageiterator.h b/src/groups/bmq/bmqp/bmqp_confirmmessageiterator.h index 91f772374..9886cc35f 100644 --- a/src/groups/bmq/bmqp/bmqp_confirmmessageiterator.h +++ b/src/groups/bmq/bmqp/bmqp_confirmmessageiterator.h @@ -59,10 +59,9 @@ #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -81,14 +80,14 @@ namespace bmqp { class ConfirmMessageIterator { private: // DATA - mwcu::BlobIterator d_blobIter; + bmqu::BlobIterator d_blobIter; // Blob iterator pointing to the // current message in the blob. - mwcu::BlobObjectProxy d_header; + bmqu::BlobObjectProxy d_header; // Header - mwcu::BlobObjectProxy d_message; + bmqu::BlobObjectProxy d_message; // Current message int d_advanceLength; @@ -175,7 +174,7 @@ class ConfirmMessageIterator { // CREATORS inline ConfirmMessageIterator::ConfirmMessageIterator() -: d_blobIter(0, mwcu::BlobPosition(), 0, true) +: d_blobIter(0, bmqu::BlobPosition(), 0, true) , d_advanceLength(0) { // NOTHING @@ -184,7 +183,7 @@ inline ConfirmMessageIterator::ConfirmMessageIterator() inline ConfirmMessageIterator::ConfirmMessageIterator( const bdlbb::Blob* blob, const EventHeader& eventHeader) -: d_blobIter(0, mwcu::BlobPosition(), 0, true) // no def ctor - set in reset +: d_blobIter(0, bmqu::BlobPosition(), 0, true) // no def ctor - set in reset { reset(blob, eventHeader); } @@ -192,7 +191,7 @@ inline ConfirmMessageIterator::ConfirmMessageIterator( inline ConfirmMessageIterator::ConfirmMessageIterator( const ConfirmMessageIterator& src) : d_blobIter(0, - mwcu::BlobPosition(), + bmqu::BlobPosition(), 0, true) // no def ctor - set in copyFrom { @@ -209,7 +208,7 @@ ConfirmMessageIterator::operator=(const ConfirmMessageIterator& rhs) inline void ConfirmMessageIterator::clear() { - d_blobIter.reset(0, mwcu::BlobPosition(), 0, true); + d_blobIter.reset(0, bmqu::BlobPosition(), 0, true); d_header.reset(); d_message.reset(); d_advanceLength = 0; diff --git a/src/groups/bmq/bmqp/bmqp_confirmmessageiterator.t.cpp b/src/groups/bmq/bmqp/bmqp_confirmmessageiterator.t.cpp index 05558801d..dcccb2177 100644 --- a/src/groups/bmq/bmqp/bmqp_confirmmessageiterator.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_confirmmessageiterator.t.cpp @@ -27,11 +27,10 @@ #include #include -// MWC -#include +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -189,7 +188,7 @@ static void populateBlob(bdlbb::Blob* blob, static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -295,7 +294,7 @@ static void test1_breathingTest() static void test2_multiConfirm() { - mwctst::TestHelper::printTestName("MULTI CONFIRM"); + bmqtst::TestHelper::printTestName("MULTI CONFIRM"); // Test iterating over CONFIRM event having multiple CONFIRM messages @@ -350,7 +349,7 @@ static void test3_nextMethod() // Testing: // int next(); // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("NEXT METHOD"); + bmqtst::TestHelper::printTestName("NEXT METHOD"); // Test iterating over CONFIRM event having multiple CONFIRM messages @@ -425,7 +424,7 @@ static void test4_resetMethod() // Testing: // int reset(); // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("RESET METHOD"); + bmqtst::TestHelper::printTestName("RESET METHOD"); // Default values for event header bmqp::EventHeader eventHeader; @@ -506,12 +505,12 @@ static void test5_dumpBlob() // Testing: // void dumpBlob(bsl::ostream& stream); // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("DUMB BLOB"); + bmqtst::TestHelper::printTestName("DUMB BLOB"); // Test iterator dump contains expected value bmqp::EventHeader eventHeader; - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); const int qId = 54321; const bmqt::MessageGUID guid; const int sQId = 123; @@ -561,7 +560,7 @@ static void test5_dumpBlob() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -576,5 +575,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_controlmessageutil.t.cpp b/src/groups/bmq/bmqp/bmqp_controlmessageutil.t.cpp index d37cbebe8..d624fe1c3 100644 --- a/src/groups/bmq/bmqp/bmqp_controlmessageutil.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_controlmessageutil.t.cpp @@ -20,7 +20,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -48,7 +48,7 @@ static void test1_validate() // validate // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("VALIDATE"); + bmqtst::TestHelper::printTestName("VALIDATE"); struct Test { int d_line; @@ -113,7 +113,7 @@ static void test2_makeStatusControlMessage() // makeStatusControlMessage // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("MAKE STATUS CONTROL MESSAGE"); + bmqtst::TestHelper::printTestName("MAKE STATUS CONTROL MESSAGE"); struct Test { int d_line; @@ -156,7 +156,7 @@ static void test2_makeStatusControlMessage() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -168,5 +168,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_crc32c.t.cpp b/src/groups/bmq/bmqp/bmqp_crc32c.t.cpp index 723bfc597..e9f3017eb 100644 --- a/src/groups/bmq/bmqp/bmqp_crc32c.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_crc32c.t.cpp @@ -17,12 +17,11 @@ #include // TEST DRIVER -#include +#include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -247,7 +246,7 @@ static void printTableRows(bsl::ostream& out, // PRECONDITIONS BSLS_ASSERT_SAFE(headerCols.size() == 4); - mwcu::OutStreamFormatSaver fmtSaver(out); + bmqu::OutStreamFormatSaver fmtSaver(out); out << bsl::right << bsl::fixed; @@ -309,7 +308,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { PV("BUFFER"); @@ -492,7 +491,7 @@ static void test2_calculateOnBuffer() // both the default and software flavors for calculating CRC32-C. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CALCULATE CRC32-C ON BUFFER"); + bmqtst::TestHelper::printTestName("CALCULATE CRC32-C ON BUFFER"); struct Test { int d_line; @@ -601,7 +600,7 @@ static void test3_calculateOnMisalignedBuffer() // unsigned int crc = k_NULL_CRC32C); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "CALCULATE CRC32-C ON MISALIGNED BUFFER"); const int k_BUFFER_SIZE = 1024; @@ -712,7 +711,7 @@ static void test3_calculateOnMisalignedBuffer() /// ------------------------------------------------------------------------ static void test4_calculateOnBufferWithPreviousCrc() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "CALCULATE CRC32-C ON BUFFER WITH PREVIOUS CRC"); struct Test { @@ -856,7 +855,7 @@ static void test5_multithreadedCrc32cDefault() // 'bslmt::ThreadUtil::create()' uses the global allocator to allocate // memory. - mwctst::TestHelper::printTestName("MULTITHREAD DEFAULT CRC32-C"); + bmqtst::TestHelper::printTestName("MULTITHREAD DEFAULT CRC32-C"); enum { k_NUM_PAYLOADS = 10000, k_NUM_THREADS = 10 }; @@ -949,7 +948,7 @@ static void test6_multithreadedCrc32cSoftware() // 'bslmt::ThreadUtil::create()' uses the global allocator to allocate // memory. - mwctst::TestHelper::printTestName("MULTITHREAD SOFTWARE CRC32-C"); + bmqtst::TestHelper::printTestName("MULTITHREAD SOFTWARE CRC32-C"); enum { k_NUM_PAYLOADS = 10000, k_NUM_THREADS = 10 }; @@ -1036,7 +1035,7 @@ static void test7_calculateOnBlob() // both the default and software flavors. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "CALCULATE CRC32-C ON BLOB w/o PREVIOUS CRC"); { @@ -1160,7 +1159,7 @@ static void test8_calculateOnBlobWithPreviousCrc() // using both the default and software flavors. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "CALCULATE CRC32-C ON BLOB WITH PREVIOUS CRC"); { @@ -1302,7 +1301,7 @@ static void testN1_performanceDefaultUserInput() // on an user input. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "PERFORMANCE: CALCULATE CRC32-C DEFAULT ON USER INPUT"); cout << "Please enter the string:" << endl << "> "; @@ -1348,7 +1347,7 @@ static void testN2_performanceDefault() // Performance of calculating CRC32-C using the default implementation. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "PERFORMANCE: CALCULATE CRC32-C ON BUFFER DEFAULT"); const int k_NUM_ITERS = 100000; // 100K @@ -1464,7 +1463,7 @@ static void testN3_defaultCalculateThroughput() // implementation in a single thread environment. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "BENCHMARK: CALCULATE CRC32-C THROUGPUT DEFAULT"); const bsls::Types::Uint64 k_NUM_ITERS = 1000000; // 1M @@ -1497,15 +1496,15 @@ static void testN3_defaultCalculateThroughput() cout << "=========================\n"; cout << "For a payload of length " << bufLen << ", completed " << k_NUM_ITERS << " HW-version iterations in " - << mwcu::PrintUtil::prettyTimeInterval(diffDef) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(diffDef) << ".\n" << "Above implies that 1 HW-version iteration was calculated in " << diffDef / k_NUM_ITERS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ITERS * bdlt::TimeUnitRatio::k_NS_PER_S) / diffDef)) << " HW-version iterations per second." << endl << "HW-version throughput: " - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( (k_NUM_ITERS * bdlt::TimeUnitRatio::k_NS_PER_S * bufLen) / diffDef) << " per second.\n\n" @@ -1535,7 +1534,7 @@ static void testN3_softwareCalculateThroughput() // software implementation in a single thread environment. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "BENCHMARK: CALCULATE CRC32-C THROUGPUT SOFTWARE"); const bsls::Types::Uint64 k_NUM_ITERS = 1000000; // 1M @@ -1560,15 +1559,15 @@ static void testN3_softwareCalculateThroughput() cout << "=========================\n"; cout << "For a payload of length " << bufLen << ", completed " << k_NUM_ITERS << " SW-version iterations in " - << mwcu::PrintUtil::prettyTimeInterval(diffSW) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(diffSW) << ".\n" << "Above implies that 1 SW-version iteration was calculated in " << diffSW / k_NUM_ITERS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ITERS * bdlt::TimeUnitRatio::k_NS_PER_S) / diffSW)) << " SW-version iterations per second." << endl << "SW-version throughput: " - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( (k_NUM_ITERS * bdlt::TimeUnitRatio::k_NS_PER_S * bufLen) / diffSW) << " per second.\n" @@ -1599,7 +1598,7 @@ static void testN3_bdldCalculateThroughput() // BDE implementation in a single thread environment. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "BENCHMARK: CALCULATE CRC32-C THROUGPUT BDE"); const bsls::Types::Uint64 k_NUM_ITERS = 1000000; // 1M @@ -1629,15 +1628,15 @@ static void testN3_bdldCalculateThroughput() cout << "==========================\n"; cout << "For a payload of length " << bufLen << ", completed " << k_NUM_ITERS << " BDE-version iterations in " - << mwcu::PrintUtil::prettyTimeInterval(diffBde) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(diffBde) << ".\n" << "Above implies that 1 BDE-version iteration was calculated in " << diffBde / k_NUM_ITERS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ITERS * bdlt::TimeUnitRatio::k_NS_PER_S) / diffBde)) << " BDE-version iterations per second." << endl << "BDE-version throughput: " - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( (k_NUM_ITERS * bdlt::TimeUnitRatio::k_NS_PER_S * bufLen) / diffBde) << " per second.\n" @@ -1666,7 +1665,7 @@ static void testN4_calculateSerialDefault() // Performance of crc32c calculation using the default implementation // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "PERFORMANCE: CALCULATE CRC32-C DEFAULT"); const int k_NUM_ITERS = 100000; // 100K @@ -1748,7 +1747,7 @@ static void testN4_calculateHardwareSerial() // Performance of crc32c calculation using the 'hardware serial' approach // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "PERFORMANCE: CALCULATE CRC32-C HARDWARE SERIAL"); const int k_NUM_ITERS = 100000; // 100K @@ -1835,7 +1834,7 @@ static void testN5_bmqpPerformanceSoftware() // Performance of calculating CRC32-C using the software implementation. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "PERFORMANCE: CALCULATE CRC32-C ON BUFFER SOFTWARE"); const int k_NUM_ITERS = 100000; // 100K @@ -1922,7 +1921,7 @@ static void testN5_bdldPerformanceSoftware() // Performance of calculating CRC32-C using the bdlde::crc32 implementation. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "PERFORMANCE: CALCULATE CRC32-C ON BUFFER SOFTWARE"); const int k_NUM_ITERS = 100000; // 100K @@ -2014,7 +2013,7 @@ static void testN6_bmqpPerformanceDefault() { s_ignoreCheckDefAlloc = true; s_ignoreCheckGblAlloc = true; - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "PERFORMANCE: CALCULATE CRC32-C ON BUFFER DEFAULT"); const int k_NUM_ITERS = 100000; // 100K @@ -2104,7 +2103,7 @@ static void testN6_bdldPerformanceDefault() { s_ignoreCheckDefAlloc = true; s_ignoreCheckGblAlloc = true; - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "PERFORMANCE: CALCULATE CRC32-C ON BUFFER BDE"); const int k_NUM_ITERS = 100000; // 100K @@ -2187,7 +2186,7 @@ testN1_performanceDefaultUserInput_GoogleBenchmark(benchmark::State& state) // on an user input. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "GOOGLE BENCHMARK PERFORMANCE: " "CALCULATE CRC32-C DEFAULT ON USER INPUT"); @@ -2227,7 +2226,7 @@ testN3_defaultCalculateThroughput_GoogleBenchmark(benchmark::State& state) // implementation in a single thread environment. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK: " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK: " "CALCULATE CRC32-C THROUGHPUT DEFAULT"); for (auto _ : state) { const int bufLen = 12345; @@ -2248,7 +2247,7 @@ testN3_softwareCalculateThroughput_GoogleBenchmark(benchmark::State& state) { //=======================================================================// // [2] Crc32c (software) - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK: " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK: " "CALCULATE CRC32-C THROUGHPUT SOFTWARE"); for (auto _ : state) { const int bufLen = 12345; @@ -2270,7 +2269,7 @@ testN3_bdldCalculateThroughput_GoogleBenchmark(benchmark::State& state) { //=======================================================================// // [3] BDE bdlde::crc32 - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK: " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK: " "CALCULATE CRC32-C THROUGPUT BDE"); const int bufLen = 12345; @@ -2308,7 +2307,7 @@ testN4_calculateSerialDefault_GoogleBenchmark(benchmark::State& state) // Performance of crc32c calculation using the default implementation // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE: " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE: " "CALCULATE CRC32-C DEFAULT"); const int k_MAX_SIZE = 67108864; // 64 Mi @@ -2351,7 +2350,7 @@ testN4_calculateHardwareSerial_GoogleBenchmark(benchmark::State& state) // approach. // ------------------------------------------------------------------------ // [2] Crc32c (hardware serial) - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE: " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE: " "CALCULATE CRC32-C HARDWARE SERIAL"); const int k_MAX_SIZE = 67108864; // 64 Mi @@ -2391,7 +2390,7 @@ testN5_bmqpPerformanceSoftware_GoogleBenchmark(benchmark::State& state) // Performance of calculating CRC32-C using the software implementation. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE: " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE: " "CALCULATE CRC32-C ON BUFFER SOFTWARE"); const int k_MAX_SIZE = 67108864; // 64 Mi @@ -2432,7 +2431,7 @@ testN5_bdldPerformanceSoftware_GoogleBenchmark(benchmark::State& state) // Performance of calculating CRC32-C using the BDE software implementation. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "GOOGLE BENCHMARK PERFORMANCE: " "CALCULATE CRC32-C ON BUFFER SOFTWARE BDE"); @@ -2482,7 +2481,7 @@ testN6_bmqpPerformanceDefault_GoogleBenchmark(benchmark::State& state) // Performance of calculating CRC32-C using the default implementation. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE: " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE: " "CALCULATE CRC32-C ON BUFFER DEFAULT"); const int k_MAX_SIZE = 67108864; // 64 Mi @@ -2511,7 +2510,7 @@ testN6_bdldPerformanceDefault_GoogleBenchmark(benchmark::State& state) { //===================================================================// // [2] BDE bdlde::crc32 - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE: " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE: " "CALCULATE CRC32-C ON BUFFER BDE"); const int k_MAX_SIZE = 67108864; // 64 Mi @@ -2546,7 +2545,7 @@ int main(int argc, char* argv[]) // case where the associated logging infrastructure triggers a default // allocation violation for no apparent reason. - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); size_t seed = bsl::time(0); PV("Seed: " << seed); @@ -2562,43 +2561,43 @@ int main(int argc, char* argv[]) case 3: test3_calculateOnMisalignedBuffer(); break; case 2: test2_calculateOnBuffer(); break; case 1: test1_breathingTest(); break; - case -1: MWC_BENCHMARK(testN1_performanceDefaultUserInput); break; + case -1: BMQTST_BENCHMARK(testN1_performanceDefaultUserInput); break; case -2: testN2_performanceDefault(); break; case -3: - MWC_BENCHMARK_WITH_ARGS(testN3_defaultCalculateThroughput, - RangeMultiplier(10) - ->Range(10, 1000000) - ->Unit(benchmark::kMillisecond)); - MWC_BENCHMARK_WITH_ARGS(testN3_softwareCalculateThroughput, - RangeMultiplier(10) - ->Range(10, 1000000) - ->Unit(benchmark::kMillisecond)); - MWC_BENCHMARK_WITH_ARGS(testN3_bdldCalculateThroughput, - RangeMultiplier(10) - ->Range(10, 1000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN3_defaultCalculateThroughput, + RangeMultiplier(10) + ->Range(10, 1000000) + ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN3_softwareCalculateThroughput, + RangeMultiplier(10) + ->Range(10, 1000000) + ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN3_bdldCalculateThroughput, + RangeMultiplier(10) + ->Range(10, 1000000) + ->Unit(benchmark::kMillisecond)); break; case -4: - MWC_BENCHMARK_WITH_ARGS( + BMQTST_BENCHMARK_WITH_ARGS( testN4_calculateSerialDefault, Apply(populateBufferLengthsSorted_GoogleBenchmark_Small)); - MWC_BENCHMARK_WITH_ARGS( + BMQTST_BENCHMARK_WITH_ARGS( testN4_calculateHardwareSerial, Apply(populateBufferLengthsSorted_GoogleBenchmark_Small)); break; case -5: - MWC_BENCHMARK_WITH_ARGS( + BMQTST_BENCHMARK_WITH_ARGS( testN5_bmqpPerformanceSoftware, Apply(populateBufferLengthsSorted_GoogleBenchmark_Small)); - MWC_BENCHMARK_WITH_ARGS( + BMQTST_BENCHMARK_WITH_ARGS( testN5_bdldPerformanceSoftware, Apply(populateBufferLengthsSorted_GoogleBenchmark_Small)); break; case -6: - MWC_BENCHMARK_WITH_ARGS( + BMQTST_BENCHMARK_WITH_ARGS( testN6_bmqpPerformanceDefault, Apply(populateBufferLengthsSorted_GoogleBenchmark_Large)); - MWC_BENCHMARK_WITH_ARGS( + BMQTST_BENCHMARK_WITH_ARGS( testN6_bdldPerformanceDefault, Apply(populateBufferLengthsSorted_GoogleBenchmark_Large)); break; @@ -2613,5 +2612,5 @@ int main(int argc, char* argv[]) benchmark::RunSpecifiedBenchmarks(); } #endif - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_event.h b/src/groups/bmq/bmqp/bmqp_event.h index bb250bd4b..44e2a89c2 100644 --- a/src/groups/bmq/bmqp/bmqp_event.h +++ b/src/groups/bmq/bmqp/bmqp_event.h @@ -40,10 +40,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -86,7 +85,7 @@ class Event { // the blob represented by this event // (as specified upon construction). - mwcu::BlobObjectProxy d_header; + bmqu::BlobObjectProxy d_header; // Event Header from this blob (or // unset if the blob/event is // invalid). @@ -258,7 +257,7 @@ inline void Event::initialize(const bdlbb::Blob* blob, bool clone) // the struct bytes (-1 parameter), and then resizing the proxy to match // the size declared in the header d_header.reset(d_blob_p, - mwcu::BlobPosition(), + bmqu::BlobPosition(), -EventHeader::k_MIN_HEADER_SIZE, true, false); @@ -330,7 +329,7 @@ int Event::loadSchemaEvent(TYPE* message) const encodingType = EventHeaderUtil::controlEventEncodingType(*d_header); } - mwcu::MemOutStream os; + bmqu::MemOutStream os; int rc = ProtocolUtil::decodeMessage(os, message, *d_blob_p, diff --git a/src/groups/bmq/bmqp/bmqp_event.t.cpp b/src/groups/bmq/bmqp/bmqp_event.t.cpp index fffab624b..3b16be0b9 100644 --- a/src/groups/bmq/bmqp/bmqp_event.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_event.t.cpp @@ -21,8 +21,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -33,7 +32,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -45,7 +44,7 @@ using namespace bsl; static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::Blob blob(s_allocator_p); @@ -133,7 +132,7 @@ static void test1_breathingTest() static void test2_isValid() { - mwctst::TestHelper::printTestName("IS VALID"); + bmqtst::TestHelper::printTestName("IS VALID"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -202,7 +201,7 @@ static void test3_eventTypes() // bmqp::Event::isHeartbeatRspEvent() // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("EVENT TYPES"); + bmqtst::TestHelper::printTestName("EVENT TYPES"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -507,7 +506,7 @@ static void test4_eventLoading() // int bmqp::Event::loadElectorEvent(TYPE *message) const // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("EVENT LOADING"); + bmqtst::TestHelper::printTestName("EVENT LOADING"); // Disable check that no memory was allocated from the default allocator s_ignoreCheckDefAlloc = true; // baljsn::Encoder constructor does not pass the allocator to the @@ -643,7 +642,7 @@ static void test5_iteratorLoading() // RecoveryMessageIterator *iterator) const // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("ITERATOR LOADING"); + bmqtst::TestHelper::printTestName("ITERATOR LOADING"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -762,7 +761,7 @@ static void test6_printing() // const bmqp::Event& rhs) // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); BSLMF_ASSERT(bmqp::EventType::e_CONTROL == bmqp::EventType::k_LOWEST_SUPPORTED_EVENT_TYPE); @@ -797,8 +796,8 @@ static void test6_printing() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); bmqp::EventHeader eh(static_cast(test.d_type)); bdlbb::Blob blob(&bufferFactory, s_allocator_p); @@ -838,7 +837,7 @@ static void test6_printing() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -854,5 +853,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_eventutil.cpp b/src/groups/bmq/bmqp/bmqp_eventutil.cpp index 099e13114..6ffcb0bf3 100644 --- a/src/groups/bmq/bmqp/bmqp_eventutil.cpp +++ b/src/groups/bmq/bmqp/bmqp_eventutil.cpp @@ -25,8 +25,7 @@ #include #include -// MWC -#include +#include // BDE #include diff --git a/src/groups/bmq/bmqp/bmqp_eventutil.t.cpp b/src/groups/bmq/bmqp/bmqp_eventutil.t.cpp index 348e94dfd..cdaa48d0c 100644 --- a/src/groups/bmq/bmqp/bmqp_eventutil.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_eventutil.t.cpp @@ -38,7 +38,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -246,7 +246,7 @@ static void test1_breathingTest() // Basic functionality of 'flattenPushEvent(...)'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqp::PushEventBuilder pushEventBuilder(&bufferFactory, s_allocator_p); @@ -432,7 +432,7 @@ static void test2_flattenExplodesEvent() // - 'flattenPushEvent(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("FLATTEN EXPLODES EVENT"); + bmqtst::TestHelper::printTestName("FLATTEN EXPLODES EVENT"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqp::PushEventBuilder pushEventBuilder(&bufferFactory, s_allocator_p); @@ -639,7 +639,7 @@ static void test3_flattenWithMessageProperties() // - 'flattenPushEvent(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("FLATTEN WITH MESSAGE PROPERTIES"); + bmqtst::TestHelper::printTestName("FLATTEN WITH MESSAGE PROPERTIES"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqp::MessageProperties msgProperties(s_allocator_p); @@ -785,7 +785,7 @@ static void test3_flattenWithMessageProperties() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); @@ -806,5 +806,5 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_messageguidgenerator.cpp b/src/groups/bmq/bmqp/bmqp_messageguidgenerator.cpp index f19973245..ea7230dda 100644 --- a/src/groups/bmq/bmqp/bmqp_messageguidgenerator.cpp +++ b/src/groups/bmq/bmqp/bmqp_messageguidgenerator.cpp @@ -17,9 +17,9 @@ #include #include -// MWC -#include -#include + +#include +#include // BDE #include @@ -85,7 +85,7 @@ MessageGUIDGenerator::MessageGUIDGenerator(int sessionId, bool doIpResolving) // Get hostname bsl::string hostname; - ntsa::Error error = mwcio::ResolveUtil::getHostname(&hostname); + ntsa::Error error = bmqio::ResolveUtil::getHostname(&hostname); if (error.code() != ntsa::Error::e_OK) { BALL_LOG_ERROR << "Failed to get local hostname, error: " << error; @@ -98,7 +98,7 @@ MessageGUIDGenerator::MessageGUIDGenerator(int sessionId, bool doIpResolving) bool useIP = doIpResolving; if (doIpResolving) { - error = mwcio::ResolveUtil::getIpAddress(&defaultIP, hostname); + error = bmqio::ResolveUtil::getIpAddress(&defaultIP, hostname); if (error.code() != ntsa::Error::e_OK) { // IP address retrieval can fail in case process is running in a @@ -148,7 +148,7 @@ MessageGUIDGenerator::MessageGUIDGenerator(int sessionId, bool doIpResolving) // NOTE: since we know the size, the `defaultAllocator` will never be // used here bdlma::LocalSequentialAllocator localAllocator(0); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); bdlb::Print::singleLineHexDump(os, d_clientId, k_CLIENT_ID_LEN_BINARY); bsl::memcpy(d_clientIdHex, os.str().data(), os.str().length()); @@ -253,7 +253,7 @@ int MessageGUIDGenerator::extractFields(int* version, // ClientId bdlma::LocalSequentialAllocator localAlloc(0); - mwcu::MemOutStream os(&localAlloc); + bmqu::MemOutStream os(&localAlloc); bdlb::Print::singleLineHexDump(os, buffer, k_CLIENT_ID_LEN_BINARY); clientId->assign(os.str()); diff --git a/src/groups/bmq/bmqp/bmqp_messageguidgenerator.t.cpp b/src/groups/bmq/bmqp/bmqp_messageguidgenerator.t.cpp index 009b61bf3..232a0411b 100644 --- a/src/groups/bmq/bmqp/bmqp_messageguidgenerator.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_messageguidgenerator.t.cpp @@ -19,10 +19,9 @@ // BMQ #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -44,7 +43,7 @@ #include // TEST DRIVER -#include +#include // BENCHMARKING LIBRARY #ifdef BSLS_PLATFORM_OS_LINUX @@ -407,11 +406,11 @@ HashBenchmarkStats benchmarkHash(const bsl::string& name) cout << "Calculated " << stats.d_numIterations << " <" << stats.d_caseName << "> hashes of the GUID in " - << mwcu::PrintUtil::prettyTimeInterval(stats.d_timeDeltaNs) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(stats.d_timeDeltaNs) << ".\n" << "Above implies that 1 hash of the GUID was calculated in " << stats.d_timePerHashNs << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(stats.d_hashesPerSecond) + << bmqu::PrintUtil::prettyNumber(stats.d_hashesPerSecond) << " hashes per second." << endl; return stats; @@ -468,7 +467,7 @@ static void test1_breathingTest() // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bmqp::MessageGUIDGenerator generator(0); @@ -534,7 +533,7 @@ static void test2_extract() { s_ignoreCheckDefAlloc = true; // Implicit string conversion in ASSERT_EQ - mwctst::TestHelper::printTestName("EXTRACT"); + bmqtst::TestHelper::printTestName("EXTRACT"); { PVV("All 0s"); @@ -657,7 +656,7 @@ static void test3_multithreadUseIP() // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("MULTITHREAD"); + bmqtst::TestHelper::printTestName("MULTITHREAD"); const int k_NUM_THREADS = 10; @@ -673,7 +672,7 @@ static void test3_multithreadUseIP() // GCC-supported macros for checking MSAN const int k_NUM_GUIDS = 500000; // 500k #else - const int k_NUM_GUIDS = 1000000; // 1M + const int k_NUM_GUIDS = 1000000; // 1M #endif bslmt::ThreadGroup threadGroup(s_allocator_p); @@ -739,7 +738,7 @@ static void test4_multithreadUseHostname() // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("MULTITHREAD"); + bmqtst::TestHelper::printTestName("MULTITHREAD"); const int k_NUM_THREADS = 10; @@ -751,7 +750,7 @@ static void test4_multithreadUseHostname() // GCC-supported macros for checking MSAN const int k_NUM_GUIDS = 500000; // 500k #else - const int k_NUM_GUIDS = 1000000; // 1M + const int k_NUM_GUIDS = 1000000; // 1M #endif bslmt::ThreadGroup threadGroup(s_allocator_p); @@ -809,7 +808,7 @@ static void test5_print() // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); bmqp::MessageGUIDGenerator generator(0); @@ -818,7 +817,7 @@ static void test5_print() bmqt::MessageGUID guid; ASSERT_EQ(guid.isUnset(), true); - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); bmqp::MessageGUIDGenerator::print(out, guid); ASSERT_EQ(out.str(), "** UNSET **"); } @@ -838,7 +837,7 @@ static void test5_print() // Print and compare const char k_EXPECTED[] = "1-2964169-297593876864458-0DCE04742D2E"; - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); bmqp::MessageGUIDGenerator::print(out, guid); ASSERT_EQ(out.str(), k_EXPECTED); } @@ -858,7 +857,7 @@ static void test5_print() // Print and compare const char k_EXPECTED[] = "[Unsupported GUID version 0]"; - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); bmqp::MessageGUIDGenerator::print(out, guid); ASSERT_EQ(out.str(), k_EXPECTED); } @@ -868,7 +867,7 @@ static void test5_print() bmqt::MessageGUID guid; generator.generateGUID(&guid); - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); bmqp::MessageGUIDGenerator::print(out, guid); PVV("Output: '" << out.str() << "', GUID " << guid); @@ -890,8 +889,8 @@ static void test5_print() // Print and compare const char k_EXPECTED_1[] = "1-0-0-000000000001"; const char k_EXPECTED_2[] = "1-0-0-000000000002"; - mwcu::MemOutStream out1(s_allocator_p); - mwcu::MemOutStream out2(s_allocator_p); + bmqu::MemOutStream out1(s_allocator_p); + bmqu::MemOutStream out2(s_allocator_p); bmqp::MessageGUIDGenerator::print(out1, guid1); bmqp::MessageGUIDGenerator::print(out2, guid2); @@ -920,7 +919,7 @@ static void test6_defaultHashUniqueness() // created upon insertion of objects in the map uses the default // allocator. - mwctst::TestHelper::printTestName("DEFAULT HASH UNIQUENESS"); + bmqtst::TestHelper::printTestName("DEFAULT HASH UNIQUENESS"); #if defined(__has_feature) // Avoid timeout under MemorySanitizer @@ -1009,7 +1008,7 @@ static void test7_customHashUniqueness() // created upon insertion of objects in the map uses the default // allocator. - mwctst::TestHelper::printTestName("CUSTOM HASH UNIQUENESS"); + bmqtst::TestHelper::printTestName("CUSTOM HASH UNIQUENESS"); #if defined(__has_feature) // Avoid timeout under MemorySanitizer @@ -1104,7 +1103,7 @@ static void testN1_decode() { s_ignoreCheckDefAlloc = true; // istringstream allocates - mwctst::TestHelper::printTestName("DECODE"); + bmqtst::TestHelper::printTestName("DECODE"); cout << "Please enter the hex representation of a GUID, followed by\n" << " when done (optionally, specify the nanoSecondsFromEpoch\n" @@ -1198,7 +1197,7 @@ static void testN2_bmqtPerformance() // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("PERFORMANCE"); + bmqtst::TestHelper::printTestName("PERFORMANCE"); const bsls::Types::Int64 k_NUM_GUIDS = 1000000; // 1O million @@ -1226,11 +1225,11 @@ static void testN2_bmqtPerformance() bsls::Types::Int64 end = bsls::TimeUtil::getTimer(); cout << "Calculated " << k_NUM_GUIDS << " bmqt::MessageGUIDs in " - << mwcu::PrintUtil::prettyTimeInterval(end - start) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - start) << ".\n" << "Above implies that 1 bmqt::MessageGUID was calculated in " << (end - start) / k_NUM_GUIDS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber((k_NUM_GUIDS * 1000000000) / + << bmqu::PrintUtil::prettyNumber((k_NUM_GUIDS * 1000000000) / (end - start)) << " bmqt::MessageGUIDs per second.\n\n" << endl; @@ -1256,7 +1255,7 @@ static void testN2_bdlbPerformance() // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("PERFORMANCE"); + bmqtst::TestHelper::printTestName("PERFORMANCE"); const bsls::Types::Int64 k_NUM_GUIDS = 1000000; // 1 million @@ -1282,11 +1281,11 @@ static void testN2_bdlbPerformance() bsls::Types::Int64 end = bsls::TimeUtil::getTimer(); cout << "Calculated " << k_NUM_GUIDS << " bdlb::Guids in " - << mwcu::PrintUtil::prettyTimeInterval(end - start) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - start) << ".\n" << "Above implies that 1 bdlb::Guid was calculated in " << (end - start) / k_NUM_GUIDS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber((k_NUM_GUIDS * 1000000000) / + << bmqu::PrintUtil::prettyNumber((k_NUM_GUIDS * 1000000000) / (end - start)) << " bdlb::Guids per second." << endl; } @@ -1309,7 +1308,7 @@ BSLA_MAYBE_UNUSED static void testN3_defaultHashBenchmark() // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("DEFAULT HASH BENCHMARK"); benchmarkHash >("default"); } @@ -1332,7 +1331,7 @@ BSLA_MAYBE_UNUSED static void testN4_customHashBenchmark() // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("CUSTOM HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("CUSTOM HASH BENCHMARK"); benchmarkHash >("custom"); } @@ -1350,7 +1349,7 @@ BSLA_MAYBE_UNUSED static void testN5_hashTableWithDefaultHashBenchmark() // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("HASH TABLE w/ DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("HASH TABLE w/ DEFAULT HASH BENCHMARK"); const size_t k_NUM_ELEMS = 10000000; // 10M bmqt::MessageGUID guid; @@ -1376,11 +1375,11 @@ BSLA_MAYBE_UNUSED static void testN5_hashTableWithDefaultHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in hashtable using " << "default hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second." << endl; } @@ -1399,7 +1398,7 @@ BSLA_MAYBE_UNUSED static void testN6_hashTableWithCustomHashBenchmark() // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("HASH TABLE w/ CUSTOM HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("HASH TABLE w/ CUSTOM HASH BENCHMARK"); const size_t k_NUM_ELEMS = 10000000; // 10M bmqt::MessageGUID guid; @@ -1429,11 +1428,11 @@ BSLA_MAYBE_UNUSED static void testN6_hashTableWithCustomHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in hashtable using " << "custom hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second." << endl; } @@ -1452,12 +1451,12 @@ BSLA_MAYBE_UNUSED static void testN7_orderedMapWithDefaultHashBenchmark() // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("ORDERED MAP DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("ORDERED MAP DEFAULT HASH BENCHMARK"); const size_t k_NUM_ELEMS = 10000000; // 10M bmqt::MessageGUID guid; - mwcc::OrderedHashMap ht(k_NUM_ELEMS, + bmqc::OrderedHashMap ht(k_NUM_ELEMS, s_allocator_p); bmqp::MessageGUIDGenerator generator(0); @@ -1479,11 +1478,11 @@ BSLA_MAYBE_UNUSED static void testN7_orderedMapWithDefaultHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in ordered map using " << "default hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second." << endl; } @@ -1502,12 +1501,12 @@ BSLA_MAYBE_UNUSED static void testN8_orderedMapWithCustomHashBenchmark() // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("ORDERED MAP CUSTOM HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("ORDERED MAP CUSTOM HASH BENCHMARK"); const size_t k_NUM_ELEMS = 10000000; // 10M bmqt::MessageGUID guid; - mwcc::OrderedHashMap > ht(k_NUM_ELEMS, s_allocator_p); @@ -1531,11 +1530,11 @@ BSLA_MAYBE_UNUSED static void testN8_orderedMapWithCustomHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in ordered map using " << "custom hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second." << endl; } @@ -1554,7 +1553,7 @@ static void testN9_hashBenchmarkComparison() // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("HASH BENCHMARK COMPARISON"); + bmqtst::TestHelper::printTestName("HASH BENCHMARK COMPARISON"); bsl::vector stats; stats.push_back(benchmarkHash >("baseline")); @@ -1591,7 +1590,7 @@ static void testN10_hashCollisionsComparison() // created upon insertion of objects in the map uses the default // allocator. - mwctst::TestHelper::printTestName("HASH COLLISIONS COMPARISON"); + bmqtst::TestHelper::printTestName("HASH COLLISIONS COMPARISON"); #ifdef BSLS_PLATFORM_OS_SOLARIS const bsls::Types::Int64 k_NUM_GUIDS = 1000000; // 1M @@ -1870,7 +1869,7 @@ static void testN1_decode_GoogleBenchmark(benchmark::State& state) state.PauseTiming(); s_ignoreCheckDefAlloc = true; // istringstream allocates - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK DECODE"); + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK DECODE"); cout << "Please enter the hex representation of a GUID, followed by\n" << " when done (optionally, specify the " @@ -1967,7 +1966,7 @@ static void testN2_bmqtPerformance_GoogleBenchmark(benchmark::State& state) // ------------------------------------------------------------------------ { s_ignoreCheckDefAlloc = true; - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE"); + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE"); // ---------------------------- // bmqt::MessageGUID generation // ---------------------------- @@ -1999,7 +1998,7 @@ static void testN2_bdlbPerformance_GoogleBenchmark(benchmark::State& state) // Warm the cache s_ignoreCheckDefAlloc = true; - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE"); + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE"); for (int i = 0; i < 1000; ++i) { bdlb::Guid guid; bdlb::GuidUtil::generate(&guid); @@ -2034,7 +2033,7 @@ testN3_defaultHashBenchmark_GoogleBenchmark(benchmark::State& state) // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK: DEFAULT " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK: DEFAULT " "HASH BENCHMARK"); bsl::hash hasher; // same as: bslh::Hash<> hasher; @@ -2068,7 +2067,7 @@ static void testN4_customHashBenchmark_GoogleBenchmark(benchmark::State& state) // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "GOOGLE BENCHMARK CUSTOM HASH BENCHMARK"); bslh::Hash hasher; @@ -2099,7 +2098,7 @@ static void testN5_hashTableWithDefaultHashBenchmark_GoogleBenchmark( // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK HASH TABLE " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK HASH TABLE " "w/ DEFAULT HASH BENCHMARK"); bmqt::MessageGUID guid; @@ -2139,7 +2138,7 @@ static void testN6_hashTableWithCustomHashBenchmark_GoogleBenchmark( // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK HASH TABLE " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK HASH TABLE " "w/ CUSTOM HASH BENCHMARK"); bmqt::MessageGUID guid; @@ -2183,12 +2182,12 @@ static void testN7_orderedMapWithDefaultHashBenchmark_GoogleBenchmark( // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK ORDERED MAP " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK ORDERED MAP " "DEFAULT HASH BENCHMARK"); bmqt::MessageGUID guid; - mwcc::OrderedHashMap ht(state.range(0), + bmqc::OrderedHashMap ht(state.range(0), s_allocator_p); bmqp::MessageGUIDGenerator generator(0); @@ -2223,12 +2222,12 @@ static void testN8_orderedMapWithCustomHashBenchmark_GoogleBenchmark( // 'bmqp::MessageGUIDGenerator::ctor' prints a BALL_LOG_INFO which // allocates using the default allocator. - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK ORDERED MAP " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK ORDERED MAP " "CUSTOM HASH BENCHMARK"); bmqt::MessageGUID guid; - mwcc::OrderedHashMap > ht(state.range(0), s_allocator_p); @@ -2261,7 +2260,7 @@ int main(int argc, char* argv[]) // To be called only once per process instantiation. bsls::TimeUtil::initialize(); - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -2275,50 +2274,50 @@ int main(int argc, char* argv[]) case -1: testN1_decode(); break; case -2: // Todo: split test case - MWC_BENCHMARK_WITH_ARGS(testN2_bdlbPerformance, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); - MWC_BENCHMARK_WITH_ARGS(testN2_bmqtPerformance, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN2_bdlbPerformance, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN2_bmqtPerformance, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -3: - MWC_BENCHMARK_WITH_ARGS(testN3_defaultHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN3_defaultHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -4: - MWC_BENCHMARK_WITH_ARGS(testN4_customHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN4_customHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -5: - MWC_BENCHMARK_WITH_ARGS(testN5_hashTableWithDefaultHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN5_hashTableWithDefaultHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -6: - MWC_BENCHMARK_WITH_ARGS(testN6_hashTableWithCustomHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN6_hashTableWithCustomHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -7: - MWC_BENCHMARK_WITH_ARGS(testN7_orderedMapWithDefaultHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN7_orderedMapWithDefaultHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -8: - MWC_BENCHMARK_WITH_ARGS(testN8_orderedMapWithCustomHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN8_orderedMapWithCustomHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -9: testN9_hashBenchmarkComparison(); break; case -10: testN10_hashCollisionsComparison(); break; @@ -2334,7 +2333,7 @@ int main(int argc, char* argv[]) } #endif - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } // ---------------------------------------------------------------------------- diff --git a/src/groups/bmq/bmqp/bmqp_messageproperties.cpp b/src/groups/bmq/bmqp/bmqp_messageproperties.cpp index 7f5ac3c19..34fa41a82 100644 --- a/src/groups/bmq/bmqp/bmqp_messageproperties.cpp +++ b/src/groups/bmq/bmqp/bmqp_messageproperties.cpp @@ -20,12 +20,11 @@ // BMQ #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -236,8 +235,8 @@ bool MessageProperties::streamInPropertyValue(const Property& p) const BSLS_ASSERT_SAFE(p.d_value.isUnset()); BSLS_ASSERT_SAFE(p.d_offset); - mwcu::BlobPosition position; - int rc = mwcu::BlobUtil::findOffsetSafe(&position, + bmqu::BlobPosition position; + int rc = bmqu::BlobUtil::findOffsetSafe(&position, d_blob.object(), p.d_offset); BSLS_ASSERT_SAFE(rc == 0); @@ -245,7 +244,7 @@ bool MessageProperties::streamInPropertyValue(const Property& p) const switch (p.d_type) { case bmqt::PropertyType::e_BOOL: { char value; - rc = mwcu::BlobUtil::readNBytes(&value, + rc = bmqu::BlobUtil::readNBytes(&value, d_blob.object(), position, sizeof(value)); @@ -255,7 +254,7 @@ bool MessageProperties::streamInPropertyValue(const Property& p) const } case bmqt::PropertyType::e_CHAR: { char value; - rc = mwcu::BlobUtil::readNBytes(&value, + rc = bmqu::BlobUtil::readNBytes(&value, d_blob.object(), position, sizeof(value)); @@ -265,7 +264,7 @@ bool MessageProperties::streamInPropertyValue(const Property& p) const } case bmqt::PropertyType::e_SHORT: { bdlb::BigEndianInt16 nboValue; - rc = mwcu::BlobUtil::readNBytes(reinterpret_cast(&nboValue), + rc = bmqu::BlobUtil::readNBytes(reinterpret_cast(&nboValue), d_blob.object(), position, sizeof(nboValue)); @@ -275,7 +274,7 @@ bool MessageProperties::streamInPropertyValue(const Property& p) const } case bmqt::PropertyType::e_INT32: { bdlb::BigEndianInt32 nboValue; - rc = mwcu::BlobUtil::readNBytes(reinterpret_cast(&nboValue), + rc = bmqu::BlobUtil::readNBytes(reinterpret_cast(&nboValue), d_blob.object(), position, sizeof(nboValue)); @@ -285,7 +284,7 @@ bool MessageProperties::streamInPropertyValue(const Property& p) const } case bmqt::PropertyType::e_INT64: { bdlb::BigEndianInt64 nboValue; - rc = mwcu::BlobUtil::readNBytes(reinterpret_cast(&nboValue), + rc = bmqu::BlobUtil::readNBytes(reinterpret_cast(&nboValue), d_blob.object(), position, sizeof(nboValue)); @@ -296,7 +295,7 @@ bool MessageProperties::streamInPropertyValue(const Property& p) const case bmqt::PropertyType::e_STRING: { bsl::string value(p.d_length, ' '); - rc = mwcu::BlobUtil::readNBytes(&value[0], + rc = bmqu::BlobUtil::readNBytes(&value[0], d_blob.object(), position, p.d_length); @@ -306,7 +305,7 @@ bool MessageProperties::streamInPropertyValue(const Property& p) const } case bmqt::PropertyType::e_BINARY: { bsl::vector value(p.d_length); - rc = mwcu::BlobUtil::readNBytes(&value[0], + rc = bmqu::BlobUtil::readNBytes(&value[0], d_blob.object(), position, p.d_length); @@ -504,7 +503,7 @@ int MessageProperties::streamInHeader(const bdlbb::Blob& blob) // end with padding for word alignment. // Read 'MessagePropertiesHeader'. - mwcu::BlobObjectProxy msgPropsHeader( + bmqu::BlobObjectProxy msgPropsHeader( &blob, -MessagePropertiesHeader::k_MIN_HEADER_SIZE, true, // read flag @@ -569,14 +568,14 @@ int MessageProperties::streamInPropertyHeader(Property* property, BSLS_ASSERT_SAFE(d_dataOffset && start); BSLS_ASSERT_SAFE(d_isBlobConstructed); - mwcu::BlobPosition position; + bmqu::BlobPosition position; - if (mwcu::BlobUtil::findOffsetSafe(&position, d_blob.object(), start)) { + if (bmqu::BlobUtil::findOffsetSafe(&position, d_blob.object(), start)) { // Failed to advance blob to next 'MessagePropertyHeader' location. return rc_NO_MSG_PROPERTY_HEADER; // RETURN } - mwcu::BlobObjectProxy mpHeader( + bmqu::BlobObjectProxy mpHeader( &d_blob.object(), position, d_mphSize, @@ -691,15 +690,15 @@ int MessageProperties::streamInPropertyHeader(Property* property, // Future reads will assert on error. name->assign(nameLen, ' '); - mwcu::BlobPosition namePosition; - int rc = mwcu::BlobUtil::findOffsetSafe(&namePosition, + bmqu::BlobPosition namePosition; + int rc = bmqu::BlobUtil::findOffsetSafe(&namePosition, d_blob.object(), offset); if (rc) { return rc_MISSING_PROPERTY_AREA; // RETURN } - rc = mwcu::BlobUtil::readNBytes(name->begin(), + rc = bmqu::BlobUtil::readNBytes(name->begin(), d_blob.object(), namePosition, nameLen); @@ -910,8 +909,8 @@ MessageProperties::streamOut(bdlbb::BlobBufferFactory* bufferFactory, // invoked 'setLength' on the blob and reinterpret_casted first few bytes // of the first buffer to 'bmqp::MessagePropertiesHeader'. - mwcu::BlobUtil::reserve(blob, sizeof(MessagePropertiesHeader)); - mwcu::BlobObjectProxy msgPropsHeader( + bmqu::BlobUtil::reserve(blob, sizeof(MessagePropertiesHeader)); + bmqu::BlobObjectProxy msgPropsHeader( blob, false, // read flag true); // write flag @@ -937,9 +936,9 @@ MessageProperties::streamOut(bdlbb::BlobBufferFactory* bufferFactory, BSLS_ASSERT(!p.d_value.isUnset()); - mwcu::BlobPosition pos; - mwcu::BlobUtil::reserve(&pos, blob, sizeof(MessagePropertyHeader)); - mwcu::BlobObjectProxy msgPropHeader( + bmqu::BlobPosition pos; + bmqu::BlobUtil::reserve(&pos, blob, sizeof(MessagePropertyHeader)); + bmqu::BlobObjectProxy msgPropHeader( blob, pos, false, // read flag @@ -999,7 +998,7 @@ MessageProperties::streamOut(bdlbb::BlobBufferFactory* bufferFactory, // Update the 'total message properties area words' field in the top-level // struct 'MessagePropertiesHeader'. - mwcu::BlobObjectProxy msgPropsHdr( + bmqu::BlobObjectProxy msgPropsHdr( blob, false, // read flag true); // write flag @@ -1032,7 +1031,7 @@ bsl::ostream& MessageProperties::print(bsl::ostream& stream, while (msgPropIter.hasNext()) { bdlma::LocalSequentialAllocator<64> nameLsa(0); - mwcu::MemOutStream nameOs(&nameLsa); + bmqu::MemOutStream nameOs(&nameLsa); nameOs << msgPropIter.name() << " (" << msgPropIter.type() << ")" << bsl::ends; @@ -1043,7 +1042,7 @@ bsl::ostream& MessageProperties::print(bsl::ostream& stream, msgPropIter.getAsBool()); } break; case bmqt::PropertyType::e_CHAR: { - mwcu::OutStreamFormatSaver fmtSaver(stream); + bmqu::OutStreamFormatSaver fmtSaver(stream); stream << bsl::hex; printer.printAttribute(nameOs.str().data(), static_cast(msgPropIter.getAsChar())); @@ -1070,7 +1069,7 @@ bsl::ostream& MessageProperties::print(bsl::ostream& stream, bdlma::LocalSequentialAllocator lsa(0); - mwcu::MemOutStream os(k_MAX_BYTES_DUMP, &lsa); + bmqu::MemOutStream os(k_MAX_BYTES_DUMP, &lsa); os << bdlb::PrintStringHexDumper(&binaryVec[0], static_cast(printSize)); diff --git a/src/groups/bmq/bmqp/bmqp_messageproperties.t.cpp b/src/groups/bmq/bmqp/bmqp_messageproperties.t.cpp index 5e506f0f7..6b25bd56a 100644 --- a/src/groups/bmq/bmqp/bmqp_messageproperties.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_messageproperties.t.cpp @@ -20,11 +20,10 @@ #include #include #include -#include +#include -// MWC -#include -#include +#include +#include // BDE #include @@ -40,7 +39,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -165,7 +164,7 @@ void populateProperties(bmqp::MessageProperties* properties, for (size_t i = 1; i < (numProps + 1); ++i) { size_t remainder = i % numPropTypes; - mwcu::MemOutStream osstr(s_allocator_p); + bmqu::MemOutStream osstr(s_allocator_p); switch (remainder) { case 0: { @@ -397,7 +396,7 @@ void encode(bdlbb::Blob* blob, const PropertyMap& pmap) int totalSize = 0; // Add 'bmqp::MessagePropertiesHeader'. - mwcu::BlobUtil::reserve(blob, sizeof(bmqp::MessagePropertiesHeader)); + bmqu::BlobUtil::reserve(blob, sizeof(bmqp::MessagePropertiesHeader)); new (b.buffer(0).data()) bmqp::MessagePropertiesHeader; // Above is ok because in this test driver, we control the buffer size @@ -461,7 +460,7 @@ void encode(bdlbb::Blob* blob, const PropertyMap& pmap) static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Testing MessageProperties"); bdlbb::PooledBlobBufferFactory bufferFactory(128, s_allocator_p); @@ -571,7 +570,7 @@ static void test1_breathingTest() static void test2_setPropertyTest() { - mwctst::TestHelper::printTestName("'setPropertyAs*' TEST"); + bmqtst::TestHelper::printTestName("'setPropertyAs*' TEST"); { // Test all flavors of 'setPropertyAs*'. @@ -733,7 +732,7 @@ static void test2_setPropertyTest() bmqp::MessageProperties::k_MAX_PROPERTY_VALUE_LENGTH; for (int i = 0; i < numProp; ++i) { - mwcu::MemOutStream osstr(s_allocator_p); + bmqu::MemOutStream osstr(s_allocator_p); osstr << "propName" << i << bsl::ends; ASSERT_EQ(0, p.setPropertyAsString(osstr.str(), bigValue)); } @@ -747,7 +746,7 @@ static void test2_setPropertyTest() for (int i = 0; i < bmqp::MessageProperties::k_MAX_NUM_PROPERTIES; ++i) { - mwcu::MemOutStream osstr(s_allocator_p); + bmqu::MemOutStream osstr(s_allocator_p); osstr << "propName" << i << bsl::ends; ASSERT_EQ(0, p.setPropertyAsInt32(osstr.str(), i)); } @@ -760,7 +759,7 @@ static void test2_setPropertyTest() static void test3_binaryPropertyTest() { // Ensure that a binary property is set and retrieved correctly. - mwctst::TestHelper::printTestName("'setPropertyAsBinary' TEST"); + bmqtst::TestHelper::printTestName("'setPropertyAsBinary' TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(128, s_allocator_p); @@ -782,7 +781,7 @@ static void test3_binaryPropertyTest() static void test4_iteratorTest() { // Ensure iterator's functionality is correct. - mwctst::TestHelper::printTestName("'setPropertyAsBinary' TEST"); + bmqtst::TestHelper::printTestName("'setPropertyAsBinary' TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(128, s_allocator_p); bmqp::MessageProperties p(s_allocator_p); @@ -805,7 +804,7 @@ static void test4_iteratorTest() static void test5_streamInTest() { // Ensure 'streamIn' functionality is correct. - mwctst::TestHelper::printTestName("'streamIn' TEST"); + bmqtst::TestHelper::printTestName("'streamIn' TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(128, s_allocator_p); bmqp::MessageProperties p(s_allocator_p); @@ -854,7 +853,7 @@ static void test5_streamInTest() static void test6_streamOutTest() { // Ensure 'streamOut' functionality is correct. - mwctst::TestHelper::printTestName("'streamOut' TEST"); + bmqtst::TestHelper::printTestName("'streamOut' TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(128, s_allocator_p); bdlbb::Blob wireRep(&bufferFactory, s_allocator_p); @@ -909,7 +908,7 @@ static void test7_streamInOutMixTest() // Ensure that 'streamOut' works correctly if 'streamIn' was invoked before // on the instance. - mwctst::TestHelper::printTestName("'streamIn/Out Mix' TEST"); + bmqtst::TestHelper::printTestName("'streamIn/Out Mix' TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(128, s_allocator_p); bdlbb::Blob wireRep(&bufferFactory, s_allocator_p); @@ -990,7 +989,7 @@ static void test8_printTest() // const bmqp::MessageProperties& rhs) // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); BSLMF_ASSERT(bmqt::PropertyType::e_BOOL == bmqt::PropertyType::k_LOWEST_SUPPORTED_PROPERTY_TYPE); @@ -1035,8 +1034,8 @@ static void test8_printTest() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; bmqp::MessageProperties obj(s_allocator_p); - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); switch (test.d_type) { case bmqt::PropertyType::e_BOOL: { @@ -1103,7 +1102,7 @@ static void test9_copyAssignTest() // bmqp::MessageProperties& operator=(const MessageProperties& rhs); // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("COPY AND ASSIGN"); + bmqtst::TestHelper::printTestName("COPY AND ASSIGN"); bdlbb::PooledBlobBufferFactory bufferFactory(128, s_allocator_p); bmqp::MessageProperties obj(s_allocator_p); @@ -1158,7 +1157,7 @@ static void test10_empty() { // Even if SDK does not send out empty MPS, streaming out/in should work. - mwctst::TestHelper::printTestName("'empty MPs' TEST"); + bmqtst::TestHelper::printTestName("'empty MPs' TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(128, s_allocator_p); bmqp::MessageProperties p(s_allocator_p); @@ -1182,7 +1181,7 @@ static void test10_empty() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); @@ -1206,7 +1205,7 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); // Check for default allocator is explicitly disabled as // 'bmqp::MessageProperties' or one of its data members may allocate diff --git a/src/groups/bmq/bmqp/bmqp_optionsview.cpp b/src/groups/bmq/bmqp/bmqp_optionsview.cpp index 56e42d24c..ca47dfedc 100644 --- a/src/groups/bmq/bmqp/bmqp_optionsview.cpp +++ b/src/groups/bmq/bmqp/bmqp_optionsview.cpp @@ -21,9 +21,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -38,7 +37,7 @@ namespace bmqp { // PRIVATE MANIPULATORS int OptionsView::resetImpl(const bdlbb::Blob* blob, - const mwcu::BlobPosition& optionsAreaPos, + const bmqu::BlobPosition& optionsAreaPos, int optionsAreaSize) { // PRECONDITIONS @@ -64,9 +63,9 @@ int OptionsView::resetImpl(const bdlbb::Blob* blob, }; - mwcu::BlobIterator blobIter(blob, optionsAreaPos, optionsAreaSize, true); + bmqu::BlobIterator blobIter(blob, optionsAreaPos, optionsAreaSize, true); while (!blobIter.atEnd()) { - mwcu::BlobObjectProxy oh(blobIter.blob(), + bmqu::BlobObjectProxy oh(blobIter.blob(), blobIter.position()); if (!oh.isSet()) { @@ -148,7 +147,7 @@ int OptionsView::resetImpl(const bdlbb::Blob* blob, // PRIVATE ACCESSORS int OptionsView::loadOptionPositionAndSize( - mwcu::BlobPosition* payloadPosition, + bmqu::BlobPosition* payloadPosition, int* payloadSizeBytes, const bmqp::OptionType::Enum optionType, const bool hasPadding) const @@ -159,13 +158,13 @@ int OptionsView::loadOptionPositionAndSize( BSLS_ASSERT_SAFE(isValid()); BSLS_ASSERT_SAFE(find(optionType) != end()); - const mwcu::BlobPosition& headerPos = d_optionPositions[optionType]; - mwcu::BlobObjectProxy oh(d_blob_p, headerPos); + const bmqu::BlobPosition& headerPos = d_optionPositions[optionType]; + bmqu::BlobObjectProxy oh(d_blob_p, headerPos); BSLS_ASSERT_SAFE(oh.isSet() && "Option header not set"); // should be ok, as in the constructor - int rc = mwcu::BlobUtil::findOffsetSafe(payloadPosition, + int rc = bmqu::BlobUtil::findOffsetSafe(payloadPosition, *d_blob_p, headerPos, sizeof(OptionHeader)); @@ -192,8 +191,8 @@ int OptionsView::loadOptionPositionAndSize( return rc; // RETURN } - mwcu::BlobPosition lastBytePos; - rc = mwcu::BlobUtil::findOffsetSafe(&lastBytePos, + bmqu::BlobPosition lastBytePos; + rc = bmqu::BlobUtil::findOffsetSafe(&lastBytePos, *d_blob_p, headerPos, optionTotalSizeBytes - 1); @@ -219,7 +218,7 @@ void OptionsView::dumpBlob(bsl::ostream& stream) // For now, print only the beginning of the blob.. we may later on print // also the bytes around the current position. if (d_blob_p) { - stream << mwcu::BlobStartHexDumper(d_blob_p, k_MAX_BYTES_DUMP); + stream << bmqu::BlobStartHexDumper(d_blob_p, k_MAX_BYTES_DUMP); } else { stream << "/no blob/"; @@ -279,9 +278,9 @@ int OptionsView::loadSubQueueInfosOption( }; if (find(OptionType::e_SUB_QUEUE_INFOS) != end()) { - const mwcu::BlobPosition& headerPos = + const bmqu::BlobPosition& headerPos = d_optionPositions[OptionType::e_SUB_QUEUE_INFOS]; - mwcu::BlobObjectProxy oh(d_blob_p, headerPos); + bmqu::BlobObjectProxy oh(d_blob_p, headerPos); BSLS_ASSERT_SAFE(oh.isSet() && "Option header not set"); BSLS_ASSERT_SAFE(oh->type() == OptionType::e_SUB_QUEUE_INFOS); @@ -367,7 +366,7 @@ int OptionsView::loadMsgGroupIdOption(Protocol::MsgGroupId* msgGroupId) const rc_INVALID_LENGTH = -3 }; - mwcu::BlobPosition msgGroupIdStartPos; + bmqu::BlobPosition msgGroupIdStartPos; int msgGroupIdSizeBytes; int rc = loadOptionPositionAndSize(&msgGroupIdStartPos, &msgGroupIdSizeBytes, @@ -397,7 +396,7 @@ int OptionsView::loadMsgGroupIdOption(Protocol::MsgGroupId* msgGroupId) const // Read msgGroupId msgGroupId->resize(msgGroupIdSizeBytes); - rc = mwcu::BlobUtil::readNBytes(&(*msgGroupId)[0], + rc = bmqu::BlobUtil::readNBytes(&(*msgGroupId)[0], *d_blob_p, msgGroupIdStartPos, msgGroupIdSizeBytes); diff --git a/src/groups/bmq/bmqp/bmqp_optionsview.h b/src/groups/bmq/bmqp/bmqp_optionsview.h index d54ae3da0..d6dd12bb9 100644 --- a/src/groups/bmq/bmqp/bmqp_optionsview.h +++ b/src/groups/bmq/bmqp/bmqp_optionsview.h @@ -50,9 +50,7 @@ // BMQ #include - -// MWC -#include +#include // BDE #include @@ -83,11 +81,11 @@ class OptionsView { /// Sequential stack allocator for the first template-specified bytes /// (falls back to other allocator afterwards) typedef bdlma::LocalSequentialAllocator<(OptionHeader::k_MAX_TYPE + 1) * - sizeof(mwcu::BlobPosition)> + sizeof(bmqu::BlobPosition)> LocalSequentialAllocator; /// Mapping of OptionType (index) to BlobPosition - typedef bsl::vector OptionPositions; + typedef bsl::vector OptionPositions; /// Enables iteration on `bmqp::OptionsView` class Iterator { @@ -167,7 +165,7 @@ class OptionsView { // Flag indicating if this view is // initialized and valid. - const mwcu::BlobPosition d_NullBlobPosition; + const bmqu::BlobPosition d_NullBlobPosition; // Value indicating no blob position // (member just to avoid repeated // instantiations elsewhere) @@ -184,7 +182,7 @@ class OptionsView { /// `optionsAreaSize` bytes from `optionsAreaPos` offset. Return 0 on /// success, and non-zero on error. int resetImpl(const bdlbb::Blob* blob, - const mwcu::BlobPosition& optionsAreaPos, + const bmqu::BlobPosition& optionsAreaPos, int optionsAreaSize); // PRIVATE ACCESSORS @@ -203,7 +201,7 @@ class OptionsView { /// undefined unless `isValid()` returns `true` and `find(optionType)` /// returns a valid iterator. Note that if the option blob is *packed*, /// `payloadSizeBytes` will be loaded as zero. - int loadOptionPositionAndSize(mwcu::BlobPosition* payloadPosition, + int loadOptionPositionAndSize(bmqu::BlobPosition* payloadPosition, int* payloadSizeBytes, const bmqp::OptionType::Enum optionType, const bool hasPadding) const; @@ -244,7 +242,7 @@ class OptionsView { /// `optionsAreaSize` bytes from `optionsAreaPos` offset. Return 0 on /// success, and non-zero on error. OptionsView(const bdlbb::Blob* blob, - const mwcu::BlobPosition& optionsAreaPos, + const bmqu::BlobPosition& optionsAreaPos, int optionsAreaSize, bslma::Allocator* allocator); @@ -259,7 +257,7 @@ class OptionsView { /// `optionsAreaPos` offset. Return 0 on success, and non-zero on /// error. int reset(const bdlbb::Blob* blob, - const mwcu::BlobPosition& optionsAreaPos, + const bmqu::BlobPosition& optionsAreaPos, int optionsAreaSize); /// Set the internal state of this instance to be same as default @@ -429,7 +427,7 @@ int OptionsView::loadSubQueueInfosOptionHelper( rc_INVALID_BLOB = -1 }; - mwcu::BlobPosition firstSubQueueInfoPos; + bmqu::BlobPosition firstSubQueueInfoPos; int subQueueInfosSize; int rc = loadOptionPositionAndSize(&firstSubQueueInfoPos, @@ -448,7 +446,7 @@ int OptionsView::loadSubQueueInfosOptionHelper( out->resize(numSubQueueInfos); // Read option payload - rc = mwcu::BlobUtil::readNBytes(reinterpret_cast(out->data()), + rc = bmqu::BlobUtil::readNBytes(reinterpret_cast(out->data()), *d_blob_p, firstSubQueueInfoPos, subQueueInfosSize); @@ -471,7 +469,7 @@ inline OptionsView::OptionsView(bslma::Allocator* allocator) , d_optionPositions(OptionHeader::k_MAX_TYPE + 1, &d_bufferAllocator) , d_blob_p(0) , d_isValid(false) -, d_NullBlobPosition(mwcu::BlobPosition(-1, 0)) +, d_NullBlobPosition(bmqu::BlobPosition(-1, 0)) { // NOTHING } @@ -483,30 +481,30 @@ inline OptionsView::OptionsView(const OptionsView& src, , d_optionPositions(src.d_optionPositions, &d_bufferAllocator) , d_blob_p(src.d_blob_p) , d_isValid(src.d_isValid) -, d_NullBlobPosition(mwcu::BlobPosition(-1, 0)) +, d_NullBlobPosition(bmqu::BlobPosition(-1, 0)) { // NOTHING } inline OptionsView::OptionsView(const bdlbb::Blob* blob, - const mwcu::BlobPosition& optionsAreaPos, + const bmqu::BlobPosition& optionsAreaPos, int optionsAreaSize, bslma::Allocator* allocator) : d_allocator_p(allocator) , d_bufferAllocator(allocator) , d_optionPositions(OptionHeader::k_MAX_TYPE + 1, - mwcu::BlobPosition(-1, 0), + bmqu::BlobPosition(-1, 0), &d_bufferAllocator) , d_blob_p(blob) , d_isValid(false) -, d_NullBlobPosition(mwcu::BlobPosition(-1, 0)) +, d_NullBlobPosition(bmqu::BlobPosition(-1, 0)) { resetImpl(blob, optionsAreaPos, optionsAreaSize); } // MANIPULATORS inline int OptionsView::reset(const bdlbb::Blob* blob, - const mwcu::BlobPosition& optionsAreaPos, + const bmqu::BlobPosition& optionsAreaPos, int optionsAreaSize) { clear(); diff --git a/src/groups/bmq/bmqp/bmqp_optionsview.t.cpp b/src/groups/bmq/bmqp/bmqp_optionsview.t.cpp index fd55a3618..b14f2b975 100644 --- a/src/groups/bmq/bmqp/bmqp_optionsview.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_optionsview.t.cpp @@ -21,13 +21,12 @@ #include #include #include -#include +#include -// MWC -#include +#include // TEST DRIVER -#include +#include // BDE #include @@ -162,7 +161,7 @@ static void generateMsgGroupId(bmqp::Protocol::MsgGroupId* msgGroupId) int seed = bsl::numeric_limits::max(); - mwcu::MemOutStream oss(s_allocator_p); + bmqu::MemOutStream oss(s_allocator_p); oss << "gid:" << bdlb::Random::generate15(&seed); *msgGroupId = oss.str(); } @@ -181,7 +180,7 @@ static void generateMsgGroupId(bmqp::Protocol::MsgGroupId* msgGroupId) /// default value if there is no option payload), and loads into the /// specified `optionsAreaSize` the size of the options area in bytes. void populateBlob(bdlbb::Blob* blob, - mwcu::BlobPosition* optionsAreaPosition, + bmqu::BlobPosition* optionsAreaPosition, int* optionsAreaSize, bsl::vector* subQueueInfos, bsl::vector* subQueueIdsOld, @@ -262,13 +261,13 @@ void populateBlob(bdlbb::Blob* blob, if (hasSubQueues || hasMsgGroupId) { // Capture options area position (Position of 1st OptionHeader) - mwcu::BlobUtil::reserve(optionsAreaPosition, + bmqu::BlobUtil::reserve(optionsAreaPosition, blob, sizeof(bmqp::OptionHeader)); } else { // We don't write an option header when there is no option to write - *optionsAreaPosition = mwcu::BlobPosition(); + *optionsAreaPosition = bmqu::BlobPosition(); } if (hasSubQueues) { @@ -282,7 +281,7 @@ void populateBlob(bdlbb::Blob* blob, } // Append OptionHeader - mwcu::BlobUtil::writeBytes(blob, + bmqu::BlobUtil::writeBytes(blob, *optionsAreaPosition, reinterpret_cast(&oh), sizeof(bmqp::OptionHeader)); @@ -316,7 +315,7 @@ void populateBlob(bdlbb::Blob* blob, /// `optionsAreaPosition` the position of the options area, and load into /// the specified `optionsAreaSize` the size of the options area in bytes. void populatePackedBlob(bdlbb::Blob* blob, - mwcu::BlobPosition* optionsAreaPosition, + bmqu::BlobPosition* optionsAreaPosition, int* optionsAreaSize, bsl::vector* subQueueInfos) { @@ -361,7 +360,7 @@ void populatePackedBlob(bdlbb::Blob* blob, ph.headerWords() * bmqp::Protocol::k_WORD_SIZE); // Append *packed* OptionHeader - mwcu::BlobUtil::reserve(optionsAreaPosition, + bmqu::BlobUtil::reserve(optionsAreaPosition, blob, sizeof(bmqp::OptionHeader)); @@ -372,7 +371,7 @@ void populatePackedBlob(bdlbb::Blob* blob, // Reinterpret 'words' field as RDA counter oh.setWords(subQueueInfos->front().rdaInfo().internalRepresentation()); - mwcu::BlobUtil::writeBytes(blob, + bmqu::BlobUtil::writeBytes(blob, *optionsAreaPosition, reinterpret_cast(&oh), sizeof(bmqp::OptionHeader)); @@ -430,7 +429,7 @@ void test1_breathingTest() // Create valid view, PUSH event with 1 message, zero options bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwcu::BlobPosition optionsAreaPosition; + bmqu::BlobPosition optionsAreaPosition; int optionsAreaSize = 0; // Populate blob, 0 options @@ -497,7 +496,7 @@ void test1_breathingTest() // Create valid view, PUSH event with 1 message, 1 option header and // 1 sub-queue id bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwcu::BlobPosition optionsAreaPosition; + bmqu::BlobPosition optionsAreaPosition; int optionsAreaSize = 0; // Populate blob, 1 option header and 1 sub-queue id @@ -518,7 +517,7 @@ void test1_breathingTest() // Sanity test: First verify that populateBlob gave us back valid // parameters to pass to OptionsView - mwcu::BlobObjectProxy oh(&blob, + bmqu::BlobObjectProxy oh(&blob, optionsAreaPosition, optionsAreaSize); @@ -561,7 +560,7 @@ void test1_breathingTest() // Create valid view, PUSH event with 3 sub-queue ids bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwcu::BlobPosition optionsAreaPosition; + bmqu::BlobPosition optionsAreaPosition; int optionsAreaSize = 0; // Populate blob, 1 option header, multiple sub-queue ids) @@ -615,7 +614,7 @@ void test1_breathingTest() // Create valid view, PUSH event with 3 sub-queue ids bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwcu::BlobPosition optionsAreaPosition; + bmqu::BlobPosition optionsAreaPosition; int optionsAreaSize = 0; // Populate blob, 1 option header, multiple sub-queue ids) @@ -709,7 +708,7 @@ void test2_subQueueIdsOld() // Create valid view, PUSH event with 3 old sub-queue ids bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwcu::BlobPosition optionsAreaPosition; + bmqu::BlobPosition optionsAreaPosition; int optionsAreaSize = 0; // Populate blob, 1 option header, multiple old sub-queue ids) @@ -778,7 +777,7 @@ void test3_packedOptions() // Create valid view, PUSH event with a *packed* sub-queue id option bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwcu::BlobPosition optionsAreaPosition; + bmqu::BlobPosition optionsAreaPosition; int optionsAreaSize = 0; bsl::vector subQueueInfos(s_allocator_p); @@ -853,7 +852,7 @@ void test4_invalidOptionsArea() // could lie to us that it has bigger payload than it actually has in // the blob and the view will still be valid. bdlbb::Blob optionsBlob(&bufferFactory, s_allocator_p); - mwcu::BlobPosition optionsAreaPosition; // start of blob + bmqu::BlobPosition optionsAreaPosition; // start of blob int numSubQueueInfos = 6; const int optionPayloadSize = numSubQueueInfos * @@ -896,7 +895,7 @@ void test4_invalidOptionsArea() // An OptionsHeader but no option payload (sub-queue info) bdlbb::Blob optionsBlob(&bufferFactory, s_allocator_p); - const mwcu::BlobPosition optionsAreaPosition; // start of blob + const bmqu::BlobPosition optionsAreaPosition; // start of blob const int optionsAreaSize = sizeof(bmqp::OptionHeader); bmqp::OptionHeader oh; @@ -923,7 +922,7 @@ void test4_invalidOptionsArea() // An OptionHeader with type 'OptionType::e_UNDEFINED' bdlbb::Blob optionsBlob(&bufferFactory, s_allocator_p); - const mwcu::BlobPosition optionsAreaPosition; // start of blob + const bmqu::BlobPosition optionsAreaPosition; // start of blob const int numSubQueueInfos = 1; const int optionPayloadSize = numSubQueueInfos * @@ -965,7 +964,7 @@ void test4_invalidOptionsArea() // #1: An OptionHeader with an unsupported type bdlbb::Blob optionsBlob(&bufferFactory, s_allocator_p); - const mwcu::BlobPosition optionsAreaPosition; // start of blob + const bmqu::BlobPosition optionsAreaPosition; // start of blob const int numSubQueueInfos = 2; const int optionPayloadSize = numSubQueueInfos * @@ -1008,7 +1007,7 @@ void test4_invalidOptionsArea() oh.setType(optionType); // Overwrite OptionHeader - mwcu::BlobUtil::writeBytes(&optionsBlob, + bmqu::BlobUtil::writeBytes(&optionsBlob, optionsAreaPosition, reinterpret_cast(&oh), sizeof(bmqp::OptionHeader)); @@ -1028,7 +1027,7 @@ void test4_invalidOptionsArea() // Multiple OptionHeader of the same type (duplicate) bdlbb::Blob optionsBlob(&bufferFactory, s_allocator_p); - const mwcu::BlobPosition optionsAreaPosition; // start of blob + const bmqu::BlobPosition optionsAreaPosition; // start of blob const int numSubQueueInfos = 2; const int optionPayloadSize = numSubQueueInfos * @@ -1092,7 +1091,7 @@ void test4_invalidOptionsArea() PV("EMPTY BLOB"); bdlbb::Blob optionsBlob(&bufferFactory, s_allocator_p); - const mwcu::BlobPosition optionsAreaPosition; // start of blob + const bmqu::BlobPosition optionsAreaPosition; // start of blob const int optionsAreaSize = sizeof(bmqp::OptionHeader); bmqp::OptionHeader oh; @@ -1111,7 +1110,7 @@ void test4_invalidOptionsArea() PV("WRONG AREA SIZE FOR OPTION VIEW"); bdlbb::Blob optionsBlob(&bufferFactory, s_allocator_p); - const mwcu::BlobPosition optionsAreaPosition; // start of blob + const bmqu::BlobPosition optionsAreaPosition; // start of blob const int numSubQueueInfos = 6; const int optionPayloadSize = numSubQueueInfos * @@ -1173,7 +1172,7 @@ void test5_iteratorTest() // Create valid view, PUSH event with 3 sub-queue ids bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwcu::BlobPosition optionsAreaPosition; + bmqu::BlobPosition optionsAreaPosition; int optionsAreaSize = 0; // Populate blob, 1 option header, multiple sub-queue ids @@ -1250,7 +1249,7 @@ void test6_iteratorTestSubQueueIdsOld() // Create valid view, PUSH event with 3 old version sub-queue ids bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwcu::BlobPosition optionsAreaPosition; + bmqu::BlobPosition optionsAreaPosition; int optionsAreaSize = 0; // Populate blob, 1 option header, multiple sub-queue ids @@ -1326,9 +1325,9 @@ void test7_dumpBlob() // Create valid view, PUSH event with 3 sub-queue ids bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwcu::BlobPosition optionsAreaPosition; + bmqu::BlobPosition optionsAreaPosition; int optionsAreaSize = 0; - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); // Populate blob, 1 option header, multiple sub-queue ids) bsl::vector subQueueIds(s_allocator_p); @@ -1413,9 +1412,9 @@ void test8_dumpBlobSubQueueIdsOld() // Create valid view, PUSH event with 3 old version sub-queue ids bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwcu::BlobPosition optionsAreaPosition; + bmqu::BlobPosition optionsAreaPosition; int optionsAreaSize = 0; - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); // Populate blob, 1 option header, multiple sub-queue ids) bsl::vector subQueueIdsOld(s_allocator_p); @@ -1469,7 +1468,7 @@ void test8_dumpBlobSubQueueIdsOld() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); @@ -1491,5 +1490,5 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_optionutil.cpp b/src/groups/bmq/bmqp/bmqp_optionutil.cpp index 6207121bd..1a00b6ae4 100644 --- a/src/groups/bmq/bmqp/bmqp_optionutil.cpp +++ b/src/groups/bmq/bmqp/bmqp_optionutil.cpp @@ -20,8 +20,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -103,10 +102,10 @@ void OptionUtil::OptionsBox::add(bdlbb::Blob* blob, const OptionMeta& option) { // Write Option Header - mwcu::BlobPosition ohOffset; - mwcu::BlobUtil::reserve(&ohOffset, blob, sizeof(OptionHeader)); + bmqu::BlobPosition ohOffset; + bmqu::BlobUtil::reserve(&ohOffset, blob, sizeof(OptionHeader)); - mwcu::BlobObjectProxy optionHeader(blob, + bmqu::BlobObjectProxy optionHeader(blob, ohOffset, false, // no read true); // write mode @@ -198,11 +197,11 @@ OptionUtil::OptionsBox::canAdd(const int currentSize, } bool OptionUtil::loadOptionsPosition(int* optionsSize, - mwcu::BlobPosition* optionsPosition, + bmqu::BlobPosition* optionsPosition, const bdlbb::Blob& blob, const int headerWords, const int optionsWords, - const mwcu::BlobPosition& startPosition) + const bmqu::BlobPosition& startPosition) { const int headerSize = headerWords * Protocol::k_WORD_SIZE; const int myOptionsSize = optionsWords * Protocol::k_WORD_SIZE; @@ -215,8 +214,8 @@ bool OptionUtil::loadOptionsPosition(int* optionsSize, // Options exist. // Find start position of options area - mwcu::BlobPosition myOptionsPosition; - int rc = mwcu::BlobUtil::findOffsetSafe(&myOptionsPosition, + bmqu::BlobPosition myOptionsPosition; + int rc = bmqu::BlobUtil::findOffsetSafe(&myOptionsPosition, blob, startPosition, headerSize); @@ -227,8 +226,8 @@ bool OptionUtil::loadOptionsPosition(int* optionsSize, // Ensure that 'blob' contains 'myOptionsSize' bytes starting at // 'myOptionsPosition'. - mwcu::BlobPosition optionsAreaEndPos; - rc = mwcu::BlobUtil::findOffsetSafe(&optionsAreaEndPos, + bmqu::BlobPosition optionsAreaEndPos; + rc = bmqu::BlobUtil::findOffsetSafe(&optionsAreaEndPos, blob, myOptionsPosition, myOptionsSize); diff --git a/src/groups/bmq/bmqp/bmqp_optionutil.h b/src/groups/bmq/bmqp/bmqp_optionutil.h index fcd5fc014..a62897510 100644 --- a/src/groups/bmq/bmqp/bmqp_optionutil.h +++ b/src/groups/bmq/bmqp/bmqp_optionutil.h @@ -30,8 +30,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -213,11 +212,11 @@ struct OptionUtil { /// `optionsWords` size - both in words and both found in message's /// header. The options segment starts at the specified `startPosition` static bool loadOptionsPosition(int* optionsSize, - mwcu::BlobPosition* optionsPosition, + bmqu::BlobPosition* optionsPosition, const bdlbb::Blob& blob, const int headerWords, const int optionsWords, - const mwcu::BlobPosition& startPosition); + const bmqu::BlobPosition& startPosition); public: /// Returns `bmqt::EventBuilderResult::e_SUCCESS` if the specified @@ -233,9 +232,9 @@ struct OptionUtil { /// `headerPosition` is the position within the `blob`. template static bool loadOptionsPosition(int* optionsSize, - mwcu::BlobPosition* optionsPosition, + bmqu::BlobPosition* optionsPosition, const bdlbb::Blob& blob, - const mwcu::BlobPosition headerPosition, + const bmqu::BlobPosition headerPosition, const HEADER& header); }; @@ -330,9 +329,9 @@ inline int OptionUtil::OptionsBox::optionsCount() const template inline bool OptionUtil::loadOptionsPosition(int* optionsSize, - mwcu::BlobPosition* optionsPosition, + bmqu::BlobPosition* optionsPosition, const bdlbb::Blob& blob, - const mwcu::BlobPosition headerPosition, + const bmqu::BlobPosition headerPosition, const HEADER& header) { return loadOptionsPosition(optionsSize, diff --git a/src/groups/bmq/bmqp/bmqp_optionutil.t.cpp b/src/groups/bmq/bmqp/bmqp_optionutil.t.cpp index d59da1c23..e3c93ebd7 100644 --- a/src/groups/bmq/bmqp/bmqp_optionutil.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_optionutil.t.cpp @@ -25,7 +25,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -158,7 +158,7 @@ static void test1_basicOptionMetaProperties() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BASIC OPTIONMETA PROPERTIES"); + bmqtst::TestHelper::printTestName("BASIC OPTIONMETA PROPERTIES"); typedef bmqp::OptionUtil::OptionMeta OptionMeta; @@ -230,7 +230,7 @@ static void test2_basicOptionsBoxCanAdd() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("OPTIONSBOX CAN ADD"); + bmqtst::TestHelper::printTestName("OPTIONSBOX CAN ADD"); // Arbitrary value const bmqp::OptionType::Enum type = bmqp::OptionType::e_SUB_QUEUE_IDS_OLD; @@ -326,7 +326,7 @@ static void test3_checkOptionsBlobSegment() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CHECK OPTIONS BLOB SEGMENT"); + bmqtst::TestHelper::printTestName("CHECK OPTIONS BLOB SEGMENT"); typedef bmqp::OptionUtil::OptionMeta OptionMeta; typedef bmqp::OptionUtil::OptionsBox OptionsBox; @@ -388,6 +388,7 @@ static void test3_checkOptionsBlobSegment() } } +#ifdef BMQ_ENABLE_MSG_GROUPID static void test4_isValidMsgGroupId() // ------------------------------------------------------------------------ // VALIDATE GROUPID LENGTH @@ -404,7 +405,7 @@ static void test4_isValidMsgGroupId() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("VALIDATE GROUPID LENGTH"); + bmqtst::TestHelper::printTestName("VALIDATE GROUPID LENGTH"); typedef bmqt::EventBuilderResult Result; @@ -426,6 +427,7 @@ static void test4_isValidMsgGroupId() ASSERT_EQ(Result::e_SUCCESS, bmqp::OptionUtil::isValidMsgGroupId(maxLength)); } +#endif // ============================================================================ // MAIN PROGRAM @@ -433,13 +435,15 @@ static void test4_isValidMsgGroupId() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); switch (_testCase) { case 0: +#ifdef BMQ_ENABLE_MSG_GROUPID case 4: test4_isValidMsgGroupId(); break; +#endif case 3: test3_checkOptionsBlobSegment(); break; case 2: test2_basicOptionsBoxCanAdd(); break; case 1: test1_basicOptionMetaProperties(); break; @@ -451,5 +455,5 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_protocol.h b/src/groups/bmq/bmqp/bmqp_protocol.h index 3424ddbc7..be9340f48 100644 --- a/src/groups/bmq/bmqp/bmqp_protocol.h +++ b/src/groups/bmq/bmqp/bmqp_protocol.h @@ -143,13 +143,11 @@ // BMQ +#include #include #include #include -// MWC -#include - // BDE #include #include // for bsl::memset & bsl::memcpy @@ -347,7 +345,7 @@ struct Protocol { /// An array of subQueueInfos with statically reserved space for a /// number of subQueueInfos (as indicated by the second template /// parameter). - typedef mwcc::Array + typedef bmqc::Array SubQueueInfosArray; /// An array of subQueueIds with statically reserved space for a number @@ -355,7 +353,7 @@ struct Protocol { /// is deprecated by the new SubQueueInfosArray above inside the /// brokers, but the SDK still receives and process this older flavor /// due to backward compatibility issues. - typedef mwcc::Array + typedef bmqc::Array SubQueueIdsArrayOld; /// Holds the client-provided Group Id. diff --git a/src/groups/bmq/bmqp/bmqp_protocol.t.cpp b/src/groups/bmq/bmqp/bmqp_protocol.t.cpp index 6f3f5dba6..48e107590 100644 --- a/src/groups/bmq/bmqp/bmqp_protocol.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_protocol.t.cpp @@ -23,11 +23,10 @@ #include #include -// MWC -#include +#include // TEST DRIVER -#include +#include // BDE #include @@ -77,7 +76,7 @@ static void test1_breathingTest() // Testing: // Basic functionality // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { // ----------- @@ -778,7 +777,7 @@ static void test2_bitManipulation() // Concerns: // Test manipulators // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("BIT MANIPULATION ROUTINE TEST"); + bmqtst::TestHelper::printTestName("BIT MANIPULATION ROUTINE TEST"); { // combine @@ -1083,7 +1082,7 @@ static void test3_flagUtils() // StorageHeaderFlagUtil::isSet // StorageHeaderFlagUtil::isValid // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("FLAG UTILS"); + bmqtst::TestHelper::printTestName("FLAG UTILS"); { // -------------------------------- @@ -1116,7 +1115,7 @@ static void test3_flagUtils() bmqp::PutHeaderFlagUtil::setFlag(&flags, test.d_value); ASSERT(bmqp::PutHeaderFlagUtil::isSet(flags, test.d_value)); - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); bmqp::PutHeaderFlagUtil::prettyPrint(out, flags); const bslstl::StringRef& flagsString = out.str(); for (int currFlagVal = 1; @@ -1139,7 +1138,7 @@ static void test3_flagUtils() // 3. Verify that, with this flag set, the flags are correctly // identified as 'isValid' or not 'isValid'. - mwcu::MemOutStream errDesc(s_allocator_p); + bmqu::MemOutStream errDesc(s_allocator_p); ASSERT_EQ(bmqp::PutHeaderFlagUtil::isValid(errDesc, flags), test.d_isValid); @@ -1181,7 +1180,7 @@ static void test3_flagUtils() bmqp::PushHeaderFlagUtil::setFlag(&flags, test.d_value); ASSERT(bmqp::PushHeaderFlagUtil::isSet(flags, test.d_value)); - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); bmqp::PushHeaderFlagUtil::prettyPrint(out, flags); const bslstl::StringRef& flagsString = out.str(); for (int currFlagVal = 1; @@ -1204,7 +1203,7 @@ static void test3_flagUtils() // 3. Verify that, with this flag set, the flags are correctly // identified as 'isValid' or not 'isValid'. - mwcu::MemOutStream errDesc(s_allocator_p); + bmqu::MemOutStream errDesc(s_allocator_p); ASSERT_EQ(bmqp::PushHeaderFlagUtil::isValid(errDesc, flags), test.d_isValid); @@ -1251,7 +1250,7 @@ static void test3_flagUtils() static_cast(flags), test.d_value)); - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); bmqp::StorageHeaderFlagUtil::prettyPrint( out, static_cast(flags)); @@ -1278,7 +1277,7 @@ static void test3_flagUtils() // 3. Verify that, with this flag set, the flags are correctly // identified as 'isValid' or not 'isValid'. - mwcu::MemOutStream errDesc(s_allocator_p); + bmqu::MemOutStream errDesc(s_allocator_p); ASSERT_EQ(bmqp::StorageHeaderFlagUtil::isValid( errDesc, static_cast(flags)), @@ -1301,8 +1300,8 @@ static void printEnumHelper(ARRAY (&data)[SIZE]) PVVV("Line [" << test.d_line << "]"); - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); typedef typename ENUM_TYPE::Enum T; @@ -1362,7 +1361,7 @@ static void test4_enumPrint() // operator<<(bsl::ostream&, RecoveryFileChunkType::Enum) // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("ENUM LAYOUT"); + bmqtst::TestHelper::printTestName("ENUM LAYOUT"); PV("Test bmqp::EventType printing"); { @@ -1575,7 +1574,7 @@ static void test5_enumIsomorphism() PV("Check isomorphism for " #ENUM_VAL " value of " #ENUM_TYPE \ " enum"); \ typedef bmqp::ENUM_TYPE T; \ - mwcu::MemOutStream stream(s_allocator_p); \ + bmqu::MemOutStream stream(s_allocator_p); \ \ T::Enum obj; \ const char* str; \ @@ -1589,7 +1588,7 @@ static void test5_enumIsomorphism() ASSERT_EQ(bsl::strncmp(str, #ENUM_VAL, sizeof(#ENUM_VAL)), 0); \ } - mwctst::TestHelper::printTestName("ENUM ISOMORPHISM"); + bmqtst::TestHelper::printTestName("ENUM ISOMORPHISM"); // Enum PutHeaderFlags TEST_ISOMORPHISM(PutHeaderFlags, ACK_REQUESTED) @@ -1618,7 +1617,7 @@ static void enumFromStringHelper(FLAG_TYPE expectedFlags, const bsl::string& incorrStr, const bsl::string& errOutput) { - mwcu::MemOutStream errStream(s_allocator_p); + bmqu::MemOutStream errStream(s_allocator_p); FLAG_TYPE outFlags; int rc; rc = ENUM_UTIL_TYPE::fromString(errStream, &outFlags, corrStr); @@ -1652,7 +1651,7 @@ static void test6_enumFromString() // StorageHeaderFlagUtil::fromString // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("ENUM UTIL toString"); + bmqtst::TestHelper::printTestName("ENUM UTIL toString"); // Util PushHeaderFlagUtil PV("Testing PushHeaderFlagUtil toString method"); @@ -1720,7 +1719,7 @@ static void test7_eventHeaderUtil() // EventHeaderUtil::controlEventEncodingType // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("EVENT HEADER UTIL"); + bmqtst::TestHelper::printTestName("EVENT HEADER UTIL"); PV("Test bmqp::EventHeaderUtil setControlEventEncodingType"); { @@ -1760,7 +1759,7 @@ static void test7_eventHeaderUtil() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -1777,5 +1776,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_protocolutil.cpp b/src/groups/bmq/bmqp/bmqp_protocolutil.cpp index 4463268bc..b429b5f96 100644 --- a/src/groups/bmq/bmqp/bmqp_protocolutil.cpp +++ b/src/groups/bmq/bmqp/bmqp_protocolutil.cpp @@ -22,11 +22,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -462,13 +461,13 @@ int ProtocolUtil::convertToOld(bdlbb::Blob* dst, // MessagePropertyHeader followed by one or more (name, value) pairs, and // end with padding for word alignment. - mwcu::BlobIterator blobIter(src, - mwcu::BlobPosition(), + bmqu::BlobIterator blobIter(src, + bmqu::BlobPosition(), src->length(), true); // Read 'MessagePropertiesHeader'. - mwcu::BlobObjectProxy srcHeader( + bmqu::BlobObjectProxy srcHeader( src, -MessagePropertiesHeader::k_MIN_HEADER_SIZE, true, // read flag @@ -509,7 +508,7 @@ int ProtocolUtil::convertToOld(bdlbb::Blob* dst, bdlbb::BlobUtil::copy(dst, 0, *src, 0, dataOffset); blobIter = - mwcu::BlobIterator(dst, mwcu::BlobPosition(), dataOffset, true); + bmqu::BlobIterator(dst, bmqu::BlobPosition(), dataOffset, true); } // Iterate over all 'MessagePropertyHeader' fields and keep track of @@ -519,7 +518,7 @@ int ProtocolUtil::convertToOld(bdlbb::Blob* dst, int previous = 0; // need to keep two instances, current and previous - mwcu::BlobObjectProxy mph[2]; + bmqu::BlobObjectProxy mph[2]; while (numProps--) { // Move the blob position to the beginning of @@ -617,7 +616,7 @@ int ProtocolUtil::convertToOld(bdlbb::Blob* dst, bdlbb::BlobUtil::append(&compressed, *src, mpsSize); - mwcu::MemOutStream error(allocator); + bmqu::MemOutStream error(allocator); rc = bmqp::Compression::decompress(dst, factory, cat, @@ -631,7 +630,7 @@ int ProtocolUtil::convertToOld(bdlbb::Blob* dst, int ProtocolUtil::readPropertiesSize(int* size, const bdlbb::Blob& blob, - const mwcu::BlobPosition& position) + const bmqu::BlobPosition& position) { enum RcEnum { // Return codes @@ -639,7 +638,7 @@ int ProtocolUtil::readPropertiesSize(int* size, rc_INCOMPLETE_MSG_PROPERTIES_HEADER = -1, rc_CORRUPT_MESSAGE = -2 }; - mwcu::BlobObjectProxy mpsHeader( + bmqu::BlobObjectProxy mpsHeader( &blob, position, -MessagePropertiesHeader::k_MIN_HEADER_SIZE, @@ -678,7 +677,7 @@ int ProtocolUtil::parse(bdlbb::Blob* messagePropertiesOutput, const bdlbb::Blob& input, int length, bool decompressFlag, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, bool haveMessageProperties, bool haveNewMessageProperties, bmqt::CompressionAlgorithmType::Enum cat, @@ -712,7 +711,7 @@ int ProtocolUtil::parse(bdlbb::Blob* messagePropertiesOutput, } int offset; - int rc = mwcu::BlobUtil::positionToOffsetSafe(&offset, input, position); + int rc = bmqu::BlobUtil::positionToOffsetSafe(&offset, input, position); int copyFrom = offset; int copyLen = length; @@ -741,7 +740,7 @@ int ProtocolUtil::parse(bdlbb::Blob* messagePropertiesOutput, copyFrom += *messagePropertiesSize; copyLen -= *messagePropertiesSize; } // else don't rush appending to 'dataOutput'. - } // else MPs are compressed + } // else MPs are compressed } if (cat == bmqt::CompressionAlgorithmType::e_NONE) { @@ -756,7 +755,7 @@ int ProtocolUtil::parse(bdlbb::Blob* messagePropertiesOutput, // De-compress, if requested bdlbb::Blob bufferCompressed(blobBufferFactory, allocator); - mwcu::MemOutStream error(allocator); + bmqu::MemOutStream error(allocator); bdlbb::Blob bufferDecompressed(blobBufferFactory, allocator); bdlbb::Blob* decompressedBlob; @@ -798,7 +797,7 @@ int ProtocolUtil::parse(bdlbb::Blob* messagePropertiesOutput, // Now read de-compressed MPs rc = bmqp::ProtocolUtil::readPropertiesSize(messagePropertiesSize, *decompressedBlob, - mwcu::BlobPosition()); + bmqu::BlobPosition()); if (rc < 0) { return rc * 10 + rc_INVALID_MSG_PROPERTIES_HEADER; // RETURN } diff --git a/src/groups/bmq/bmqp/bmqp_protocolutil.h b/src/groups/bmq/bmqp/bmqp_protocolutil.h index f83f3879c..b8c2af80f 100644 --- a/src/groups/bmq/bmqp/bmqp_protocolutil.h +++ b/src/groups/bmq/bmqp/bmqp_protocolutil.h @@ -42,15 +42,11 @@ // BMQ +#include #include #include #include - -// MWC -#include - -// MWC -#include +#include // BDE #include @@ -96,7 +92,7 @@ struct ProtocolUtil { StreamInfo(const VALUE& value); }; - typedef mwcc::TwoKeyHashMap + typedef bmqc::TwoKeyHashMap StreamsMap; // Map {appId, subId} to StreamInfo @@ -438,7 +434,7 @@ struct ProtocolUtil { /// Return `true` on success, `false` otherwise. static int readPropertiesSize(int* size, const bdlbb::Blob& blob, - const mwcu::BlobPosition& position); + const bmqu::BlobPosition& position); /// Parse the specified `input` of the specified `length` starting at /// the specified `position` and supporting all styles of @@ -458,7 +454,7 @@ struct ProtocolUtil { const bdlbb::Blob& input, int length, bool decompressFlag, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, bool haveMessageProperties, bool haveNewMessageProperties, bmqt::CompressionAlgorithmType::Enum cat, diff --git a/src/groups/bmq/bmqp/bmqp_protocolutil.t.cpp b/src/groups/bmq/bmqp/bmqp_protocolutil.t.cpp index d9f760c1e..e87730d53 100644 --- a/src/groups/bmq/bmqp/bmqp_protocolutil.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_protocolutil.t.cpp @@ -16,8 +16,7 @@ // bmqp_protocolutil.t.cpp -*-C++-*- #include -// MWC -#include +#include // BMQ #include @@ -39,7 +38,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -76,7 +75,7 @@ static void test1_initializeShutdown() // shutdown // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("INITIALIZE / SHUTDOWN"); + bmqtst::TestHelper::printTestName("INITIALIZE / SHUTDOWN"); // 1. Calling 'shutdown' without a call to 'initialize' should assert. ASSERT_SAFE_FAIL(bmqp::ProtocolUtil::shutdown()); @@ -122,7 +121,7 @@ static void test2_hexBinaryConversions() // - void binaryToHex(char *buffer, char *binary, int binaryBufferLength) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HEX/BINARY CONVERSIONS"); + bmqtst::TestHelper::printTestName("HEX/BINARY CONVERSIONS"); PV("hexToBinary"); { @@ -232,7 +231,7 @@ static void test3_calcNumWordsAndPadding() // - int calcNumDwordsAndPAdding(int *padding, int length) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CALC NUM WORDS AND PADDING"); + bmqtst::TestHelper::printTestName("CALC NUM WORDS AND PADDING"); bmqp::ProtocolUtil::initialize(s_allocator_p); @@ -298,7 +297,7 @@ static void test4_paddingChar() // - void appendPaddingDwordRaw(char *destination, int numPaddingBytes) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("APPEND PADDING (char)"); + bmqtst::TestHelper::printTestName("APPEND PADDING (char)"); bmqp::ProtocolUtil::initialize(s_allocator_p); @@ -385,7 +384,7 @@ static void test5_paddingBlob() // but is being called for coverage purposes. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("APPEND PADDING (blob)"); + bmqtst::TestHelper::printTestName("APPEND PADDING (blob)"); bmqp::ProtocolUtil::initialize(s_allocator_p); @@ -486,7 +485,7 @@ static void test6_heartbeatAndEmptyBlobs() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HEARTBEAT BLOBS"); + bmqtst::TestHelper::printTestName("HEARTBEAT BLOBS"); bmqp::ProtocolUtil::initialize(s_allocator_p); @@ -543,7 +542,7 @@ static void test7_ackResultToCode() // ackResultToCode // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ACK RESULT TO CODE"); + bmqtst::TestHelper::printTestName("ACK RESULT TO CODE"); struct Test { int d_line; @@ -591,7 +590,7 @@ static void test8_ackResultFromCode() // ackResultFromCode // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ACK RESULT FROM CODE"); + bmqtst::TestHelper::printTestName("ACK RESULT FROM CODE"); struct Test { int d_line; @@ -638,7 +637,7 @@ static void test9_loadFieldValues() // loadFieldValues // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LOAD FIELD VALUES"); + bmqtst::TestHelper::printTestName("LOAD FIELD VALUES"); // Disable check that no memory was allocated from the default allocator s_ignoreCheckDefAlloc = true; @@ -714,7 +713,7 @@ static void test9_loadFieldValues() template static void encodeDecodeHelper(E encodingType) { - mwcu::MemOutStream ms; + bmqu::MemOutStream ms; bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob blob(&bufferFactory, s_allocator_p); bmqp_ctrlmsg::ClusterMessage clusterMessage; @@ -780,7 +779,7 @@ static void test10_encodeDecodeMessage() // 'loggedMessages' methods of Encoder returns a memory-aware object // without utilizing the parameter allocator. - mwctst::TestHelper::printTestName("ENCODE DECODE MESSAGE"); + bmqtst::TestHelper::printTestName("ENCODE DECODE MESSAGE"); PV("Test using JSON encoding"); { @@ -837,7 +836,7 @@ static void test11_parseMessageProperties() { bmqp::ProtocolUtil::initialize(s_allocator_p); - mwctst::TestHelper::printTestName("TEST PARSING"); + bmqtst::TestHelper::printTestName("TEST PARSING"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqp::MessageProperties in(s_allocator_p); @@ -879,7 +878,7 @@ static void test11_parseMessageProperties() payloadIn, payloadIn.length(), true, // decompress - mwcu::BlobPosition(), + bmqu::BlobPosition(), true, // MPs true, // new style peb.compressionAlgorithmType(), @@ -904,7 +903,7 @@ int main(int argc, char* argv[]) { bmqp::Crc32c::initialize(); - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -925,5 +924,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_pusheventbuilder.cpp b/src/groups/bmq/bmqp/bmqp_pusheventbuilder.cpp index 22819f9c8..ff27f6342 100644 --- a/src/groups/bmq/bmqp/bmqp_pusheventbuilder.cpp +++ b/src/groups/bmq/bmqp/bmqp_pusheventbuilder.cpp @@ -17,8 +17,8 @@ #include #include -// MWC -#include + +#include // BDE #include @@ -133,8 +133,8 @@ void PushEventBuilder::ensurePushHeader() } // Add the PushHeader - mwcu::BlobPosition phOffset; - mwcu::BlobUtil::reserve(&phOffset, &d_blob, sizeof(PushHeader)); + bmqu::BlobPosition phOffset; + bmqu::BlobUtil::reserve(&phOffset, &d_blob, sizeof(PushHeader)); d_currPushHeader.reset(&d_blob, phOffset, diff --git a/src/groups/bmq/bmqp/bmqp_pusheventbuilder.h b/src/groups/bmq/bmqp/bmqp_pusheventbuilder.h index eb5c3d46b..47d71e2f7 100644 --- a/src/groups/bmq/bmqp/bmqp_pusheventbuilder.h +++ b/src/groups/bmq/bmqp/bmqp_pusheventbuilder.h @@ -63,8 +63,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -105,7 +104,7 @@ class PushEventBuilder { // associated with the options of the // current (to-be-packed) message. - mwcu::BlobObjectProxy d_currPushHeader; + bmqu::BlobObjectProxy d_currPushHeader; // Push Header associated with the // current (to-be-packed) message. diff --git a/src/groups/bmq/bmqp/bmqp_pusheventbuilder.t.cpp b/src/groups/bmq/bmqp/bmqp_pusheventbuilder.t.cpp index 3d7e9f456..75959ac81 100644 --- a/src/groups/bmq/bmqp/bmqp_pusheventbuilder.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_pusheventbuilder.t.cpp @@ -24,9 +24,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -47,7 +46,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -58,13 +57,17 @@ using namespace bsl; // ---------------------------------------------------------------------------- namespace { +#ifdef BMQ_ENABLE_MSG_GROUPID typedef bdlb::NullableValue NullableMsgGroupId; +#endif struct Data { - bmqt::MessageGUID d_guid; - int d_qid; - bmqp::Protocol::SubQueueInfosArray d_subQueueInfos; - NullableMsgGroupId d_msgGroupId; + bmqt::MessageGUID d_guid; + int d_qid; + bmqp::Protocol::SubQueueInfosArray d_subQueueInfos; +#ifdef BMQ_ENABLE_MSG_GROUPID + NullableMsgGroupId d_msgGroupId; +#endif bdlbb::Blob d_payload; int d_flags; bmqt::CompressionAlgorithmType::Enum d_compressionAlgorithmType; @@ -82,7 +85,9 @@ Data::Data(bdlbb::BlobBufferFactory* bufferFactory, bslma::Allocator* allocator) : d_qid(-1) , d_subQueueInfos(allocator) +#ifdef BMQ_ENABLE_MSG_GROUPID , d_msgGroupId(allocator) +#endif , d_payload(bufferFactory, allocator) , d_flags(0) , d_compressionAlgorithmType(bmqt::CompressionAlgorithmType::e_NONE) @@ -94,7 +99,9 @@ Data::Data(const Data& other, bslma::Allocator* allocator) : d_guid(other.d_guid) , d_qid(other.d_qid) , d_subQueueInfos(other.d_subQueueInfos, allocator) +#ifdef BMQ_ENABLE_MSG_GROUPID , d_msgGroupId(other.d_msgGroupId, allocator) +#endif , d_payload(other.d_payload, allocator) , d_flags(other.d_flags) , d_compressionAlgorithmType(other.d_compressionAlgorithmType) @@ -142,16 +149,18 @@ void generateSubQueueInfos(bmqp::Protocol::SubQueueInfosArray* subQueueInfos, static_cast(numSubQueueInfos)); } +#ifdef BMQ_ENABLE_MSG_GROUPID /// Populate the specified `msgGroupId` with a random Group Id. static void generateMsgGroupId(bmqp::Protocol::MsgGroupId* msgGroupId) { // PRECONDITIONS BSLS_ASSERT_OPT(msgGroupId); - mwcu::MemOutStream oss(s_allocator_p); + bmqu::MemOutStream oss(s_allocator_p); oss << "gid:" << generateRandomInteger(0, 120); *msgGroupId = oss.str(); } +#endif /// Append at least `atLeastLen` bytes to the specified `blob` and populate /// the specified `payloadLen` with the number of bytes appended. @@ -200,6 +209,7 @@ appendMessage(size_t iteration, return rc; // RETURN } +#ifdef BMQ_ENABLE_MSG_GROUPID // Every 3rd iteration we don't add a Group Id. if (iteration % 3) { generateMsgGroupId(&data.d_msgGroupId.makeValue()); @@ -208,11 +218,14 @@ appendMessage(size_t iteration, return rc; // RETURN } } +#endif - bdlbb::Blob payload(bufferFactory, allocator); - const int blobSize = generateRandomInteger(0, 1024); + bdlbb::Blob payload(bufferFactory, allocator); + const int blobSize = generateRandomInteger(0, 1024); +#ifdef BMQ_ENABLE_MSG_GROUPID const bmqp::Protocol::MsgGroupId str(blobSize, 'x', allocator); bdlbb::BlobUtil::append(&payload, str.c_str(), blobSize); +#endif data.d_payload = payload; @@ -255,7 +268,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqp::Protocol::SubQueueInfosArray subQueueInfos(s_allocator_p); @@ -369,7 +382,7 @@ static void test2_buildEventBackwardsCompatibility() // Backwards compatibility // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BACKWARDS COMPATIBILITY"); + bmqtst::TestHelper::printTestName("BACKWARDS COMPATIBILITY"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqp::Protocol::SubQueueInfosArray subQueueInfos(s_allocator_p); @@ -484,7 +497,7 @@ static void test3_buildEventWithPackedOption() // Packed Option // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PACKED OPTION"); + bmqtst::TestHelper::printTestName("PACKED OPTION"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqp::Protocol::SubQueueInfosArray subQueueInfos(s_allocator_p); @@ -585,7 +598,7 @@ static void test4_buildEventWithMultipleMessages() // Build an event with multiple PUSH msgs. Iterate and verify // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("BUILD EVENT WITH MULTIPLE MESSAGES"); + bmqtst::TestHelper::printTestName("BUILD EVENT WITH MULTIPLE MESSAGES"); // Create PushEventBuilder bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -651,6 +664,7 @@ static void test4_buildEventWithMultipleMessages() ASSERT_EQ_D(i, D.d_subQueueInfos[i], retrievedSQInfos[i]); } } +#ifdef BMQ_ENABLE_MSG_GROUPID const bool hasMsgGroupId = !D.d_msgGroupId.isNull(); ASSERT_EQ(hasMsgGroupId, optionsView.find(bmqp::OptionType::e_MSG_GROUP_ID) != @@ -661,6 +675,7 @@ static void test4_buildEventWithMultipleMessages() optionsView.loadMsgGroupIdOption(&retrievedMsgGroupId)); ASSERT_EQ(D.d_msgGroupId.value(), retrievedMsgGroupId); } +#endif ++dataIndex; } @@ -684,7 +699,7 @@ static void test5_buildEventWithPayloadTooBig() // Behavior when trying to add a message with a large payload. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PAYLOAD TOO BIG"); + bmqtst::TestHelper::printTestName("PAYLOAD TOO BIG"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); const bmqt::MessageGUID guid; @@ -870,7 +885,7 @@ static void test7_buildEventOptionTooBig() // Behavior of adding an option that is larger than the max allowed. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("OPTION TOO BIG TEST"); + bmqtst::TestHelper::printTestName("OPTION TOO BIG TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); int numSubQueueInfos; @@ -900,6 +915,7 @@ static void test7_buildEventOptionTooBig() ASSERT_EQ(rc, bmqt::EventBuilderResult::e_OPTION_TOO_BIG); +#ifdef BMQ_ENABLE_MSG_GROUPID // Add another option larger than maximum allowed bmqp::Protocol::MsgGroupId msgGrIdBig1(bmqp::OptionHeader::k_MAX_SIZE + 1, 'x', @@ -916,7 +932,6 @@ static void test7_buildEventOptionTooBig() rc = peb.addMsgGroupIdOption(msgGrIdBig2); -#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_EQ(rc, bmqt::EventBuilderResult::e_INVALID_MSG_GROUP_ID); #endif @@ -1039,7 +1054,7 @@ static void test8_buildEventTooBig() // maximum. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("EVENT TOO BIG"); + bmqtst::TestHelper::printTestName("EVENT TOO BIG"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); const bmqt::MessageGUID guid; @@ -1116,7 +1131,7 @@ static void testN1_decodeFromFile() // with expected properties and payload. // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DECODE FROM FILE"); + bmqtst::TestHelper::printTestName("DECODE FROM FILE"); const char k_VALID_HEX_REP[] = "ABCDEF0123456789ABCDEF0123456789"; const char* k_PAYLOAD = "abcdefghijklmnopqrstuvwxyz"; @@ -1127,7 +1142,7 @@ static void testN1_decodeFromFile() bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob outBlob(&bufferFactory, s_allocator_p); bdlbb::Blob payloadBlob(&bufferFactory, s_allocator_p); - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); bmqp::PushMessageIterator pushIter(&bufferFactory, s_allocator_p); bmqt::MessageGUID messageGUID; bdlb::Guid guid; @@ -1204,9 +1219,9 @@ static void testN1_decodeFromFile() bmqp::MessageProperties prop(s_allocator_p); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD, k_PAYLOAD_LEN); ASSERT_EQ(0, res); @@ -1224,7 +1239,7 @@ static void testN1_decodeFromFile() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); // Temporary workaround to suppress the 'unused operator // NestedTraitDeclaration' warning/error generated by clang. TBD: @@ -1262,5 +1277,5 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_pushmessageiterator.cpp b/src/groups/bmq/bmqp/bmqp_pushmessageiterator.cpp index d7814d0a4..edf9bda03 100644 --- a/src/groups/bmq/bmqp/bmqp_pushmessageiterator.cpp +++ b/src/groups/bmq/bmqp/bmqp_pushmessageiterator.cpp @@ -23,9 +23,8 @@ #include #include -// MWC -#include -#include +#include +#include // BSL #include @@ -87,7 +86,7 @@ int PushMessageIterator::loadOptions(bdlbb::Blob* blob) const return 0; // RETURN } - return mwcu::BlobUtil::appendToBlob(blob, + return bmqu::BlobUtil::appendToBlob(blob, *d_blobIter.blob(), d_optionsPosition, d_optionsSize); @@ -100,8 +99,8 @@ int PushMessageIterator::compressedApplicationDataSize() const // properties and message payload. const int msgLenPadded = d_header.messageWords() * Protocol::k_WORD_SIZE; - mwcu::BlobPosition lastBytePos; - int rc = mwcu::BlobUtil::findOffsetSafe(&lastBytePos, + bmqu::BlobPosition lastBytePos; + int rc = bmqu::BlobUtil::findOffsetSafe(&lastBytePos, *d_blobIter.blob(), d_blobIter.position(), msgLenPadded - 1); @@ -145,12 +144,12 @@ int PushMessageIterator::applicationDataSize() const } int PushMessageIterator::loadApplicationDataPosition( - mwcu::BlobPosition* position) const + bmqu::BlobPosition* position) const { // PRECONDITIONS BSLS_ASSERT_SAFE(position); BSLS_ASSERT_SAFE(isValid()); - BSLS_ASSERT_SAFE(d_applicationDataPosition != mwcu::BlobPosition()); + BSLS_ASSERT_SAFE(d_applicationDataPosition != bmqu::BlobPosition()); enum RcEnum { // Value for the various RC error categories @@ -189,16 +188,16 @@ int PushMessageIterator::loadApplicationData(bdlbb::Blob* blob) const return rc_IMPLICIT_APP_DATA; // RETURN } - BSLS_ASSERT_SAFE(d_applicationDataPosition != mwcu::BlobPosition()); + BSLS_ASSERT_SAFE(d_applicationDataPosition != bmqu::BlobPosition()); if (d_decompressFlag) { - mwcu::BlobUtil::appendToBlob(blob, + bmqu::BlobUtil::appendToBlob(blob, d_applicationData, - mwcu::BlobPosition()); + bmqu::BlobPosition()); return rc_SUCCESS; // RETURN } - int rc = mwcu::BlobUtil::appendToBlob(blob, + int rc = bmqu::BlobUtil::appendToBlob(blob, *d_blobIter.blob(), d_applicationDataPosition, applicationDataSize()); @@ -247,9 +246,9 @@ int PushMessageIterator::loadMessageProperties(bdlbb::Blob* blob) const BSLS_ASSERT_SAFE(0 < d_messagePropertiesSize); - int rc = mwcu::BlobUtil::appendToBlob(blob, + int rc = bmqu::BlobUtil::appendToBlob(blob, d_applicationData, - mwcu::BlobPosition(), + bmqu::BlobPosition(), d_messagePropertiesSize); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(rc != 0)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; @@ -341,14 +340,14 @@ int PushMessageIterator::loadMessagePayloadPosition() const BSLS_ASSERT_SAFE(0 < d_messagePropertiesSize); - int rc = mwcu::BlobUtil::findOffsetSafe(&d_lazyMessagePayloadPosition, + int rc = bmqu::BlobUtil::findOffsetSafe(&d_lazyMessagePayloadPosition, d_applicationData, - mwcu::BlobPosition(), + bmqu::BlobPosition(), d_messagePropertiesSize); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(rc != 0)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - d_lazyMessagePayloadPosition = mwcu::BlobPosition(); + d_lazyMessagePayloadPosition = bmqu::BlobPosition(); return (rc * 10 + rc_INVALID_PAYLOAD_OFFSET); // RETURN } @@ -373,7 +372,7 @@ int PushMessageIterator::loadMessagePayload(bdlbb::Blob* blob) const } if (hasMessageProperties() && - (d_lazyMessagePayloadPosition == mwcu::BlobPosition())) { + (d_lazyMessagePayloadPosition == bmqu::BlobPosition())) { // This could be because 'loadMessagePayloadPosition' wasn't called or // because it failed. If its later, calling it will fail again, and an // appropriate error will be returned. @@ -383,10 +382,10 @@ int PushMessageIterator::loadMessagePayload(bdlbb::Blob* blob) const return rc * 10 + rc_INVALID_PAYLOAD_OFFSET; // RETURN } - BSLS_ASSERT_SAFE(d_lazyMessagePayloadPosition != mwcu::BlobPosition()); + BSLS_ASSERT_SAFE(d_lazyMessagePayloadPosition != bmqu::BlobPosition()); } - int rc = mwcu::BlobUtil::appendToBlob(blob, + int rc = bmqu::BlobUtil::appendToBlob(blob, d_applicationData, d_lazyMessagePayloadPosition, messagePayloadSize()); @@ -516,11 +515,11 @@ int PushMessageIterator::next() // message d_applicationDataSize = -1; d_lazyMessagePayloadSize = -1; - d_lazyMessagePayloadPosition = mwcu::BlobPosition(); + d_lazyMessagePayloadPosition = bmqu::BlobPosition(); d_messagePropertiesSize = 0; - d_applicationDataPosition = mwcu::BlobPosition(); + d_applicationDataPosition = bmqu::BlobPosition(); d_optionsSize = 0; - d_optionsPosition = mwcu::BlobPosition(); + d_optionsPosition = bmqu::BlobPosition(); d_optionsView.reset(); d_applicationData.removeAll(); @@ -532,7 +531,7 @@ int PushMessageIterator::next() // Read PushHeader, supporting protocol evolution by reading as many bytes // as the header declares (and not as many as the size of the struct) - mwcu::BlobObjectProxy header(d_blobIter.blob(), + bmqu::BlobObjectProxy header(d_blobIter.blob(), d_blobIter.position(), -PushHeader::k_MIN_HEADER_SIZE, true, @@ -595,7 +594,7 @@ int PushMessageIterator::next() // load the 'd_applicationDataPosition' instance variable with the start of // the application data offset. - int rc = mwcu::BlobUtil::findOffsetSafe( + int rc = bmqu::BlobUtil::findOffsetSafe( &d_applicationDataPosition, *d_blobIter.blob(), header.position(), @@ -603,7 +602,7 @@ int PushMessageIterator::next() bmqp::Protocol::k_WORD_SIZE); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(rc != 0)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - d_applicationDataPosition = mwcu::BlobPosition(); + d_applicationDataPosition = bmqu::BlobPosition(); return (rc * 10 + rc_INVALID_APPLICATION_DATA_OFFSET); // RETURN } @@ -671,7 +670,7 @@ int PushMessageIterator::reset(const bdlbb::Blob* blob, clear(); d_decompressFlag = decompressFlag; - d_blobIter.reset(blob, mwcu::BlobPosition(), blob->length(), true); + d_blobIter.reset(blob, bmqu::BlobPosition(), blob->length(), true); bool rc = d_blobIter.advance(eventHeader.headerWords() * Protocol::k_WORD_SIZE); @@ -711,7 +710,7 @@ void PushMessageIterator::dumpBlob(bsl::ostream& stream) // For now, print only the beginning of the blob.. we may later on print // also the bytes around the current position if (d_blobIter.blob()) { - stream << mwcu::BlobStartHexDumper(d_blobIter.blob(), + stream << bmqu::BlobStartHexDumper(d_blobIter.blob(), k_MAX_BYTES_DUMP); } else { diff --git a/src/groups/bmq/bmqp/bmqp_pushmessageiterator.h b/src/groups/bmq/bmqp/bmqp_pushmessageiterator.h index 66d6e890c..55b4b55b2 100644 --- a/src/groups/bmq/bmqp/bmqp_pushmessageiterator.h +++ b/src/groups/bmq/bmqp/bmqp_pushmessageiterator.h @@ -59,9 +59,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -90,7 +89,7 @@ class PushMessageIterator { private: // DATA - mwcu::BlobIterator d_blobIter; + bmqu::BlobIterator d_blobIter; // Blob iterator pointing to the // current message in the blob. @@ -110,7 +109,7 @@ class PushMessageIterator { // (without padding). -1 if not // initialized. - mutable mwcu::BlobPosition d_lazyMessagePayloadPosition; + mutable bmqu::BlobPosition d_lazyMessagePayloadPosition; // Lazily computed payload position. // Unset if not initialized. @@ -120,14 +119,14 @@ class PushMessageIterator { // includes padding and message // properties header. - mwcu::BlobPosition d_applicationDataPosition; + bmqu::BlobPosition d_applicationDataPosition; // Application Data position. For each // blob, initialized in next(). mutable int d_optionsSize; // Message options size. - mutable mwcu::BlobPosition d_optionsPosition; + mutable bmqu::BlobPosition d_optionsPosition; // Message options position. Unset if // not initialized. @@ -303,7 +302,7 @@ class PushMessageIterator { /// data is implicit. Behavior is undefined unless latest call to /// `next()` returned 1. Note that application data includes message /// properties and message payload, but excludes the options. - int loadApplicationDataPosition(mwcu::BlobPosition* position) const; + int loadApplicationDataPosition(bmqu::BlobPosition* position) const; /// Load into the specified `blob` the application data for the message /// currently pointed to by this iterator. Return zero on success, and @@ -397,7 +396,7 @@ class PushMessageIterator { inline PushMessageIterator::PushMessageIterator( bdlbb::BlobBufferFactory* bufferFactory, bslma::Allocator* allocator) -: d_blobIter(0, mwcu::BlobPosition(), 0, true) +: d_blobIter(0, bmqu::BlobPosition(), 0, true) , d_applicationDataSize(-1) , d_lazyMessagePayloadSize(-1) , d_lazyMessagePayloadPosition() @@ -421,7 +420,7 @@ inline PushMessageIterator::PushMessageIterator( bool decompressFlag, bdlbb::BlobBufferFactory* bufferFactory, bslma::Allocator* allocator) -: d_blobIter(0, mwcu::BlobPosition(), 0, true) // no def ctor - set in reset +: d_blobIter(0, bmqu::BlobPosition(), 0, true) // no def ctor - set in reset , d_optionsView(allocator) , d_decompressFlag(decompressFlag) , d_applicationData(bufferFactory, allocator) @@ -434,7 +433,7 @@ inline PushMessageIterator::PushMessageIterator( inline PushMessageIterator::PushMessageIterator(const PushMessageIterator& src, bslma::Allocator* allocator) : d_blobIter(0, - mwcu::BlobPosition(), + bmqu::BlobPosition(), 0, true) // no def ctor - set in copyFrom , d_applicationData(src.d_bufferFactory_p, allocator) @@ -457,15 +456,15 @@ PushMessageIterator::operator=(const PushMessageIterator& rhs) inline void PushMessageIterator::clear() { - d_blobIter.reset(0, mwcu::BlobPosition(), 0, true); + d_blobIter.reset(0, bmqu::BlobPosition(), 0, true); d_header = PushHeader(); d_applicationDataSize = -1; d_lazyMessagePayloadSize = -1; - d_lazyMessagePayloadPosition = mwcu::BlobPosition(); + d_lazyMessagePayloadPosition = bmqu::BlobPosition(); d_messagePropertiesSize = 0; - d_applicationDataPosition = mwcu::BlobPosition(); + d_applicationDataPosition = bmqu::BlobPosition(); d_optionsSize = 0; - d_optionsPosition = mwcu::BlobPosition(); + d_optionsPosition = bmqu::BlobPosition(); d_advanceLength = -1; d_applicationData.removeAll(); d_optionsView.reset(); @@ -527,8 +526,8 @@ inline bool PushMessageIterator::hasOptions() const // PRECONDITIONS BSLS_ASSERT_SAFE(isValid()); BSLS_ASSERT_SAFE( - (d_optionsSize == 0 && d_optionsPosition == mwcu::BlobPosition()) || - (d_optionsSize != 0 && d_optionsPosition != mwcu::BlobPosition())); + (d_optionsSize == 0 && d_optionsPosition == bmqu::BlobPosition()) || + (d_optionsSize != 0 && d_optionsPosition != bmqu::BlobPosition())); return d_optionsSize > 0; } diff --git a/src/groups/bmq/bmqp/bmqp_pushmessageiterator.t.cpp b/src/groups/bmq/bmqp/bmqp_pushmessageiterator.t.cpp index 9e0e92e2d..fd3f757c0 100644 --- a/src/groups/bmq/bmqp/bmqp_pushmessageiterator.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_pushmessageiterator.t.cpp @@ -25,8 +25,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -44,7 +43,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -75,7 +74,7 @@ struct Data { int d_optionsSize; - mwcu::BlobPosition d_optionsPosition; + bmqu::BlobPosition d_optionsPosition; // TRAITS BSLMF_NESTED_TRAIT_DECLARATION(Data, bslma::UsesBslmaAllocator) @@ -218,7 +217,7 @@ static void generateMsgGroupId(bmqp::Protocol::MsgGroupId* msgGroupId) // PRECONDITIONS BSLS_ASSERT_OPT(msgGroupId); - mwcu::MemOutStream oss(s_allocator_p); + bmqu::MemOutStream oss(s_allocator_p); oss << "gid:" << generateRandomInteger(0, 200); *msgGroupId = oss.str(); } @@ -570,9 +569,9 @@ void populateBlob(bdlbb::Blob* blob, // Options if (numSubQueueInfos > 0) { // Write option header - mwcu::BlobUtil::reserve(&data.d_optionsPosition, blob, sizeof(oh)); + bmqu::BlobUtil::reserve(&data.d_optionsPosition, blob, sizeof(oh)); - mwcu::BlobUtil::writeBytes(blob, + bmqu::BlobUtil::writeBytes(blob, data.d_optionsPosition, reinterpret_cast(&oh), sizeof(oh)); @@ -624,8 +623,8 @@ void populateBlob(bdlbb::Blob* blob, bmqp::EventHeader* eh, bdlbb::Blob* eb, // expected appData int* ebLen, // expected appDataLen - mwcu::BlobPosition* headerPosition, - mwcu::BlobPosition* payloadPosition, + bmqu::BlobPosition* headerPosition, + bmqu::BlobPosition* payloadPosition, int queueId, const bmqt::MessageGUID& guid, bmqt::CompressionAlgorithmType::Enum cat, @@ -640,7 +639,7 @@ void populateBlob(bdlbb::Blob* blob, *ebLen = bsl::strlen(payload); bdlbb::BlobUtil::append(eb, payload, *ebLen); - mwcu::MemOutStream error(allocator); + bmqu::MemOutStream error(allocator); bdlbb::Blob compressedBlob(bufferFactory, allocator); int payloadLength = bsl::strlen(payload); bmqp::Compression::compress(&compressedBlob, @@ -692,18 +691,18 @@ void populateBlob(bdlbb::Blob* blob, eh->headerWords() * bmqp::Protocol::k_WORD_SIZE); // Capture PushHeader position - mwcu::BlobUtil::reserve(headerPosition, + bmqu::BlobUtil::reserve(headerPosition, blob, ph.headerWords() * bmqp::Protocol::k_WORD_SIZE); - mwcu::BlobUtil::writeBytes(blob, + bmqu::BlobUtil::writeBytes(blob, *headerPosition, reinterpret_cast(&ph), ph.headerWords() * bmqp::Protocol::k_WORD_SIZE); const int payloadOffset = blob->length(); bdlbb::BlobUtil::append(blob, compressedBlob); - mwcu::BlobUtil::findOffset(payloadPosition, *blob, payloadOffset); + bmqu::BlobUtil::findOffset(payloadPosition, *blob, payloadOffset); } void breathingTestHelper( @@ -716,9 +715,9 @@ void breathingTestHelper( bdlbb::Blob expectedBlob(bufferFactory_p, s_allocator_p); bdlbb::Blob expectedCompressedBlob(bufferFactory_p, s_allocator_p); int expectedBlobLength = 0; - mwcu::BlobPosition expectedHeaderPos; - mwcu::BlobPosition expectedPayloadPos; - mwcu::BlobPosition retrievedPayloadPos; + bmqu::BlobPosition expectedHeaderPos; + bmqu::BlobPosition expectedPayloadPos; + bmqu::BlobPosition retrievedPayloadPos; bdlbb::Blob retrievedPayloadBlob(s_allocator_p); // Populate blob @@ -853,7 +852,7 @@ void breathingTestHelper( retrievedPayloadBlob2.removeAll(); } - mwcu::BlobPosition retrievedPayloadPos2; + bmqu::BlobPosition retrievedPayloadPos2; ASSERT_EQ(0, iter.loadApplicationDataPosition(&retrievedPayloadPos2)); ASSERT_EQ(retrievedPayloadPos2, expectedPayloadPos); @@ -915,7 +914,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -977,7 +976,7 @@ static void test1_breathingTest() static void test2_iteratorReset() { - mwctst::TestHelper::printTestName("ITERATOR RESET"); + bmqtst::TestHelper::printTestName("ITERATOR RESET"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqp::PushMessageIterator pmt(&bufferFactory, s_allocator_p); @@ -985,8 +984,8 @@ static void test2_iteratorReset() bdlbb::Blob expectedBlob(&bufferFactory, s_allocator_p); bdlbb::Blob expectedCompressedBlob(&bufferFactory, s_allocator_p); int expectedBlobLength = 0; - mwcu::BlobPosition headerPosition; - mwcu::BlobPosition payloadPosition; + bmqu::BlobPosition headerPosition; + bmqu::BlobPosition payloadPosition; const int queueId = 123; bmqt::MessageGUID guid; bmqp::EventHeader eventHeader; @@ -1047,7 +1046,7 @@ static void test2_iteratorReset() /// Test iterating over PUSH event having *NO* PUSH messages static void test3_iteratePushEventHavingNoMessages() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "ITERATE PUSH EVENT HAVING NO PUSH MESSAGES"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -1075,7 +1074,7 @@ static void test3_iteratePushEventHavingNoMessages() /// enough bytes in the blob). static void test4_iterateInvalidPushEvent() { - mwctst::TestHelper::printTestName("ITERATE INVALID PUSH EVENT"); + bmqtst::TestHelper::printTestName("ITERATE INVALID PUSH EVENT"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob eventBlob(&bufferFactory, s_allocator_p); @@ -1114,7 +1113,7 @@ static void test4_iterateInvalidPushEvent() static void test5_iteratePushEventHavingMultipleMessages() { - mwctst::TestHelper::printTestName("PUSH EVENT HAVING MULTIPLE MESSAGES"); + bmqtst::TestHelper::printTestName("PUSH EVENT HAVING MULTIPLE MESSAGES"); // Test iterating over PUSH event having multiple PUSH messages bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -1172,9 +1171,9 @@ static void test5_iteratePushEventHavingMultipleMessages() bdlbb::Blob props(s_allocator_p); bdlbb::Blob payload(s_allocator_p); bdlbb::Blob appData(s_allocator_p); - mwcu::BlobPosition propsPos; - mwcu::BlobPosition payloadPos; - mwcu::BlobPosition appDataPos; + bmqu::BlobPosition propsPos; + bmqu::BlobPosition payloadPos; + bmqu::BlobPosition appDataPos; // Below, we are relying on the imp detail when we check for rc of // '-1' for various 'load*' routines when 'isAppDataImplicit' flag @@ -1218,7 +1217,7 @@ static void test5_iteratePushEventHavingMultipleMessages() /// messages. static void test6_iteratePushEventHavingZeroLengthMessages() { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "PUSH EVENT HAVING ZERO-LENGTH MESSAGES"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -1278,9 +1277,9 @@ static void test6_iteratePushEventHavingZeroLengthMessages() bdlbb::Blob props(s_allocator_p); bdlbb::Blob payload(s_allocator_p); bdlbb::Blob appData(s_allocator_p); - mwcu::BlobPosition propsPos; - mwcu::BlobPosition payloadPos; - mwcu::BlobPosition appDataPos; + bmqu::BlobPosition propsPos; + bmqu::BlobPosition payloadPos; + bmqu::BlobPosition appDataPos; // Below, we are relying on the imp detail when we check for rc of // '-1' for various 'load*' routines when 'isAppDataImplicit' flag @@ -1351,7 +1350,7 @@ static void test7_extractOptions() // - extractMsgGroupId(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("EXTRACT OPTIONS"); + bmqtst::TestHelper::printTestName("EXTRACT OPTIONS"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob eventBlob(&bufferFactory, s_allocator_p); @@ -1536,7 +1535,7 @@ static void test7_extractOptions() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); // Temporary workaround to suppress the 'unused operator // NestedTraitDeclaration' warning/error generated by clang. TBD: @@ -1575,5 +1574,5 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_puteventbuilder.cpp b/src/groups/bmq/bmqp/bmqp_puteventbuilder.cpp index 3d6da5b4c..dfca9cd2c 100644 --- a/src/groups/bmq/bmqp/bmqp_puteventbuilder.cpp +++ b/src/groups/bmq/bmqp/bmqp_puteventbuilder.cpp @@ -23,10 +23,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -90,9 +89,9 @@ PutEventBuilder::packMessageInternal(const bdlbb::Blob& appData, int queueId) } // Add the PutHeader - mwcu::BlobPosition offset; - mwcu::BlobUtil::reserve(&offset, &d_blob, sizeof(PutHeader)); - mwcu::BlobObjectProxy putHeader(&d_blob, + bmqu::BlobPosition offset; + bmqu::BlobUtil::reserve(&offset, &d_blob, sizeof(PutHeader)); + bmqu::BlobObjectProxy putHeader(&d_blob, offset, false, // no read true); // write mode @@ -262,7 +261,7 @@ PutEventBuilder::packMessageInOldStyle(int queueId) d_compressionAlgorithmType != bmqt::CompressionAlgorithmType::e_NONE) { bdlbb::Blob compressedApplicationData(d_bufferFactory_p, d_allocator_p); - mwcu::MemOutStream error(d_allocator_p); + bmqu::MemOutStream error(d_allocator_p); int rc = Compression::compress(&compressedApplicationData, d_bufferFactory_p, @@ -355,7 +354,7 @@ bmqt::EventBuilderResult::Enum PutEventBuilder::packMessage(int queueId) if (payloadBlob->length() >= Protocol::k_COMPRESSION_MIN_APPDATA_SIZE && d_compressionAlgorithmType != bmqt::CompressionAlgorithmType::e_NONE) { bdlbb::Blob compressedPayloadBlob(d_bufferFactory_p, d_allocator_p); - mwcu::MemOutStream error(d_allocator_p); + bmqu::MemOutStream error(d_allocator_p); int rc = Compression::compress(&compressedPayloadBlob, d_bufferFactory_p, diff --git a/src/groups/bmq/bmqp/bmqp_puteventbuilder.t.cpp b/src/groups/bmq/bmqp/bmqp_puteventbuilder.t.cpp index 4396d0d99..c120b609b 100644 --- a/src/groups/bmq/bmqp/bmqp_puteventbuilder.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_puteventbuilder.t.cpp @@ -27,9 +27,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -52,7 +51,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -96,9 +95,10 @@ Data::Data(const Data& other, bslma::Allocator* allocator) // NOTHING } +#ifdef BMQ_ENABLE_MSG_GROUPID void setMsgGroupId(bmqp::PutEventBuilder* peb, const size_t iteration) { - mwcu::MemOutStream oss(s_allocator_p); + bmqu::MemOutStream oss(s_allocator_p); oss << "gid:" << iteration; peb->setMsgGroupId(oss.str()); } @@ -109,10 +109,11 @@ void validateGroupId(const size_t iteration, ASSERT(putIter.hasMsgGroupId()); bmqp::Protocol::MsgGroupId msgGroupId; ASSERT(putIter.extractMsgGroupId(&msgGroupId)); - mwcu::MemOutStream oss(s_allocator_p); + bmqu::MemOutStream oss(s_allocator_p); oss << "gid:" << iteration; ASSERT_EQ(oss.str(), msgGroupId); } +#endif bmqt::EventBuilderResult::Enum appendMessage(size_t iteration, @@ -137,7 +138,9 @@ appendMessage(size_t iteration, peb->startMessage(); } +#ifdef BMQ_ENABLE_MSG_GROUPID setMsgGroupId(peb, iteration); +#endif peb->setMessagePayload(&data.d_payload); peb->setMessageGUID(data.d_guid); @@ -163,7 +166,7 @@ unsigned int findExpectedCrc32( // New format. } - mwcu::MemOutStream error(allocator); + bmqu::MemOutStream error(allocator); int rc = bmqp::Compression::compress(&applicationData, bufferFactory, compressionAlgorithmType, @@ -208,17 +211,19 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); - bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); + bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); +#ifdef BMQ_ENABLE_MSG_GROUPID const bmqp::Protocol::MsgGroupId k_MSG_GROUP_ID("gid:0", s_allocator_p); - const int k_PROPERTY_VAL_ENCODING = 3; - const bsl::string k_PROPERTY_VAL_ID = "myCoolId"; - const unsigned int k_CRC32 = 123; - const bsls::Types::Int64 k_TIME_STAMP = 1234567890LL; - const int k_NUM_PROPERTIES = 3; - const char* k_PAYLOAD = "abcdefghijklmnopqrstuvwxyz"; - const int k_PAYLOAD_BIGGER_LEN = +#endif + const int k_PROPERTY_VAL_ENCODING = 3; + const bsl::string k_PROPERTY_VAL_ID = "myCoolId"; + const unsigned int k_CRC32 = 123; + const bsls::Types::Int64 k_TIME_STAMP = 1234567890LL; + const int k_NUM_PROPERTIES = 3; + const char* k_PAYLOAD = "abcdefghijklmnopqrstuvwxyz"; + const int k_PAYLOAD_BIGGER_LEN = bmqp::Protocol::k_COMPRESSION_MIN_APPDATA_SIZE + 400; char k_PAYLOAD_BIGGER[k_PAYLOAD_BIGGER_LEN]; @@ -254,7 +259,9 @@ static void test1_breathingTest() obj.startMessage(); obj.setMessagePayload(k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); obj.setMessageProperties(&msgProps); +#ifdef BMQ_ENABLE_MSG_GROUPID obj.setMsgGroupId(k_MSG_GROUP_ID); +#endif struct Test { int d_line; @@ -303,8 +310,10 @@ static void test1_breathingTest() s_allocator_p, obj.compressionAlgorithmType()); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_EQ(obj.msgGroupId().isNull(), false); ASSERT_EQ(obj.msgGroupId().value(), k_MSG_GROUP_ID); +#endif ASSERT_EQ(obj.unpackedMessageSize(), k_PAYLOAD_BIGGER_LEN); @@ -355,9 +364,9 @@ static void test1_breathingTest() k_PAYLOAD_BIGGER_LEN); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); @@ -391,11 +400,13 @@ static void test1_breathingTest() test.d_timeStamp); } +#ifdef BMQ_ENABLE_MSG_GROUPID bmqp::Protocol::MsgGroupId msgGroupId(s_allocator_p); ASSERT_EQ(putIter.hasMsgGroupId(), true); ASSERT_EQ(putIter.extractMsgGroupId(&msgGroupId), true); ASSERT_EQ(msgGroupId, k_MSG_GROUP_ID); ASSERT_EQ(putIter.isValid(), true); +#endif } ASSERT_EQ(true, putIter.isValid()); @@ -436,9 +447,9 @@ static void test1_breathingTest() bmqp::MessageProperties prop(s_allocator_p); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); ASSERT_EQ(0, res); @@ -472,7 +483,9 @@ static void test1_breathingTest() obj.startMessage(); obj.setMessagePayload(k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); obj.setMessageProperties(&msgProps); +#ifdef BMQ_ENABLE_MSG_GROUPID obj.setMsgGroupId(k_MSG_GROUP_ID); +#endif struct Test { int d_line; @@ -520,8 +533,10 @@ static void test1_breathingTest() s_allocator_p, obj.compressionAlgorithmType()); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_EQ(obj.msgGroupId().isNull(), false); ASSERT_EQ(obj.msgGroupId().value(), k_MSG_GROUP_ID); +#endif ASSERT_EQ(obj.unpackedMessageSize(), k_PAYLOAD_BIGGER_LEN); @@ -573,9 +588,9 @@ static void test1_breathingTest() k_PAYLOAD_BIGGER_LEN); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); @@ -609,10 +624,12 @@ static void test1_breathingTest() test.d_timeStamp); } +#ifdef BMQ_ENABLE_MSG_GROUPID bmqp::Protocol::MsgGroupId msgGroupId(s_allocator_p); ASSERT_EQ(putIter.hasMsgGroupId(), true); ASSERT_EQ(putIter.extractMsgGroupId(&msgGroupId), true); ASSERT_EQ(msgGroupId, k_MSG_GROUP_ID); +#endif ASSERT_EQ(putIter.isValid(), true); } @@ -660,9 +677,9 @@ static void test1_breathingTest() bmqp::MessageProperties prop(s_allocator_p); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); ASSERT_EQ(0, res); @@ -696,7 +713,9 @@ static void test1_breathingTest() obj.startMessage(); obj.setMessagePayload(k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); obj.setMessageProperties(&msgProps); +#ifdef BMQ_ENABLE_MSG_GROUPID obj.setMsgGroupId(k_MSG_GROUP_ID); +#endif struct Test { int d_line; @@ -751,8 +770,10 @@ static void test1_breathingTest() s_allocator_p, obj.compressionAlgorithmType()); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_EQ(obj.msgGroupId().isNull(), false); ASSERT_EQ(obj.msgGroupId().value(), k_MSG_GROUP_ID); +#endif ASSERT_EQ(obj.unpackedMessageSize(), k_PAYLOAD_BIGGER_LEN); @@ -811,9 +832,9 @@ static void test1_breathingTest() k_PAYLOAD_BIGGER_LEN); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); @@ -847,10 +868,12 @@ static void test1_breathingTest() test.d_timeStamp); } +#ifdef BMQ_ENABLE_MSG_GROUPID bmqp::Protocol::MsgGroupId msgGroupId(s_allocator_p); ASSERT_EQ(putIter.hasMsgGroupId(), true); ASSERT_EQ(putIter.extractMsgGroupId(&msgGroupId), true); ASSERT_EQ(msgGroupId, k_MSG_GROUP_ID); +#endif ASSERT_EQ(putIter.isValid(), true); } @@ -898,9 +921,9 @@ static void test1_breathingTest() bmqp::MessageProperties prop(s_allocator_p); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); ASSERT_EQ(0, res); @@ -935,7 +958,9 @@ static void test1_breathingTest() obj.startMessage(); obj.setMessagePayload(k_PAYLOAD, k_PAYLOAD_LEN); obj.setMessageProperties(&msgProps); +#ifdef BMQ_ENABLE_MSG_GROUPID obj.setMsgGroupId(k_MSG_GROUP_ID); +#endif struct Test { int d_line; @@ -990,8 +1015,10 @@ static void test1_breathingTest() s_allocator_p, bmqt::CompressionAlgorithmType::e_NONE); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_EQ(obj.msgGroupId().isNull(), false); ASSERT_EQ(obj.msgGroupId().value(), k_MSG_GROUP_ID); +#endif ASSERT_EQ(obj.unpackedMessageSize(), k_PAYLOAD_LEN); @@ -1043,9 +1070,9 @@ static void test1_breathingTest() BSLS_ASSERT_OPT(putIter.messagePayloadSize() == k_PAYLOAD_LEN); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD, k_PAYLOAD_LEN); @@ -1079,10 +1106,12 @@ static void test1_breathingTest() test.d_timeStamp); } +#ifdef BMQ_ENABLE_MSG_GROUPID bmqp::Protocol::MsgGroupId msgGroupId(s_allocator_p); ASSERT_EQ(putIter.hasMsgGroupId(), true); ASSERT_EQ(putIter.extractMsgGroupId(&msgGroupId), true); ASSERT_EQ(msgGroupId, k_MSG_GROUP_ID); +#endif ASSERT_EQ(putIter.isValid(), true); } @@ -1125,9 +1154,9 @@ static void test1_breathingTest() bmqp::MessageProperties prop(s_allocator_p); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD, k_PAYLOAD_LEN); ASSERT_EQ(0, res); @@ -1162,7 +1191,9 @@ static void test1_breathingTest() obj.startMessage(); obj.setMessagePayload(k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); obj.setMessageProperties(&msgProps); +#ifdef BMQ_ENABLE_MSG_GROUPID obj.setMsgGroupId(k_MSG_GROUP_ID); +#endif struct Test { int d_line; @@ -1211,8 +1242,10 @@ static void test1_breathingTest() s_allocator_p, bmqt::CompressionAlgorithmType::e_NONE); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_EQ(obj.msgGroupId().isNull(), false); ASSERT_EQ(obj.msgGroupId().value(), k_MSG_GROUP_ID); +#endif ASSERT_EQ(obj.unpackedMessageSize(), k_PAYLOAD_BIGGER_LEN); @@ -1263,9 +1296,9 @@ static void test1_breathingTest() k_PAYLOAD_BIGGER_LEN); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); @@ -1299,10 +1332,12 @@ static void test1_breathingTest() test.d_timeStamp); } +#ifdef BMQ_ENABLE_MSG_GROUPID bmqp::Protocol::MsgGroupId msgGroupId(s_allocator_p); ASSERT_EQ(putIter.hasMsgGroupId(), true); ASSERT_EQ(putIter.extractMsgGroupId(&msgGroupId), true); ASSERT_EQ(msgGroupId, k_MSG_GROUP_ID); +#endif ASSERT_EQ(putIter.isValid(), true); } @@ -1345,9 +1380,9 @@ static void test1_breathingTest() bmqp::MessageProperties prop(s_allocator_p); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); ASSERT_EQ(0, res); @@ -1366,7 +1401,7 @@ static void test1_breathingTest() // Create PutEventBuilder bmqp::PutEventBuilder obj(&bufferFactory, s_allocator_p); ASSERT_EQ(obj.crc32c(), 0U); - mwcu::MemOutStream error(s_allocator_p); + bmqu::MemOutStream error(s_allocator_p); obj.startMessage(); @@ -1382,7 +1417,9 @@ static void test1_breathingTest() s_allocator_p); obj.setMessagePayload(&payload); +#ifdef BMQ_ENABLE_MSG_GROUPID obj.setMsgGroupId(k_MSG_GROUP_ID); +#endif struct Test { int d_line; @@ -1410,8 +1447,10 @@ static void test1_breathingTest() ASSERT_EQ(obj.crc32c(), k_CRC32); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_EQ(obj.msgGroupId().isNull(), false); ASSERT_EQ(obj.msgGroupId().value(), k_MSG_GROUP_ID); +#endif ASSERT_EQ(obj.unpackedMessageSize(), payload.length()); @@ -1461,9 +1500,9 @@ static void test1_breathingTest() k_PAYLOAD_BIGGER_LEN); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); @@ -1476,10 +1515,12 @@ static void test1_breathingTest() ASSERT_EQ(0, putIter.loadMessageProperties(&prop)); ASSERT_EQ(0, prop.numProperties()); +#ifdef BMQ_ENABLE_MSG_GROUPID bmqp::Protocol::MsgGroupId msgGroupId(s_allocator_p); ASSERT_EQ(putIter.hasMsgGroupId(), true); ASSERT_EQ(putIter.extractMsgGroupId(&msgGroupId), true); ASSERT_EQ(msgGroupId, k_MSG_GROUP_ID); +#endif ASSERT_EQ(putIter.isValid(), true); } @@ -1524,9 +1565,9 @@ static void test1_breathingTest() bmqp::MessageProperties prop(s_allocator_p); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); ASSERT_EQ(0, res); @@ -1558,7 +1599,7 @@ static void test2_manipulators_one() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("MANIPULATORS - ONE"); + bmqtst::TestHelper::printTestName("MANIPULATORS - ONE"); struct TestData { int d_line; @@ -1636,7 +1677,9 @@ static void test2_manipulators_one() ASSERT_EQ_D(dataIdx, obj.unpackedMessageSize(), 0); +#ifdef BMQ_ENABLE_MSG_GROUPID setMsgGroupId(&obj, dataIdx); +#endif obj.setMessagePayload(data.d_payload, data.d_payloadLen); ASSERT_EQ(0, msgProps.setPropertyAsInt64("timestamp", dataIdx * 10LL)); @@ -1696,9 +1739,9 @@ static void test2_manipulators_one() putIter.messagePayloadSize()); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), data.d_payload, data.d_payloadLen); @@ -1720,7 +1763,9 @@ static void test2_manipulators_one() ASSERT_EQ(bmqt::PropertyType::e_INT64, ptype); ASSERT_EQ(dataIndex * 10LL, p.getPropertyAsInt64("timestamp")); +#ifdef BMQ_ENABLE_MSG_GROUPID validateGroupId(dataIndex, putIter); +#endif ++dataIndex; } @@ -1743,13 +1788,15 @@ static void test3_eventTooBig() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("EVENT TOO BIG"); + bmqtst::TestHelper::printTestName("EVENT TOO BIG"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); - bdlbb::Blob bigMsgPayload(&bufferFactory, s_allocator_p); + bdlbb::Blob bigMsgPayload(&bufferFactory, s_allocator_p); +#ifdef BMQ_ENABLE_MSG_GROUPID bmqp::Protocol::MsgGroupId k_MSG_GROUP_ID("gid:0", s_allocator_p); - const int k_QID = 4321; - bmqt::MessageGUID guid = bmqp::MessageGUIDGenerator::testGUID(); +#endif + const int k_QID = 4321; + bmqt::MessageGUID guid = bmqp::MessageGUIDGenerator::testGUID(); bmqp::PutTester::populateBlob(&bigMsgPayload, bmqp::PutHeader::k_MAX_PAYLOAD_SIZE_SOFT + @@ -1762,7 +1809,9 @@ static void test3_eventTooBig() bmqp::PutEventBuilder obj(&bufferFactory, s_allocator_p); obj.startMessage(); +#ifdef BMQ_ENABLE_MSG_GROUPID obj.setMsgGroupId(k_MSG_GROUP_ID); +#endif obj.setMessageGUID(guid); obj.setMessagePayload(&bigMsgPayload); @@ -1774,7 +1823,9 @@ static void test3_eventTooBig() const int k_PAYLOAD_LEN = bsl::strlen(k_PAYLOAD); // Now append a "regular"-sized message +#ifdef BMQ_ENABLE_MSG_GROUPID obj.setMsgGroupId(k_MSG_GROUP_ID); +#endif obj.setMessageGUID(guid); obj.setMessagePayload(k_PAYLOAD, k_PAYLOAD_LEN); rc = obj.packMessage(k_QID); @@ -1805,20 +1856,22 @@ static void test3_eventTooBig() ASSERT_EQ(putIter.messagePayloadSize(), k_PAYLOAD_LEN); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD, k_PAYLOAD_LEN); ASSERT_EQ(res, 0); ASSERT_EQ(compareResult, 0); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT(putIter.hasMsgGroupId()); bmqp::Protocol::MsgGroupId msgGroupId(s_allocator_p); ASSERT_EQ(putIter.extractMsgGroupId(&msgGroupId), true); ASSERT_EQ(msgGroupId, k_MSG_GROUP_ID); +#endif ASSERT_EQ(0, putIter.next()); // we added only 1 msg } @@ -1838,7 +1891,7 @@ static void test4_manipulators_two() // setMessagePayload(const char* data, int size) variant. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("MANIPULATORS - TWO"); + bmqtst::TestHelper::printTestName("MANIPULATORS - TWO"); // Create PutEventBuilder bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -1890,7 +1943,9 @@ static void test4_manipulators_two() 0, bdlbb::BlobUtil::compare(payloadBlob, D.d_payload)); +#ifdef BMQ_ENABLE_MSG_GROUPID validateGroupId(dataIndex, putIter); +#endif ++dataIndex; } @@ -1912,7 +1967,7 @@ static void test5_putEventWithZeroLengthMessage() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PUT EVENT WITH ZERO LEGNTH MESSAGE"); + bmqtst::TestHelper::printTestName("PUT EVENT WITH ZERO LEGNTH MESSAGE"); // Create PutEventBuilder bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -1960,10 +2015,12 @@ static void test6_emptyBuilder() // bmqp::PutEventBuilder setters and getters // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("EMPTY BUILDER"); + bmqtst::TestHelper::printTestName("EMPTY BUILDER"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); - bmqp::Protocol::MsgGroupId k_MSG_GROUP_ID("gid:0", s_allocator_p); +#ifdef BMQ_ENABLE_MSG_GROUPID + bmqp::Protocol::MsgGroupId k_MSG_GROUP_ID("gid:0", s_allocator_p); +#endif unsigned char zeroGuidBuf[bmqt::MessageGUID::e_SIZE_BINARY]; bsl::memset(zeroGuidBuf, 0, bmqt::MessageGUID::e_SIZE_BINARY); @@ -1981,7 +2038,9 @@ static void test6_emptyBuilder() ASSERT_EQ(obj.unpackedMessageSize(), 0); ASSERT_SAFE_FAIL(obj.setFlags(0)); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_SAFE_FAIL(obj.setMsgGroupId(k_MSG_GROUP_ID)); +#endif ASSERT_SAFE_FAIL(obj.setMessageGUID(zeroGuid)); ASSERT_SAFE_FAIL(obj.setCrc32c(0)); ASSERT_SAFE_FAIL(obj.setMessagePayload(k_PAYLOAD, bsl::strlen(k_PAYLOAD))); @@ -1992,7 +2051,9 @@ static void test6_emptyBuilder() const int evtSize = sizeof(bmqp::EventHeader); ASSERT_EQ(obj.messageGUID(), zeroGuid); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_EQ(obj.msgGroupId().isNull(), true); +#endif ASSERT_EQ(obj.unpackedMessageSize(), 0); ASSERT_EQ(obj.eventSize(), evtSize); ASSERT_EQ(obj.flags(), 0); @@ -2004,6 +2065,7 @@ static void test6_emptyBuilder() ASSERT_EQ(obj.messageGUID(), onesGuid); +#ifdef BMQ_ENABLE_MSG_GROUPID obj.setMsgGroupId(k_MSG_GROUP_ID); ASSERT_EQ(obj.msgGroupId().isNull(), false); @@ -2012,6 +2074,7 @@ static void test6_emptyBuilder() obj.clearMsgGroupId(); ASSERT_EQ(obj.msgGroupId().isNull(), true); +#endif static_cast(k_PAYLOAD); // suppress 'unused-variable' warning in // prod build @@ -2037,17 +2100,19 @@ static void test7_multiplePackMessage() // multiple calls to bmqp::PutEventBuilder::packMessage() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("TEST MULTIPLE CALLS TO PACK MESSAGE"); + bmqtst::TestHelper::printTestName("TEST MULTIPLE CALLS TO PACK MESSAGE"); - bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); + bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); +#ifdef BMQ_ENABLE_MSG_GROUPID const bmqp::Protocol::MsgGroupId k_MSG_GROUP_ID("gid:0", s_allocator_p); - const int k_PROPERTY_VAL_ENCODING = 3; - const bsl::string k_PROPERTY_VAL_ID = "myCoolId"; - const unsigned int k_CRC32 = 123; - const bsls::Types::Int64 k_TIME_STAMP = 1234567890LL; - const int k_NUM_PROPERTIES = 3; - const char* k_PAYLOAD = "abcdefghijklmnopqrstuvwxyz"; - const int k_PAYLOAD_BIGGER_LEN = +#endif + const int k_PROPERTY_VAL_ENCODING = 3; + const bsl::string k_PROPERTY_VAL_ID = "myCoolId"; + const unsigned int k_CRC32 = 123; + const bsls::Types::Int64 k_TIME_STAMP = 1234567890LL; + const int k_NUM_PROPERTIES = 3; + const char* k_PAYLOAD = "abcdefghijklmnopqrstuvwxyz"; + const int k_PAYLOAD_BIGGER_LEN = bmqp::Protocol::k_COMPRESSION_MIN_APPDATA_SIZE + 400; char k_PAYLOAD_BIGGER[k_PAYLOAD_BIGGER_LEN]; const char* k_HEX_GUIDS[] = {"40000000000000000000000000000001", @@ -2080,7 +2145,9 @@ static void test7_multiplePackMessage() obj.setMessagePayload(k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN) .setMessageProperties(&msgProps) .setMessageGUID(bmqp::MessageGUIDGenerator::testGUID()) +#ifdef BMQ_ENABLE_MSG_GROUPID .setMsgGroupId(k_MSG_GROUP_ID) +#endif .setCompressionAlgorithmType(bmqt::CompressionAlgorithmType::e_ZLIB); int d_q1 = 9876; @@ -2102,8 +2169,10 @@ static void test7_multiplePackMessage() s_allocator_p, obj.compressionAlgorithmType()); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_EQ(obj.msgGroupId().isNull(), false); ASSERT_EQ(obj.msgGroupId().value(), k_MSG_GROUP_ID); +#endif ASSERT_EQ(obj.unpackedMessageSize(), k_PAYLOAD_BIGGER_LEN); @@ -2157,9 +2226,9 @@ static void test7_multiplePackMessage() ASSERT_EQ(putIter.messagePayloadSize(), k_PAYLOAD_BIGGER_LEN); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); @@ -2185,10 +2254,12 @@ static void test7_multiplePackMessage() ASSERT_EQ(bmqt::PropertyType::e_INT64, ptype); ASSERT_EQ(prop.getPropertyAsInt64("timestamp"), k_TIME_STAMP); +#ifdef BMQ_ENABLE_MSG_GROUPID bmqp::Protocol::MsgGroupId msgGroupId(s_allocator_p); ASSERT_EQ(putIter.hasMsgGroupId(), true); ASSERT_EQ(putIter.extractMsgGroupId(&msgGroupId), true); ASSERT_EQ(msgGroupId, k_MSG_GROUP_ID); +#endif ASSERT_EQ(putIter.isValid(), true); } @@ -2211,7 +2282,9 @@ static void test7_multiplePackMessage() ASSERT_EQ(bmqt::EventBuilderResult::e_SUCCESS, rc); ASSERT_GT(obj.eventSize(), k_PAYLOAD_BIGGER_LEN); ASSERT_EQ(obj.messageCount(), 3); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_EQ(obj.msgGroupId().isNull(), true); +#endif ASSERT_EQ(obj.compressionAlgorithmType(), bmqt::CompressionAlgorithmType::e_NONE); rawEvent.reset(&obj.blob()); @@ -2231,15 +2304,17 @@ static void test7_multiplePackMessage() bmqp::MessageProperties prop(s_allocator_p); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD_BIGGER, k_PAYLOAD_BIGGER_LEN); ASSERT_EQ(0, res); ASSERT_EQ(0, compareResult); ASSERT_EQ(false, putIter.hasMessageProperties()); +#ifdef BMQ_ENABLE_MSG_GROUPID ASSERT_EQ(false, putIter.hasMsgGroupId()); +#endif ASSERT_EQ(0, putIter.loadMessageProperties(&prop)); ASSERT_EQ(0, prop.numProperties()); ASSERT_EQ(true, putIter.isValid()); @@ -2262,12 +2337,12 @@ static void testN1_decodeFromFile() // with expected properties and payload. // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DECODE FROM FILE"); + bmqtst::TestHelper::printTestName("DECODE FROM FILE"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob outBlob(&bufferFactory, s_allocator_p); bdlbb::Blob payloadBlob(s_allocator_p); - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); bmqp::PutMessageIterator putIter(&bufferFactory, s_allocator_p); bdlb::Guid guid = bdlb::GuidUtil::generate(); @@ -2385,9 +2460,9 @@ static void testN1_decodeFromFile() ASSERT_EQ(putIter.messagePayloadSize(), k_PAYLOAD_LEN); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, payloadBlob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_PAYLOAD, k_PAYLOAD_LEN); @@ -2422,7 +2497,7 @@ int main(int argc, char* argv[]) // case where the associated logging infrastructure triggers a default // allocation violation for no apparent reason. - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); // Temporary workaround to suppress the 'unused operator // NestedTraitDeclaration' warning/error generated by clang. TBD: figure @@ -2458,5 +2533,5 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_putmessageiterator.cpp b/src/groups/bmq/bmqp/bmqp_putmessageiterator.cpp index a7ca31003..210949337 100644 --- a/src/groups/bmq/bmqp/bmqp_putmessageiterator.cpp +++ b/src/groups/bmq/bmqp/bmqp_putmessageiterator.cpp @@ -25,9 +25,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -90,8 +89,8 @@ int PutMessageIterator::compressedApplicationDataSize() const // and message payload. const int msgLenPadded = d_header.messageWords() * Protocol::k_WORD_SIZE; - mwcu::BlobPosition lastBytePos; - int rc = mwcu::BlobUtil::findOffsetSafe(&lastBytePos, + bmqu::BlobPosition lastBytePos; + int rc = bmqu::BlobUtil::findOffsetSafe(&lastBytePos, *d_blobIter.blob(), d_blobIter.position(), msgLenPadded - 1); @@ -135,12 +134,12 @@ int PutMessageIterator::applicationDataSize() const } int PutMessageIterator::loadApplicationDataPosition( - mwcu::BlobPosition* position) const + bmqu::BlobPosition* position) const { // PRECONDITIONS BSLS_ASSERT_SAFE(position); BSLS_ASSERT_SAFE(isValid()); - BSLS_ASSERT_SAFE(d_applicationDataPosition != mwcu::BlobPosition()); + BSLS_ASSERT_SAFE(d_applicationDataPosition != bmqu::BlobPosition()); enum RcEnum { // Value for the various RC error categories @@ -168,14 +167,14 @@ int PutMessageIterator::loadApplicationData(bdlbb::Blob* blob) const }; if (d_applicationDataSize > -1) { - mwcu::BlobUtil::appendToBlob(blob, + bmqu::BlobUtil::appendToBlob(blob, d_applicationData, - mwcu::BlobPosition()); + bmqu::BlobPosition()); return rc_SUCCESS; // RETURN } - BSLS_ASSERT_SAFE(d_applicationDataPosition != mwcu::BlobPosition()); - int rc = mwcu::BlobUtil::appendToBlob(blob, + BSLS_ASSERT_SAFE(d_applicationDataPosition != bmqu::BlobPosition()); + int rc = bmqu::BlobUtil::appendToBlob(blob, *d_blobIter.blob(), d_applicationDataPosition, applicationDataSize()); @@ -211,7 +210,7 @@ int PutMessageIterator::loadOptions(bdlbb::Blob* blob) const return rc_SUCCESS; // RETURN } - const int rc = mwcu::BlobUtil::appendToBlob(blob, + const int rc = bmqu::BlobUtil::appendToBlob(blob, *d_blobIter.blob(), d_optionsPosition, d_optionsSize); @@ -232,7 +231,7 @@ int PutMessageIterator::loadOptionsView(OptionsView* view) const } int PutMessageIterator::loadMessagePropertiesPosition( - mwcu::BlobPosition* position) const + bmqu::BlobPosition* position) const { // PRECONDITIONS BSLS_ASSERT_SAFE(position); @@ -242,11 +241,11 @@ int PutMessageIterator::loadMessagePropertiesPosition( if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!hasMessageProperties())) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - *position = mwcu::BlobPosition(); + *position = bmqu::BlobPosition(); return rc_NO_MSG_PROPERTIES; // RETURN } - BSLS_ASSERT_SAFE(d_applicationDataPosition != mwcu::BlobPosition()); + BSLS_ASSERT_SAFE(d_applicationDataPosition != bmqu::BlobPosition()); BSLS_ASSERT_SAFE(0 < d_messagePropertiesSize); *position = d_applicationDataPosition; @@ -268,12 +267,12 @@ int PutMessageIterator::loadMessageProperties(bdlbb::Blob* blob) const } // Message properties are present. - BSLS_ASSERT_SAFE(d_applicationDataPosition != mwcu::BlobPosition()); + BSLS_ASSERT_SAFE(d_applicationDataPosition != bmqu::BlobPosition()); BSLS_ASSERT_SAFE(0 < d_messagePropertiesSize); - int rc = mwcu::BlobUtil::appendToBlob(blob, + int rc = bmqu::BlobUtil::appendToBlob(blob, d_applicationData, - mwcu::BlobPosition(), + bmqu::BlobPosition(), d_messagePropertiesSize); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(rc != 0)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; @@ -336,7 +335,7 @@ int PutMessageIterator::messagePayloadSize() const } int PutMessageIterator::loadMessagePayloadPosition( - mwcu::BlobPosition* position) const + bmqu::BlobPosition* position) const { // PRECONDITIONS BSLS_ASSERT_SAFE(position); @@ -350,19 +349,19 @@ int PutMessageIterator::loadMessagePayloadPosition( rc_INVALID_PAYLOAD_OFFSET = -2 }; - if (d_lazyMessagePayloadPosition != mwcu::BlobPosition()) { + if (d_lazyMessagePayloadPosition != bmqu::BlobPosition()) { *position = d_lazyMessagePayloadPosition; return rc_SUCCESS; // RETURN } - int rc = mwcu::BlobUtil::findOffsetSafe(&d_lazyMessagePayloadPosition, + int rc = bmqu::BlobUtil::findOffsetSafe(&d_lazyMessagePayloadPosition, d_applicationData, - mwcu::BlobPosition(), + bmqu::BlobPosition(), d_messagePropertiesSize); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(rc != 0)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - d_lazyMessagePayloadPosition = mwcu::BlobPosition(); + d_lazyMessagePayloadPosition = bmqu::BlobPosition(); return (rc * 10 + rc_INVALID_PAYLOAD_OFFSET); // RETURN } @@ -382,12 +381,12 @@ int PutMessageIterator::loadMessagePayload(bdlbb::Blob* blob) const rc_INVALID_PAYLOAD_LENGTH = -2 }; - if (d_lazyMessagePayloadPosition == mwcu::BlobPosition()) { + if (d_lazyMessagePayloadPosition == bmqu::BlobPosition()) { // This could be because 'loadMessagePayloadPosition' wasn't called or // because it failed. If its later, calling it will fail again, and an // appropriate error will be returned. - mwcu::BlobPosition payloadPos; + bmqu::BlobPosition payloadPos; int rc = loadMessagePayloadPosition(&payloadPos); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(rc != 0)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; @@ -397,7 +396,7 @@ int PutMessageIterator::loadMessagePayload(bdlbb::Blob* blob) const BSLS_ASSERT_SAFE(d_lazyMessagePayloadPosition == payloadPos); } - int rc = mwcu::BlobUtil::appendToBlob(blob, + int rc = bmqu::BlobUtil::appendToBlob(blob, d_applicationData, d_lazyMessagePayloadPosition, messagePayloadSize()); @@ -482,11 +481,11 @@ int PutMessageIterator::next() // message d_applicationDataSize = -1; d_lazyMessagePayloadSize = -1; - d_lazyMessagePayloadPosition = mwcu::BlobPosition(); + d_lazyMessagePayloadPosition = bmqu::BlobPosition(); d_messagePropertiesSize = 0; - d_applicationDataPosition = mwcu::BlobPosition(); + d_applicationDataPosition = bmqu::BlobPosition(); d_optionsSize = 0; - d_optionsPosition = mwcu::BlobPosition(); + d_optionsPosition = bmqu::BlobPosition(); d_optionsView.reset(); d_applicationData.removeAll(); @@ -496,7 +495,7 @@ int PutMessageIterator::next() // Read PutHeader, supporting protocol evolution by reading as many bytes // as the header declares (and not as many as the size of the struct) - mwcu::BlobObjectProxy header(d_blobIter.blob(), + bmqu::BlobObjectProxy header(d_blobIter.blob(), d_blobIter.position(), -PutHeader::k_MIN_HEADER_SIZE, true, @@ -570,14 +569,14 @@ int PutMessageIterator::next() // the application data offset. int dataOffset = (d_header.headerWords() + d_header.optionsWords()) * bmqp::Protocol::k_WORD_SIZE; - int rc = mwcu::BlobUtil::findOffsetSafe(&d_applicationDataPosition, + int rc = bmqu::BlobUtil::findOffsetSafe(&d_applicationDataPosition, *d_blobIter.blob(), header.position(), dataOffset); // 'd_applicationDataPosition' is 'sizeof(EventHeader) + dataOffset' if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(rc != 0)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - d_applicationDataPosition = mwcu::BlobPosition(); + d_applicationDataPosition = bmqu::BlobPosition(); d_advanceLength = -1; return (rc * 10 + rc_INVALID_APPLICATION_DATA_OFFSET); // RETURN } @@ -633,7 +632,7 @@ int PutMessageIterator::next() d_allocator_p); if (rc < 0) { - d_applicationDataPosition = mwcu::BlobPosition(); + d_applicationDataPosition = bmqu::BlobPosition(); d_advanceLength = -1; return rc * 100 + rc_PARSING_ERROR; // RETURN } @@ -675,7 +674,7 @@ int PutMessageIterator::reset(const bdlbb::Blob* blob, clear(); d_decompressFlag = decompressFlag; - d_blobIter.reset(blob, mwcu::BlobPosition(), blob->length(), true); + d_blobIter.reset(blob, bmqu::BlobPosition(), blob->length(), true); bool rc = d_blobIter.advance(eventHeader.headerWords() * Protocol::k_WORD_SIZE); @@ -715,7 +714,7 @@ void PutMessageIterator::dumpBlob(bsl::ostream& stream) // For now, print only the beginning of the blob.. we may later on print // also the bytes around the current position if (d_blobIter.blob()) { - stream << mwcu::BlobStartHexDumper(d_blobIter.blob(), + stream << bmqu::BlobStartHexDumper(d_blobIter.blob(), k_MAX_BYTES_DUMP); } else { diff --git a/src/groups/bmq/bmqp/bmqp_putmessageiterator.h b/src/groups/bmq/bmqp/bmqp_putmessageiterator.h index 73b72ae49..227dca735 100644 --- a/src/groups/bmq/bmqp/bmqp_putmessageiterator.h +++ b/src/groups/bmq/bmqp/bmqp_putmessageiterator.h @@ -57,9 +57,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -91,7 +90,7 @@ class PutMessageIterator { private: // DATA - mwcu::BlobIterator d_blobIter; + bmqu::BlobIterator d_blobIter; // Blob iterator pointing to the current // message in the blob. @@ -122,7 +121,7 @@ class PutMessageIterator { // (without padding). -1 if not // initialized. - mutable mwcu::BlobPosition d_lazyMessagePayloadPosition; + mutable bmqu::BlobPosition d_lazyMessagePayloadPosition; // Lazily computed payload position. // Unset if not initialized. @@ -132,14 +131,14 @@ class PutMessageIterator { // includes padding and message // properties header. - mutable mwcu::BlobPosition d_applicationDataPosition; + mutable bmqu::BlobPosition d_applicationDataPosition; // Application Data position. For each // blob, initialized in next(). mutable int d_optionsSize; // Message options size. - mutable mwcu::BlobPosition d_optionsPosition; + mutable bmqu::BlobPosition d_optionsPosition; // Message options position. Unset if // not initialized. @@ -206,7 +205,7 @@ class PutMessageIterator { /// success, and a non-zero value otherwise. Behavior is undefined /// unless `d_decompressFlag` is true and the latest call to `next()` /// returned 1. - int loadMessagePayloadPosition(mwcu::BlobPosition* position) const; + int loadMessagePayloadPosition(bmqu::BlobPosition* position) const; /// Return the size (in bytes) of compressed application data for the /// message currently pointed to by this iterator. Behavior is @@ -323,7 +322,7 @@ class PutMessageIterator { /// Behavior is undefined unless latest call to `next()` returned 1. /// Note that application data includes message properties and message /// payload, but excludes the options. - int loadApplicationDataPosition(mwcu::BlobPosition* position) const; + int loadApplicationDataPosition(bmqu::BlobPosition* position) const; /// Load into the specified `blob` the application data for the message /// currently pointed to by this iterator. Behavior is undefined unless @@ -367,7 +366,7 @@ class PutMessageIterator { /// success, non-zero value if no properties are associated with the /// current message. Behavior is undefined unless latest call to /// `next()` returned 1. - int loadMessagePropertiesPosition(mwcu::BlobPosition* position) const; + int loadMessagePropertiesPosition(bmqu::BlobPosition* position) const; /// Load into the specified `blob` the properties for the message /// currently pointed to by this iterator. Behavior is undefined unless @@ -418,7 +417,7 @@ inline PutMessageIterator::PutMessageIterator( bdlbb::BlobBufferFactory* bufferFactory, bslma::Allocator* allocator, bool isDecompressingOldMPs) -: d_blobIter(0, mwcu::BlobPosition(), 0, true) +: d_blobIter(0, bmqu::BlobPosition(), 0, true) , d_applicationDataSize(-1) , d_lazyMessagePayloadSize(-1) , d_lazyMessagePayloadPosition() @@ -443,7 +442,7 @@ inline PutMessageIterator::PutMessageIterator( bool decompressFlag, bdlbb::BlobBufferFactory* bufferFactory, bslma::Allocator* allocator) -: d_blobIter(0, mwcu::BlobPosition(), 0, true) // no def ctor - set in reset +: d_blobIter(0, bmqu::BlobPosition(), 0, true) // no def ctor - set in reset , d_optionsView(allocator) , d_decompressFlag(decompressFlag) , d_applicationData(bufferFactory, allocator) @@ -457,7 +456,7 @@ inline PutMessageIterator::PutMessageIterator( inline PutMessageIterator::PutMessageIterator(const PutMessageIterator& src, bslma::Allocator* allocator) : d_blobIter(0, - mwcu::BlobPosition(), + bmqu::BlobPosition(), 0, true) // no def ctor - set in copyFrom , d_applicationData(src.d_bufferFactory_p, allocator) @@ -480,15 +479,15 @@ PutMessageIterator::operator=(const PutMessageIterator& rhs) inline void PutMessageIterator::clear() { - d_blobIter.reset(0, mwcu::BlobPosition(), 0, true); + d_blobIter.reset(0, bmqu::BlobPosition(), 0, true); d_header = PutHeader(); d_applicationDataSize = -1; d_lazyMessagePayloadSize = -1; - d_lazyMessagePayloadPosition = mwcu::BlobPosition(); + d_lazyMessagePayloadPosition = bmqu::BlobPosition(); d_messagePropertiesSize = 0; - d_applicationDataPosition = mwcu::BlobPosition(); + d_applicationDataPosition = bmqu::BlobPosition(); d_optionsSize = 0; - d_optionsPosition = mwcu::BlobPosition(); + d_optionsPosition = bmqu::BlobPosition(); d_advanceLength = -1; d_applicationData.removeAll(); d_optionsView.reset(); @@ -541,8 +540,8 @@ inline bool PutMessageIterator::hasOptions() const // PRECONDITIONS BSLS_ASSERT_SAFE(isValid()); BSLS_ASSERT_SAFE( - (d_optionsSize == 0 && d_optionsPosition == mwcu::BlobPosition()) || - (d_optionsSize != 0 && d_optionsPosition != mwcu::BlobPosition())); + (d_optionsSize == 0 && d_optionsPosition == bmqu::BlobPosition()) || + (d_optionsSize != 0 && d_optionsPosition != bmqu::BlobPosition())); return d_optionsSize > 0; } diff --git a/src/groups/bmq/bmqp/bmqp_putmessageiterator.t.cpp b/src/groups/bmq/bmqp/bmqp_putmessageiterator.t.cpp index d196bb8bc..eb526eb34 100644 --- a/src/groups/bmq/bmqp/bmqp_putmessageiterator.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_putmessageiterator.t.cpp @@ -34,7 +34,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -73,7 +73,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -109,9 +109,9 @@ static void test1_breathingTest() bdlbb::Blob blob(&bufferFactory, s_allocator_p); bdlbb::Blob expectedBlob(&bufferFactory, s_allocator_p); int expectedBlobLength = 0; - mwcu::BlobPosition expectedHeaderPos; - mwcu::BlobPosition expectedPayloadPos; - mwcu::BlobPosition retrievedPayloadPos; + bmqu::BlobPosition expectedHeaderPos; + bmqu::BlobPosition expectedPayloadPos; + bmqu::BlobPosition retrievedPayloadPos; bdlbb::Blob retrievedPayloadBlob(s_allocator_p); // Populate blob @@ -142,9 +142,9 @@ static void test1_breathingTest() ASSERT_EQ(expectedBlobLength, iter.applicationDataSize()); ASSERT_EQ(false, iter.hasMessageProperties()); - mwcu::BlobPosition emptyPos; + bmqu::BlobPosition emptyPos; ASSERT_EQ(false, 0 == iter.loadMessagePropertiesPosition(&emptyPos)); - ASSERT_EQ(mwcu::BlobPosition(), emptyPos); + ASSERT_EQ(bmqu::BlobPosition(), emptyPos); ASSERT_EQ(0, iter.loadApplicationDataPosition(&retrievedPayloadPos)); ASSERT_EQ(retrievedPayloadPos, expectedPayloadPos); @@ -184,10 +184,10 @@ static void test1_breathingTest() ASSERT_EQ(false, iter.hasMessageProperties()); ASSERT_EQ(false, 0 == iter.loadMessagePropertiesPosition(&emptyPos)); - ASSERT_EQ(mwcu::BlobPosition(), emptyPos); + ASSERT_EQ(bmqu::BlobPosition(), emptyPos); bdlbb::Blob retrievedPayloadBlob2(s_allocator_p); - mwcu::BlobPosition retrievedPayloadPos2; + bmqu::BlobPosition retrievedPayloadPos2; ASSERT_EQ(0, iter.loadApplicationDataPosition(&retrievedPayloadPos2)); ASSERT_EQ(retrievedPayloadPos2, expectedPayloadPos); @@ -209,9 +209,9 @@ static void test1_breathingTest() bdlbb::Blob blob(&bufferFactory, s_allocator_p); bdlbb::Blob expectedBlob(&bufferFactory, s_allocator_p); int expectedBlobLength = 0; - mwcu::BlobPosition expectedHeaderPos; - mwcu::BlobPosition expectedPayloadPos; - mwcu::BlobPosition retrievedPayloadPos; + bmqu::BlobPosition expectedHeaderPos; + bmqu::BlobPosition expectedPayloadPos; + bmqu::BlobPosition retrievedPayloadPos; bdlbb::Blob retrievedPayloadBlob(s_allocator_p); // Populate blob @@ -244,9 +244,9 @@ static void test1_breathingTest() ASSERT_EQ(guid, iter.header().messageGUID()); ASSERT_EQ(false, iter.hasMessageProperties()); - mwcu::BlobPosition emptyPos; + bmqu::BlobPosition emptyPos; ASSERT_EQ(false, 0 == iter.loadMessagePropertiesPosition(&emptyPos)); - ASSERT_EQ(mwcu::BlobPosition(), emptyPos); + ASSERT_EQ(bmqu::BlobPosition(), emptyPos); ASSERT_EQ(0, iter.loadApplicationDataPosition(&retrievedPayloadPos)); ASSERT_EQ(retrievedPayloadPos, expectedPayloadPos); @@ -284,10 +284,10 @@ static void test1_breathingTest() ASSERT_EQ(false, iter.hasMessageProperties()); ASSERT_EQ(false, 0 == iter.loadMessagePropertiesPosition(&emptyPos)); - ASSERT_EQ(mwcu::BlobPosition(), emptyPos); + ASSERT_EQ(bmqu::BlobPosition(), emptyPos); bdlbb::Blob retrievedPayloadBlob2(s_allocator_p); - mwcu::BlobPosition retrievedPayloadPos2; + bmqu::BlobPosition retrievedPayloadPos2; ASSERT_EQ(0, iter.loadApplicationDataPosition(&retrievedPayloadPos2)); ASSERT_EQ(retrievedPayloadPos2, expectedPayloadPos); @@ -309,9 +309,9 @@ static void test1_breathingTest() bdlbb::Blob blob(&bufferFactory, s_allocator_p); bdlbb::Blob expectedBlob(&bufferFactory, s_allocator_p); int expectedBlobLength = 0; - mwcu::BlobPosition expectedHeaderPos; - mwcu::BlobPosition expectedPayloadPos; - mwcu::BlobPosition retrievedPayloadPos; + bmqu::BlobPosition expectedHeaderPos; + bmqu::BlobPosition expectedPayloadPos; + bmqu::BlobPosition retrievedPayloadPos; bdlbb::Blob retrievedPayloadBlob(&bufferFactory, s_allocator_p); // Populate blob @@ -348,9 +348,9 @@ static void test1_breathingTest() ASSERT_EQ(0, iter.loadMessageProperties(&emptyBlob)); ASSERT_EQ(0, emptyBlob.length()); - mwcu::BlobPosition emptyPos; + bmqu::BlobPosition emptyPos; ASSERT_EQ(false, 0 == iter.loadMessagePropertiesPosition(&emptyPos)); - ASSERT_EQ(mwcu::BlobPosition(), emptyPos); + ASSERT_EQ(bmqu::BlobPosition(), emptyPos); bmqp::MessageProperties emptyProps(s_allocator_p); ASSERT_EQ(0, iter.loadMessageProperties(&emptyProps)); @@ -402,12 +402,12 @@ static void test1_breathingTest() ASSERT_EQ(0, iter.loadMessageProperties(&emptyBlob)); ASSERT_EQ(0, emptyBlob.length()); ASSERT_EQ(false, 0 == iter.loadMessagePropertiesPosition(&emptyPos)); - ASSERT_EQ(mwcu::BlobPosition(), emptyPos); + ASSERT_EQ(bmqu::BlobPosition(), emptyPos); ASSERT_EQ(0, iter.loadMessageProperties(&emptyProps)); ASSERT_EQ(0, emptyProps.numProperties()); bdlbb::Blob retrievedPayloadBlob2(&bufferFactory, s_allocator_p); - mwcu::BlobPosition retrievedPayloadPos2; + bmqu::BlobPosition retrievedPayloadPos2; ASSERT_EQ(0, iter.loadMessagePayload(&retrievedPayloadBlob2)); ASSERT_EQ(0, @@ -434,9 +434,9 @@ static void test1_breathingTest() bdlbb::Blob blob(&bufferFactory, s_allocator_p); bdlbb::Blob expectedBlob(&bufferFactory, s_allocator_p); int expectedBlobLength = 0; - mwcu::BlobPosition expectedHeaderPos; - mwcu::BlobPosition expectedPayloadPos; - mwcu::BlobPosition retrievedPayloadPos; + bmqu::BlobPosition expectedHeaderPos; + bmqu::BlobPosition expectedPayloadPos; + bmqu::BlobPosition retrievedPayloadPos; bdlbb::Blob retrievedPayloadBlob(&bufferFactory, s_allocator_p); // Populate blob @@ -476,9 +476,9 @@ static void test1_breathingTest() ASSERT_EQ(0, iter.loadMessageProperties(&emptyBlob)); ASSERT_EQ(0, emptyBlob.length()); - mwcu::BlobPosition emptyPos; + bmqu::BlobPosition emptyPos; ASSERT_EQ(false, 0 == iter.loadMessagePropertiesPosition(&emptyPos)); - ASSERT_EQ(mwcu::BlobPosition(), emptyPos); + ASSERT_EQ(bmqu::BlobPosition(), emptyPos); bmqp::MessageProperties emptyProps(s_allocator_p); ASSERT_EQ(0, iter.loadMessageProperties(&emptyProps)); @@ -530,12 +530,12 @@ static void test1_breathingTest() ASSERT_EQ(0, iter.loadMessageProperties(&emptyBlob)); ASSERT_EQ(0, emptyBlob.length()); ASSERT_EQ(false, 0 == iter.loadMessagePropertiesPosition(&emptyPos)); - ASSERT_EQ(mwcu::BlobPosition(), emptyPos); + ASSERT_EQ(bmqu::BlobPosition(), emptyPos); ASSERT_EQ(0, iter.loadMessageProperties(&emptyProps)); ASSERT_EQ(0, emptyProps.numProperties()); bdlbb::Blob retrievedPayloadBlob2(&bufferFactory, s_allocator_p); - mwcu::BlobPosition retrievedPayloadPos2; + bmqu::BlobPosition retrievedPayloadPos2; ASSERT_EQ(0, iter.loadMessagePayload(&retrievedPayloadBlob2)); ASSERT_EQ(0, @@ -569,7 +569,7 @@ static void test2_reset() // reset // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("RESET"); + bmqtst::TestHelper::printTestName("RESET"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -579,8 +579,8 @@ static void test2_reset() bdlbb::Blob copiedBlob(s_allocator_p); bdlbb::Blob expectedBlob(&bufferFactory, s_allocator_p); int expectedBlobLength = 0; - mwcu::BlobPosition headerPosition; - mwcu::BlobPosition payloadPosition; + bmqu::BlobPosition headerPosition; + bmqu::BlobPosition payloadPosition; const int queueId = 123; bmqp::EventHeader eventHeader; bdlbb::Blob payloadBlob(s_allocator_p); @@ -637,8 +637,8 @@ static void test2_reset() bdlbb::Blob copiedBlob(s_allocator_p); bdlbb::Blob expectedBlob(&bufferFactory, s_allocator_p); int expectedBlobLength = 0; - mwcu::BlobPosition headerPosition; - mwcu::BlobPosition payloadPosition; + bmqu::BlobPosition headerPosition; + bmqu::BlobPosition payloadPosition; const int queueId = 123; bmqp::EventHeader eventHeader; bdlbb::Blob payloadBlob(s_allocator_p); @@ -707,7 +707,7 @@ static void test3_putEventWithNoMessages() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PUT EVENT WITH NO MESSAGES"); + bmqtst::TestHelper::printTestName("PUT EVENT WITH NO MESSAGES"); // Test bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -741,7 +741,7 @@ static void test4_invalidPutEvent() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("INVALID PUT EVENT"); + bmqtst::TestHelper::printTestName("INVALID PUT EVENT"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); { @@ -823,7 +823,7 @@ static void test5_putEventWithMultipleMessages() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PUT EVENT WITH MULTIPLE MESSAGES"); + bmqtst::TestHelper::printTestName("PUT EVENT WITH MULTIPLE MESSAGES"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -873,9 +873,9 @@ static void test5_putEventWithMultipleMessages() bdlbb::Blob props(s_allocator_p); bdlbb::Blob payload(s_allocator_p); bdlbb::Blob appData(s_allocator_p); - mwcu::BlobPosition propsPos; - mwcu::BlobPosition payloadPos; - mwcu::BlobPosition appDataPos; + bmqu::BlobPosition propsPos; + bmqu::BlobPosition payloadPos; + bmqu::BlobPosition appDataPos; ASSERT_EQ_D(index, 0, @@ -974,9 +974,9 @@ static void test5_putEventWithMultipleMessages() bdlbb::Blob props(s_allocator_p); bdlbb::Blob payload(s_allocator_p); bdlbb::Blob appData(s_allocator_p); - mwcu::BlobPosition propsPos; - mwcu::BlobPosition payloadPos; - mwcu::BlobPosition appDataPos; + bmqu::BlobPosition propsPos; + bmqu::BlobPosition payloadPos; + bmqu::BlobPosition appDataPos; ASSERT_EQ_D(index, 0, @@ -1041,7 +1041,7 @@ static void test6_putEventWithZeroLengthPutMessages() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PUT EVENT WITH ZERO-LENGTH MESSAGES"); + bmqtst::TestHelper::printTestName("PUT EVENT WITH ZERO-LENGTH MESSAGES"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -1088,9 +1088,9 @@ static void test6_putEventWithZeroLengthPutMessages() bdlbb::Blob props(s_allocator_p); bdlbb::Blob payload(s_allocator_p); bdlbb::Blob appData(s_allocator_p); - mwcu::BlobPosition propsPos; - mwcu::BlobPosition payloadPos; - mwcu::BlobPosition appDataPos; + bmqu::BlobPosition propsPos; + bmqu::BlobPosition payloadPos; + bmqu::BlobPosition appDataPos; ASSERT_EQ_D(index, 0, @@ -1137,7 +1137,7 @@ static void test6_putEventWithZeroLengthPutMessages() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); @@ -1157,5 +1157,5 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_puttester.cpp b/src/groups/bmq/bmqp/bmqp_puttester.cpp index 78d01a0cd..ebdb70c44 100644 --- a/src/groups/bmq/bmqp/bmqp_puttester.cpp +++ b/src/groups/bmq/bmqp/bmqp_puttester.cpp @@ -22,8 +22,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -137,7 +136,7 @@ void PutTester::populateBlob(bdlbb::Blob* blob, bdlbb::BlobUtil::append(&properties, payload); data.d_appData = properties; - mwcu::MemOutStream error(allocator); + bmqu::MemOutStream error(allocator); int paddedCompressedAppDataNumWords = -1; if (cat != bmqt::CompressionAlgorithmType::e_NONE) { bdlbb::Blob compressed(bufferFactory, allocator); @@ -182,7 +181,7 @@ void PutTester::populateBlob(bdlbb::Blob* blob, const bool hasMsgGroupId = (i % 3); if (hasMsgGroupId) { // Don't add Group Id, once every 3 iterations - mwcu::MemOutStream oss(allocator); + bmqu::MemOutStream oss(allocator); oss << "gid:" << i; data.d_msgGroupId.makeValue(oss.str()); } @@ -274,8 +273,8 @@ void PutTester::populateBlob(bdlbb::Blob* blob, bmqp::EventHeader* eh, bdlbb::Blob* eb, int* ebLen, - mwcu::BlobPosition* headerPosition, - mwcu::BlobPosition* payloadPosition, + bmqu::BlobPosition* headerPosition, + bmqu::BlobPosition* payloadPosition, int queueId, const bmqt::MessageGUID& messageGUID, bmqt::CompressionAlgorithmType::Enum cat, @@ -289,7 +288,7 @@ void PutTester::populateBlob(bdlbb::Blob* blob, *ebLen = bsl::strlen(payload); bdlbb::BlobUtil::append(eb, payload, *ebLen); - mwcu::MemOutStream error(allocator); + bmqu::MemOutStream error(allocator); bdlbb::Blob compressedBlob(bufferFactory, allocator); if (cat != bmqt::CompressionAlgorithmType::e_NONE) { int payloadLength = bsl::strlen(payload); @@ -355,11 +354,11 @@ void PutTester::populateBlob(bdlbb::Blob* blob, eh->headerWords() * bmqp::Protocol::k_WORD_SIZE); // Capture PutHeader position - mwcu::BlobUtil::reserve(headerPosition, + bmqu::BlobUtil::reserve(headerPosition, blob, ph.headerWords() * bmqp::Protocol::k_WORD_SIZE); - mwcu::BlobUtil::writeBytes(blob, + bmqu::BlobUtil::writeBytes(blob, *headerPosition, reinterpret_cast(&ph), ph.headerWords() * bmqp::Protocol::k_WORD_SIZE); @@ -369,13 +368,13 @@ void PutTester::populateBlob(bdlbb::Blob* blob, const int payloadOffset = blob->length(); bdlbb::BlobUtil::append(blob, compressedBlob); - mwcu::BlobUtil::findOffset(payloadPosition, *blob, payloadOffset); + bmqu::BlobUtil::findOffset(payloadPosition, *blob, payloadOffset); } else { // Capture payload position - mwcu::BlobUtil::reserve(payloadPosition, blob, bsl::strlen(payload)); + bmqu::BlobUtil::reserve(payloadPosition, blob, bsl::strlen(payload)); - mwcu::BlobUtil::writeBytes(blob, + bmqu::BlobUtil::writeBytes(blob, *payloadPosition, payload, bsl::strlen(payload)); @@ -399,7 +398,7 @@ void PutTester::populateBlob(bdlbb::Blob* blob, bmqt::CompressionAlgorithmType::Enum cat, bslma::Allocator* allocator) { - mwcu::BlobUtil::reserve(blob, + bmqu::BlobUtil::reserve(blob, sizeof(bmqp::EventHeader) + sizeof(bmqp::PutHeader)); @@ -452,7 +451,7 @@ void PutTester::populateBlob(bdlbb::Blob* blob, } else { bdlbb::Blob dataBlob(bufferFactory, allocator); - mwcu::MemOutStream error(allocator); + bmqu::MemOutStream error(allocator); bdlbb::BlobUtil::append(&dataBlob, propertiesBlob); populateBlob(&dataBlob, length); @@ -479,21 +478,21 @@ void PutTester::populateBlob(bdlbb::Blob* blob, eh->setLength(sizeof(bmqp::EventHeader) + ph->messageWords() * bmqp::Protocol::k_WORD_SIZE); - mwcu::BlobPosition pos; - mwcu::BlobUtil::writeBytes(blob, + bmqu::BlobPosition pos; + bmqu::BlobUtil::writeBytes(blob, pos, reinterpret_cast(eh), eh->headerWords() * bmqp::Protocol::k_WORD_SIZE); - BSLA_MAYBE_UNUSED int rc = mwcu::BlobUtil::findOffsetSafe( + BSLA_MAYBE_UNUSED int rc = bmqu::BlobUtil::findOffsetSafe( &pos, *blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), sizeof(bmqp::EventHeader)); BSLS_ASSERT_SAFE(rc == 0); - mwcu::BlobUtil::writeBytes(blob, + bmqu::BlobUtil::writeBytes(blob, pos, reinterpret_cast(ph), ph->headerWords() * diff --git a/src/groups/bmq/bmqp/bmqp_puttester.h b/src/groups/bmq/bmqp/bmqp_puttester.h index 7439c54e0..27d31c40c 100644 --- a/src/groups/bmq/bmqp/bmqp_puttester.h +++ b/src/groups/bmq/bmqp/bmqp_puttester.h @@ -36,8 +36,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -128,8 +127,8 @@ struct PutTester { bmqp::EventHeader* eh, bdlbb::Blob* eb, int* ebLen, - mwcu::BlobPosition* headerPosition, - mwcu::BlobPosition* payloadPosition, + bmqu::BlobPosition* headerPosition, + bmqu::BlobPosition* payloadPosition, int queueId, const bmqt::MessageGUID& messageGUID, bmqt::CompressionAlgorithmType::Enum cat = diff --git a/src/groups/bmq/bmqp/bmqp_queueid.cpp b/src/groups/bmq/bmqp/bmqp_queueid.cpp index c03a80001..eaf5164f1 100644 --- a/src/groups/bmq/bmqp/bmqp_queueid.cpp +++ b/src/groups/bmq/bmqp/bmqp_queueid.cpp @@ -30,8 +30,7 @@ namespace bsl { // need to have 'is_fundamental' trait. template <> -struct is_fundamental : true_type { -}; +struct is_fundamental : true_type {}; template <> struct is_fundamental : true_type { diff --git a/src/groups/bmq/bmqp/bmqp_queueid.t.cpp b/src/groups/bmq/bmqp/bmqp_queueid.t.cpp index a9d5f2709..c8fcb10a8 100644 --- a/src/groups/bmq/bmqp/bmqp_queueid.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_queueid.t.cpp @@ -19,8 +19,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -29,7 +28,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -60,7 +59,7 @@ int generateRandomInteger(int min, int max) static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { // ----------- @@ -125,7 +124,7 @@ static void test1_breathingTest() static void test2_print() { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); int id = 5; unsigned int subId = 10; @@ -133,7 +132,7 @@ static void test2_print() bmqp::QueueId obj(id, subId); // Print - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); out.setstate(bsl::ios_base::badbit); obj.print(out, 0, -1); @@ -172,7 +171,7 @@ static void test3_hashAppend() // const bmqp::QueueId& queueId) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HASH APPEND"); + bmqtst::TestHelper::printTestName("HASH APPEND"); { PV("HASH FUNCTION DETERMINISTIC"); @@ -202,7 +201,7 @@ static void test3_hashAppend() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); unsigned int seed = bsl::time(NULL); bsl::srand(seed); @@ -219,5 +218,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_queueutil.t.cpp b/src/groups/bmq/bmqp/bmqp_queueutil.t.cpp index 673d82dd1..dde06ae64 100644 --- a/src/groups/bmq/bmqp/bmqp_queueutil.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_queueutil.t.cpp @@ -28,7 +28,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -51,7 +51,7 @@ static void test1_createQueueIdFromHandleParameters() // createQueueIdFromHandleParameters // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("createQueueIdFromHandleParameters"); + bmqtst::TestHelper::printTestName("createQueueIdFromHandleParameters"); struct Test { int d_line; @@ -106,7 +106,7 @@ static void test2_extractSubQueueId() // extractSubQueueId // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("extractSubQueueId"); + bmqtst::TestHelper::printTestName("extractSubQueueId"); struct Test { int d_line; @@ -170,7 +170,7 @@ static void test3_extractCanonicalHandleParameters() // extractCanonicalHandleParameters // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("extractCanonicalHandleParameters"); + bmqtst::TestHelper::printTestName("extractCanonicalHandleParameters"); // Short alias const int k_READ = bmqt::QueueFlags::e_READ; @@ -290,7 +290,7 @@ static void test4_isEmpty() // isEmpty // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("isEmpty"); + bmqtst::TestHelper::printTestName("isEmpty"); struct Test { int d_line; @@ -356,7 +356,7 @@ static void test4_isEmpty() static void test5_isValidFanoutConsumerSubId() { - mwctst::TestHelper::printTestName("isValidFanoutConsumerSubQueueId"); + bmqtst::TestHelper::printTestName("isValidFanoutConsumerSubQueueId"); using namespace bmqp; @@ -378,7 +378,7 @@ static void test5_isValidFanoutConsumerSubId() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); @@ -397,5 +397,5 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_recoveryeventbuilder.cpp b/src/groups/bmq/bmqp/bmqp_recoveryeventbuilder.cpp index 024c78047..943e79683 100644 --- a/src/groups/bmq/bmqp/bmqp_recoveryeventbuilder.cpp +++ b/src/groups/bmq/bmqp/bmqp_recoveryeventbuilder.cpp @@ -20,9 +20,8 @@ // BMQ #include -// MWC -#include -#include +#include +#include // BDE #include @@ -103,10 +102,10 @@ RecoveryEventBuilder::packMessage(unsigned int partitionId, } // Add RecoveryHeader - mwcu::BlobPosition offset; - mwcu::BlobUtil::reserve(&offset, &d_blob, sizeof(RecoveryHeader)); + bmqu::BlobPosition offset; + bmqu::BlobUtil::reserve(&offset, &d_blob, sizeof(RecoveryHeader)); - mwcu::BlobObjectProxy recoveryHeader(&d_blob, + bmqu::BlobObjectProxy recoveryHeader(&d_blob, offset, false, // no read true); // write mode diff --git a/src/groups/bmq/bmqp/bmqp_recoveryeventbuilder.t.cpp b/src/groups/bmq/bmqp/bmqp_recoveryeventbuilder.t.cpp index 424b23454..a4c4e92d0 100644 --- a/src/groups/bmq/bmqp/bmqp_recoveryeventbuilder.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_recoveryeventbuilder.t.cpp @@ -19,8 +19,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -28,7 +27,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -111,7 +110,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); const char* CHUNK = "abcdefghijklmnopqrstuvwx"; @@ -173,10 +172,10 @@ static void test1_breathingTest() ASSERT_EQ((sizeof(bmqp::RecoveryHeader) / bmqp::Protocol::k_WORD_SIZE), static_cast(recoveryIter.header().headerWords())); - mwcu::BlobPosition position; + bmqu::BlobPosition position; ASSERT_EQ(recoveryIter.loadChunkPosition(&position), 0); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, eventBlob, position, CHUNK, @@ -199,7 +198,7 @@ static void test2_multipleMessagesTest() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("MULTIPLE MESSAGES TEST"); + bmqtst::TestHelper::printTestName("MULTIPLE MESSAGES TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqp::RecoveryEventBuilder reb(&bufferFactory, s_allocator_p); @@ -249,11 +248,11 @@ static void test2_multipleMessagesTest() iter.header().md5Digest(), k_MD5_DIGEST_LEN)); - mwcu::BlobPosition chunkPosition; + bmqu::BlobPosition chunkPosition; ASSERT_EQ_D(dataIndex, 0, iter.loadChunkPosition(&chunkPosition)); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, eventBlob, chunkPosition, D.d_chunk.c_str(), @@ -276,7 +275,7 @@ static void test3_eventTooBigTest() // Test behavior when trying to build *one* big event. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("EVENT TOO BIG TEST"); + bmqtst::TestHelper::printTestName("EVENT TOO BIG TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqp::RecoveryEventBuilder reb(&bufferFactory, s_allocator_p); @@ -344,10 +343,10 @@ static void test3_eventTooBigTest() ASSERT_EQ(bmqp::RecoveryFileChunkType::e_DATA, recoveryIter.header().fileChunkType()); - mwcu::BlobPosition position; + bmqu::BlobPosition position; ASSERT_EQ(recoveryIter.loadChunkPosition(&position), 0); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, eventBlob, position, k_SMALL_CHUNK, @@ -365,7 +364,7 @@ static void test4_emptyPayloadTest() // Trying to build an event where the message has empty payload. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("EMPTY PAYLOAD TEST"); + bmqtst::TestHelper::printTestName("EMPTY PAYLOAD TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bmqp::RecoveryEventBuilder reb(&bufferFactory, s_allocator_p); @@ -406,7 +405,7 @@ static void test4_emptyPayloadTest() ASSERT_EQ(recoveryIter.header().fileChunkType(), bmqp::RecoveryFileChunkType::e_DATA); - mwcu::BlobPosition position; + bmqu::BlobPosition position; ASSERT_EQ(recoveryIter.loadChunkPosition(&position), 0); ASSERT_EQ(recoveryIter.next(), 0); // we added only 1 msg @@ -418,7 +417,7 @@ static void test4_emptyPayloadTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -432,5 +431,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_recoverymessageiterator.cpp b/src/groups/bmq/bmqp/bmqp_recoverymessageiterator.cpp index f0fb5c64e..0cfcf548f 100644 --- a/src/groups/bmq/bmqp/bmqp_recoverymessageiterator.cpp +++ b/src/groups/bmq/bmqp/bmqp_recoverymessageiterator.cpp @@ -132,7 +132,7 @@ int RecoveryMessageIterator::reset(const bdlbb::Blob* blob, // are no messages in it }; - d_blobIter.reset(blob, mwcu::BlobPosition(), blob->length(), true); + d_blobIter.reset(blob, bmqu::BlobPosition(), blob->length(), true); bool rc = d_blobIter.advance(eventHeader.headerWords() * Protocol::k_WORD_SIZE); @@ -172,7 +172,7 @@ void RecoveryMessageIterator::dumpBlob(bsl::ostream& stream) const // For now, print only the beginning of the blob.. we may later on print // also the bytes around the current position if (d_blobIter.blob()) { - stream << mwcu::BlobStartHexDumper(d_blobIter.blob(), + stream << bmqu::BlobStartHexDumper(d_blobIter.blob(), k_MAX_BYTES_DUMP); } else { diff --git a/src/groups/bmq/bmqp/bmqp_recoverymessageiterator.h b/src/groups/bmq/bmqp/bmqp_recoverymessageiterator.h index df76f9412..b03af2b8f 100644 --- a/src/groups/bmq/bmqp/bmqp_recoverymessageiterator.h +++ b/src/groups/bmq/bmqp/bmqp_recoverymessageiterator.h @@ -58,10 +58,9 @@ #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -80,11 +79,11 @@ namespace bmqp { class RecoveryMessageIterator { private: // DATA - mwcu::BlobIterator d_blobIter; + bmqu::BlobIterator d_blobIter; // Blob iterator pointing to the // current message in the blob. - mwcu::BlobObjectProxy d_header; + bmqu::BlobObjectProxy d_header; // Current PutHeader int d_advanceLength; @@ -166,7 +165,7 @@ class RecoveryMessageIterator { /// chunk of the recovery message currently pointed to by this iterator. /// The behavior is undefined unless `position` is not null. Return /// zero on success, non zero value otherwise. - int loadChunkPosition(mwcu::BlobPosition* position) const; + int loadChunkPosition(bmqu::BlobPosition* position) const; /// Dump the beginning of the blob associated to this /// RecoveryMessageIterator to the specified `stream`. @@ -183,7 +182,7 @@ class RecoveryMessageIterator { // CREATORS inline RecoveryMessageIterator::RecoveryMessageIterator() -: d_blobIter(0, mwcu::BlobPosition(), 0, true) +: d_blobIter(0, bmqu::BlobPosition(), 0, true) , d_advanceLength(-1) { // NOTHING @@ -192,7 +191,7 @@ inline RecoveryMessageIterator::RecoveryMessageIterator() inline RecoveryMessageIterator::RecoveryMessageIterator( const bdlbb::Blob* blob, const EventHeader& eventHeader) -: d_blobIter(0, mwcu::BlobPosition(), 0, true) // no def ctor - set in reset +: d_blobIter(0, bmqu::BlobPosition(), 0, true) // no def ctor - set in reset { reset(blob, eventHeader); } @@ -200,7 +199,7 @@ inline RecoveryMessageIterator::RecoveryMessageIterator( inline RecoveryMessageIterator::RecoveryMessageIterator( const RecoveryMessageIterator& src) : d_blobIter(0, - mwcu::BlobPosition(), + bmqu::BlobPosition(), 0, true) // no def ctor - set in copyFrom { @@ -220,7 +219,7 @@ RecoveryMessageIterator::operator=(const RecoveryMessageIterator& rhs) inline void RecoveryMessageIterator::clear() { - d_blobIter.reset(0, mwcu::BlobPosition(), 0, true); + d_blobIter.reset(0, bmqu::BlobPosition(), 0, true); d_header.reset(); d_advanceLength = -1; } @@ -240,13 +239,13 @@ inline const RecoveryHeader& RecoveryMessageIterator::header() const } inline int -RecoveryMessageIterator::loadChunkPosition(mwcu::BlobPosition* position) const +RecoveryMessageIterator::loadChunkPosition(bmqu::BlobPosition* position) const { // PRECONDITIONS BSLS_ASSERT_SAFE(position); BSLS_ASSERT_SAFE(isValid()); - return mwcu::BlobUtil::findOffsetSafe( + return bmqu::BlobUtil::findOffsetSafe( position, *d_blobIter.blob(), d_blobIter.position(), diff --git a/src/groups/bmq/bmqp/bmqp_recoverymessageiterator.t.cpp b/src/groups/bmq/bmqp/bmqp_recoverymessageiterator.t.cpp index 5a52c163e..982ee10b6 100644 --- a/src/groups/bmq/bmqp/bmqp_recoverymessageiterator.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_recoverymessageiterator.t.cpp @@ -16,8 +16,7 @@ // bmqp_recoverymessageiterator.t.cpp -*-C++-*- #include -// MWC -#include +#include // BDE #include @@ -25,7 +24,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -178,7 +177,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -326,13 +325,13 @@ static void test2_multipleMessages() ASSERT_EQ_D(index, D.d_seqNum, iter.header().chunkSequenceNumber()); // Compare chunk record - mwcu::BlobPosition position; + bmqu::BlobPosition position; ASSERT_EQ_D(index, 0, iter.loadChunkPosition(&position)); int compareRc = 0; ASSERT_EQ_D(index, 0, - mwcu::BlobUtil::compareSection(&compareRc, + bmqu::BlobUtil::compareSection(&compareRc, eventBlob, position, D.d_chunk.c_str(), @@ -561,7 +560,7 @@ static void test5_emptyPayload() iter.header().fileChunkType()); ASSERT_EQ(0, iter.header().messageWords() - iter.header().headerWords()); - mwcu::BlobPosition chunkPosition; + bmqu::BlobPosition chunkPosition; ASSERT_EQ(iter.loadChunkPosition(&chunkPosition), 0); ASSERT_EQ(iter.next(), 0); ASSERT_EQ(iter.isValid(), false); @@ -600,7 +599,7 @@ static void test6_nextMethod() // Testing: // int next(); // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("NEXT METHOD"); + bmqtst::TestHelper::printTestName("NEXT METHOD"); // Populate blob bsl::vector data(s_allocator_p); @@ -718,7 +717,7 @@ static void test7_resetMethod() // Testing: // int reset(); // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("RESET METHOD"); + bmqtst::TestHelper::printTestName("RESET METHOD"); // Populate blob bsl::vector data(s_allocator_p); @@ -771,12 +770,12 @@ static void test8_dumpBlob() // Testing: // void dumpBlob(bsl::ostream& stream); // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("DUMP BLOB"); + bmqtst::TestHelper::printTestName("DUMP BLOB"); // Test iterator dump contains expected value bmqp::EventHeader eventHeader; bsl::vector data(s_allocator_p); - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob blob(&bufferFactory, s_allocator_p); @@ -823,7 +822,7 @@ static void test8_dumpBlob() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -841,5 +840,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_rejecteventbuilder.cpp b/src/groups/bmq/bmqp/bmqp_rejecteventbuilder.cpp index e1e045a85..0cbea16b0 100644 --- a/src/groups/bmq/bmqp/bmqp_rejecteventbuilder.cpp +++ b/src/groups/bmq/bmqp/bmqp_rejecteventbuilder.cpp @@ -20,9 +20,8 @@ // BMQ #include -// MWC -#include -#include +#include +#include // BDE #include @@ -86,10 +85,10 @@ RejectEventBuilder::appendMessage(int queueId, } // Resize the blob to have space for an 'RejectMessage' at the end ... - mwcu::BlobPosition offset; - mwcu::BlobUtil::reserve(&offset, &d_blob, sizeof(RejectMessage)); + bmqu::BlobPosition offset; + bmqu::BlobUtil::reserve(&offset, &d_blob, sizeof(RejectMessage)); - mwcu::BlobObjectProxy rejectMessage(&d_blob, + bmqu::BlobObjectProxy rejectMessage(&d_blob, offset, false, // no read true); // write mode diff --git a/src/groups/bmq/bmqp/bmqp_rejecteventbuilder.t.cpp b/src/groups/bmq/bmqp/bmqp_rejecteventbuilder.t.cpp index 54e623321..38bdabe4e 100644 --- a/src/groups/bmq/bmqp/bmqp_rejecteventbuilder.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_rejecteventbuilder.t.cpp @@ -22,8 +22,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -39,7 +38,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -133,7 +132,7 @@ static void verifyContent(const bmqp::RejectEventBuilder& builder, static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(256, s_allocator_p); bmqp::RejectEventBuilder obj(&bufferFactory, s_allocator_p); @@ -154,7 +153,7 @@ static void test1_breathingTest() static void test2_multiMessage() { - mwctst::TestHelper::printTestName("MULTI MESSAGE"); + bmqtst::TestHelper::printTestName("MULTI MESSAGE"); // Create a RejectEvent with multiple messages. Iterate and verify. const int k_NUM_MSGS = 1000; @@ -172,7 +171,7 @@ static void test2_multiMessage() static void test3_reset() { - mwctst::TestHelper::printTestName("RESET"); + bmqtst::TestHelper::printTestName("RESET"); // Verifying reset: add three messages, reset, and add another message. bdlbb::PooledBlobBufferFactory bufferFactory(256, s_allocator_p); @@ -200,7 +199,7 @@ static void test3_reset() static void test4_capacity() { - mwctst::TestHelper::printTestName("CAPACITY"); + bmqtst::TestHelper::printTestName("CAPACITY"); // Verify that once the event is full, AppendMessage returns error. int rc; @@ -255,13 +254,13 @@ static void testN1_decodeFromFile() // with expected properties. // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DECODE FROM FILE"); + bmqtst::TestHelper::printTestName("DECODE FROM FILE"); bdlbb::PooledBlobBufferFactory bufferFactory(256, s_allocator_p); bmqp::RejectEventBuilder obj(&bufferFactory, s_allocator_p); bsl::vector messages(s_allocator_p); bdlbb::Blob outBlob(&bufferFactory, s_allocator_p); - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); bdlb::Guid guid = bdlb::GuidUtil::generate(); const int k_NUM_MSGS = 10; @@ -349,7 +348,7 @@ static void testN1_decodeFromFile() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -364,5 +363,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_rejectmessageiterator.cpp b/src/groups/bmq/bmqp/bmqp_rejectmessageiterator.cpp index 8de83e4c5..3e8ac5868 100644 --- a/src/groups/bmq/bmqp/bmqp_rejectmessageiterator.cpp +++ b/src/groups/bmq/bmqp/bmqp_rejectmessageiterator.cpp @@ -118,7 +118,7 @@ int RejectMessageIterator::reset(const bdlbb::Blob* blob, // header }; - d_blobIter.reset(blob, mwcu::BlobPosition(), blob->length(), true); + d_blobIter.reset(blob, bmqu::BlobPosition(), blob->length(), true); // Skip the EventHeader to point to the RejectHeader bool rc = d_blobIter.advance(eventHeader.headerWords() * @@ -180,7 +180,7 @@ void RejectMessageIterator::dumpBlob(bsl::ostream& stream) // For now, print only the beginning of the blob.. we may later on print // also the bytes around the current position if (d_blobIter.blob()) { - stream << mwcu::BlobStartHexDumper(d_blobIter.blob(), + stream << bmqu::BlobStartHexDumper(d_blobIter.blob(), k_MAX_BYTES_DUMP); } else { diff --git a/src/groups/bmq/bmqp/bmqp_rejectmessageiterator.h b/src/groups/bmq/bmqp/bmqp_rejectmessageiterator.h index 2ad677cda..119084217 100644 --- a/src/groups/bmq/bmqp/bmqp_rejectmessageiterator.h +++ b/src/groups/bmq/bmqp/bmqp_rejectmessageiterator.h @@ -59,10 +59,9 @@ #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -81,14 +80,14 @@ namespace bmqp { class RejectMessageIterator { private: // DATA - mwcu::BlobIterator d_blobIter; + bmqu::BlobIterator d_blobIter; // Blob iterator pointing to the // current message in the blob. - mwcu::BlobObjectProxy d_header; + bmqu::BlobObjectProxy d_header; // Header - mwcu::BlobObjectProxy d_message; + bmqu::BlobObjectProxy d_message; // Current message int d_advanceLength; @@ -175,7 +174,7 @@ class RejectMessageIterator { // CREATORS inline RejectMessageIterator::RejectMessageIterator() -: d_blobIter(0, mwcu::BlobPosition(), 0, true) +: d_blobIter(0, bmqu::BlobPosition(), 0, true) , d_advanceLength(0) { // NOTHING @@ -184,7 +183,7 @@ inline RejectMessageIterator::RejectMessageIterator() inline RejectMessageIterator::RejectMessageIterator( const bdlbb::Blob* blob, const EventHeader& eventHeader) -: d_blobIter(0, mwcu::BlobPosition(), 0, true) // no def ctor - set in reset +: d_blobIter(0, bmqu::BlobPosition(), 0, true) // no def ctor - set in reset { reset(blob, eventHeader); } @@ -192,7 +191,7 @@ inline RejectMessageIterator::RejectMessageIterator( inline RejectMessageIterator::RejectMessageIterator( const RejectMessageIterator& src) : d_blobIter(0, - mwcu::BlobPosition(), + bmqu::BlobPosition(), 0, true) // no def ctor - set in copyFrom { @@ -209,7 +208,7 @@ RejectMessageIterator::operator=(const RejectMessageIterator& rhs) inline void RejectMessageIterator::clear() { - d_blobIter.reset(0, mwcu::BlobPosition(), 0, true); + d_blobIter.reset(0, bmqu::BlobPosition(), 0, true); d_header.reset(); d_message.reset(); d_advanceLength = 0; diff --git a/src/groups/bmq/bmqp/bmqp_rejectmessageiterator.t.cpp b/src/groups/bmq/bmqp/bmqp_rejectmessageiterator.t.cpp index b14bd9ed6..611c10c05 100644 --- a/src/groups/bmq/bmqp/bmqp_rejectmessageiterator.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_rejectmessageiterator.t.cpp @@ -28,11 +28,10 @@ #include #include -// MWC -#include +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -188,7 +187,7 @@ static void populateBlob(bdlbb::Blob* blob, static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -294,7 +293,7 @@ static void test1_breathingTest() static void test2_multiReject() { - mwctst::TestHelper::printTestName("MULTI REJECT"); + bmqtst::TestHelper::printTestName("MULTI REJECT"); // Test iterating over REJECT event having multiple REJECT messages @@ -349,7 +348,7 @@ static void test3_nextMethod() // Testing: // int next(); // ------------------------------------------------------------------------ - mwctst::TestHelper::printTestName("NEXT METHOD"); + bmqtst::TestHelper::printTestName("NEXT METHOD"); // Default values for event header bmqp::EventHeader eventHeader; @@ -422,7 +421,7 @@ static void test4_resetMethod() // Testing: // int reset(); // ------------------------------------------------------------------------ - mwctst::TestHelper::printTestName("RESET METHOD"); + bmqtst::TestHelper::printTestName("RESET METHOD"); // Default values for event header bmqp::EventHeader eventHeader; @@ -503,12 +502,12 @@ static void test5_dumpBlob() // Testing: // void dumpBlob(bsl::ostream& stream); // ------------------------------------------------------------------------ - mwctst::TestHelper::printTestName("DUMB BLOB"); + bmqtst::TestHelper::printTestName("DUMB BLOB"); // Test iterator dump contains expected value bmqp::EventHeader eventHeader; - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); const int qId = 54321; const bmqt::MessageGUID guid; const int sQId = 123; @@ -559,7 +558,7 @@ static void test5_dumpBlob() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); @@ -578,5 +577,5 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_requestmanager.h b/src/groups/bmq/bmqp/bmqp_requestmanager.h index 14bd5ae2a..6121729e7 100644 --- a/src/groups/bmq/bmqp/bmqp_requestmanager.h +++ b/src/groups/bmq/bmqp/bmqp_requestmanager.h @@ -27,7 +27,7 @@ // the 'bmqp::RequestManagerRequest' type) and their associated responses. // This component takes care of encoding requests (using the // 'bmqp::SchemaEventBuilder' component) and sending them over a provided -// 'mwcio::Channel' (or using a raw 'sendFn' method, suitable for test drivers +// 'bmqio::Channel' (or using a raw 'sendFn' method, suitable for test drivers // implementation). When a response is received, it can be injected to the // 'RequestManager' (via the 'processResponse()' method), which will invoke the // appropriate callback and wake up any eventual waiter on that request. This @@ -128,7 +128,7 @@ //.. // // Then we can use it to create and send a request. (here we assume that we -// have an already established and valid 'mwcio::Channel' object to use) +// have an already established and valid 'bmqio::Channel' object to use) //.. // // We first ask a Request object to the RequestManager // RequestManagerType::RequestSp request = requestManager.createRequest(); @@ -150,13 +150,13 @@ // bdlf::PlaceHolders::_1)); // // // Finally, we can send the request -// mwcio::StatusCategory::Enum rc = requestManager.sendRequest( +// bmqio::StatusCategory::Enum rc = requestManager.sendRequest( // request, // channel, // "bmqMachine123", // bsls::TimeInterval(30), // 64 * 1024 * 1024); -// if (rc != mwcio::StatusCategory::e_SUCCESS) { +// if (rc != bmqio::StatusCategory::e_SUCCESS) { // // Request failed to encode/be sent; process error handling (note that // // neither the 'responseCb' nor the 'asyncNotifierCb' will ever get // // invoked in this case). @@ -218,13 +218,13 @@ // // For synchronous request, we don't need to specify an 'asyncNotifierCb' // // // Finally, we can send the request -// mwcio::StatusCategory::Enum rc = requestManager.sendRequest( +// bmqio::StatusCategory::Enum rc = requestManager.sendRequest( // request, // channel, // "bmqMachine123", // bsls::TimeInterval(30), // 64 * 1024 * 1024); -// if (rc != mwcio::StatusCategory::e_SUCCESS) { +// if (rc != bmqio::StatusCategory::e_SUCCESS) { // // Request failed to encode/be sent; process error handling (note that // // neither the 'responseCb' nor the 'asyncNotifierCb' will ever get // // invoked in this case). @@ -259,13 +259,13 @@ // // We also don't need to specify any 'asyncNotifierCb' // // // Send the request -// mwcio::StatusCategory::Enum rc = requestManager.sendRequest( +// bmqio::StatusCategory::Enum rc = requestManager.sendRequest( // request, // channel, // "bmqMachine123", // bsls::TimeInterval(30), // 64 * 1024 * 1024); -// if (rc != mwcio::StatusCategory::e_SUCCESS) { +// if (rc != bmqio::StatusCategory::e_SUCCESS) { // // Request failed to encode/be sent; process error handling (note that // // neither the 'responseCb' nor the 'asyncNotifierCb' will ever get // // invoked in this case). @@ -301,13 +301,13 @@ // bdlf::PlaceHolders::_1)); // // // Finally, we can send the request -// mwcio::StatusCategory::Enum rc = requestManager.sendRequest( +// bmqio::StatusCategory::Enum rc = requestManager.sendRequest( // request, // channel, // "bmqMachine123", // bsls::TimeInterval(30), // 64 * 1024 * 1024); -// if (rc != mwcio::StatusCategory::e_SUCCESS) { +// if (rc != bmqio::StatusCategory::e_SUCCESS) { // // Request failed to encode/be sent; process error handling (note that // // neither the 'responseCb' nor the 'asyncNotifierCb' will ever get // // invoked in this case). @@ -329,17 +329,16 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -641,7 +640,7 @@ class RequestManager { /// the order of insertion of requests is simply the order of traversal /// in the map. Alternatively, we could also use an ordered hash map, /// but using an un-ordered map is not an option. - typedef mwcc::OrderedHashMap RequestMap; + typedef bmqc::OrderedHashMap RequestMap; typedef typename RequestMap::iterator RequestMapIter; @@ -681,7 +680,7 @@ class RequestManager { // received after the request has been locally // timed out) should still be processed or not. - mwcex::Executor d_executor; + bmqex::Executor d_executor; // The executor supplying the threading context // to use for processing the timeout of a // request. @@ -700,7 +699,7 @@ class RequestManager { /// Send the specified `blob` over the specified `channel` using the /// specified `watermark`. Return a Generic Result code representing /// the status of delivery of this request. - static bmqt::GenericResult::Enum sendHelper(mwcio::Channel* channel, + static bmqt::GenericResult::Enum sendHelper(bmqio::Channel* channel, const bdlbb::Blob& blob, bsls::Types::Int64 watermark); @@ -747,13 +746,13 @@ class RequestManager { bdlbb::BlobBufferFactory* bufferFactory, bdlmt::EventScheduler* scheduler, bool lateResponseMode, - const mwcex::Executor& executor, + const bmqex::Executor& executor, bslma::Allocator* allocator = 0); RequestManager(bmqp::EventType::Enum eventType, bdlbb::BlobBufferFactory* bufferFactory, bdlmt::EventScheduler* scheduler, bool lateResponseMode, - const mwcex::Executor& executor, + const bmqex::Executor& executor, const DTContextSp& dtContextSp, bslma::Allocator* allocator = 0); @@ -764,7 +763,7 @@ class RequestManager { /// Set this object executor to the specified `executor` (may not be /// available at construction time). - RequestManager& setExecutor(const mwcex::Executor& executor); + RequestManager& setExecutor(const bmqex::Executor& executor); /// Get a new Request object. RequestSp createRequest(); @@ -778,7 +777,7 @@ class RequestManager { /// of delivery of this request. bmqt::GenericResult::Enum sendRequest(const RequestSp& request, - mwcio::Channel* channel, + bmqio::Channel* channel, const bsl::string& description, const bsls::TimeInterval& timeout, bsls::Types::Int64 watermark = @@ -1044,23 +1043,23 @@ const bdld::Datum& RequestManagerRequest::userData() const template inline bmqt::GenericResult::Enum -RequestManager::sendHelper(mwcio::Channel* channel, +RequestManager::sendHelper(bmqio::Channel* channel, const bdlbb::Blob& blob, bsls::Types::Int64 watermark) { - mwcio::Status status; + bmqio::Status status; channel->write(&status, blob, watermark); switch (status.category()) { - case mwcio::StatusCategory::e_SUCCESS: + case bmqio::StatusCategory::e_SUCCESS: return bmqt::GenericResult::e_SUCCESS; - case mwcio::StatusCategory::e_CONNECTION: + case bmqio::StatusCategory::e_CONNECTION: return bmqt::GenericResult::e_NOT_CONNECTED; - case mwcio::StatusCategory::e_LIMIT: + case bmqio::StatusCategory::e_LIMIT: return bmqt::GenericResult::e_NOT_READY; - case mwcio::StatusCategory::e_GENERIC_ERROR: - case mwcio::StatusCategory::e_TIMEOUT: - case mwcio::StatusCategory::e_CANCELED: + case bmqio::StatusCategory::e_GENERIC_ERROR: + case bmqio::StatusCategory::e_TIMEOUT: + case bmqio::StatusCategory::e_CANCELED: default: return bmqt::GenericResult::e_UNKNOWN; } } @@ -1106,10 +1105,10 @@ void RequestManager::onRequestTimeout(int requestId) // 1. 'fake' a response, with a Timeout status type response.rId().makeValue(requestId); - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "The request timedout after " - << mwcu::PrintUtil::prettyTimeInterval( - mwcsys::Time::highResolutionTimer() - request->d_sendTime); + << bmqu::PrintUtil::prettyTimeInterval( + bmqsys::Time::highResolutionTimer() - request->d_sendTime); response.choice().makeStatus(); response.choice().status().code() = k_CODE_TIMEOUT_LOCAL; @@ -1205,7 +1204,7 @@ RequestManager::RequestManager( , d_requests(allocator) , d_schemaEventBuilder(bufferFactory, allocator) , d_lateResponseMode(lateResponseMode) -, d_executor(mwcex::SystemExecutor()) // Use SystemExecutor so that when using +, d_executor(bmqex::SystemExecutor()) // Use SystemExecutor so that when using // 'possiblyBlocking' it will inline // invoke the function in the callers // thread instead of spawning a new @@ -1223,7 +1222,7 @@ RequestManager::RequestManager( bdlbb::BlobBufferFactory* bufferFactory, bdlmt::EventScheduler* scheduler, bool lateResponseMode, - const mwcex::Executor& executor, + const bmqex::Executor& executor, bslma::Allocator* allocator) : d_allocator_p(allocator) , d_eventType(eventType) @@ -1247,7 +1246,7 @@ RequestManager::RequestManager( bdlbb::BlobBufferFactory* bufferFactory, bdlmt::EventScheduler* scheduler, bool lateResponseMode, - const mwcex::Executor& executor, + const bmqex::Executor& executor, const DTContextSp& dtContext, bslma::Allocator* allocator) : d_allocator_p(allocator) @@ -1278,7 +1277,7 @@ RequestManager::~RequestManager() template inline RequestManager& -RequestManager::setExecutor(const mwcex::Executor& executor) +RequestManager::setExecutor(const bmqex::Executor& executor) { d_executor = executor; return *this; @@ -1303,7 +1302,7 @@ RequestManager::createRequest() template bmqt::GenericResult::Enum RequestManager::sendRequest( const typename RequestManager::RequestSp& request, - mwcio::Channel* channel, + bmqio::Channel* channel, const bsl::string& nodeDescription, const bsls::TimeInterval& timeout, bsls::Types::Int64 watermark, @@ -1339,7 +1338,7 @@ bmqt::GenericResult::Enum RequestManager::sendRequest( d_schemaEventBuilder.reset(); int rc = d_schemaEventBuilder.setMessage(request->request(), d_eventType); if (rc != 0) { - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; errorDesc << "ENCODING_FAILED, rc: " << rc; if (errorDescription) { *errorDescription = errorDesc.str(); @@ -1362,10 +1361,10 @@ bmqt::GenericResult::Enum RequestManager::sendRequest( // the map. // Send the request - request->d_sendTime = mwcsys::Time::highResolutionTimer(); + request->d_sendTime = bmqsys::Time::highResolutionTimer(); bmqt::GenericResult::Enum sendRc = sendFn(d_schemaEventBuilder.blob()); if (sendRc != bmqt::GenericResult::e_SUCCESS) { - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; errorDesc << "WRITE_FAILED, status: " << sendRc; if (errorDescription) { *errorDescription = errorDesc.str(); @@ -1381,9 +1380,9 @@ bmqt::GenericResult::Enum RequestManager::sendRequest( // Schedule a timeout d_scheduler_p->scheduleEvent( &(request->d_timeoutSchedulerHandle), - mwcsys::Time::nowMonotonicClock() + timeout, - mwcex::BindUtil::bindExecute( - mwcex::ExecutionPolicyUtil::oneWay() + bmqsys::Time::nowMonotonicClock() + timeout, + bmqex::BindUtil::bindExecute( + bmqex::ExecutionPolicyUtil::oneWay() .possiblyBlocking() .useExecutor(d_executor) .useAllocator(d_allocator_p), diff --git a/src/groups/bmq/bmqp/bmqp_requestmanager.t.cpp b/src/groups/bmq/bmqp/bmqp_requestmanager.t.cpp index 20fcdb62f..df5ba6a8b 100644 --- a/src/groups/bmq/bmqp/bmqp_requestmanager.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_requestmanager.t.cpp @@ -38,8 +38,8 @@ #include // TEST DRIVER -#include -#include +#include +#include // CONVENIENCE using namespace BloombergLP; @@ -118,7 +118,7 @@ class TestContext { bdlmt::EventScheduler& d_scheduler; // Mocked network channel object to be used in the request manager - mwcio::TestChannel d_testChannel; + bmqio::TestChannel d_testChannel; // RequestManager object under testing ReqManagerType d_requestManager; @@ -147,7 +147,7 @@ class TestContext { bslma::Allocator* allocator() const; /// Return reference to the mocked network channel object. - mwcio::TestChannel& channel(); + bmqio::TestChannel& channel(); /// Return reference to the buffer factory bdlbb::PooledBlobBufferFactory& factory(); @@ -211,8 +211,8 @@ TestContext::TestContext(bool lateResponseMode, bslma::Allocator* allocator) allocator) , d_allocator_p(allocator) { - mwcsys::Time::shutdown(); - mwcsys::Time::initialize( + bmqsys::Time::shutdown(); + bmqsys::Time::initialize( bdlf::BindUtil::bind(&TestClock::realtimeClock, &d_testClock), bdlf::BindUtil::bind(&TestClock::monotonicClock, &d_testClock), bdlf::BindUtil::bind(&TestClock::highResTimer, &d_testClock), @@ -235,7 +235,7 @@ bslma::Allocator* TestContext::allocator() const return d_allocator_p; } -mwcio::TestChannel& TestContext::channel() +bmqio::TestChannel& TestContext::channel() { return d_testChannel; } @@ -298,7 +298,7 @@ Mes TestContext::createResponseCancel() Mes TestContext::getNextRequest() { ASSERT(d_testChannel.waitFor(1, true, bsls::TimeInterval(1))); - mwcio::TestChannel::WriteCall wc = d_testChannel.popWriteCall(); + bmqio::TestChannel::WriteCall wc = d_testChannel.popWriteCall(); bmqp::Event ev(&wc.d_blob, d_allocator_p); ASSERT(ev.isControlEvent()); Mes controlMessage(d_allocator_p); @@ -375,7 +375,7 @@ static void test1_creatorsTest() // RequestManager::RequestManager() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CREATORS TEST"); + bmqtst::TestHelper::printTestName("CREATORS TEST"); bdlbb::PooledBlobBufferFactory blobBufferFactory(4096, s_allocator_p); @@ -406,14 +406,14 @@ static void test1_creatorsTest() &blobBufferFactory, &scheduler, false, // late response mode is off - mwcex::SystemExecutor(), + bmqex::SystemExecutor(), s_allocator_p)); ASSERT_PASS(ReqManagerType(bmqp::EventType::e_CONTROL, &blobBufferFactory, &scheduler, false, // late response mode is off - mwcex::SystemExecutor(), + bmqex::SystemExecutor(), ReqManagerType::DTContextSp(), s_allocator_p)); } @@ -425,12 +425,12 @@ static void test2_setExecutorTest() // void RequestManager::setExecutor() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SET EXECUTOR TEST"); + bmqtst::TestHelper::printTestName("SET EXECUTOR TEST"); { // set SystemExecutor TestContext context(false, s_allocator_p); - ASSERT_PASS(context.manager().setExecutor(mwcex::SystemExecutor())); + ASSERT_PASS(context.manager().setExecutor(bmqex::SystemExecutor())); } } @@ -440,7 +440,7 @@ static void test3_createRequestTest() // RequestSp RequestManager::createRequest(); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CREATE REQUEST TEST"); + bmqtst::TestHelper::printTestName("CREATE REQUEST TEST"); { // Check that RequestManager really creates request @@ -456,7 +456,7 @@ static void test4_sendRequestTest() // void RequestManager::sendRequest(); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SEND REQUEST TEST"); + bmqtst::TestHelper::printTestName("SEND REQUEST TEST"); /// Check that the specified `blob` contains the same request as the /// specified `request`, and set the specified `called` flag to true @@ -616,7 +616,7 @@ static void test5_processResponseTest() // int RequestManager::processResponse() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PROCESS RESPONSE TEST"); + bmqtst::TestHelper::printTestName("PROCESS RESPONSE TEST"); { // Correct response @@ -827,7 +827,7 @@ static void test6_cancelAllRequestsTest() // void RequestManager::cancelAllRequests() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CANCEL ALL REQUESTS TEST"); + bmqtst::TestHelper::printTestName("CANCEL ALL REQUESTS TEST"); { // Cancel one event @@ -914,7 +914,7 @@ static void test7_requestBreathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("REQUEST BREATHING TEST"); + bmqtst::TestHelper::printTestName("REQUEST BREATHING TEST"); { // Create request and check its initial state @@ -997,7 +997,7 @@ static void test8_requestSignalWaitTest() // void RequestManagerRequest::wait() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("REQUEST SIGNAL WAIT TEST"); + bmqtst::TestHelper::printTestName("REQUEST SIGNAL WAIT TEST"); /// Call wait function of the specified `request`, and then set the /// specified `worked` flag to true. @@ -1042,9 +1042,9 @@ static void test8_requestSignalWaitTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); - mwcsys::Time::initialize(s_allocator_p); + bmqsys::Time::initialize(s_allocator_p); bmqp::ProtocolUtil::initialize(s_allocator_p); switch (_testCase) { @@ -1063,10 +1063,10 @@ int main(int argc, char* argv[]) } break; } - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); // RETURN - // Default: EventQueue uses mwcex::BindUtil::bindExecute(), which uses + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); // RETURN + // Default: EventQueue uses bmqex::BindUtil::bindExecute(), which uses // default allocator. } diff --git a/src/groups/bmq/bmqp/bmqp_routingconfigurationutils.t.cpp b/src/groups/bmq/bmqp/bmqp_routingconfigurationutils.t.cpp index e498ad03e..785c8b2fd 100644 --- a/src/groups/bmq/bmqp/bmqp_routingconfigurationutils.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_routingconfigurationutils.t.cpp @@ -23,7 +23,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -71,7 +71,7 @@ int numFlagsUnset(const bmqp_ctrlmsg::RoutingConfiguration& config) static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); typedef bmqp::RoutingConfigurationUtils obj; @@ -175,7 +175,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -186,5 +186,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_schemaeventbuilder.h b/src/groups/bmq/bmqp/bmqp_schemaeventbuilder.h index d9d014ba7..e419405ae 100644 --- a/src/groups/bmq/bmqp/bmqp_schemaeventbuilder.h +++ b/src/groups/bmq/bmqp/bmqp_schemaeventbuilder.h @@ -69,8 +69,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -229,7 +228,7 @@ int SchemaEventBuilder::setMessage(const TYPE& message, EventType::Enum type) } // Append appropriate encoding of 'message' to the blob - mwcu::MemOutStream os; + bmqu::MemOutStream os; int rc = ProtocolUtil::encodeMessage(os, &d_blob, message, diff --git a/src/groups/bmq/bmqp/bmqp_schemaeventbuilder.t.cpp b/src/groups/bmq/bmqp/bmqp_schemaeventbuilder.t.cpp index 490fce5a5..f4e349f77 100644 --- a/src/groups/bmq/bmqp/bmqp_schemaeventbuilder.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_schemaeventbuilder.t.cpp @@ -23,8 +23,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -41,7 +40,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -53,7 +52,7 @@ using namespace bsl; static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); int rc; bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -132,7 +131,7 @@ void testDecodeFromFileHelper(bmqp::SchemaEventBuilder* obj, ASSERT_EQ(rc, 0); ASSERT_NE(obj->blob().length(), 0); - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); bdlb::Guid guid = bdlb::GuidUtil::generate(); os << "msg_control_" << typeString << "_" << guid << ".bin" << bsl::ends; @@ -204,7 +203,7 @@ static void test2_bestEncodingSupported() // bestEncodingSupported // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("BEST ENCODING SUPPORTED"); + bmqtst::TestHelper::printTestName("BEST ENCODING SUPPORTED"); PV("Empty remote feature set"); { @@ -272,7 +271,7 @@ static void testN1_decodeFromFile() // EventType::Enum type) // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DECODE FROM FILE"); + bmqtst::TestHelper::printTestName("DECODE FROM FILE"); const int k_SIZE = 512; bdlbb::PooledBlobBufferFactory bufferFactory(k_SIZE, s_allocator_p); @@ -548,7 +547,7 @@ static void testN1_decodeFromFile() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); @@ -565,5 +564,5 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_schemagenerator.t.cpp b/src/groups/bmq/bmqp/bmqp_schemagenerator.t.cpp index e448a7b50..fd7f924d1 100644 --- a/src/groups/bmq/bmqp/bmqp_schemagenerator.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_schemagenerator.t.cpp @@ -23,7 +23,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -187,7 +187,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -198,5 +198,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_schemalearner.t.cpp b/src/groups/bmq/bmqp/bmqp_schemalearner.t.cpp index f2a33a249..31c4e8e15 100644 --- a/src/groups/bmq/bmqp/bmqp_schemalearner.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_schemalearner.t.cpp @@ -20,8 +20,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -29,7 +28,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -241,7 +240,7 @@ static void test5_emptyMPs() { // Even if SDK does not send out empty MPS, streaming out/in should work. - mwctst::TestHelper::printTestName("'empty MPs' TEST"); + bmqtst::TestHelper::printTestName("'empty MPs' TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(128, s_allocator_p); bmqp::SchemaLearner theLearner(s_allocator_p); @@ -311,7 +310,7 @@ static void test6_partialRead() ASSERT_EQ(y, out3.getPropertyAsString("y")); ASSERT_EQ(0, out3.setPropertyAsString("y", mod)); - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); out3.print(os, 0, -1); PV(os.str()); @@ -401,7 +400,7 @@ static void test7_removeBeforeRead() } } - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); out2.print(os, 0, -1); PV(os.str()); @@ -448,7 +447,7 @@ static void test7_removeBeforeRead() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); switch (_testCase) { @@ -467,5 +466,5 @@ int main(int argc, char* argv[]) } bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_storageeventbuilder.cpp b/src/groups/bmq/bmqp/bmqp_storageeventbuilder.cpp index b74c90bbc..445649fd5 100644 --- a/src/groups/bmq/bmqp/bmqp_storageeventbuilder.cpp +++ b/src/groups/bmq/bmqp/bmqp_storageeventbuilder.cpp @@ -20,8 +20,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -68,10 +67,10 @@ bmqt::EventBuilderResult::Enum StorageEventBuilder::packMessageImp( } // Add the StorageHeader - mwcu::BlobPosition offset; - mwcu::BlobUtil::reserve(&offset, &d_blob, sizeof(StorageHeader)); + bmqu::BlobPosition offset; + bmqu::BlobUtil::reserve(&offset, &d_blob, sizeof(StorageHeader)); - mwcu::BlobObjectProxy storageHeader(&d_blob, + bmqu::BlobObjectProxy storageHeader(&d_blob, offset, false, // no read true); // write mode @@ -141,7 +140,7 @@ void StorageEventBuilder::reset() bmqt::EventBuilderResult::Enum StorageEventBuilder::packMessageRaw(const bdlbb::Blob& blob, - const mwcu::BlobPosition& startPos, + const bmqu::BlobPosition& startPos, int length) { // PRECONDITIONS @@ -152,7 +151,7 @@ StorageEventBuilder::packMessageRaw(const bdlbb::Blob& blob, } if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( - !mwcu::BlobUtil::isValidPos(blob, startPos))) { + !bmqu::BlobUtil::isValidPos(blob, startPos))) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; return bmqt::EventBuilderResult::e_UNKNOWN; // RETURN } @@ -170,7 +169,7 @@ StorageEventBuilder::packMessageRaw(const bdlbb::Blob& blob, if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( 0 != - mwcu::BlobUtil::appendToBlob(&d_blob, blob, startPos, length))) { + bmqu::BlobUtil::appendToBlob(&d_blob, blob, startPos, length))) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; return bmqt::EventBuilderResult::e_UNKNOWN; // RETURN } diff --git a/src/groups/bmq/bmqp/bmqp_storageeventbuilder.h b/src/groups/bmq/bmqp/bmqp_storageeventbuilder.h index 23f7dd547..c9fbd45e0 100644 --- a/src/groups/bmq/bmqp/bmqp_storageeventbuilder.h +++ b/src/groups/bmq/bmqp/bmqp_storageeventbuilder.h @@ -65,8 +65,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -176,7 +175,7 @@ class StorageEventBuilder BSLS_CPP11_FINAL { /// `bmqp::StorageHeader` before the storage message. bmqt::EventBuilderResult::Enum packMessageRaw(const bdlbb::Blob& blob, - const mwcu::BlobPosition& startPos, + const bmqu::BlobPosition& startPos, int length); // ACCESSORS diff --git a/src/groups/bmq/bmqp/bmqp_storageeventbuilder.t.cpp b/src/groups/bmq/bmqp/bmqp_storageeventbuilder.t.cpp index e8d44c551..89c01e472 100644 --- a/src/groups/bmq/bmqp/bmqp_storageeventbuilder.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_storageeventbuilder.t.cpp @@ -31,7 +31,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -182,7 +182,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); const char* PAYLOAD = "abcdefghijklmnopqrstuvwx"; @@ -246,10 +246,10 @@ static void test1_breathingTest() ASSERT_EQ(storageIter.header().messageType(), bmqp::StorageMessageType::e_DATA); - mwcu::BlobPosition position; + bmqu::BlobPosition position; ASSERT_EQ(0, storageIter.loadDataPosition(&position)); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, eventBlob, position, JOURNAL_REC, @@ -257,14 +257,14 @@ static void test1_breathingTest() ASSERT_EQ(res, 0); ASSERT_EQ(compareResult, 0); - mwcu::BlobPosition dataPos; + bmqu::BlobPosition dataPos; ASSERT_EQ(0, - mwcu::BlobUtil::findOffsetSafe(&dataPos, + bmqu::BlobUtil::findOffsetSafe(&dataPos, eventBlob, position, JOURNAL_REC_LEN)); - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, eventBlob, dataPos, PAYLOAD, @@ -280,7 +280,7 @@ static void test2_storageEventHavingMultipleMessages() // Build an event with multiple STORAGE msgs. Iterate and verify // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("STORAGE EVENT HAVING MULTIPLE" + bmqtst::TestHelper::printTestName("STORAGE EVENT HAVING MULTIPLE" " MESSAGES"); const int k_SPV = 2; // Storage protocol version @@ -323,11 +323,11 @@ static void test2_storageEventHavingMultipleMessages() ASSERT_EQ_D(dataIndex, D.d_pid, iter.header().partitionId()); ASSERT_EQ_D(dataIndex, D.d_messageType, iter.header().messageType()); - mwcu::BlobPosition recordPosition; + bmqu::BlobPosition recordPosition; ASSERT_EQ_D(dataIndex, 0, iter.loadDataPosition(&recordPosition)); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, eventBlob, recordPosition, D.d_recordBuffer, @@ -337,13 +337,13 @@ static void test2_storageEventHavingMultipleMessages() if (bmqp::StorageMessageType::e_DATA == D.d_messageType || bmqp::StorageMessageType::e_QLIST == D.d_messageType) { - mwcu::BlobPosition payloadPos; + bmqu::BlobPosition payloadPos; ASSERT_EQ(0, - mwcu::BlobUtil::findOffsetSafe(&payloadPos, + bmqu::BlobUtil::findOffsetSafe(&payloadPos, eventBlob, recordPosition, k_RECORD_SIZE)); - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, eventBlob, payloadPos, D.d_payload.c_str(), @@ -367,7 +367,7 @@ static void test3_packMessage_payloadTooBig() // Test behavior when trying to build *one* big message. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PACK MESSAGE - PAYLOAD TOO BIG"); + bmqtst::TestHelper::printTestName("PACK MESSAGE - PAYLOAD TOO BIG"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -455,10 +455,10 @@ static void test3_packMessage_payloadTooBig() ASSERT_EQ(storageIter.header().messageType(), bmqp::StorageMessageType::e_DATA); - mwcu::BlobPosition position; + bmqu::BlobPosition position; ASSERT_EQ(storageIter.loadDataPosition(&position), 0); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, eventBlob, position, JOURNAL_REC, @@ -466,14 +466,14 @@ static void test3_packMessage_payloadTooBig() ASSERT_EQ(0, res); ASSERT_EQ(0, compareResult); - mwcu::BlobPosition dataPos; + bmqu::BlobPosition dataPos; ASSERT_EQ(0, - mwcu::BlobUtil::findOffsetSafe(&dataPos, + bmqu::BlobUtil::findOffsetSafe(&dataPos, eventBlob, position, JOURNAL_REC_LEN)); - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, eventBlob, dataPos, PAYLOAD, @@ -492,7 +492,7 @@ static void test4_packMessageRaw() // messages, all added via 'packMessageRaw'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PACK MESSAGE RAW"); + bmqtst::TestHelper::printTestName("PACK MESSAGE RAW"); // We will build an event (event 'A') contain multiple messages using // 'packMessage' which has been tested in case 2. We will then iterate @@ -576,11 +576,11 @@ static void test4_packMessageRaw() ASSERT_EQ_D(dataIndex, D.d_messageType, iterB.header().messageType()); - mwcu::BlobPosition recordPosition; + bmqu::BlobPosition recordPosition; ASSERT_EQ_D(dataIndex, 0, iterB.loadDataPosition(&recordPosition)); int res, compareResult; - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, eventB, recordPosition, D.d_recordBuffer, @@ -590,13 +590,13 @@ static void test4_packMessageRaw() if (bmqp::StorageMessageType::e_DATA == D.d_messageType || bmqp::StorageMessageType::e_QLIST == D.d_messageType) { - mwcu::BlobPosition payloadPos; + bmqu::BlobPosition payloadPos; ASSERT_EQ(0, - mwcu::BlobUtil::findOffsetSafe(&payloadPos, + bmqu::BlobUtil::findOffsetSafe(&payloadPos, eventB, recordPosition, k_RECORD_SIZE)); - res = mwcu::BlobUtil::compareSection(&compareResult, + res = bmqu::BlobUtil::compareSection(&compareResult, eventB, payloadPos, D.d_payload.c_str(), @@ -627,7 +627,7 @@ static void test5_packMessageRaw_emptyMessage() // packMessageRaw // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PACK MESSAGE RAW - EMPTY MESSAGE"); + bmqtst::TestHelper::printTestName("PACK MESSAGE RAW - EMPTY MESSAGE"); const int k_SPV = 2; // Storage protocol version bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -639,8 +639,8 @@ static void test5_packMessageRaw_emptyMessage() bdlbb::Blob emptyBlob(&bufferFactory, s_allocator_p); BSLS_ASSERT_OPT(emptyBlob.length() == 0); ASSERT_SAFE_FAIL( - seb.packMessageRaw(emptyBlob, mwcu::BlobPosition(0, 0), 0)); - ASSERT_EQ(seb.packMessageRaw(emptyBlob, mwcu::BlobPosition(0, 0), 10), + seb.packMessageRaw(emptyBlob, bmqu::BlobPosition(0, 0), 0)); + ASSERT_EQ(seb.packMessageRaw(emptyBlob, bmqu::BlobPosition(0, 0), 10), bmqt::EventBuilderResult::e_SUCCESS); // Above we packMessageRaw with 'length' of 10 because we need an // arbitrary 'length > 0' to not trigger an assert and at the same time @@ -666,7 +666,7 @@ static void test6_packMessageRaw_invalidPosition() // packMessageRaw // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PACK MESSAGE RAW - INVALID POSITION"); + bmqtst::TestHelper::printTestName("PACK MESSAGE RAW - INVALID POSITION"); const int k_SPV = 2; // Storage protocol version bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -686,7 +686,7 @@ static void test6_packMessageRaw_invalidPosition() bdlbb::Blob message(&bufferFactory, s_allocator_p); message.appendDataBuffer(dataBlobBuffer); - mwcu::BlobPosition invalidPosition(-1, -1); + bmqu::BlobPosition invalidPosition(-1, -1); ASSERT_NE(seb.packMessageRaw(message, invalidPosition, message.length()), bmqt::EventBuilderResult::e_SUCCESS); ASSERT_EQ(bdlbb::BlobUtil::compare(seb.blob(), k_EMPTY_BLOB), 0); @@ -700,7 +700,7 @@ static void test6_packMessageRaw_invalidPosition() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); // Temporary workaround to suppress the 'unused operator // NestedTraitDeclaration' warning/error generated by clang. TBD: figure @@ -725,5 +725,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/bmqp_storagemessageiterator.cpp b/src/groups/bmq/bmqp/bmqp_storagemessageiterator.cpp index 78b044598..4fb6fc9fe 100644 --- a/src/groups/bmq/bmqp/bmqp_storagemessageiterator.cpp +++ b/src/groups/bmq/bmqp/bmqp_storagemessageiterator.cpp @@ -130,7 +130,7 @@ int StorageMessageIterator::reset(const bdlbb::Blob* blob, // are no messages in it }; - d_blobIter.reset(blob, mwcu::BlobPosition(), blob->length(), true); + d_blobIter.reset(blob, bmqu::BlobPosition(), blob->length(), true); bool rc = d_blobIter.advance(eventHeader.headerWords() * Protocol::k_WORD_SIZE); @@ -169,7 +169,7 @@ void StorageMessageIterator::dumpBlob(bsl::ostream& stream) const // For now, print only the beginning of the blob.. we may later on print // also the bytes around the current position if (d_blobIter.blob()) { - stream << mwcu::BlobStartHexDumper(d_blobIter.blob(), + stream << bmqu::BlobStartHexDumper(d_blobIter.blob(), k_MAX_BYTES_DUMP); } else { diff --git a/src/groups/bmq/bmqp/bmqp_storagemessageiterator.h b/src/groups/bmq/bmqp/bmqp_storagemessageiterator.h index c1297a867..0cd2d7bae 100644 --- a/src/groups/bmq/bmqp/bmqp_storagemessageiterator.h +++ b/src/groups/bmq/bmqp/bmqp_storagemessageiterator.h @@ -58,10 +58,9 @@ #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -80,11 +79,11 @@ namespace bmqp { class StorageMessageIterator { private: // DATA - mwcu::BlobIterator d_blobIter; + bmqu::BlobIterator d_blobIter; // Blob iterator pointing to the // current message in the blob. - mwcu::BlobObjectProxy d_header; + bmqu::BlobObjectProxy d_header; // Current PutHeader int d_advanceLength; @@ -165,13 +164,13 @@ class StorageMessageIterator { /// Return a const reference to the position of header of the currently /// pointed to by this iterator. The behavior is undefined unless /// `isValid` returns true. - const mwcu::BlobPosition& headerPosition() const; + const bmqu::BlobPosition& headerPosition() const; /// Load into the specified `position` the starting location of the data /// of the storage message currently pointed to by this iterator. The /// behavior is undefined unless `position` is not null. Return zero on /// success, non zero value otherwise. - int loadDataPosition(mwcu::BlobPosition* position) const; + int loadDataPosition(bmqu::BlobPosition* position) const; /// Dump the beginning of the blob associated to this /// StorageMessageIterator to the specified `stream`. @@ -188,7 +187,7 @@ class StorageMessageIterator { // CREATORS inline StorageMessageIterator::StorageMessageIterator() -: d_blobIter(0, mwcu::BlobPosition(), 0, true) +: d_blobIter(0, bmqu::BlobPosition(), 0, true) , d_advanceLength(-1) { // NOTHING @@ -197,7 +196,7 @@ inline StorageMessageIterator::StorageMessageIterator() inline StorageMessageIterator::StorageMessageIterator( const bdlbb::Blob* blob, const EventHeader& eventHeader) -: d_blobIter(0, mwcu::BlobPosition(), 0, true) // no def ctor - set in reset +: d_blobIter(0, bmqu::BlobPosition(), 0, true) // no def ctor - set in reset { reset(blob, eventHeader); } @@ -205,7 +204,7 @@ inline StorageMessageIterator::StorageMessageIterator( inline StorageMessageIterator::StorageMessageIterator( const StorageMessageIterator& src) : d_blobIter(0, - mwcu::BlobPosition(), + bmqu::BlobPosition(), 0, true) // no def ctor - set in copyFrom { @@ -225,7 +224,7 @@ StorageMessageIterator::operator=(const StorageMessageIterator& rhs) inline void StorageMessageIterator::clear() { - d_blobIter.reset(0, mwcu::BlobPosition(), 0, true); + d_blobIter.reset(0, bmqu::BlobPosition(), 0, true); d_header.reset(); d_advanceLength = -1; } @@ -244,7 +243,7 @@ inline const StorageHeader& StorageMessageIterator::header() const return *d_header; } -inline const mwcu::BlobPosition& StorageMessageIterator::headerPosition() const +inline const bmqu::BlobPosition& StorageMessageIterator::headerPosition() const { // PRECONDITIONS BSLS_ASSERT_SAFE(isValid()); @@ -253,7 +252,7 @@ inline const mwcu::BlobPosition& StorageMessageIterator::headerPosition() const } inline int -StorageMessageIterator::loadDataPosition(mwcu::BlobPosition* position) const +StorageMessageIterator::loadDataPosition(bmqu::BlobPosition* position) const { // PRECONDITIONS BSLS_ASSERT_SAFE(position); @@ -261,7 +260,7 @@ StorageMessageIterator::loadDataPosition(mwcu::BlobPosition* position) const BSLS_ASSERT_SAFE(StorageMessageType::e_UNDEFINED != d_header->messageType()); - return mwcu::BlobUtil::findOffsetSafe( + return bmqu::BlobUtil::findOffsetSafe( position, *d_blobIter.blob(), d_blobIter.position(), diff --git a/src/groups/bmq/bmqp/bmqp_storagemessageiterator.t.cpp b/src/groups/bmq/bmqp/bmqp_storagemessageiterator.t.cpp index f83804385..3823fff79 100644 --- a/src/groups/bmq/bmqp/bmqp_storagemessageiterator.t.cpp +++ b/src/groups/bmq/bmqp/bmqp_storagemessageiterator.t.cpp @@ -19,8 +19,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -32,7 +31,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -249,7 +248,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -363,7 +362,7 @@ static void test2_storageEventHavingMultipleMessages() // Iterating over STORAGE event having multiple STORAGE messages. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("STORAGE EVENT HAVING MULTIPLE" + bmqtst::TestHelper::printTestName("STORAGE EVENT HAVING MULTIPLE" " MESSAGES"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); @@ -391,13 +390,13 @@ static void test2_storageEventHavingMultipleMessages() ASSERT_EQ_D(index, D.d_pid, iter.header().partitionId()); // Compare journal record - mwcu::BlobPosition position; + bmqu::BlobPosition position; ASSERT_EQ_D(index, 0, iter.loadDataPosition(&position)); int compareRc = 0; ASSERT_EQ_D(index, 0, - mwcu::BlobUtil::compareSection(&compareRc, + bmqu::BlobUtil::compareSection(&compareRc, eventBlob, position, D.d_recordBuffer, @@ -408,17 +407,17 @@ static void test2_storageEventHavingMultipleMessages() bmqp::StorageMessageType::e_QLIST == iter.header().messageType()) { // Compare data payload as well. Need to find data payload // position first. - mwcu::BlobPosition dataPos; + bmqu::BlobPosition dataPos; ASSERT_EQ_D(index, 0, - mwcu::BlobUtil::findOffsetSafe(&dataPos, + bmqu::BlobUtil::findOffsetSafe(&dataPos, eventBlob, position, k_RECORD_SIZE)); int compRc = 0; ASSERT_EQ_D(index, 0, - mwcu::BlobUtil::compareSection(&compRc, + bmqu::BlobUtil::compareSection(&compRc, eventBlob, position, D.d_payload.c_str(), @@ -448,7 +447,7 @@ static void test3_corruptedStorageEvent_part1() // storageHeader). // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CORRUPTED STORAGE EVENT - PART 1"); + bmqtst::TestHelper::printTestName("CORRUPTED STORAGE EVENT - PART 1"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob eventBlob(&bufferFactory, s_allocator_p); @@ -525,7 +524,7 @@ static void test4_corruptedStorageEvent_part2() // bytes in the blob). // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CORRUPTED STORAGE EVENT - PART 2"); + bmqtst::TestHelper::printTestName("CORRUPTED STORAGE EVENT - PART 2"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob eventBlob(&bufferFactory, s_allocator_p); @@ -607,7 +606,7 @@ static void test5_corruptedStorageEvent_part3() // Iterating over corrupted STORAGE event (not having enough payload // bytes in the blob). // ------------------------------------------------------------------------ - mwctst::TestHelper::printTestName("CORRUPTED STORAGE EVENT - PART 3"); + bmqtst::TestHelper::printTestName("CORRUPTED STORAGE EVENT - PART 3"); // Populate blob bsl::vector data(s_allocator_p); @@ -649,7 +648,7 @@ static void test6_resetMethod() // Testing: // int reset(); // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("RESET METHOD"); + bmqtst::TestHelper::printTestName("RESET METHOD"); // Populate blob bsl::vector data(s_allocator_p); @@ -701,12 +700,12 @@ static void test7_dumpBlob() // Testing: // void dumpBlob(bsl::ostream& stream); // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("DUMP BLOB"); + bmqtst::TestHelper::printTestName("DUMP BLOB"); // Test iterator dump contains expected value bmqp::EventHeader eventHeader; bsl::vector data(s_allocator_p); - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); bdlbb::Blob blob(&bufferFactory, s_allocator_p); @@ -757,7 +756,7 @@ static void test7_dumpBlob() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); // Temporary workaround to suppress the 'unused operator // NestedTraitDeclaration' warning/error generated by clang. TBD: figure @@ -783,5 +782,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqp/package/bmqp.dep b/src/groups/bmq/bmqp/package/bmqp.dep index 2bcdca521..07daf165b 100644 --- a/src/groups/bmq/bmqp/package/bmqp.dep +++ b/src/groups/bmq/bmqp/package/bmqp.dep @@ -1,3 +1,8 @@ +bmqc +bmqex +bmqio bmqpi -bmqt bmqscm +bmqsys +bmqt +bmqu diff --git a/src/groups/bmq/bmqpi/README.md b/src/groups/bmq/bmqpi/README.dox similarity index 98% rename from src/groups/bmq/bmqpi/README.md rename to src/groups/bmq/bmqpi/README.dox index 35ea63ab5..df13d9cb9 100644 --- a/src/groups/bmq/bmqpi/README.md +++ b/src/groups/bmq/bmqpi/README.dox @@ -1,3 +1,4 @@ +/** @dir bmqpi @brief The `BMQPI` (BlazingMQ Public Interfaces) package provides class @@ -8,3 +9,4 @@ clients to extend in their own applications and libraries. These extension points facilitate integration with other aspects of a runtime environment (e.g. authentication, host health-checking), which may vary significantly from organization to organization. +*/ diff --git a/src/groups/bmq/bmqpi/bmqpi_dtcontext.t.cpp b/src/groups/bmq/bmqpi/bmqpi_dtcontext.t.cpp index 6d01cd1ad..17a565f72 100644 --- a/src/groups/bmq/bmqpi/bmqpi_dtcontext.t.cpp +++ b/src/groups/bmq/bmqpi/bmqpi_dtcontext.t.cpp @@ -25,7 +25,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -88,7 +88,7 @@ static void test1_breathingTest() // 'markDone' methods of AbstractSession may sometimes return a // memory-aware object without utilizing the parameter allocator. - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Creating a concrete object"); bsls::ProtocolTest context; @@ -114,7 +114,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -126,5 +126,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqpi/bmqpi_dtspan.t.cpp b/src/groups/bmq/bmqpi/bmqpi_dtspan.t.cpp index f8c657249..601975e59 100644 --- a/src/groups/bmq/bmqpi/bmqpi_dtspan.t.cpp +++ b/src/groups/bmq/bmqpi/bmqpi_dtspan.t.cpp @@ -21,7 +21,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -76,7 +76,7 @@ static void test1_breathingTest() // 'markDone' methods of AbstractSession may sometimes return a // memory-aware object without utilizing the parameter allocator. - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Creating a concrete object"); bsls::ProtocolTest span; @@ -101,7 +101,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -113,5 +113,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqpi/bmqpi_dttracer.t.cpp b/src/groups/bmq/bmqpi/bmqpi_dttracer.t.cpp index da8fcd78f..997137a15 100644 --- a/src/groups/bmq/bmqpi/bmqpi_dttracer.t.cpp +++ b/src/groups/bmq/bmqpi/bmqpi_dttracer.t.cpp @@ -24,7 +24,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -85,7 +85,7 @@ static void test1_breathingTest() // 'markDone' methods of AbstractSession may sometimes return a // memory-aware object without utilizing the parameter allocator. - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Creating a concrete object"); bsls::ProtocolTest tracer; @@ -110,7 +110,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -122,5 +122,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqpi/bmqpi_hosthealthmonitor.t.cpp b/src/groups/bmq/bmqpi/bmqpi_hosthealthmonitor.t.cpp index eb2d938ff..0b7ecb52f 100644 --- a/src/groups/bmq/bmqpi/bmqpi_hosthealthmonitor.t.cpp +++ b/src/groups/bmq/bmqpi/bmqpi_hosthealthmonitor.t.cpp @@ -24,7 +24,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -91,7 +91,7 @@ static void test1_breathingTest() // 'markDone' methods of AbstractSession may sometimes return a // memory-aware object without utilizing the parameter allocator. - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Creating a concrete object"); bsls::ProtocolTest monitor; @@ -118,7 +118,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -130,5 +130,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqscm/bmqscm_versiontag.h b/src/groups/bmq/bmqscm/bmqscm_versiontag.h index 536f42b79..994f1f93f 100644 --- a/src/groups/bmq/bmqscm/bmqscm_versiontag.h +++ b/src/groups/bmq/bmqscm/bmqscm_versiontag.h @@ -56,7 +56,7 @@ #define BMQ_VERSION_PATCH 99 // BlazingMQ patch level -#define BMQ_MAKE_VERSION(major, minor) ((major)*10000 + (minor)*100) +#define BMQ_MAKE_VERSION(major, minor) ((major) * 10000 + (minor) * 100) // Construct a composite version number in the range [ 0 .. 999900 ] from // the specified 'major' and 'minor' version numbers. The resulting value, // when expressed as a 6-digit decimal string, has "00" as the two @@ -72,7 +72,7 @@ // and 'minor' are integral values in the range '[ 0 .. 99 ]'. #define BMQ_MAKE_EXT_VERSION(major, minor, patch) \ - ((major)*10000 + (minor)*100 + (patch)) + ((major) * 10000 + (minor) * 100 + (patch)) // Similar to BMQ_MAKE_VERSION(), but include the patch number as well. #define BMQ_VERSION BMQ_MAKE_VERSION(BMQ_VERSION_MAJOR, BMQ_VERSION_MINOR) diff --git a/src/groups/mwc/mwcst/mwcst_basetable.cpp b/src/groups/bmq/bmqst/bmqst_basetable.cpp similarity index 88% rename from src/groups/mwc/mwcst/mwcst_basetable.cpp rename to src/groups/bmq/bmqst/bmqst_basetable.cpp index bb0f4bb54..aa788358c 100644 --- a/src/groups/mwc/mwcst/mwcst_basetable.cpp +++ b/src/groups/bmq/bmqst/bmqst_basetable.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_basetable.cpp -*-C++-*- -#include +// bmqst_basetable.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // --------------- // class BaseTable diff --git a/src/groups/mwc/mwcst/mwcst_basetable.h b/src/groups/bmq/bmqst/bmqst_basetable.h similarity index 83% rename from src/groups/mwc/mwcst/mwcst_basetable.h rename to src/groups/bmq/bmqst/bmqst_basetable.h index a79fe0030..2b82ff6f1 100644 --- a/src/groups/mwc/mwcst/mwcst_basetable.h +++ b/src/groups/bmq/bmqst/bmqst_basetable.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_basetable.h -*-C++-*- -#ifndef INCLUDED_MWCST_BASETABLE -#define INCLUDED_MWCST_BASETABLE +// bmqst_basetable.h -*-C++-*- +#ifndef INCLUDED_BMQST_BASETABLE +#define INCLUDED_BMQST_BASETABLE //@PURPOSE: Provide a generic BaseTable protocol // //@CLASSES: -// mwcst::BaseTable +// bmqst::BaseTable // -//@DESCRIPTION: This component defines a pure protocol, 'mwcst::BaseTable', for +//@DESCRIPTION: This component defines a pure protocol, 'bmqst::BaseTable', for // a // generic 2-dimensional table of values. @@ -32,7 +32,7 @@ namespace BloombergLP { -namespace mwcst { +namespace bmqst { // FORWARD DECLARATIONS class Value; @@ -41,7 +41,7 @@ class Value; // class BaseTable // =============== -/// Protocol for a generic table of `mwcst::Value`s +/// Protocol for a generic table of `bmqst::Value`s class BaseTable { public: // CREATORS @@ -62,7 +62,7 @@ class BaseTable { /// Load into the specified `value` the value in the specified `column` /// of the specified `row`. - virtual void value(mwcst::Value* value, int row, int column) const = 0; + virtual void value(bmqst::Value* value, int row, int column) const = 0; }; } // close package namespace diff --git a/src/groups/mwc/mwcst/mwcst_basictableinfoprovider.cpp b/src/groups/bmq/bmqst/bmqst_basictableinfoprovider.cpp similarity index 91% rename from src/groups/mwc/mwcst/mwcst_basictableinfoprovider.cpp rename to src/groups/bmq/bmqst/bmqst_basictableinfoprovider.cpp index a6001cb7f..9df581506 100644 --- a/src/groups/mwc/mwcst/mwcst_basictableinfoprovider.cpp +++ b/src/groups/bmq/bmqst/bmqst_basictableinfoprovider.cpp @@ -13,20 +13,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_basictableinfoprovider.cpp -*-C++-*- -#include +// bmqst_basictableinfoprovider.cpp -*-C++-*- +#include -#include -#include -#include +#include +#include +#include -#include +#include #include #include namespace BloombergLP { -namespace mwcst { +namespace bmqst { namespace { @@ -34,7 +34,7 @@ namespace { const bslstl::StringRef NA_STRING("N/A"); // FUNCTIONS -int findColumn(mwcst::BaseTable* table, const bslstl::StringRef& columnName) +int findColumn(bmqst::BaseTable* table, const bslstl::StringRef& columnName) { if (table) { for (int i = 0; i < table->numColumns(); ++i) { @@ -188,19 +188,19 @@ int BasicTableInfoProvider_ValueSizeVisitor::operator()( return static_cast(d_fmt_p->d_zeroString.value().length()); } else if (d_fmt_p->d_type == ColumnFormat::DMCU_NS_TIME_INTERVAL) { - return mwcst::PrintUtil::printedTimeIntervalNsLength( + return bmqst::PrintUtil::printedTimeIntervalNsLength( value, d_fmt_p->d_precision); } else if (d_fmt_p->d_type == ColumnFormat::DMCU_MEMORY) { - return mwcst::PrintUtil::printedMemoryLength(value, + return bmqst::PrintUtil::printedMemoryLength(value, d_fmt_p->d_precision); } else if (d_fmt_p->d_printSeparators) { - return mwcst::PrintUtil::printedValueLengthWithSeparator(value, 3); + return bmqst::PrintUtil::printedValueLengthWithSeparator(value, 3); } else { - return mwcst::PrintUtil::printedValueLength(value); + return bmqst::PrintUtil::printedValueLength(value); } } @@ -221,13 +221,13 @@ int BasicTableInfoProvider_ValueSizeVisitor::operator()(double value) const return static_cast(d_fmt_p->d_zeroString.value().length()); } else if (d_fmt_p->d_printSeparators) { - return mwcst::PrintUtil::printedValueLengthWithSeparator( + return bmqst::PrintUtil::printedValueLengthWithSeparator( value, d_fmt_p->d_precision, 3); } - return mwcst::PrintUtil::printedValueLength(value, d_fmt_p->d_precision); + return bmqst::PrintUtil::printedValueLength(value, d_fmt_p->d_precision); } int BasicTableInfoProvider_ValueSizeVisitor::operator()( @@ -273,17 +273,17 @@ int BasicTableInfoProvider_ValuePrintVisitor::operator()( (*d_stream_p) << d_fmt_p->d_zeroString; } else if (d_fmt_p->d_type == ColumnFormat::DMCU_NS_TIME_INTERVAL) { - mwcst::PrintUtil::printTimeIntervalNs(*d_stream_p, + bmqst::PrintUtil::printTimeIntervalNs(*d_stream_p, value, d_fmt_p->d_precision); } else if (d_fmt_p->d_type == ColumnFormat::DMCU_MEMORY) { - mwcst::PrintUtil::printMemory(*d_stream_p, + bmqst::PrintUtil::printMemory(*d_stream_p, value, d_fmt_p->d_precision); } else if (d_fmt_p->d_printSeparators) { - mwcst::PrintUtil::printValueWithSeparator(*d_stream_p, value, 3, ','); + bmqst::PrintUtil::printValueWithSeparator(*d_stream_p, value, 3, ','); } else { (*d_stream_p) << value; @@ -311,7 +311,7 @@ int BasicTableInfoProvider_ValuePrintVisitor::operator()(double value) const (*d_stream_p) << d_fmt_p->d_zeroString; } else if (d_fmt_p->d_printSeparators) { - mwcst::PrintUtil::printValueWithSeparator(*d_stream_p, + bmqst::PrintUtil::printValueWithSeparator(*d_stream_p, value, d_fmt_p->d_precision, 3, @@ -349,7 +349,7 @@ BasicTableInfoProvider::BasicTableInfoProvider( } BasicTableInfoProvider::BasicTableInfoProvider( - mwcst::BaseTable* table, + bmqst::BaseTable* table, bslma::Allocator* basicAllocator) : d_table_p(table) , d_title(basicAllocator) @@ -367,7 +367,7 @@ void BasicTableInfoProvider::reset() d_columns.clear(); } -void BasicTableInfoProvider::setTable(mwcst::BaseTable* table) +void BasicTableInfoProvider::setTable(bmqst::BaseTable* table) { d_table_p = table; } @@ -413,7 +413,7 @@ BasicTableInfoProvider::addColumn(const bslstl::StringRef& tableColumnName, // ACCESSORS -// mwcst::TableInfoProvider +// bmqst::TableInfoProvider int BasicTableInfoProvider::numRows() const { return d_table_p->numRows(); @@ -442,7 +442,7 @@ int BasicTableInfoProvider::numHeaderLevels() const int BasicTableInfoProvider::getValueSize(int row, int column) const { const ColumnFormat& fmt = d_columns[column]; - mwcst::Value value; + bmqst::Value value; if (fmt.d_tableColumnIndex >= 0) { d_table_p->value(&value, row, fmt.d_tableColumnIndex); @@ -461,7 +461,7 @@ bsl::ostream& BasicTableInfoProvider::printValue(bsl::ostream& stream, int /*width*/) const { const ColumnFormat& fmt = d_columns[column]; - mwcst::Value value; + bmqst::Value value; if (fmt.d_tableColumnIndex >= 0) { d_table_p->value(&value, row, fmt.d_tableColumnIndex); @@ -500,7 +500,7 @@ int BasicTableInfoProvider::getParentHeader(int /*level*/, int column) const bsl::ostream& BasicTableInfoProvider::printTitle(bsl::ostream& stream) const { - return mwcst::PrintUtil::printStringCentered(stream, d_title); + return bmqst::PrintUtil::printStringCentered(stream, d_title); } bsl::ostream& BasicTableInfoProvider::printHeader(bsl::ostream& stream, @@ -509,12 +509,12 @@ bsl::ostream& BasicTableInfoProvider::printHeader(bsl::ostream& stream, int /*width*/) const { if (level == 0) { - return mwcst::PrintUtil::printStringCentered( + return bmqst::PrintUtil::printStringCentered( stream, d_columns[column].d_printColumnName); } else { - return mwcst::PrintUtil::printStringCentered(stream, + return bmqst::PrintUtil::printStringCentered(stream, d_columnGroups[column]); } } diff --git a/src/groups/mwc/mwcst/mwcst_basictableinfoprovider.h b/src/groups/bmq/bmqst/bmqst_basictableinfoprovider.h similarity index 91% rename from src/groups/mwc/mwcst/mwcst_basictableinfoprovider.h rename to src/groups/bmq/bmqst/bmqst_basictableinfoprovider.h index 6297cf8bd..e466dbcb4 100644 --- a/src/groups/mwc/mwcst/mwcst_basictableinfoprovider.h +++ b/src/groups/bmq/bmqst/bmqst_basictableinfoprovider.h @@ -13,22 +13,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_basictableinfoprovider.h -*-C++-*- -#ifndef INCLUDED_MWCST_BASICTABLEINFOPROVIDER -#define INCLUDED_MWCST_BASICTABLEINFOPROVIDER +// bmqst_basictableinfoprovider.h -*-C++-*- +#ifndef INCLUDED_BMQST_BASICTABLEINFOPROVIDER +#define INCLUDED_BMQST_BASICTABLEINFOPROVIDER -//@PURPOSE: Provide an adapter of 'mwcst::BaseTable' to -//'mwcst::TableInfoProvider' +//@PURPOSE: Provide an adapter of 'bmqst::BaseTable' to +//'bmqst::TableInfoProvider' // //@CLASSES: -// mwcst::BasicTableInfoProvider +// bmqst::BasicTableInfoProvider // //@DESCRIPTION: This component defines a mechanism, -// 'mwcst::BasicTableInfoProvider', which adapts the 'mwcst::BaseTable' -// protocol to the 'mwcst::TableInfoProvider' protocol. It allows the user to -// specifiy exactly how a 'mwcst::BaseTable' should be printed. +// 'bmqst::BasicTableInfoProvider', which adapts the 'bmqst::BaseTable' +// protocol to the 'bmqst::TableInfoProvider' protocol. It allows the user to +// specifiy exactly how a 'bmqst::BaseTable' should be printed. -#include +#include #include #include @@ -39,7 +39,7 @@ namespace BloombergLP { -namespace mwcst { +namespace bmqst { // FORWARD DECLARATIONS class BaseTable; @@ -51,7 +51,7 @@ class BasicTableInfoProvider_ValuePrintVisitor; // class BasicTableInfoProvider_ColumnFormat // ========================================= -/// Format of a a column to be printed by a `BasicTableInfoProvider` +/// Format of a column to be printed by a `BasicTableInfoProvider` class BasicTableInfoProvider_ColumnFormat { private: // PRIVATE TYPES @@ -145,7 +145,7 @@ class BasicTableInfoProvider_ColumnFormat { // class BasicTableInfoProvider_ValueSizeVisitor // ============================================= -/// A `mwcst::Value` visitor that returns the printed size of the value +/// A `bmqst::Value` visitor that returns the printed size of the value class BasicTableInfoProvider_ValueSizeVisitor { public: // PUBLIC TYPES @@ -191,7 +191,7 @@ class BasicTableInfoProvider_ValueSizeVisitor { // class BasicTableInfoProvider_ValuePrintVisitor // ============================================== -/// A `mwcst::Value` visitor that prints the a value +/// A `bmqst::Value` visitor that prints the a value class BasicTableInfoProvider_ValuePrintVisitor { public: // PUBLIC TYPES @@ -238,8 +238,8 @@ class BasicTableInfoProvider_ValuePrintVisitor { // class BasicTableInfoProvider // ============================ -/// Adapts `mwcst::BaseTable` to `mwcst::TableInfoProvider` -class BasicTableInfoProvider : public mwcst::TableInfoProvider { +/// Adapts `bmqst::BaseTable` to `bmqst::TableInfoProvider` +class BasicTableInfoProvider : public bmqst::TableInfoProvider { public: // PUBLIC TYPES typedef BasicTableInfoProvider_ColumnFormat ColumnFormat; @@ -251,7 +251,7 @@ class BasicTableInfoProvider : public mwcst::TableInfoProvider { typedef bsl::vector ColumnList; // DATA - mwcst::BaseTable* d_table_p; + bmqst::BaseTable* d_table_p; bsl::string d_title; bsl::vector d_columnGroups; ColumnList d_columns; @@ -265,7 +265,7 @@ class BasicTableInfoProvider : public mwcst::TableInfoProvider { public: // CREATORS BasicTableInfoProvider(bslma::Allocator* basicAllocator = 0); - BasicTableInfoProvider(mwcst::BaseTable* table, + BasicTableInfoProvider(bmqst::BaseTable* table, bslma::Allocator* basicAllocator = 0); // MANIPULATORS @@ -275,7 +275,7 @@ class BasicTableInfoProvider : public mwcst::TableInfoProvider { /// Set the table to be printed to the specified `table`. Any added /// columns will continue to refer to the same column indices. - void setTable(mwcst::BaseTable* table); + void setTable(bmqst::BaseTable* table); /// Find the right column indices in the current table corresponding to /// the source column names of the current columns. @@ -297,7 +297,7 @@ class BasicTableInfoProvider : public mwcst::TableInfoProvider { // ACCESSORS - // mwcst::TableInfoProvider + // bmqst::TableInfoProvider int numRows() const BSLS_KEYWORD_OVERRIDE; int numColumns(int level) const BSLS_KEYWORD_OVERRIDE; bool hasTitle() const BSLS_KEYWORD_OVERRIDE; diff --git a/src/groups/mwc/mwcst/mwcst_printutil.cpp b/src/groups/bmq/bmqst/bmqst_printutil.cpp similarity index 98% rename from src/groups/mwc/mwcst/mwcst_printutil.cpp rename to src/groups/bmq/bmqst/bmqst_printutil.cpp index 4c739ff48..65dd52993 100644 --- a/src/groups/mwc/mwcst/mwcst_printutil.cpp +++ b/src/groups/bmq/bmqst/bmqst_printutil.cpp @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_printutil.cpp -*-C++-*- -#include +// bmqst_printutil.cpp -*-C++-*- +#include #include #include #include +#include #include #include #include #include -#include #include #include @@ -31,7 +31,7 @@ #include namespace BloombergLP { -namespace mwcst { +namespace bmqst { namespace { @@ -195,7 +195,7 @@ int PrintUtil::printedValueLength(bsls::Types::Int64 value) int PrintUtil::printedValueLength(double value, int precision) { - return mwcst::PrintUtil::printedValueLength((bsls::Types::Int64)value) + + return bmqst::PrintUtil::printedValueLength((bsls::Types::Int64)value) + precision + 1; } @@ -225,7 +225,7 @@ int PrintUtil::printedValueLengthWithSeparator(double value, int precision, int groupSize) { - return mwcst::PrintUtil::printedValueLengthWithSeparator( + return bmqst::PrintUtil::printedValueLengthWithSeparator( (bsls::Types::Int64)value, groupSize) + precision + (precision > 0 ? 1 : 0); diff --git a/src/groups/mwc/mwcst/mwcst_printutil.h b/src/groups/bmq/bmqst/bmqst_printutil.h similarity index 87% rename from src/groups/mwc/mwcst/mwcst_printutil.h rename to src/groups/bmq/bmqst/bmqst_printutil.h index a0b5464c0..b69dcfe8b 100644 --- a/src/groups/mwc/mwcst/mwcst_printutil.h +++ b/src/groups/bmq/bmqst/bmqst_printutil.h @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_printutil.h -*-C++-*- -#ifndef INCLUDED_MWCST_PRINTUTIL -#define INCLUDED_MWCST_PRINTUTIL +// bmqst_printutil.h -*-C++-*- +#ifndef INCLUDED_BMQST_PRINTUTIL +#define INCLUDED_BMQST_PRINTUTIL //@PURPOSE: Provide utilities for printing things // //@CLASSES: -// mwcst::PrintUtil +// bmqst::PrintUtil // //@DESCRIPTION: // This component provides a set of utility functions useful for printing @@ -43,7 +43,7 @@ namespace bsls { class Stopwatch; } -namespace mwcst { +namespace bmqst { // FORWARD DECLARATIONS class TableInfoProvider; @@ -257,24 +257,24 @@ Printer::print(bsl::ostream& stream, int level, int spacesPerLevel) const // FREE OPERATORS template -bsl::ostream& mwcst::operator<<(bsl::ostream& stream, - const mwcst::Printer& p) +bsl::ostream& bmqst::operator<<(bsl::ostream& stream, + const bmqst::Printer& p) { return stream << p.obj(); } template -bsl::ostream& mwcst::operator<<(bsl::ostream& stream, - const mwcst::Printer >& p) +bsl::ostream& bmqst::operator<<(bsl::ostream& stream, + const bmqst::Printer >& p) { stream << "["; if (!p.obj().empty()) { for (size_t i = 0; i < p.obj().size() - 1; ++i) { - stream << mwcst::Printer(&p.obj()[i]) << ", "; + stream << bmqst::Printer(&p.obj()[i]) << ", "; } - stream << mwcst::Printer(&p.obj().back()); + stream << bmqst::Printer(&p.obj().back()); } return stream << "]"; @@ -282,8 +282,8 @@ bsl::ostream& mwcst::operator<<(bsl::ostream& stream, template bsl::ostream& -mwcst::operator<<(bsl::ostream& stream, - const mwcst::Printer >& p) +bmqst::operator<<(bsl::ostream& stream, + const bmqst::Printer >& p) { stream << "{"; @@ -292,20 +292,20 @@ mwcst::operator<<(bsl::ostream& stream, Iter iter = p.obj().begin(); Iter lastElem = --p.obj().end(); for (; iter != lastElem; ++iter) { - stream << mwcst::Printer(&iter->first) << ":" - << mwcst::Printer(&iter->second) << ", "; + stream << bmqst::Printer(&iter->first) << ":" + << bmqst::Printer(&iter->second) << ", "; } - stream << mwcst::Printer(&iter->first) << ":" - << mwcst::Printer(&iter->second); + stream << bmqst::Printer(&iter->first) << ":" + << bmqst::Printer(&iter->second); } return stream << "}"; } template -bsl::ostream& mwcst::operator<<(bsl::ostream& stream, - const mwcst::Printer >& p) +bsl::ostream& bmqst::operator<<(bsl::ostream& stream, + const bmqst::Printer >& p) { stream << "{"; @@ -314,10 +314,10 @@ bsl::ostream& mwcst::operator<<(bsl::ostream& stream, Iter iter = p.obj().begin(); Iter lastElem = --p.obj().end(); for (; iter != lastElem; ++iter) { - stream << mwcst::Printer(&(*iter)) << ", "; + stream << bmqst::Printer(&(*iter)) << ", "; } - stream << mwcst::Printer(&(*iter)); + stream << bmqst::Printer(&(*iter)); } return stream << "}"; @@ -325,8 +325,8 @@ bsl::ostream& mwcst::operator<<(bsl::ostream& stream, template bsl::ostream& -mwcst::operator<<(bsl::ostream& stream, - const mwcst::Printer >& p) +bmqst::operator<<(bsl::ostream& stream, + const bmqst::Printer >& p) { stream << "{"; @@ -338,7 +338,7 @@ mwcst::operator<<(bsl::ostream& stream, if (iter != begin) { stream << ", "; } - stream << mwcst::Printer(&(*iter)); + stream << bmqst::Printer(&(*iter)); } } @@ -347,8 +347,8 @@ mwcst::operator<<(bsl::ostream& stream, template bsl::ostream& -mwcst::operator<<(bsl::ostream& stream, - const mwcst::Printer >& p) +bmqst::operator<<(bsl::ostream& stream, + const bmqst::Printer >& p) { stream << "{"; @@ -360,8 +360,8 @@ mwcst::operator<<(bsl::ostream& stream, stream << ", "; } - stream << mwcst::Printer(&iter->first) << ":" - << mwcst::Printer(&iter->second); + stream << bmqst::Printer(&iter->first) << ":" + << bmqst::Printer(&iter->second); } return stream << "}"; @@ -369,8 +369,8 @@ mwcst::operator<<(bsl::ostream& stream, template bsl::ostream& -mwcst::operator<<(bsl::ostream& stream, - const mwcst::Printer >& p) +bmqst::operator<<(bsl::ostream& stream, + const bmqst::Printer >& p) { return stream << '<' << p.obj().first << ", " << p.obj().second << '>'; } diff --git a/src/groups/mwc/mwcst/mwcst_printutil.t.cpp b/src/groups/bmq/bmqst/bmqst_printutil.t.cpp similarity index 98% rename from src/groups/mwc/mwcst/mwcst_printutil.t.cpp rename to src/groups/bmq/bmqst/bmqst_printutil.t.cpp index 0085934e0..8da0b33d3 100644 --- a/src/groups/mwc/mwcst/mwcst_printutil.t.cpp +++ b/src/groups/bmq/bmqst/bmqst_printutil.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_printutil.t.cpp -*-C++-*- +// bmqst_printutil.t.cpp -*-C++-*- -#include +#include -#include +#include #include #include @@ -28,7 +28,7 @@ #include using namespace BloombergLP; -using namespace mwcst; +using namespace bmqst; using namespace bsl; //============================================================================= @@ -65,7 +65,7 @@ template void checkStreamOutput(int line, const TYPE& obj, const char* expected) { bsl::ostringstream ss; - ss << mwcst::Printer(&obj); + ss << bmqst::Printer(&obj); LOOP_ASSERT_EQUALS(line, ss.str(), expected); } @@ -77,8 +77,8 @@ void checkPrintOutput(int line, int spacesPerLevel, const char* expected) { - bsl::ostringstream ss; - mwcst::Printer printer(&obj); + bsl::ostringstream ss; + bmqst::Printer printer(&obj); printer.print(ss, level, spacesPerLevel); LOOP_ASSERT_EQUALS(line, ss.str(), expected); } diff --git a/src/groups/mwc/mwcst/mwcst_statcontext.cpp b/src/groups/bmq/bmqst/bmqst_statcontext.cpp similarity index 93% rename from src/groups/mwc/mwcst/mwcst_statcontext.cpp rename to src/groups/bmq/bmqst/bmqst_statcontext.cpp index 32308c222..d15fa1cf2 100644 --- a/src/groups/mwc/mwcst/mwcst_statcontext.cpp +++ b/src/groups/bmq/bmqst/bmqst_statcontext.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_statcontext.cpp -*-C++-*- -#include +// bmqst_statcontext.cpp -*-C++-*- +#include -#include -#include +#include +#include #include @@ -36,10 +36,10 @@ #include #include -#include +#include namespace BloombergLP { -namespace mwcst { +namespace bmqst { namespace { @@ -109,7 +109,7 @@ void clearStats(bsl::vector* values) /// load a full `StatValue` update into each element of `values`, otherwise /// load the changes since the last snapshot. static void -loadUpdatesFromValues(bsl::vector* updates, +loadUpdatesFromValues(bsl::vector* updates, const bsl::vector* values, int mask, bool full) @@ -164,8 +164,8 @@ inline static bsls::Types::Int64 convertFromEpoch(bsls::Types::Int64 epochTime) // PRIVATE CLASS METHODS void StatContext::statContextDeleter(void* context_vp, void* allocator_vp) { - StatContext* context = (StatContext*)context_vp; - context->d_isDeleted = true; + StatContext* context = (StatContext*)context_vp; + context->d_isDeleted = true; if (context->d_released.swap(true)) { // Context was already release by its parent context, therefore we are // responsible for deallocating it. @@ -221,9 +221,9 @@ void StatContext::clearDeletedSubcontexts( // that we use to erase the element. BSLS_ASSERT((*iter)->d_update_p); - bsl::vector& updates = + bsl::vector& updates = d_update_p->subcontexts(); - mwcstm::StatContextUpdate* update = (*iter)->d_update_p; + bmqstm::StatContextUpdate* update = (*iter)->d_update_p; BSLS_ASSERT(updates.begin() <= update && update < updates.end()); // Swap the update to be deleted with the last update, update the @@ -231,7 +231,7 @@ void StatContext::clearDeletedSubcontexts( // erase the last element, corresponding to the deleted update. if (update != &updates.back()) { - mwcstm::StatContextUpdate* last = &updates.back(); + bmqstm::StatContextUpdate* last = &updates.back(); StatContext* subcontext = d_subcontextsById[last->id()]; bsl::swap(update, last); subcontext->d_update_p = update; @@ -257,7 +257,7 @@ void StatContext::moveNewSubcontexts() localNewSubcontexts.swap(d_newSubcontexts); } - bsl::vector* updates = 0; + bsl::vector* updates = 0; if (d_update_p) { updates = &d_update_p->subcontexts(); updates->reserve(updates->size() + localNewSubcontexts.size()); @@ -332,7 +332,7 @@ void StatContext::snapshotImp(bsls::Types::Int64 snapshotTime) d_update_p->configuration().reset(); d_update_p->flags() = bdlb::BitUtil::withBitCleared( d_update_p->flags(), - mwcstm::StatContextUpdateFlags::E_CONTEXT_CREATED); + bmqstm::StatContextUpdateFlags::E_CONTEXT_CREATED); } } @@ -362,11 +362,11 @@ void StatContext::snapshotImp(bsls::Types::Int64 snapshotTime) if (iter->second->isDeleted()) { d_deletedSubcontexts.push_back(iter->second); - mwcstm::StatContextUpdate* update = iter->second->d_update_p; + bmqstm::StatContextUpdate* update = iter->second->d_update_p; if (update) { update->flags() = bdlb::BitUtil::withBitSet( update->flags(), - mwcstm::StatContextUpdateFlags::E_CONTEXT_DELETED); + bmqstm::StatContextUpdateFlags::E_CONTEXT_DELETED); } d_subcontexts.erase(iter++); } @@ -451,7 +451,7 @@ void StatContext::cleanupImp(bsl::vector* expiredValuesVec) } } -void StatContext::applyUpdate(const mwcstm::StatContextUpdate& update) +void StatContext::applyUpdate(const bmqstm::StatContextUpdate& update) { // Apply the update to all of our values. @@ -467,8 +467,8 @@ void StatContext::applyUpdate(const mwcstm::StatContextUpdate& update) // Create, update, or delete subcontexts as specified in the update. - typedef mwcstm::StatContextUpdateFlags Flags; - for (bsl::vector::const_iterator i = + typedef bmqstm::StatContextUpdateFlags Flags; + for (bsl::vector::const_iterator i = update.subcontexts().begin(); i != update.subcontexts().end(); ++i) { @@ -587,7 +587,7 @@ bslma::ManagedPtr StatContext::addSubcontext(const Config& config) // Stash the 'update' to be applied to the subcontext so that we can wait // to apply it after we have completely initialized the subcontext. - const mwcstm::StatContextUpdate* update = newConfig.d_update_p; + const bmqstm::StatContextUpdate* update = newConfig.d_update_p; newConfig.d_update_p = 0; if (d_isTable) { @@ -680,7 +680,7 @@ void StatContext::clearValues() } } -void StatContext::snapshotFromUpdate(const mwcstm::StatContextUpdate& update) +void StatContext::snapshotFromUpdate(const bmqstm::StatContextUpdate& update) { applyUpdate(update); snapshotImp(convertFromEpoch(update.timeStamp())); @@ -708,7 +708,7 @@ void StatContext::clearSubcontexts() // that no incremental cleanup is performed, and then just clear it out // after that's done. - mwcstm::StatContextUpdate* update = d_update_p; + bmqstm::StatContextUpdate* update = d_update_p; d_update_p = 0; clearDeletedSubcontexts(0); @@ -732,25 +732,25 @@ int StatContext::valueIndex(const bslstl::StringRef& name) const return -1; } -void StatContext::initializeUpdate(mwcstm::StatContextUpdate* update) const +void StatContext::initializeUpdate(bmqstm::StatContextUpdate* update) const { update->id() = d_uniqueId; update->flags() = bdlb::BitUtil::withBitSet( 0u, - mwcstm::StatContextUpdateFlags::E_CONTEXT_CREATED); + bmqstm::StatContextUpdateFlags::E_CONTEXT_CREATED); - mwcstm::StatContextConfiguration& config = + bmqstm::StatContextConfiguration& config = update->configuration().makeValue(); config.flags() = 0; if (isTable()) { config.flags() = bdlb::BitUtil::withBitSet( config.flags(), - mwcstm::StatContextConfigurationFlags::E_IS_TABLE); + bmqstm::StatContextConfigurationFlags::E_IS_TABLE); } if (d_storeExpiredValues) { config.flags() = bdlb::BitUtil::withBitSet( config.flags(), - mwcstm::StatContextConfigurationFlags::E_STORE_EXPIRED_VALUES); + bmqstm::StatContextConfigurationFlags::E_STORE_EXPIRED_VALUES); } if (hasName()) { @@ -766,10 +766,10 @@ void StatContext::initializeUpdate(mwcstm::StatContextUpdate* update) const } for (int i = 0; i < numValues(); ++i) { - mwcstm::StatValueDefinition& definition = config.values()[i]; + bmqstm::StatValueDefinition& definition = config.values()[i]; const StatValue& val = value(StatContext::e_DIRECT_VALUE, i); definition.name() = valueName(i); - definition.type() = static_cast( + definition.type() = static_cast( val.type()); definition.historySizes().resize(val.numLevels()); for (int l = 0; l < val.numLevels(); ++l) { @@ -778,7 +778,7 @@ void StatContext::initializeUpdate(mwcstm::StatContextUpdate* update) const } } -void StatContext::loadFullUpdate(mwcstm::StatContextUpdate* update, +void StatContext::loadFullUpdate(bmqstm::StatContextUpdate* update, int valueFieldMask) const { initializeUpdate(update); @@ -839,7 +839,7 @@ StatContext::print(bsl::ostream& stream, int level, int spacesPerLevel) const // CREATORS StatContextConfiguration::StatContextConfiguration( - const mwcstm::StatContextUpdate& update, + const bmqstm::StatContextUpdate& update, bslma::Allocator* basicAllocator) : d_id(basicAllocator) , d_uniqueId(0) @@ -857,10 +857,10 @@ StatContextConfiguration::StatContextConfiguration( BSLS_ASSERT(!update.configuration().isNull()); BSLS_ASSERT(bdlb::BitUtil::isBitSet( update.flags(), - mwcstm::StatContextUpdateFlags::E_CONTEXT_CREATED)); + bmqstm::StatContextUpdateFlags::E_CONTEXT_CREATED)); d_uniqueId = update.id(); - const mwcstm::StatContextConfiguration& config = + const bmqstm::StatContextConfiguration& config = update.configuration().value(); if (config.choice().isNameValue()) { @@ -872,14 +872,14 @@ StatContextConfiguration::StatContextConfiguration( d_isTable = bdlb::BitUtil::isBitSet( config.flags(), - mwcstm::StatContextConfigurationFlags::E_IS_TABLE); + bmqstm::StatContextConfigurationFlags::E_IS_TABLE); d_storeExpiredSubcontextValues = bdlb::BitUtil::isBitSet( config.flags(), - mwcstm::StatContextConfigurationFlags::E_STORE_EXPIRED_VALUES); + bmqstm::StatContextConfigurationFlags::E_STORE_EXPIRED_VALUES); d_valueDefs.resize(config.values().size()); for (bsl::size_t i = 0; i < d_valueDefs.size(); ++i) { - const mwcstm::StatValueDefinition& definition = config.values()[i]; + const bmqstm::StatValueDefinition& definition = config.values()[i]; d_valueDefs[i].d_name = definition.name(); d_valueDefs[i].d_type = static_cast( definition.type()); diff --git a/src/groups/mwc/mwcst/mwcst_statcontext.h b/src/groups/bmq/bmqst/bmqst_statcontext.h similarity index 92% rename from src/groups/mwc/mwcst/mwcst_statcontext.h rename to src/groups/bmq/bmqst/bmqst_statcontext.h index 683615511..eaba6bb70 100644 --- a/src/groups/mwc/mwcst/mwcst_statcontext.h +++ b/src/groups/bmq/bmqst/bmqst_statcontext.h @@ -13,29 +13,29 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_statcontext.h -*-C++-*- -#ifndef INCLUDED_MWCST_STATCONTEXT -#define INCLUDED_MWCST_STATCONTEXT +// bmqst_statcontext.h -*-C++-*- +#ifndef INCLUDED_BMQST_STATCONTEXT +#define INCLUDED_BMQST_STATCONTEXT //@PURPOSE: Provide a context to manage a set of user-defined stat values. // //@CLASSES: -// mwcst::StatContextConfiguration : configuration for a StatContext -// mwcst::StatContextIterator : iterator of subcontexts -// mwcst::StatContext : the stat context +// bmqst::StatContextConfiguration : configuration for a StatContext +// bmqst::StatContextIterator : iterator of subcontexts +// bmqst::StatContext : the stat context // //@SEE_ALSO: -// mwcst_statvalue -// mwcst_statutil -// mwcst_statcontexttableinfoprovider +// bmqst_statvalue +// bmqst_statutil +// bmqst_statcontexttableinfoprovider // -//@DESCRIPTION: This component defines a mechanism, 'mwcst::StatContext', for +//@DESCRIPTION: This component defines a mechanism, 'bmqst::StatContext', for // managing a hierarchical set of user-defined statistics. It is intended to // be used as a generic container of an application's various statistics. // /// Statistics ///---------- -// The statistics themselves are maintained by a set of 'mwcst::StatValue' +// The statistics themselves are maintained by a set of 'bmqst::StatValue' // objects owned by the 'StatContext'. The 'StatContext' itself is mainly // responsible for forwarding updates to the correct 'StatValue' and providing // a simple interface to its values. Think about a "value" as a variable, @@ -44,11 +44,11 @@ // the value every time a message is received, and in return the application // can obtain various statistics about the value, such as rates, or // min/max/average over a given period of time. See the documentation of -// 'mwcst::StatUtil' for the types of statistics that are currently supported +// 'bmqst::StatUtil' for the types of statistics that are currently supported // for a value. // // The statistics to be maintained by a 'StatContext' are defined by a -// 'mwcst::StatContextConfiguration' object provided by the application when a +// 'bmqst::StatContextConfiguration' object provided by the application when a // 'StatContext' is created. This configuration tells the 'StatContext' what // values to maintain, as well as which statistics of those values the user is // interested in. @@ -59,8 +59,8 @@ // for a value, of type 'e_NUM_INCREMENTS', and name this statistic "Number // of Messages". While these names aren't necessary for stat collection, they // are useful to components that will want to process the 'StatContext'. See -// 'mwcst::StatContextTableInfoProvider' for an example of a generic component -// that can be used with the 'mwcst::TableUtil' utility to print a table +// 'bmqst::StatContextTableInfoProvider' for an example of a generic component +// that can be used with the 'bmqst::TableUtil' utility to print a table // 'StatContext' to a stream. // /// Stat Tables @@ -124,22 +124,22 @@ // example log them on a regular basis, or publish them to some dashboard // monitoring function. To do this the application accesses all the snapshotted // values and presumably prints them in some way. For example, -// 'mwcst::StatContextTableInfoProvider' can be used in a call to -// 'mwcst::TableUtil' to print a table 'StatContext' to a stream. +// 'bmqst::StatContextTableInfoProvider' can be used in a call to +// 'bmqst::TableUtil' to print a table 'StatContext' to a stream. // /// Serializable Updates ///-------------------- // A 'StatContext' can be configured to maintain a 'diff' of its state between // the last two snapshots by providing it with a serializable -// 'mwcstm::StatContextUpdate'. On each snapshot, the 'StatContext' will -// update the values of the 'mwcstm::StatContextUpdate' to represent the value +// 'bmqstm::StatContextUpdate'. On each snapshot, the 'StatContext' will +// update the values of the 'bmqstm::StatContextUpdate' to represent the value // changes in that snapshot. This update may then be applied to another // 'StatContext', which will add or remove subcontexts and update its values // based on the update. Since the update component is serializable, this // context can reside in another process. // // 'StatContext' additionally provides a way to generate a complete -// 'mwcstm::StatContextUpdate' based on its current state. This is useful to +// 'bmqstm::StatContextUpdate' based on its current state. This is useful to // create an update containing the full state of the 'StatContext' since it was // created, rather than just the incremental changes since the last snapshot. // @@ -162,13 +162,13 @@ // for outgoing traffic. We want both values to remember 11 snapshots (10 // seconds of past snapshots plus 1 for the most recent snapshot), so // we pass this in as the second argument to the 'value()' function of -// 'mwcst::StatContextConfiguration'. Notice that -// 'mwcst::StatContextConfiguration' methods all return a reference to the +// 'bmqst::StatContextConfiguration'. Notice that +// 'bmqst::StatContextConfiguration' methods all return a reference to the // object, allowing calls to it to be chained as shown. //.. // int numSnapshots = 11; -// mwcst::StatContext context( -// mwcst::StatContextConfiguration("Network Interface") +// bmqst::StatContext context( +// bmqst::StatContextConfiguration("Network Interface") // .value("In", numSnapshots) // .value("Out", numSnapshots), // allocator); @@ -204,7 +204,7 @@ // Finally we can print the statistics in tabular format using the code // below: //.. -// mwcst::StatContextTableInfoProvider tip; +// bmqst::StatContextTableInfoProvider tip; // tip.setContext(&context); //.. // Here we define the columns to show when printing out StatContext. @@ -222,30 +222,30 @@ // First, want a column named "Bytes" which contains the value of the '0'th // (i.e. most recent) snapshot of the e_IN stat context. //.. -// tip.addColumn("Bytes", e_IN, mwcst::StatUtil::value, 0); +// tip.addColumn("Bytes", e_IN, bmqst::StatUtil::value, 0); //.. // Next we want column "Bytes/s" which calculates the rate of change of // the e_IN value from the 10th (oldest) to the 0th (most recent) snapshot. //.. -// tip.addColumn("Bytes/s", e_IN, mwcst::StatUtil::rate, 10, 0); +// tip.addColumn("Bytes/s", e_IN, bmqst::StatUtil::rate, 10, 0); //.. // Third, we want a column "Messages" showing the number of times the e_IN // value has been incremented up to the most recent (0th) snapshot. //.. -// tip.addColumn("Messages", e_IN, mwcst::StatUtil::increments, 0); +// tip.addColumn("Messages", e_IN, bmqst::StatUtil::increments, 0); //.. // Finally, we want "Messages/s" which shows the rate of increments of the // e_IN value from the 10th to the 0th snapshot. //.. -// tip.addColumn("Messages/s", e_IN, mwcst::StatUtil::incrementRate, 10, 0); +// tip.addColumn("Messages/s", e_IN, bmqst::StatUtil::incrementRate, 10, 0); //.. // Now we add similar columns for the output statistics //.. // tip.setColumnGroup("Out"); -// tip.addColumn("Bytes", e_OUT, mwcst::StatUtil::value, 0); -// tip.addColumn("Bytes/s", e_OUT, mwcst::StatUtil::rate, 10, 0); -// tip.addColumn("Messages", e_OUT, mwcst::StatUtil::increments, 0); -// tip.addColumn("Messages/s", e_OUT, mwcst::StatUtil::incrementRate, 10, 0); +// tip.addColumn("Bytes", e_OUT, bmqst::StatUtil::value, 0); +// tip.addColumn("Bytes/s", e_OUT, bmqst::StatUtil::rate, 10, 0); +// tip.addColumn("Messages", e_OUT, bmqst::StatUtil::increments, 0); +// tip.addColumn("Messages/s", e_OUT, bmqst::StatUtil::incrementRate, 10, 0); //.. // Before printing, we tell the 'StatContextTableInfoProvider' to update // itself, figuring out which StatContexts to display when printing @@ -253,7 +253,7 @@ // tip.update(); // // if (verbose) { -// mwcst::TableUtil::printTable(bsl::cout, tip); +// bmqst::TableUtil::printTable(bsl::cout, tip); // } //.. // The input stats are printed as follow (output is removed for clarity): @@ -289,7 +289,7 @@ // bsl::cout << bsl::endl << "After " << (i + 1) << " seconds:" // << bsl::endl; // tip.update(); -// mwcst::TableUtil::printTable(bsl::cout, tip); +// bmqst::TableUtil::printTable(bsl::cout, tip); // } // } //.. @@ -321,8 +321,8 @@ // "Network Interface" as a table. //.. // int numSnapshots = 11; -// mwcst::StatContext context( -// mwcst::StatContextConfiguration("Network Interface") +// bmqst::StatContext context( +// bmqst::StatContextConfiguration("Network Interface") // .isTable(true) // .value("In", numSnapshots), // allocator); @@ -334,10 +334,10 @@ // any value definitions are ignored when adding a subcontext to a table // StatContext. //.. -// bslma::ManagedPtr client1 = -// context.addSubcontext(mwcst::StatContextConfiguration("tcp://1234")); -// bslma::ManagedPtr client2 = -// context.addSubcontext(mwcst::StatContextConfiguration("tcp://5678")); +// bslma::ManagedPtr client1 = +// context.addSubcontext(bmqst::StatContextConfiguration("tcp://1234")); +// bslma::ManagedPtr client2 = +// context.addSubcontext(bmqst::StatContextConfiguration("tcp://5678")); //.. // Suppose we receive a mesage from the first client and another message // from the second client: @@ -353,19 +353,19 @@ // 'snapshot' on each client). Printing is done as usual. //.. // context.snapshot(); -// mwcst::StatContextTableInfoProvider tip; +// bmqst::StatContextTableInfoProvider tip; // tip.setContext(&context); // tip.setColumnGroup(""); // tip.addDefaultIdColumn(""); // tip.setColumnGroup("In"); -// tip.addColumn("Bytes", 0, mwcst::StatUtil::value, 0); -// tip.addColumn("Bytes/s", 0, mwcst::StatUtil::rate, 10, 0); -// tip.addColumn("Messages", 0, mwcst::StatUtil::increments, 0); -// tip.addColumn("Messages/s", 0, mwcst::StatUtil::incrementRate, 10, 0); +// tip.addColumn("Bytes", 0, bmqst::StatUtil::value, 0); +// tip.addColumn("Bytes/s", 0, bmqst::StatUtil::rate, 10, 0); +// tip.addColumn("Messages", 0, bmqst::StatUtil::increments, 0); +// tip.addColumn("Messages/s", 0, bmqst::StatUtil::incrementRate, 10, 0); // tip.update(); // // if (verbose) { -// mwcst::TableUtil::printTable(bsl::cout, tip); +// bmqst::TableUtil::printTable(bsl::cout, tip); // } //.. // This will print the hierarchy of contexts as follow. Note that there @@ -388,7 +388,7 @@ // context.snapshot(); // tip.update(); // if (verbose) { -// mwcst::TableUtil::printTable(bsl::cout, tip); +// bmqst::TableUtil::printTable(bsl::cout, tip); // } //.. // Notice the parentheses around the name of deleted client: @@ -409,7 +409,7 @@ // tip.setContext(&context); // tip.update(); // if (verbose) { -// mwcst::TableUtil::printTable(bsl::cout, tip); +// bmqst::TableUtil::printTable(bsl::cout, tip); // } //.. // The code above will print: @@ -436,7 +436,7 @@ //.. // Then create a context for the whole system. //.. -// mwcst::StatContext context(mwcst::StatContextConfiguration("Allocator") +// bmqst::StatContext context(bmqst::StatContextConfiguration("Allocator") // .value("Memory", numSnapshots), // allocator); //.. @@ -445,8 +445,8 @@ // definitions. If you specify unrelated values to contexts and // sub-contexts, it will work but the printing of stats will show //.. -// bslma::ManagedPtr subContext = context.addSubcontext( -// mwcst::StatContextConfiguration("Interface Allocator") +// bslma::ManagedPtr subContext = context.addSubcontext( +// bmqst::StatContextConfiguration("Interface Allocator") // .value("Memory", numSnapshots)); //.. // Now lets record some data points. @@ -460,18 +460,18 @@ // Finally lets snapshot and print the main context. //.. // context.snapshot(); -// mwcst::StatContextTableInfoProvider tip; +// bmqst::StatContextTableInfoProvider tip; // tip.setContext(&context); // tip.setColumnGroup(""); // tip.addDefaultIdColumn(""); // tip.setColumnGroup("In"); -// tip.addColumn("Bytes", 0, mwcst::StatUtil::value, 0); -// tip.addColumn("Avg", 0, mwcst::StatUtil::average, 10, 0); -// tip.addColumn("Min", 0, mwcst::StatUtil::absoluteMin); -// tip.addColumn("Max", 0, mwcst::StatUtil::absoluteMax); +// tip.addColumn("Bytes", 0, bmqst::StatUtil::value, 0); +// tip.addColumn("Avg", 0, bmqst::StatUtil::average, 10, 0); +// tip.addColumn("Min", 0, bmqst::StatUtil::absoluteMin); +// tip.addColumn("Max", 0, bmqst::StatUtil::absoluteMax); // tip.update(); // if (verbose) { -// mwcst::TableUtil::printTable(bsl::cout, tip); +// bmqst::TableUtil::printTable(bsl::cout, tip); // } //.. // This is what it prints: @@ -484,7 +484,7 @@ // Interface Allocator| 1,500| 150.00| 0| 1,500 //.. -#include +#include #include #include @@ -504,11 +504,11 @@ namespace BloombergLP { -namespace mwcstm { +namespace bmqstm { class StatContextUpdate; } -namespace mwcst { +namespace bmqst { // FORWARD DECLARATIONS class StatContext; @@ -656,7 +656,7 @@ class StatContext { // 'snapshot' called on it // holds the update between the last two snapshots (not owned) - mwcstm::StatContextUpdate* d_update_p; + bmqstm::StatContextUpdate* d_update_p; // which value fields to collect updates for in `d_update_p` unsigned int d_updateValueFieldMask; @@ -698,7 +698,7 @@ class StatContext { /// Update the values of this context and all subcontexts based on the /// contents of the specified `update`. - void applyUpdate(const mwcstm::StatContextUpdate& update); + void applyUpdate(const bmqstm::StatContextUpdate& update); // NOT IMPLEMENTED StatContext(const StatContext&) BSLS_KEYWORD_DELETED; @@ -763,7 +763,7 @@ class StatContext { /// according to the specified `update`. The behavior is undefined if /// this method is called and the context is configured to record its /// snapshots. - void snapshotFromUpdate(const mwcstm::StatContextUpdate& update); + void snapshotFromUpdate(const bmqstm::StatContextUpdate& update); // ACCESSORS bool hasName() const; @@ -842,7 +842,7 @@ class StatContext { /// After initialization, `update` will have a valid configuration, and /// a number of empty value upates equal to the number of values within /// this context. - void initializeUpdate(mwcstm::StatContextUpdate* update) const; + void initializeUpdate(bmqstm::StatContextUpdate* update) const; /// Load into the specified `update` the serializable representation of /// the latest snapshot of this context. Optionally specify a @@ -850,7 +850,7 @@ class StatContext { /// loaded into `update`. If `valueFieldMask` is not specified, all /// attributes are saved. The behavior is undefined if `snapshot` is /// called from another thread while this function is executing. - void loadFullUpdate(mwcstm::StatContextUpdate* update, + void loadFullUpdate(bmqstm::StatContextUpdate* update, int valueFieldMask = 0xFFFFFFFF) const; /// Format this object to the specified output `stream` at the (absolute @@ -885,8 +885,8 @@ class StatContextConfiguration { bsl::shared_ptr d_userData_p; bool d_storeExpiredSubcontextValues; StatContext::SnapshotCallback d_preSnapshotCallback; - const mwcstm::StatContextUpdate* d_update_p; - mwcstm::StatContextUpdate* d_updateCollector_p; + const bmqstm::StatContextUpdate* d_update_p; + bmqstm::StatContextUpdate* d_updateCollector_p; int d_updateValueFieldMask; bsl::shared_ptr d_nextSubcontextId_p; bslma::Allocator* d_statValueAllocator_p; @@ -926,13 +926,13 @@ class StatContextConfiguration { /// Optionally specify a `basicAllocator` used to supply memory. If /// `basicAllocator` is 0, the currently installed default allocator is /// used. The behavior is undefined unless 'update.flags() & - /// mwcstm::StatContextUpdateFlags::E_CONTEXT_CREATED' and + /// bmqstm::StatContextUpdateFlags::E_CONTEXT_CREATED' and /// `!update.configuration().isNull()`. The behavior is also undefined /// if this configuration conflicts with that of `update`, e.g., /// `isTable` differs, or the values differ. Note that `update` is held /// by reference; the behavior is undefined if `update` is destroy /// before this configuration. - explicit StatContextConfiguration(const mwcstm::StatContextUpdate& update, + explicit StatContextConfiguration(const bmqstm::StatContextUpdate& update, bslma::Allocator* basicAllocator = 0); // MANIPULATORS @@ -1002,12 +1002,12 @@ class StatContextConfiguration { /// control which changed fields of a `StatValue` are recorded. /// If `valueFieldMask` is not specified, all fields are recorded. /// A field is recorded if it has changed since the last snapshot, and - /// `valueFieldMask & (1 << mwcst::StatValueField::FIELD)`. Note that + /// `valueFieldMask & (1 << bmqst::StatValueField::FIELD)`. Note that /// if this configuration is used to create a subcontext of a /// `StatContext` that already is collecting updates, this option is /// ignored. StatContextConfiguration& - enableUpdateCollection(mwcstm::StatContextUpdate* update, + enableUpdateCollection(bmqstm::StatContextUpdate* update, int valueFieldMask = 0xFFFFFFFF); }; @@ -1048,8 +1048,8 @@ class StatContextIterator { // ACCESSORS const StatContext* operator->() const; const StatContext& operator*() const; - operator const StatContext*() const; - operator bool() const; + operator const StatContext*() const; + operator bool() const; }; // ============================================================================ @@ -1381,7 +1381,7 @@ inline StatContextConfiguration& StatContextConfiguration::preSnapshotCallback( inline StatContextConfiguration& StatContextConfiguration::enableUpdateCollection( - mwcstm::StatContextUpdate* update, + bmqstm::StatContextUpdate* update, int valueFieldMask) { d_updateCollector_p = update; @@ -1482,7 +1482,7 @@ inline StatContextIterator::operator bool() const } // close package namespace // FREE OPERATORS -inline bsl::ostream& mwcst::operator<<(bsl::ostream& stream, +inline bsl::ostream& bmqst::operator<<(bsl::ostream& stream, const StatContext& context) { return context.print(stream, 0, -1); diff --git a/src/groups/mwc/mwcst/mwcst_statcontext.t.cpp b/src/groups/bmq/bmqst/bmqst_statcontext.t.cpp similarity index 84% rename from src/groups/mwc/mwcst/mwcst_statcontext.t.cpp rename to src/groups/bmq/bmqst/bmqst_statcontext.t.cpp index 931610461..4ba82cf6e 100644 --- a/src/groups/mwc/mwcst/mwcst_statcontext.t.cpp +++ b/src/groups/bmq/bmqst/bmqst_statcontext.t.cpp @@ -13,19 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_statcontext.t.cpp -*-C++-*- +// bmqst_statcontext.t.cpp -*-C++-*- // Component under test -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include -// MWC -#include -#include +#include +#include // BDE #include @@ -38,7 +37,7 @@ using namespace BloombergLP; using namespace bsl; -using namespace mwcst; +using namespace bmqst; //============================================================================= // TEST PLAN @@ -141,7 +140,7 @@ static bool checkSnapshot(const StatValue& value, } bsl::vector expectedValues = - mwcst::TestUtil::int64Vector(snapshotDesc); + bmqst::TestUtil::int64Vector(snapshotDesc); ASSERT_EQUALS(expectedValues, snapshotValues); return expectedValues == snapshotValues; @@ -149,23 +148,23 @@ static bool checkSnapshot(const StatValue& value, /// Return `true` if the specified `update` contains the specified `field`, /// and `false` otherwise. -static bool hasField(const mwcstm::StatContextUpdate& contextUpdate, +static bool hasField(const bmqstm::StatContextUpdate& contextUpdate, int index, - mwcstm::StatValueFields::Value field) + bmqstm::StatValueFields::Value field) { - const mwcstm::StatValueUpdate& update = + const bmqstm::StatValueUpdate& update = contextUpdate.directValues()[index]; return bdlb::BitUtil::isBitSet(update.fieldMask(), field); } /// Return the value of the specified `field` within the specified `update`. /// The behavior is undefined unless `hasField(update, field)` -static bsls::Types::Int64 field(const mwcstm::StatContextUpdate& contextUpdate, +static bsls::Types::Int64 field(const bmqstm::StatContextUpdate& contextUpdate, int index, - mwcstm::StatValueFields::Value field) + bmqstm::StatValueFields::Value field) { ASSERT(hasField(contextUpdate, index, field)); - const mwcstm::StatValueUpdate& update = + const bmqstm::StatValueUpdate& update = contextUpdate.directValues()[index]; ASSERT(bdlb::BitUtil::numBitsSet(update.fieldMask()) == static_cast(update.fields().size())); @@ -209,12 +208,12 @@ static void usageExample(bsl::ostream& stream, bslma::Allocator* allocator) // to create 2 StatValues; one to keep track of incoming traffic and one // for outgoing traffic. We want both values to remember 10 snapshots, so // we pass this in as the second argument to the 'value()' function of - // 'mwcst::StatContextConfiguration'. Notice that - // 'mwcst::StatContextConfiguration' methods all return a reference to the + // 'bmqst::StatContextConfiguration'. Notice that + // 'bmqst::StatContextConfiguration' methods all return a reference to the // object, allowing calls to it to be chained as shown. int numSnapshots = 11; - mwcst::StatContext context( - mwcst::StatContextConfiguration("Network Interface") + bmqst::StatContext context( + bmqst::StatContextConfiguration("Network Interface") .value("In", numSnapshots) .value("Out", numSnapshots), allocator); @@ -243,7 +242,7 @@ static void usageExample(bsl::ostream& stream, bslma::Allocator* allocator) // Finally we can print the statistics in tabular format using the code // below: - mwcst::StatContextTableInfoProvider tip; + bmqst::StatContextTableInfoProvider tip; tip.setContext(&context); // Here we define the columns to show when printing out StatContext. @@ -258,33 +257,33 @@ static void usageExample(bsl::ostream& stream, bslma::Allocator* allocator) // First, want a column named "Bytes" which contains the value of the '0'th // (i.e. most recent) snapshot of the IN stat context. - tip.addColumn("Bytes", e_IN, mwcst::StatUtil::value, 0); + tip.addColumn("Bytes", e_IN, bmqst::StatUtil::value, 0); // Next we want column "Bytes/s" which calculates the rate of change of // the IN value from the 10th (oldest) to the 0th (most recent) snapshot. - tip.addColumn("Bytes/s", e_IN, mwcst::StatUtil::rate, 10, 0); + tip.addColumn("Bytes/s", e_IN, bmqst::StatUtil::rate, 10, 0); // Third, we want a column "Messages" showing the number of times the IN // value has been incremented up to the most recent (0th) snapshot. - tip.addColumn("Messages", e_IN, mwcst::StatUtil::increments, 0); + tip.addColumn("Messages", e_IN, bmqst::StatUtil::increments, 0); // Finally, we want "Messages/s" which shows the rate of increments of the // IN value from the 10th to the 0th snapshot. - tip.addColumn("Messages/s", e_IN, mwcst::StatUtil::incrementRate, 10, 0); + tip.addColumn("Messages/s", e_IN, bmqst::StatUtil::incrementRate, 10, 0); // Now we add similar columns for the output statistics tip.setColumnGroup("Out"); - tip.addColumn("Bytes", e_OUT, mwcst::StatUtil::value, 0); - tip.addColumn("Bytes/s", e_OUT, mwcst::StatUtil::rate, 10, 0); - tip.addColumn("Messages", e_OUT, mwcst::StatUtil::increments, 0); - tip.addColumn("Messages/s", e_OUT, mwcst::StatUtil::incrementRate, 10, 0); + tip.addColumn("Bytes", e_OUT, bmqst::StatUtil::value, 0); + tip.addColumn("Bytes/s", e_OUT, bmqst::StatUtil::rate, 10, 0); + tip.addColumn("Messages", e_OUT, bmqst::StatUtil::increments, 0); + tip.addColumn("Messages/s", e_OUT, bmqst::StatUtil::incrementRate, 10, 0); // Before printing, we tell the 'StatContextTableInfoProvider' to update // itself, figuring out which StatContexts to display when printing tip.update(); if (verbose) { - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } // The input stats are printed as follow (output is removed for clarity): @@ -319,7 +318,7 @@ static void usageExample(bsl::ostream& stream, bslma::Allocator* allocator) stream << bsl::endl << "After " << (i + 1) << " seconds:" << bsl::endl; tip.update(); - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } } @@ -342,9 +341,9 @@ static void usageExampleUpdate(bsl::ostream& stream, bslma::Allocator* allocator) { int numSnapshots = 11; - mwcstm::StatContextUpdate update; - mwcst::StatContext context( - mwcst::StatContextConfiguration("Network Interface") + bmqstm::StatContextUpdate update; + bmqst::StatContext context( + bmqst::StatContextConfiguration("Network Interface") .value("In", numSnapshots) .value("Out", numSnapshots) .enableUpdateCollection(&update), @@ -362,30 +361,30 @@ static void usageExampleUpdate(bsl::ostream& stream, // Create a second context whose values and configuration derive from // 'update', driven by 'context'. - mwcst::StatContext updatedContext( - mwcst::StatContextConfiguration(update, allocator)); + bmqst::StatContext updatedContext( + bmqst::StatContextConfiguration(update, allocator)); - mwcst::StatContextTableInfoProvider tip; + bmqst::StatContextTableInfoProvider tip; tip.setContext(&updatedContext); tip.setColumnGroup(""); tip.addDefaultIdColumn(""); tip.setColumnGroup("In"); - tip.addColumn("Bytes", e_IN, mwcst::StatUtil::value, 0); - tip.addColumn("Bytes/s", e_IN, mwcst::StatUtil::rate, 10, 0); - tip.addColumn("Messages", e_IN, mwcst::StatUtil::increments, 0); - tip.addColumn("Messages/s", e_IN, mwcst::StatUtil::incrementRate, 10, 0); + tip.addColumn("Bytes", e_IN, bmqst::StatUtil::value, 0); + tip.addColumn("Bytes/s", e_IN, bmqst::StatUtil::rate, 10, 0); + tip.addColumn("Messages", e_IN, bmqst::StatUtil::increments, 0); + tip.addColumn("Messages/s", e_IN, bmqst::StatUtil::incrementRate, 10, 0); tip.setColumnGroup("Out"); - tip.addColumn("Bytes", e_OUT, mwcst::StatUtil::value, 0); - tip.addColumn("Bytes/s", e_OUT, mwcst::StatUtil::rate, 10, 0); - tip.addColumn("Messages", e_OUT, mwcst::StatUtil::increments, 0); - tip.addColumn("Messages/s", e_OUT, mwcst::StatUtil::incrementRate, 10, 0); + tip.addColumn("Bytes", e_OUT, bmqst::StatUtil::value, 0); + tip.addColumn("Bytes/s", e_OUT, bmqst::StatUtil::rate, 10, 0); + tip.addColumn("Messages", e_OUT, bmqst::StatUtil::increments, 0); + tip.addColumn("Messages/s", e_OUT, bmqst::StatUtil::incrementRate, 10, 0); tip.update(); if (verbose) { - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } context.clearValues(); @@ -404,7 +403,7 @@ static void usageExampleUpdate(bsl::ostream& stream, stream << bsl::endl << "After " << (i + 1) << " seconds:" << bsl::endl; tip.update(); - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } } } @@ -430,8 +429,8 @@ static void tableUsageExample(bsl::ostream& stream, // traffic to keep the code minimal. We create the context for the // "Network Interface" as a table. int numSnapshots = 11; - mwcst::StatContext context( - mwcst::StatContextConfiguration("Network Interface") + bmqst::StatContext context( + bmqst::StatContextConfiguration("Network Interface") .isTable(true) .value("In", numSnapshots), allocator); @@ -442,10 +441,10 @@ static void tableUsageExample(bsl::ostream& stream, // to a table StatContext are always sub-tables. The 'isTable' flag and // any value definitions are ignored when adding a subcontext to a table // StatContext. - bslma::ManagedPtr client1 = context.addSubcontext( - mwcst::StatContextConfiguration("tcp://1234")); - bslma::ManagedPtr client2 = context.addSubcontext( - mwcst::StatContextConfiguration("tcp://5678")); + bslma::ManagedPtr client1 = context.addSubcontext( + bmqst::StatContextConfiguration("tcp://1234")); + bslma::ManagedPtr client2 = context.addSubcontext( + bmqst::StatContextConfiguration("tcp://5678")); // Suppose we receive a mesage from the first client and another message // from the second client: @@ -459,19 +458,19 @@ static void tableUsageExample(bsl::ostream& stream, // context, which cascades to the sub-tables (so we don't need to call // 'snapshot' on each client). Printing is done as usual. context.snapshot(); - mwcst::StatContextTableInfoProvider tip; + bmqst::StatContextTableInfoProvider tip; tip.setContext(&context); tip.setColumnGroup(""); tip.addDefaultIdColumn(""); tip.setColumnGroup("In"); - tip.addColumn("Bytes", 0, mwcst::StatUtil::value, 0); - tip.addColumn("Bytes/s", 0, mwcst::StatUtil::rate, 10, 0); - tip.addColumn("Messages", 0, mwcst::StatUtil::increments, 0); - tip.addColumn("Messages/s", 0, mwcst::StatUtil::incrementRate, 10, 0); + tip.addColumn("Bytes", 0, bmqst::StatUtil::value, 0); + tip.addColumn("Bytes/s", 0, bmqst::StatUtil::rate, 10, 0); + tip.addColumn("Messages", 0, bmqst::StatUtil::increments, 0); + tip.addColumn("Messages/s", 0, bmqst::StatUtil::incrementRate, 10, 0); tip.update(); if (verbose) { - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } // This will print the hierarchy of contexts as follow. Note that there @@ -493,7 +492,7 @@ static void tableUsageExample(bsl::ostream& stream, context.snapshot(); tip.update(); if (verbose) { - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } // Notice the parentheses around the name of deleted client: @@ -513,7 +512,7 @@ static void tableUsageExample(bsl::ostream& stream, tip.setContext(&context); tip.update(); if (verbose) { - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } // The code above will print: @@ -530,18 +529,18 @@ static void tableUsageExampleUpdate(bsl::ostream& stream, bslma::Allocator* allocator) { int numSnapshots = 11; - mwcstm::StatContextUpdate update; - mwcst::StatContext context( - mwcst::StatContextConfiguration("Network Interface") + bmqstm::StatContextUpdate update; + bmqst::StatContext context( + bmqst::StatContextConfiguration("Network Interface") .isTable(true) .value("In", numSnapshots) .enableUpdateCollection(&update), allocator); - bslma::ManagedPtr client1 = context.addSubcontext( - mwcst::StatContextConfiguration("tcp://1234")); - bslma::ManagedPtr client2 = context.addSubcontext( - mwcst::StatContextConfiguration("tcp://5678")); + bslma::ManagedPtr client1 = context.addSubcontext( + bmqst::StatContextConfiguration("tcp://1234")); + bslma::ManagedPtr client2 = context.addSubcontext( + bmqst::StatContextConfiguration("tcp://5678")); int messageLength = 100; // size of the message in bytes client1->adjustValue(0, messageLength); @@ -554,22 +553,22 @@ static void tableUsageExampleUpdate(bsl::ostream& stream, // Create a second context whose values and configuration derive from // 'update', driven by 'context'. - mwcst::StatContext updatedContext( - mwcst::StatContextConfiguration(update, allocator)); + bmqst::StatContext updatedContext( + bmqst::StatContextConfiguration(update, allocator)); - mwcst::StatContextTableInfoProvider tip; + bmqst::StatContextTableInfoProvider tip; tip.setContext(&updatedContext); tip.setColumnGroup(""); tip.addDefaultIdColumn(""); tip.setColumnGroup("In"); - tip.addColumn("Bytes", 0, mwcst::StatUtil::value, 0); - tip.addColumn("Bytes/s", 0, mwcst::StatUtil::rate, 10, 0); - tip.addColumn("Messages", 0, mwcst::StatUtil::increments, 0); - tip.addColumn("Messages/s", 0, mwcst::StatUtil::incrementRate, 10, 0); + tip.addColumn("Bytes", 0, bmqst::StatUtil::value, 0); + tip.addColumn("Bytes/s", 0, bmqst::StatUtil::rate, 10, 0); + tip.addColumn("Messages", 0, bmqst::StatUtil::increments, 0); + tip.addColumn("Messages/s", 0, bmqst::StatUtil::incrementRate, 10, 0); tip.update(); if (verbose) { - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } client1.clear(); @@ -577,14 +576,14 @@ static void tableUsageExampleUpdate(bsl::ostream& stream, updatedContext.snapshotFromUpdate(update); tip.update(); if (verbose) { - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } updatedContext.cleanup(); tip.setContext(&updatedContext); tip.update(); if (verbose) { - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } } @@ -609,7 +608,7 @@ static void subcontextUsageExample(bsl::ostream& stream, int numSnapshots = 11; // Then create a context for the whole system. - mwcst::StatContext context(mwcst::StatContextConfiguration("Allocator") + bmqst::StatContext context(bmqst::StatContextConfiguration("Allocator") .value("Memory", numSnapshots), allocator); @@ -617,8 +616,8 @@ static void subcontextUsageExample(bsl::ostream& stream, // Note that the context and any sub-contexts must share the same value // definitions. If you specify unrelated values to contexts and // sub-contexts, it will work but the printing of stats will show - bslma::ManagedPtr subContext = context.addSubcontext( - mwcst::StatContextConfiguration("Interface Allocator") + bslma::ManagedPtr subContext = context.addSubcontext( + bmqst::StatContextConfiguration("Interface Allocator") .value("Memory", numSnapshots)); // Now lets record some data points. @@ -630,18 +629,18 @@ static void subcontextUsageExample(bsl::ostream& stream, // Finally lets snapshot and print the main context. context.snapshot(); - mwcst::StatContextTableInfoProvider tip; + bmqst::StatContextTableInfoProvider tip; tip.setContext(&context); tip.setColumnGroup(""); tip.addDefaultIdColumn(""); tip.setColumnGroup("In"); - tip.addColumn("Bytes", 0, mwcst::StatUtil::value, 0); - tip.addColumn("Avg", 0, mwcst::StatUtil::average, 10, 0); - tip.addColumn("Min", 0, mwcst::StatUtil::absoluteMin); - tip.addColumn("Max", 0, mwcst::StatUtil::absoluteMax); + tip.addColumn("Bytes", 0, bmqst::StatUtil::value, 0); + tip.addColumn("Avg", 0, bmqst::StatUtil::average, 10, 0); + tip.addColumn("Min", 0, bmqst::StatUtil::absoluteMin); + tip.addColumn("Max", 0, bmqst::StatUtil::absoluteMax); tip.update(); if (verbose) { - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } // This is what it prints: @@ -658,14 +657,14 @@ static void subcontextUsageExampleUpdate(bsl::ostream& stream, bslma::Allocator* allocator) { int numSnapshots = 11; - mwcstm::StatContextUpdate update; - mwcst::StatContext context(mwcst::StatContextConfiguration("Allocator") + bmqstm::StatContextUpdate update; + bmqst::StatContext context(bmqst::StatContextConfiguration("Allocator") .value("Memory", numSnapshots) .enableUpdateCollection(&update), allocator); - bslma::ManagedPtr subContext = context.addSubcontext( - mwcst::StatContextConfiguration("Interface Allocator") + bslma::ManagedPtr subContext = context.addSubcontext( + bmqst::StatContextConfiguration("Interface Allocator") .value("Memory", numSnapshots)); int memInUse = 50000; // size of the allocator in bytes @@ -679,21 +678,21 @@ static void subcontextUsageExampleUpdate(bsl::ostream& stream, // Create a second context whose values and configuration derive from // 'update', driven by 'context'. - mwcst::StatContext updatedContext( - mwcst::StatContextConfiguration(update, allocator)); + bmqst::StatContext updatedContext( + bmqst::StatContextConfiguration(update, allocator)); - mwcst::StatContextTableInfoProvider tip; + bmqst::StatContextTableInfoProvider tip; tip.setContext(&updatedContext); tip.setColumnGroup(""); tip.addDefaultIdColumn(""); tip.setColumnGroup("In"); - tip.addColumn("Bytes", 0, mwcst::StatUtil::value, 0); - tip.addColumn("Avg", 0, mwcst::StatUtil::average, 10, 0); - tip.addColumn("Min", 0, mwcst::StatUtil::absoluteMin); - tip.addColumn("Max", 0, mwcst::StatUtil::absoluteMax); + tip.addColumn("Bytes", 0, bmqst::StatUtil::value, 0); + tip.addColumn("Avg", 0, bmqst::StatUtil::average, 10, 0); + tip.addColumn("Min", 0, bmqst::StatUtil::absoluteMin); + tip.addColumn("Max", 0, bmqst::StatUtil::absoluteMax); tip.update(); if (verbose) { - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } } @@ -718,14 +717,14 @@ static void valueLevelUsageExample(bsl::ostream& stream, enum { e_IN = 0 }; int numSnapshots = 60 + 1; int numAggSnapshots = 5 + 1; - mwcst::StatContext context( - mwcst::StatContextConfiguration("Network Interface") + bmqst::StatContext context( + bmqst::StatContextConfiguration("Network Interface") .value("In", numSnapshots) .valueLevel(numAggSnapshots), allocator); // TIP to print the statistics in tabular format - mwcst::StatContextTableInfoProvider tip; + bmqst::StatContextTableInfoProvider tip; tip.setContext(&context); tip.setColumnGroup(""); @@ -736,25 +735,25 @@ static void valueLevelUsageExample(bsl::ostream& stream, // Use the 'SnapshotLocation' function for the columns which use the minute // samples. First argument is the level number (e.g. 1), second argument // is the sample number. - tip.addColumn("Bytes", e_IN, mwcst::StatUtil::value, 0); - tip.addColumn("Bytes/s (last min)", e_IN, mwcst::StatUtil::rate, 60, 0); + tip.addColumn("Bytes", e_IN, bmqst::StatUtil::value, 0); + tip.addColumn("Bytes/s (last min)", e_IN, bmqst::StatUtil::rate, 60, 0); tip.addColumn("Bytes/s (5 min)", e_IN, - mwcst::StatUtil::rate, - mwcst::StatValue::SnapshotLocation(1, 4), - mwcst::StatValue::SnapshotLocation(1, 0)); + bmqst::StatUtil::rate, + bmqst::StatValue::SnapshotLocation(1, 4), + bmqst::StatValue::SnapshotLocation(1, 0)); - tip.addColumn("Msg", e_IN, mwcst::StatUtil::increments, 0); + tip.addColumn("Msg", e_IN, bmqst::StatUtil::increments, 0); tip.addColumn("Msg/s (last min)", e_IN, - mwcst::StatUtil::incrementRate, + bmqst::StatUtil::incrementRate, 60, 0); tip.addColumn("Msg/s (5 min)", e_IN, - mwcst::StatUtil::incrementRate, - mwcst::StatValue::SnapshotLocation(1, 4), - mwcst::StatValue::SnapshotLocation(1, 0)); + bmqst::StatUtil::incrementRate, + bmqst::StatValue::SnapshotLocation(1, 4), + bmqst::StatValue::SnapshotLocation(1, 0)); // Capture 5 minutes of data. int messageLength = 10; // bytes @@ -770,7 +769,7 @@ static void valueLevelUsageExample(bsl::ostream& stream, tip.update(); if (verbose) { stream << bsl::endl << "Minute number " << i; - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } } } @@ -778,12 +777,12 @@ static void valueLevelUsageExample(bsl::ostream& stream, static void valueLevelUsageExampleUpdate(bsl::ostream& stream, bslma::Allocator* allocator) { - mwcstm::StatContextUpdate update; + bmqstm::StatContextUpdate update; enum { e_IN = 0 }; int numSnapshots = 60 + 1; int numAggSnapshots = 5 + 1; - mwcst::StatContext context( - mwcst::StatContextConfiguration("Network Interface") + bmqst::StatContext context( + bmqst::StatContextConfiguration("Network Interface") .value("In", numSnapshots) .valueLevel(numAggSnapshots) .enableUpdateCollection(&update), @@ -792,13 +791,13 @@ static void valueLevelUsageExampleUpdate(bsl::ostream& stream, // Create a second context whose values and configuration derive from // 'update', driven by 'context'. - mwcst::StatContext updatedContext( - mwcst::StatContextConfiguration("Network Interface") + bmqst::StatContext updatedContext( + bmqst::StatContextConfiguration("Network Interface") .value("In", numSnapshots) .valueLevel(numAggSnapshots), allocator); - mwcst::StatContextTableInfoProvider tip; + bmqst::StatContextTableInfoProvider tip; tip.setContext(&updatedContext); tip.setColumnGroup(""); @@ -809,25 +808,25 @@ static void valueLevelUsageExampleUpdate(bsl::ostream& stream, // Use the 'SnapshotLocation' function for the columns which use the minute // samples. First argument is the level number (e.g. 1), second argument // is the sample number. - tip.addColumn("Bytes", e_IN, mwcst::StatUtil::value, 0); - tip.addColumn("Bytes/s (last min)", e_IN, mwcst::StatUtil::rate, 60, 0); + tip.addColumn("Bytes", e_IN, bmqst::StatUtil::value, 0); + tip.addColumn("Bytes/s (last min)", e_IN, bmqst::StatUtil::rate, 60, 0); tip.addColumn("Bytes/s (5 min)", e_IN, - mwcst::StatUtil::rate, - mwcst::StatValue::SnapshotLocation(1, 4), - mwcst::StatValue::SnapshotLocation(1, 0)); + bmqst::StatUtil::rate, + bmqst::StatValue::SnapshotLocation(1, 4), + bmqst::StatValue::SnapshotLocation(1, 0)); - tip.addColumn("Msg", e_IN, mwcst::StatUtil::increments, 0); + tip.addColumn("Msg", e_IN, bmqst::StatUtil::increments, 0); tip.addColumn("Msg/s (last min)", e_IN, - mwcst::StatUtil::incrementRate, + bmqst::StatUtil::incrementRate, 60, 0); tip.addColumn("Msg/s (5 min)", e_IN, - mwcst::StatUtil::incrementRate, - mwcst::StatValue::SnapshotLocation(1, 4), - mwcst::StatValue::SnapshotLocation(1, 0)); + bmqst::StatUtil::incrementRate, + bmqst::StatValue::SnapshotLocation(1, 4), + bmqst::StatValue::SnapshotLocation(1, 0)); // Capture 5 minutes of data. int messageLength = 10; // bytes @@ -844,7 +843,7 @@ static void valueLevelUsageExampleUpdate(bsl::ostream& stream, tip.update(); if (verbose) { stream << bsl::endl << "Minute number " << i; - mwcst::TableUtil::printTable(stream, tip); + bmqst::TableUtil::printTable(stream, tip); } } } @@ -856,7 +855,7 @@ static void testUpdates(bslma::Allocator* /*allocator*/) // // Concerns: // That a 'StatValue' properly updates itself from a - // 'mwcstm::StatValueUpdate', and that 'StatValueUtil' can properly + // 'bmqstm::StatValueUpdate', and that 'StatValueUtil' can properly // initialize a 'StatValueUpdate' from a 'StatValue'. // // Plan: @@ -873,9 +872,9 @@ static void testUpdates(bslma::Allocator* /*allocator*/) PV("Verify updates are loaded and can be applied."); - typedef mwcstm::StatValueFields Fields; + typedef bmqstm::StatValueFields Fields; - mwcstm::StatContextUpdate u1, u2; + bmqstm::StatContextUpdate u1, u2; StatContext c1(StatContextConfiguration("context1") .value("c", StatValue::e_CONTINUOUS, 3) .valueLevel(2) @@ -893,7 +892,7 @@ static void testUpdates(bslma::Allocator* /*allocator*/) c1.reportValue(1, 4); c1.snapshot(); - mwcstm::StatContextUpdate fullUpdate; + bmqstm::StatContextUpdate fullUpdate; c1.loadFullUpdate(&fullUpdate); ASSERT_EQUALS(u1, fullUpdate); @@ -1025,8 +1024,8 @@ static void testUpdatesWithUsageExample(bslma::Allocator* allocator) { PV("Test usage examples using updates"); - mwcu::MemOutStream nstream; - mwcu::MemOutStream ustream; + bmqu::MemOutStream nstream; + bmqu::MemOutStream ustream; PV("a. Test basic usage example"); usageExample(nstream, allocator); @@ -1064,8 +1063,8 @@ static void testUpdatesWithUsageExample(bslma::Allocator* allocator) static void testDatum(bslma::Allocator* allocator) { - mwcst::StatContextConfiguration config("test"); - mwcst::StatContext context(config, allocator); + bmqst::StatContextConfiguration config("test"); + bmqst::StatContext context(config, allocator); bslma::ManagedPtr datum = context.datum(); @@ -1206,6 +1205,6 @@ int main(int argc, char** argv) // to indicate the number of assertion failures, or a negative // value to indicate that the test case was not found. Special value 254 // is used to skip a test, for example for Jenkins. - mwcst::TestUtil::printTestStatus(testStatus, verbose); + bmqst::TestUtil::printTestStatus(testStatus, verbose); return testStatus; } diff --git a/src/groups/mwc/mwcst/mwcst_statcontexttableinfoprovider.cpp b/src/groups/bmq/bmqst/bmqst_statcontexttableinfoprovider.cpp similarity index 95% rename from src/groups/mwc/mwcst/mwcst_statcontexttableinfoprovider.cpp rename to src/groups/bmq/bmqst/bmqst_statcontexttableinfoprovider.cpp index 256af01ea..b81eabad1 100644 --- a/src/groups/mwc/mwcst/mwcst_statcontexttableinfoprovider.cpp +++ b/src/groups/bmq/bmqst/bmqst_statcontexttableinfoprovider.cpp @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_statcontexttableinfoprovider.cpp -*-C++-*- -#include +// bmqst_statcontexttableinfoprovider.cpp -*-C++-*- +#include -#include -#include -#include +#include +#include +#include -#include +#include #include #include @@ -29,7 +29,7 @@ #include namespace BloombergLP { -namespace mwcst { +namespace bmqst { namespace { @@ -77,7 +77,7 @@ class DefaultIdColumn : public StatContextTableInfoProviderCustomColumn { length = static_cast(context.name().length()); } else { - length = mwcst::PrintUtil::printedValueLength(context.id()); + length = bmqst::PrintUtil::printedValueLength(context.id()); } } else if (valueType == StatContext::e_DIRECT_VALUE) { @@ -476,23 +476,23 @@ int StatContextTableInfoProvider::getValueSize(int row, int column) const } else if (colInfo.d_printType == e_INT_VALUE) { if (d_printSeparators) { - return mwcst::PrintUtil::printedValueLengthWithSeparator( + return bmqst::PrintUtil::printedValueLengthWithSeparator( funcValue, 3); } else { - return mwcst::PrintUtil::printedValueLength(funcValue); + return bmqst::PrintUtil::printedValueLength(funcValue); } } else { - return mwcst::PrintUtil::printedTimeIntervalNsLength( + return bmqst::PrintUtil::printedTimeIntervalNsLength( funcValue, d_precision); } } else if (colInfo.d_doubleFunc) { double funcValue = colInfo.d_doubleFunc(value); - return mwcst::PrintUtil::printedValueLength( + return bmqst::PrintUtil::printedValueLength( (bsls::Types::Int64)funcValue) + d_precision + 1; } @@ -526,7 +526,7 @@ bsl::ostream& StatContextTableInfoProvider::printValue(bsl::ostream& stream, } else if (colInfo.d_printType == e_INT_VALUE) { if (d_printSeparators) { - mwcst::PrintUtil::printValueWithSeparator(stream, + bmqst::PrintUtil::printValueWithSeparator(stream, funcValue, 3, ','); @@ -536,7 +536,7 @@ bsl::ostream& StatContextTableInfoProvider::printValue(bsl::ostream& stream, } } else { - mwcst::PrintUtil::printTimeIntervalNs(stream, + bmqst::PrintUtil::printTimeIntervalNs(stream, funcValue, d_precision); } @@ -571,7 +571,7 @@ int StatContextTableInfoProvider::getParentHeader(int /*level*/, bsl::ostream& StatContextTableInfoProvider::printTitle(bsl::ostream& stream) const { - return mwcst::PrintUtil::printStringCentered(stream, d_title); + return bmqst::PrintUtil::printStringCentered(stream, d_title); } bsl::ostream& StatContextTableInfoProvider::printHeader(bsl::ostream& stream, @@ -580,11 +580,11 @@ bsl::ostream& StatContextTableInfoProvider::printHeader(bsl::ostream& stream, int /*width*/) const { if (level == 0) { - return mwcst::PrintUtil::printStringCentered(stream, + return bmqst::PrintUtil::printStringCentered(stream, d_columns[column].d_name); } else { - return mwcst::PrintUtil::printStringCentered(stream, + return bmqst::PrintUtil::printStringCentered(stream, d_columnGroups[column]); } } diff --git a/src/groups/mwc/mwcst/mwcst_statcontexttableinfoprovider.h b/src/groups/bmq/bmqst/bmqst_statcontexttableinfoprovider.h similarity index 95% rename from src/groups/mwc/mwcst/mwcst_statcontexttableinfoprovider.h rename to src/groups/bmq/bmqst/bmqst_statcontexttableinfoprovider.h index 0f286fbb3..f1b0fba75 100644 --- a/src/groups/mwc/mwcst/mwcst_statcontexttableinfoprovider.h +++ b/src/groups/bmq/bmqst/bmqst_statcontexttableinfoprovider.h @@ -13,30 +13,30 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_statcontexttableinfoprovider.h -*-C++-*- -#ifndef INCLUDED_MWCST_STATCONTEXTTABLEINFOPROVIDER -#define INCLUDED_MWCST_STATCONTEXTTABLEINFOPROVIDER +// bmqst_statcontexttableinfoprovider.h -*-C++-*- +#ifndef INCLUDED_BMQST_STATCONTEXTTABLEINFOPROVIDER +#define INCLUDED_BMQST_STATCONTEXTTABLEINFOPROVIDER -//@PURPOSE: Provide a 'mwcst::TableInfoProvider' for a table 'StatContext'. +//@PURPOSE: Provide a 'bmqst::TableInfoProvider' for a table 'StatContext'. // //@CLASSES: -// mwcst::StatContextTableInfoProvider +// bmqst::StatContextTableInfoProvider // -//@SEE_ALSO: mwcst_statcontext -// mwcst_tableutil +//@SEE_ALSO: bmqst_statcontext +// bmqst_tableutil // //@DESCRIPTION: This component defines a mechanism, -// 'mwcst::StatContextTableInfoProvider' which is an implementation of -// 'mwcst::TableInfoProvider' using a 'mwcst::StatContext'. It gives an -// application a way of easily printing a table 'mwcst::StatContext' to a +// 'bmqst::StatContextTableInfoProvider' which is an implementation of +// 'bmqst::TableInfoProvider' using a 'bmqst::StatContext'. It gives an +// application a way of easily printing a table 'bmqst::StatContext' to a // stream. // -// Refer to the documentation of 'mwcst::Table' and 'mwcst::TableUtil' for +// Refer to the documentation of 'bmqst::Table' and 'bmqst::TableUtil' for // usage examples. -#include +#include -#include +#include #include #include @@ -46,14 +46,14 @@ #include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // ============================================== // class StatContextTableInfoProviderCustomColumn // ============================================== /// Protocol for a class that defines a custom column to be printed by a -/// `mwcst::StatContextTableInfoProvider` +/// `bmqst::StatContextTableInfoProvider` class StatContextTableInfoProviderCustomColumn { public: // CREATORS @@ -82,8 +82,8 @@ class StatContextTableInfoProviderCustomColumn { // class StatContextTableInfoProvider // ================================== -/// `mwcst::TableInfoProvider` for a table `mwcst::StatContext` -class StatContextTableInfoProvider : public mwcst::TableInfoProvider { +/// `bmqst::TableInfoProvider` for a table `bmqst::StatContext` +class StatContextTableInfoProvider : public bmqst::TableInfoProvider { public: // PUBLIC TYPES @@ -348,7 +348,7 @@ class StatContextTableInfoProvider : public mwcst::TableInfoProvider { // ACCESSORS - // mwcst::TableInfoProvider + // bmqst::TableInfoProvider /// Return the number of data rows in the table int numRows() const BSLS_KEYWORD_OVERRIDE; diff --git a/src/groups/mwc/mwcst/mwcst_statcontextuserdata.cpp b/src/groups/bmq/bmqst/bmqst_statcontextuserdata.cpp similarity index 85% rename from src/groups/mwc/mwcst/mwcst_statcontextuserdata.cpp rename to src/groups/bmq/bmqst/bmqst_statcontextuserdata.cpp index e2bbe60bd..47c50b52d 100644 --- a/src/groups/mwc/mwcst/mwcst_statcontextuserdata.cpp +++ b/src/groups/bmq/bmqst/bmqst_statcontextuserdata.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_statcontextuserdata.cpp -*-C++-*- -#include +// bmqst_statcontextuserdata.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // ------------------------- // class StatContextUserData diff --git a/src/groups/mwc/mwcst/mwcst_statcontextuserdata.h b/src/groups/bmq/bmqst/bmqst_statcontextuserdata.h similarity index 89% rename from src/groups/mwc/mwcst/mwcst_statcontextuserdata.h rename to src/groups/bmq/bmqst/bmqst_statcontextuserdata.h index 30fde9570..f7dcf7522 100644 --- a/src/groups/mwc/mwcst/mwcst_statcontextuserdata.h +++ b/src/groups/bmq/bmqst/bmqst_statcontextuserdata.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_statcontextuserdata.h -*-C++-*- -#ifndef INCLUDED_MWCST_STATCONTEXTUSERDATA -#define INCLUDED_MWCST_STATCONTEXTUSERDATA +// bmqst_statcontextuserdata.h -*-C++-*- +#ifndef INCLUDED_BMQST_STATCONTEXTUSERDATA +#define INCLUDED_BMQST_STATCONTEXTUSERDATA //@PURPOSE: Provide a protocol for user data associated with a 'StatContext'. // //@CLASSES: // StatContextUserData: protocol for 'StatContext' user data // -//@SEE_ALSO: mwcst_statcontext +//@SEE_ALSO: bmqst_statcontext // //@DESCRIPTION: This component defines a pure protocol, 'StatContextUserData' // which serves as the user data of a 'StatContext'. It provides a single pure @@ -34,13 +34,13 @@ // latest snapshot of its associated 'StatContext'. namespace BloombergLP { -namespace mwcst { +namespace bmqst { // ========================= // class StatContextUserData // ========================= -/// Protocol for `mwcst::StatContext` user data +/// Protocol for `bmqst::StatContext` user data class StatContextUserData { public: // CREATORS diff --git a/src/groups/mwc/mwcst/mwcst_statutil.cpp b/src/groups/bmq/bmqst/bmqst_statutil.cpp similarity index 99% rename from src/groups/mwc/mwcst/mwcst_statutil.cpp rename to src/groups/bmq/bmqst/bmqst_statutil.cpp index 9d53d61c0..017b8cef7 100644 --- a/src/groups/mwc/mwcst/mwcst_statutil.cpp +++ b/src/groups/bmq/bmqst/bmqst_statutil.cpp @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_statutil.cpp -*-C++-*- -#include +// bmqst_statutil.cpp -*-C++-*- +#include +#include #include -#include namespace BloombergLP { -namespace mwcst { +namespace bmqst { namespace { diff --git a/src/groups/mwc/mwcst/mwcst_statutil.h b/src/groups/bmq/bmqst/bmqst_statutil.h similarity index 94% rename from src/groups/mwc/mwcst/mwcst_statutil.h rename to src/groups/bmq/bmqst/bmqst_statutil.h index d4575fb12..4edae0f6d 100644 --- a/src/groups/mwc/mwcst/mwcst_statutil.h +++ b/src/groups/bmq/bmqst/bmqst_statutil.h @@ -13,36 +13,36 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_statutil.h -*-C++-*- -#ifndef INCLUDED_MWCST_STATUTIL -#define INCLUDED_MWCST_STATUTIL +// bmqst_statutil.h -*-C++-*- +#ifndef INCLUDED_BMQST_STATUTIL +#define INCLUDED_BMQST_STATUTIL -//@PURPOSE: Provide utility functions operating on a 'mwcst::StatValue'. +//@PURPOSE: Provide utility functions operating on a 'bmqst::StatValue'. // -//@DEPRECATED: Use 'mwcst::MetricUtil' instead. +//@DEPRECATED: Use 'bmqst::MetricUtil' instead. // //@CLASSES: -// mwcst::StatUtil : container for functions operating on a 'mwcst::StatValue'. +// bmqst::StatUtil : container for functions operating on a 'bmqst::StatValue'. // -//@SEE_ALSO: mwcst_metricutil, mwcst_table +//@SEE_ALSO: bmqst_metricutil, bmqst_table // -//@DESCRIPTION: This component defines a utility, 'mwcst::StatUtil' containing -// functions for calculating statistics of a provided 'mwcst::StatValue'. +//@DESCRIPTION: This component defines a utility, 'bmqst::StatUtil' containing +// functions for calculating statistics of a provided 'bmqst::StatValue'. // // Applications should probably not be using these functions directly with a -// given 'mwcst::StatValue' except for specific cases. Most likely this -// utility will instead be used to create a 'mwcst::Table'. +// given 'bmqst::StatValue' except for specific cases. Most likely this +// utility will instead be used to create a 'bmqst::Table'. // -// Refer to the documentation of 'mwcst::Table' for a usage example. +// Refer to the documentation of 'bmqst::Table' for a usage example. -#include +#include #ifndef INCLUDED_BSLS_TYPES #include #endif namespace BloombergLP { -namespace mwcst { +namespace bmqst { // =============== // struct StatUtil diff --git a/src/groups/mwc/mwcst/mwcst_statvalue.cpp b/src/groups/bmq/bmqst/bmqst_statvalue.cpp similarity index 97% rename from src/groups/mwc/mwcst/mwcst_statvalue.cpp rename to src/groups/bmq/bmqst/bmqst_statvalue.cpp index c475c62b9..cd88d16da 100644 --- a/src/groups/mwc/mwcst/mwcst_statvalue.cpp +++ b/src/groups/bmq/bmqst/bmqst_statvalue.cpp @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_statvalue.cpp -*-C++-*- -#include +// bmqst_statvalue.cpp -*-C++-*- +#include #include +#include #include -#include -#include +#include namespace BloombergLP { -namespace mwcst { +namespace bmqst { namespace { @@ -163,9 +163,9 @@ void StatValue::addSnapshot(const StatValue& other) d_currentStats.d_decrementsOrSum += otherSnapshot.d_decrementsOrSum; } -void StatValue::setFromUpdate(const mwcstm::StatValueUpdate& update) +void StatValue::setFromUpdate(const bmqstm::StatValueUpdate& update) { - typedef mwcstm::StatValueFields Fields; + typedef bmqstm::StatValueFields Fields; bsl::vector::const_iterator f = update.fields().begin(); for (int i = 0; f != update.fields().end() && i < Fields::NUM_ENUMERATORS; @@ -323,12 +323,12 @@ StatValue::print(bsl::ostream& stream, int level, int spacesPerLevel) const // struct StatValueUtil // -------------------- -void StatValueUtil::loadUpdateImp(mwcstm::StatValueUpdate* update, +void StatValueUtil::loadUpdateImp(bmqstm::StatValueUpdate* update, const StatValue& value, bsl::uint32_t valueFieldMask, bool fullUpdate) { - typedef mwcstm::StatValueFields Fields; + typedef bmqstm::StatValueFields Fields; bsl::uint32_t mask = 0; const StatValue::Snapshot& current = value.snapshot( StatValue::SnapshotLocation()); diff --git a/src/groups/mwc/mwcst/mwcst_statvalue.h b/src/groups/bmq/bmqst/bmqst_statvalue.h similarity index 95% rename from src/groups/mwc/mwcst/mwcst_statvalue.h rename to src/groups/bmq/bmqst/bmqst_statvalue.h index 7ab0d6ca8..742b0ec60 100644 --- a/src/groups/mwc/mwcst/mwcst_statvalue.h +++ b/src/groups/bmq/bmqst/bmqst_statvalue.h @@ -13,26 +13,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_statvalue.h -*-C++-*- -#ifndef INCLUDED_MWCST_STATVALUE -#define INCLUDED_MWCST_STATVALUE +// bmqst_statvalue.h -*-C++-*- +#ifndef INCLUDED_BMQST_STATVALUE +#define INCLUDED_BMQST_STATVALUE //@PURPOSE: Provide a statistic-collecting value. // //@CLASSES: -// mwcst::StatValue : value (or variable) able to collect statistics. -// mwcst::StatValueUtil : non-primitive operations on a 'StatValue'. +// bmqst::StatValue : value (or variable) able to collect statistics. +// bmqst::StatValueUtil : non-primitive operations on a 'StatValue'. // //@SEE_ALSO: -// mwcst_statcontext -// mwcst_statutil +// bmqst_statcontext +// bmqst_statutil // -//@DESCRIPTION: This component defines a mechanism, 'mwcst::StatValue', which +//@DESCRIPTION: This component defines a mechanism, 'bmqst::StatValue', which // maintains a value and collects statistics about it and changes to it. It // can be asked to calculate a number of statistics over its history. // // You probably should not use this class directly. Instead, you should use -// the 'mwcst::StatContext' component. Refer to the usage examples in the +// the 'bmqst::StatContext' component. Refer to the usage examples in the // documentation of that component. // /// Thread Safety @@ -77,11 +77,11 @@ namespace BloombergLP { -namespace mwcstm { +namespace bmqstm { class StatValueUpdate; } -namespace mwcst { +namespace bmqst { // FORWARD DECLARATIONS class StatValue; @@ -295,7 +295,7 @@ class StatValue { /// Set the values of this `StatValue` from the field values within the /// specified `update`. Note that any value changes made since the last /// snapshot may be lost. - void setFromUpdate(const mwcstm::StatValueUpdate& update); + void setFromUpdate(const bmqstm::StatValueUpdate& update); void takeSnapshot(bsls::Types::Int64 snapshotTime); @@ -375,7 +375,7 @@ struct StatValueUtil { /// `update` is initialized with the latest snapshot of `value`, /// otherwise only values that have changed between the last two /// snapshots are loaded. - static void loadUpdateImp(mwcstm::StatValueUpdate* update, + static void loadUpdateImp(bmqstm::StatValueUpdate* update, const StatValue& value, bsl::uint32_t valueFieldMask, bool fullUpdate); @@ -387,7 +387,7 @@ struct StatValueUtil { /// values of that snapshot. Optionally specify a `valueFieldMask` to /// control which attributes of this value are loaded into `update`. If /// `valueFieldMask` is not specified, all attributes are saved. - static void loadUpdate(mwcstm::StatValueUpdate* update, + static void loadUpdate(bmqstm::StatValueUpdate* update, const StatValue& value, int valueFieldMask = 0xFFFFFFFF); @@ -396,7 +396,7 @@ struct StatValueUtil { /// `valueFieldMask` to control which attributes of this value are /// loaded into `update`. If `valueFieldMask` is not specified, all /// attributes are saved. - static void loadFullUpdate(mwcstm::StatValueUpdate* update, + static void loadFullUpdate(bmqstm::StatValueUpdate* update, const StatValue& value, int valueFieldMask = 0xFFFFFFFF); }; @@ -723,7 +723,7 @@ inline bsls::Types::Int64 StatValue::max() const // struct StatValueUtil // -------------------- -inline void StatValueUtil::loadUpdate(mwcstm::StatValueUpdate* update, +inline void StatValueUtil::loadUpdate(bmqstm::StatValueUpdate* update, const StatValue& value, int valueFieldMask) { @@ -733,7 +733,7 @@ inline void StatValueUtil::loadUpdate(mwcstm::StatValueUpdate* update, false); } -inline void StatValueUtil::loadFullUpdate(mwcstm::StatValueUpdate* update, +inline void StatValueUtil::loadFullUpdate(bmqstm::StatValueUpdate* update, const StatValue& value, int valueFieldMask) { @@ -746,13 +746,13 @@ inline void StatValueUtil::loadFullUpdate(mwcstm::StatValueUpdate* update, } // close package namespace // FREE OPERATORS -inline bool mwcst::operator==(const StatValue_SnapshotLocation& lhs, +inline bool bmqst::operator==(const StatValue_SnapshotLocation& lhs, const StatValue_SnapshotLocation& rhs) { return lhs.level() == rhs.level() && lhs.index() == rhs.index(); } -inline bool mwcst::operator<(const StatValue_SnapshotLocation& lhs, +inline bool bmqst::operator<(const StatValue_SnapshotLocation& lhs, const StatValue_SnapshotLocation& rhs) { if (lhs.level() == rhs.level()) { @@ -763,7 +763,7 @@ inline bool mwcst::operator<(const StatValue_SnapshotLocation& lhs, } } -inline bool mwcst::operator>(const StatValue_SnapshotLocation& lhs, +inline bool bmqst::operator>(const StatValue_SnapshotLocation& lhs, const StatValue_SnapshotLocation& rhs) { if (lhs.level() == rhs.level()) { @@ -775,7 +775,7 @@ inline bool mwcst::operator>(const StatValue_SnapshotLocation& lhs, } inline bsl::ostream& -mwcst::operator<<(bsl::ostream& stream, +bmqst::operator<<(bsl::ostream& stream, const StatValue_SnapshotLocation& location) { return location.print(stream, 0, -1); diff --git a/src/groups/mwc/mwcst/mwcst_stringkey.cpp b/src/groups/bmq/bmqst/bmqst_stringkey.cpp similarity index 88% rename from src/groups/mwc/mwcst/mwcst_stringkey.cpp rename to src/groups/bmq/bmqst/bmqst_stringkey.cpp index cb74190c6..a93fdd07c 100644 --- a/src/groups/mwc/mwcst/mwcst_stringkey.cpp +++ b/src/groups/bmq/bmqst/bmqst_stringkey.cpp @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_stringkey.cpp -*-C++-*- -#include +// bmqst_stringkey.cpp -*-C++-*- +#include -#include -#include +#include +#include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // --------------- // class StringKey @@ -42,7 +42,7 @@ void StringKey::makeCopy() bsl::ostream& StringKey::print(bsl::ostream& stream, int level, int spacesPerLevel) const { - return mwcst::PrintUtil::stringRefPrint(stream, + return bmqst::PrintUtil::stringRefPrint(stream, bslstl::StringRef(d_string_p, d_length), level, diff --git a/src/groups/mwc/mwcst/mwcst_stringkey.h b/src/groups/bmq/bmqst/bmqst_stringkey.h similarity index 93% rename from src/groups/mwc/mwcst/mwcst_stringkey.h rename to src/groups/bmq/bmqst/bmqst_stringkey.h index d23abd374..b71f18264 100644 --- a/src/groups/mwc/mwcst/mwcst_stringkey.h +++ b/src/groups/bmq/bmqst/bmqst_stringkey.h @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_stringkey.h -*-C++-*- -#ifndef INCLUDED_MWCST_STRINGKEY -#define INCLUDED_MWCST_STRINGKEY +// bmqst_stringkey.h -*-C++-*- +#ifndef INCLUDED_BMQST_STRINGKEY +#define INCLUDED_BMQST_STRINGKEY //@PURPOSE: Provide a smart string key for associative containers. // //@CLASSES: -// mwcst::StringKey: a better string key for containers +// bmqst::StringKey: a better string key for containers // //@DESCRIPTION: -// This class provides a mechanism, 'mwcst::StringKey', which is intended to be +// This class provides a mechanism, 'bmqst::StringKey', which is intended to be // used as a more efficient string key in associative containers. This is // done by allowing the 'StringKey' to either hold a reference to an existing // string, or to own its own copy of it. @@ -87,7 +87,7 @@ #endif namespace BloombergLP { -namespace mwcst { +namespace bmqst { // =============== // class StringKey @@ -310,7 +310,7 @@ inline size_t StringKey::hashValue() const } // close package namespace // FREE OPERATORS -inline bool mwcst::operator<(const StringKey& lhs, const StringKey& rhs) +inline bool bmqst::operator<(const StringKey& lhs, const StringKey& rhs) { int ret = bsl::memcmp(lhs.string(), rhs.string(), @@ -324,7 +324,7 @@ inline bool mwcst::operator<(const StringKey& lhs, const StringKey& rhs) } } -inline bool mwcst::operator==(const StringKey& lhs, const StringKey& rhs) +inline bool bmqst::operator==(const StringKey& lhs, const StringKey& rhs) { if ((lhs.length() != rhs.length()) || (lhs.hashValue() != rhs.hashValue())) { @@ -336,7 +336,7 @@ inline bool mwcst::operator==(const StringKey& lhs, const StringKey& rhs) bsl::min(lhs.length(), rhs.length())) == 0; } -inline bool mwcst::operator!=(const StringKey& lhs, const StringKey& rhs) +inline bool bmqst::operator!=(const StringKey& lhs, const StringKey& rhs) { if ((lhs.length() != rhs.length()) || (lhs.hashValue() != rhs.hashValue())) { @@ -348,7 +348,7 @@ inline bool mwcst::operator!=(const StringKey& lhs, const StringKey& rhs) bsl::min(lhs.length(), rhs.length())) != 0; } -inline bsl::ostream& mwcst::operator<<(bsl::ostream& stream, +inline bsl::ostream& bmqst::operator<<(bsl::ostream& stream, const StringKey& object) { return object.print(stream, 0, -1); @@ -359,21 +359,21 @@ inline bsl::ostream& mwcst::operator<<(bsl::ostream& stream, namespace bsl { // ========================================= -// struct hash +// struct hash // ========================================= template <> -struct hash { +struct hash { // ACCESSORS - size_t operator()(const BloombergLP::mwcst::StringKey& key) const; + size_t operator()(const BloombergLP::bmqst::StringKey& key) const; }; // ----------------------------------------- -// struct hash +// struct hash // ----------------------------------------- -inline size_t hash::operator()( - const BloombergLP::mwcst::StringKey& key) const +inline size_t hash::operator()( + const BloombergLP::bmqst::StringKey& key) const { return key.hashValue(); } diff --git a/src/groups/mwc/mwcst/mwcst_stringkey.t.cpp b/src/groups/bmq/bmqst/bmqst_stringkey.t.cpp similarity index 96% rename from src/groups/mwc/mwcst/mwcst_stringkey.t.cpp rename to src/groups/bmq/bmqst/bmqst_stringkey.t.cpp index 76769de9e..9426f0495 100644 --- a/src/groups/mwc/mwcst/mwcst_stringkey.t.cpp +++ b/src/groups/bmq/bmqst/bmqst_stringkey.t.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_stringkey.t.cpp -*-C++-*- +// bmqst_stringkey.t.cpp -*-C++-*- -#include +#include -#include +#include -#include +#include #include @@ -27,7 +27,7 @@ #include using namespace BloombergLP; -using namespace mwcst; +using namespace bmqst; using namespace bsl; //============================================================================= @@ -149,13 +149,13 @@ int main(int argc, char* argv[]) { StringKey key(STRING, &testAllocator); - mwcu::MemOutStream stream(&testAllocator); + bmqu::MemOutStream stream(&testAllocator); stream << key; ASSERT(key == stream.str()); } { StringKey key(STRING, &testAllocator); - mwcu::MemOutStream stream(&testAllocator); + bmqu::MemOutStream stream(&testAllocator); key.print(stream, 1, 4); ASSERT(" String\n" == stream.str()); } diff --git a/src/groups/mwc/mwcst/mwcst_table.cpp b/src/groups/bmq/bmqst/bmqst_table.cpp similarity index 92% rename from src/groups/mwc/mwcst/mwcst_table.cpp rename to src/groups/bmq/bmqst/bmqst_table.cpp index b01cddf6d..4a8c9cbf3 100644 --- a/src/groups/mwc/mwcst/mwcst_table.cpp +++ b/src/groups/bmq/bmqst/bmqst_table.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_table.cpp -*-C++-*- -#include +// bmqst_table.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // ----------- // class Table diff --git a/src/groups/mwc/mwcst/mwcst_table.h b/src/groups/bmq/bmqst/bmqst_table.h similarity index 83% rename from src/groups/mwc/mwcst/mwcst_table.h rename to src/groups/bmq/bmqst/bmqst_table.h index 776be208e..b434181a7 100644 --- a/src/groups/mwc/mwcst/mwcst_table.h +++ b/src/groups/bmq/bmqst/bmqst_table.h @@ -13,30 +13,30 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_table.h -*-C++-*- -#ifndef INCLUDED_MWCST_TABLE -#define INCLUDED_MWCST_TABLE +// bmqst_table.h -*-C++-*- +#ifndef INCLUDED_BMQST_TABLE +#define INCLUDED_BMQST_TABLE //@PURPOSE: Provide a simple table of values derived from a table stat context. // //@CLASSES: -// mwcst::Table : table of values backed by a 'mwcst::StatContext'. +// bmqst::Table : table of values backed by a 'bmqst::StatContext'. // -//@SEE_ALSO: mwcst_statcontext -// mwcst_tableschema -// mwcst_tablerecord +//@SEE_ALSO: bmqst_statcontext +// bmqst_tableschema +// bmqst_tablerecord // -//@DESCRIPTION: This component defines a mechanism, 'mwcst::Table', which is a -// table of values derived from a table 'mwcst::StatContext'. +//@DESCRIPTION: This component defines a mechanism, 'bmqst::Table', which is a +// table of values derived from a table 'bmqst::StatContext'. // -// A 'mwcst::Table' must be associated with a 'mwcst::StatContext' after +// A 'bmqst::Table' must be associated with a 'bmqst::StatContext' after // creation; the stat context will provide the values of the table. The table // itself has two parts: a "schema" e.g. a set of colums, and a set of records // for backed by the stat context. The schema is implemented by a -// 'mwcst::TableSchema' and the records are defined by a 'mwcst::TableRecords'. +// 'bmqst::TableSchema' and the records are defined by a 'bmqst::TableRecords'. // // The application defines the schema of a table by adding named columns that -// are defined using functions (from 'mwcst::StatUtil') and their arguments. +// are defined using functions (from 'bmqst::StatUtil') and their arguments. // For example, the application can define a column named "total" as the // value of the first snapshot of a particular variable/value in the stat // context. @@ -50,36 +50,36 @@ ///------------- // Suppose we are creating an application that needs to keep track of how // much IO traffic it performs over an interface (TCP or whatever), and prints -// it on a regular basis. The application creates a 'mwcst::StatContext' with -// two 'mwcst::Value': "IN" representing the input traffic, and "OUT" +// it on a regular basis. The application creates a 'bmqst::StatContext' with +// two 'bmqst::Value': "IN" representing the input traffic, and "OUT" // representing the output traffic. The stat context can be initialized using -// a 'mwcst::StatContextConfiguration' created by the following function: +// a 'bmqst::StatContextConfiguration' created by the following function: //.. -// mwcst::StatContextConfiguration +// bmqst::StatContextConfiguration // createStatContextConfiguration(int numSamples, // bslma::Allocator *allocator) // { -// mwcst::StatContextConfiguration config("Total", allocator); +// bmqst::StatContextConfiguration config("Total", allocator); // config.isTable(true); // config.value("IN", numSamples) // config.value("OUT", numSamples) // return config; // } //.. -// To print the stat context, the application first creates a 'mwcst::Table' +// To print the stat context, the application first creates a 'bmqst::Table' // and initializes it using the following function: //.. -// void initTable(mwcst::Table *table, -// mwcst::StatContext *statContext, +// void initTable(bmqst::Table *table, +// bmqst::StatContext *statContext, // int numSamples) // { -// typedef mwcst::StatUtil SU; -// typedef mwcst::StatValue SV; +// typedef bmqst::StatUtil SU; +// typedef bmqst::StatValue SV; // // int inValueIndex = 0; // int outValueIndex = 1; // -// mwcst::TableSchema& schema = table->schema(); +// bmqst::TableSchema& schema = table->schema(); // schema.addDefaultIdColumn("Id"); // // // In @@ -133,7 +133,7 @@ // SV::SnapshotLocation(0, 0)); // // // Associate the table record to the stat context. -// mwcst::TableRecords& records = table->records(); +// bmqst::TableRecords& records = table->records(); // records.setContext(statContext); // // // Note shown here: we could add a filtering and a sorting function @@ -146,10 +146,10 @@ // argument 'numSamples' is the number of samples in the stat context. // // Now it is time to print this table, by creating a -// 'mwcst::BasicTableInfoProvider' associated with the table (pass the table +// 'bmqst::BasicTableInfoProvider' associated with the table (pass the table // in the constructor, and initializing it using the following function: //.. -// void initTIP(mwcst::BasicTableInfoProvider *tip, +// void initTIP(bmqst::BasicTableInfoProvider *tip, // int numSamples) // { // // ID @@ -178,7 +178,7 @@ // This function associates the columns of the table with the columns of the // table info provider. It also sets up column groups and formatting options // like displaying blanks instead of zeros. Refer to the documentation -// in 'mwcst::TableUtil' for details. The table that will be printed looks +// in 'bmqst::TableUtil' for details. The table that will be printed looks // like this (only showing IN; OUT is identical): //.. // | IN | @@ -188,19 +188,19 @@ // foo.tsk:123| 28,320| 28,320| 484.00| 120| 120| 2.00| //.. -#include -#include -#include +#include +#include +#include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // =========== // class Table // =========== -/// Table of values obtained from a `mwcst::StatContext`. -class Table : public mwcst::BaseTable { +/// Table of values obtained from a `bmqst::StatContext`. +class Table : public bmqst::BaseTable { private: // DATA TableSchema d_schema; diff --git a/src/groups/mwc/mwcst/mwcst_tableinfoprovider.cpp b/src/groups/bmq/bmqst/bmqst_tableinfoprovider.cpp similarity index 87% rename from src/groups/mwc/mwcst/mwcst_tableinfoprovider.cpp rename to src/groups/bmq/bmqst/bmqst_tableinfoprovider.cpp index d1c1a5ff3..8b6327516 100644 --- a/src/groups/mwc/mwcst/mwcst_tableinfoprovider.cpp +++ b/src/groups/bmq/bmqst/bmqst_tableinfoprovider.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_tableinfoprovider.cpp -*-C++-*- -#include +// bmqst_tableinfoprovider.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // ----------------------- // class TableInfoProvider diff --git a/src/groups/mwc/mwcst/mwcst_tableinfoprovider.h b/src/groups/bmq/bmqst/bmqst_tableinfoprovider.h similarity index 90% rename from src/groups/mwc/mwcst/mwcst_tableinfoprovider.h rename to src/groups/bmq/bmqst/bmqst_tableinfoprovider.h index 34a8783a3..119e90658 100644 --- a/src/groups/mwc/mwcst/mwcst_tableinfoprovider.h +++ b/src/groups/bmq/bmqst/bmqst_tableinfoprovider.h @@ -13,20 +13,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_tableinfoprovider.h -*-C++-*- -#ifndef INCLUDED_MWCST_TABLEINFOPROVIDER -#define INCLUDED_MWCST_TABLEINFOPROVIDER +// bmqst_tableinfoprovider.h -*-C++-*- +#ifndef INCLUDED_BMQST_TABLEINFOPROVIDER +#define INCLUDED_BMQST_TABLEINFOPROVIDER //@PURPOSE: Provide a protocol for an object that describes a printable table // //@CLASSES: -// mwcst::TableInfoProvider +// bmqst::TableInfoProvider // -//@SEE_ALSO: mwcst_tableutil +//@SEE_ALSO: bmqst_tableutil // //@DESCRIPTION: -// This component defines a pure protocol, 'mwcst::TableInfoProvider', which -// provides all the information necessary for 'mwcst::TableUtil' to print +// This component defines a pure protocol, 'bmqst::TableInfoProvider', which +// provides all the information necessary for 'bmqst::TableUtil' to print // any arbitrary table. // // A 'TableInfoProvider' can describe a table with an arbitrary number of @@ -35,7 +35,7 @@ // /// Usage Example ///------------- -// See the usage example of 'mwcst::TableUtil' for a simple +// See the usage example of 'bmqst::TableUtil' for a simple // implementation. #ifndef INCLUDED_BSL_OSTREAM @@ -43,14 +43,14 @@ #endif namespace BloombergLP { -namespace mwcst { +namespace bmqst { // ======================= // class TableInfoProvider // ======================= /// Protocol for an object that describes a table to be printed by -/// `mwcst::PrintTableUtil`. +/// `bmqst::PrintTableUtil`. class TableInfoProvider { public: // CREATORS diff --git a/src/groups/mwc/mwcst/mwcst_tablerecords.cpp b/src/groups/bmq/bmqst/bmqst_tablerecords.cpp similarity index 97% rename from src/groups/mwc/mwcst/mwcst_tablerecords.cpp rename to src/groups/bmq/bmqst/bmqst_tablerecords.cpp index d02e1d2da..34786c624 100644 --- a/src/groups/mwc/mwcst/mwcst_tablerecords.cpp +++ b/src/groups/bmq/bmqst/bmqst_tablerecords.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_tablerecords.cpp -*-C++-*- -#include +// bmqst_tablerecords.cpp -*-C++-*- +#include +#include #include #include -#include namespace BloombergLP { -namespace mwcst { +namespace bmqst { namespace { diff --git a/src/groups/mwc/mwcst/mwcst_tablerecords.h b/src/groups/bmq/bmqst/bmqst_tablerecords.h similarity index 87% rename from src/groups/mwc/mwcst/mwcst_tablerecords.h rename to src/groups/bmq/bmqst/bmqst_tablerecords.h index e5c84817d..1b897a7a3 100644 --- a/src/groups/mwc/mwcst/mwcst_tablerecords.h +++ b/src/groups/bmq/bmqst/bmqst_tablerecords.h @@ -13,33 +13,33 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_tablerecords.h -*-C++-*- -#ifndef INCLUDED_MWCST_TABLERECORDS -#define INCLUDED_MWCST_TABLERECORDS +// bmqst_tablerecords.h -*-C++-*- +#ifndef INCLUDED_BMQST_TABLERECORDS +#define INCLUDED_BMQST_TABLERECORDS //@PURPOSE: Provide a container for records in a Stat Context. // //@CLASSES: -// mwcst::TableRecordsRecord : An individual record. -// mwcst::TableRecord : Records of a 'mwcst::StatContext' table. +// bmqst::TableRecordsRecord : An individual record. +// bmqst::TableRecord : Records of a 'bmqst::StatContext' table. // -//@SEE_ALSO: mwcst_statcontext -// mwcst_table +//@SEE_ALSO: bmqst_statcontext +// bmqst_table // //@DESCRIPTION: This component provides a mechanism for accessing and filtering -// or sorting records in a 'mwcst::Table' associated with a -// 'mwcst::StatContext'. +// or sorting records in a 'bmqst::Table' associated with a +// 'bmqst::StatContext'. // -// See 'mwcst::Table' for more details. +// See 'bmqst::Table' for more details. -#include +#include #include #include #include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // FORWARD DECLARATIONS class TableRecords; @@ -48,7 +48,7 @@ class TableRecords; // class TableRecordsRecord // ======================== -/// A record in a `mwcst::TableRecords`. +/// A record in a `bmqst::TableRecords`. class TableRecordsRecord { private: // DATA @@ -84,7 +84,7 @@ class TableRecordsRecord { // class TableRecords // ================== -/// Records of a `mwcst::StatContext` table. +/// Records of a `bmqst::StatContext` table. class TableRecords { public: // PUBLIC TYPES diff --git a/src/groups/mwc/mwcst/mwcst_tableschema.cpp b/src/groups/bmq/bmqst/bmqst_tableschema.cpp similarity index 98% rename from src/groups/mwc/mwcst/mwcst_tableschema.cpp rename to src/groups/bmq/bmqst/bmqst_tableschema.cpp index 682113a1a..ea79b03b7 100644 --- a/src/groups/mwc/mwcst/mwcst_tableschema.cpp +++ b/src/groups/bmq/bmqst/bmqst_tableschema.cpp @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_tableschema.cpp -*-C++-*- -#include +// bmqst_tableschema.cpp -*-C++-*- +#include #include #include +#include #include #include #include -#include namespace BloombergLP { -namespace mwcst { +namespace bmqst { namespace { diff --git a/src/groups/mwc/mwcst/mwcst_tableschema.h b/src/groups/bmq/bmqst/bmqst_tableschema.h similarity index 87% rename from src/groups/mwc/mwcst/mwcst_tableschema.h rename to src/groups/bmq/bmqst/bmqst_tableschema.h index 1e4e2b469..eee8afa4f 100644 --- a/src/groups/mwc/mwcst/mwcst_tableschema.h +++ b/src/groups/bmq/bmqst/bmqst_tableschema.h @@ -13,26 +13,26 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_tableschema.h -*-C++-*- -#ifndef INCLUDED_MWCST_TABLESCHEMA -#define INCLUDED_MWCST_TABLESCHEMA +// bmqst_tableschema.h -*-C++-*- +#ifndef INCLUDED_BMQST_TABLESCHEMA +#define INCLUDED_BMQST_TABLESCHEMA -//@PURPOSE: Descriptor for the schema of a 'mwcst::Table' (columns). +//@PURPOSE: Descriptor for the schema of a 'bmqst::Table' (columns). // //@CLASSES: -// mwcst::TableSchemaColumn : a column in a 'mwcst::TableSchema'. -// mwcst::TableSchema : the columns of a 'mwcst::Table' +// bmqst::TableSchemaColumn : a column in a 'bmqst::TableSchema'. +// bmqst::TableSchema : the columns of a 'bmqst::Table' // -//@SEE_ALSO: mwcst_table +//@SEE_ALSO: bmqst_table // -//@DESCRIPTION: This component provides a mechanism, 'mwcst::TableSchema' which -// is used to define the columns of a 'mwct::Table'. +//@DESCRIPTION: This component provides a mechanism, 'bmqst::TableSchema' which +// is used to define the columns of a 'bmqt::Table'. // -// See 'mwcst::Table' for more details. +// See 'bmqst::Table' for more details. -#include -#include -#include +#include +#include +#include #include #include @@ -41,7 +41,7 @@ #include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // FORWARD DECLARATIONS class TableSchema; @@ -50,7 +50,7 @@ class TableSchema; // class TableSchemaColumn // ======================= -/// A column in a `mwcst::TableSchema`. +/// A column in a `bmqst::TableSchema`. class TableSchemaColumn { public: // PUBLIC TYPES @@ -94,7 +94,7 @@ class TableSchemaColumn { // class TableSchema // ================= -/// The columns of a `mwcst::Table`. +/// The columns of a `bmqst::Table`. class TableSchema { public: // PUBLIC TYPES diff --git a/src/groups/mwc/mwcst/mwcst_tableutil.cpp b/src/groups/bmq/bmqst/bmqst_tableutil.cpp similarity index 96% rename from src/groups/mwc/mwcst/mwcst_tableutil.cpp rename to src/groups/bmq/bmqst/bmqst_tableutil.cpp index 9fc0b1fde..675b358a7 100644 --- a/src/groups/mwc/mwcst/mwcst_tableutil.cpp +++ b/src/groups/bmq/bmqst/bmqst_tableutil.cpp @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_tableutil.cpp -*-C++-*- -#include +// bmqst_tableutil.cpp -*-C++-*- +#include -#include -#include -#include +#include +#include +#include -#include +#include -#include +#include #include #include @@ -32,7 +32,7 @@ #include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // --------------- // class TableUtil @@ -271,7 +271,7 @@ void TableUtil::printCsv(bsl::ostream& stream, const TableInfoProvider& info) // Output rows bdlma::LocalSequentialAllocator<128> bsa; - mwcu::MemOutStream ostream(&bsa); + bmqu::MemOutStream ostream(&bsa); for (int row = 0; row < numRows; ++row) { for (int col = 0; col < numColumns; ++col) { diff --git a/src/groups/mwc/mwcst/mwcst_tableutil.h b/src/groups/bmq/bmqst/bmqst_tableutil.h similarity index 93% rename from src/groups/mwc/mwcst/mwcst_tableutil.h rename to src/groups/bmq/bmqst/bmqst_tableutil.h index 95361daef..91ea106f7 100644 --- a/src/groups/mwc/mwcst/mwcst_tableutil.h +++ b/src/groups/bmq/bmqst/bmqst_tableutil.h @@ -13,25 +13,25 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_tableutil.h -*-C++-*- -#ifndef INCLUDED_MWCST_TABLEUTIL -#define INCLUDED_MWCST_TABLEUTIL +// bmqst_tableutil.h -*-C++-*- +#ifndef INCLUDED_BMQST_TABLEUTIL +#define INCLUDED_BMQST_TABLEUTIL //@PURPOSE: Provide a set of functions for working with tables // //@CLASSES: -// mwcst::TableUtil +// bmqst::TableUtil // //@SEE_ALSO: // -//@DESCRIPTION: This component defines a utility, 'mwcst::TableUtil', +//@DESCRIPTION: This component defines a utility, 'bmqst::TableUtil', // containing functions for working with tables defined by a -// 'mwcst::TableInfoProvider'. +// 'bmqst::TableInfoProvider'. // /// printTable ///--------- // This function prints a table of data to a stream by using a provided -// 'mwcst::TableInfoProvider' object which provides information about the table +// 'bmqst::TableInfoProvider' object which provides information about the table // to be printed. It supports printing tables with an arbitrary // number of header rows, and ensures that all columns are sized correctly so // all their values fit. @@ -42,7 +42,7 @@ // form '(row x column)'. To do this, we must define a 'TableInfoProvider' // implementation that will handle this for us. //.. -// class SimpleInfoProvider : public mwcst::TableInfoProvider { +// class SimpleInfoProvider : public bmqst::TableInfoProvider { // // // ACCESSORS // virtual int numRows() const @@ -137,7 +137,7 @@ namespace BloombergLP { -namespace mwcst { +namespace bmqst { // FORWARD DECLARATIONS class BaseTable; diff --git a/src/groups/mwc/mwcst/mwcst_tableutil.t.cpp b/src/groups/bmq/bmqst/bmqst_tableutil.t.cpp similarity index 91% rename from src/groups/mwc/mwcst/mwcst_tableutil.t.cpp rename to src/groups/bmq/bmqst/bmqst_tableutil.t.cpp index 49cc90d00..634124517 100644 --- a/src/groups/mwc/mwcst/mwcst_tableutil.t.cpp +++ b/src/groups/bmq/bmqst/bmqst_tableutil.t.cpp @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_tableutil.t.cpp -*-C++-*- +// bmqst_tableutil.t.cpp -*-C++-*- -#include +#include -#include +#include +#include +#include +#include #include #include -#include -#include -#include #include #include @@ -63,7 +63,7 @@ static int testStatus = 0; // class SimpleInfoProvider // ======================== -class SimpleInfoProvider : public mwcst::TableInfoProvider { +class SimpleInfoProvider : public bmqst::TableInfoProvider { // ACCESSORS int numRows() const BSLS_KEYWORD_OVERRIDE; int numColumns(int level) const BSLS_KEYWORD_OVERRIDE; @@ -207,18 +207,18 @@ int main(int argc, char* argv[]) P(LINE); - mwcst::TestTableInfoProvider tip; + bmqst::TestTableInfoProvider tip; - tip.addHeaderLevel(mwcst::TestUtil::stringVector(data.d_header)); + tip.addHeaderLevel(bmqst::TestUtil::stringVector(data.d_header)); const char* const* rows = data.d_rows; while (*rows) { - tip.addRow(mwcst::TestUtil::stringVector(*rows)); + tip.addRow(bmqst::TestUtil::stringVector(*rows)); ++rows; } - mwcu::MemOutStream stream; - mwcst::TableUtil::printCsv(stream, tip); + bmqu::MemOutStream stream; + bmqst::TableUtil::printCsv(stream, tip); ASSERT_EQUALS(stream.str(), data.d_expected); } @@ -241,9 +241,9 @@ int main(int argc, char* argv[]) cout << endl << "USAGE EXAMPLE" << endl << "=============" << endl; SimpleInfoProvider provider; - mwcst::TableUtil::printTable(bsl::cout, provider); + bmqst::TableUtil::printTable(bsl::cout, provider); } break; - /* TODO fix this test once mwcst::TestTable is written + /* TODO fix this test once bmqst::TestTable is written case 3: { // -------------------------------------------------------------------- // PRINT CSV TEST @@ -281,10 +281,10 @@ case 3: { P(LINE); TestTableInfoProvider tip; - tip.addHeaderLevel(mwcst::TestUtil::stringVector(data.d_header)); + tip.addHeaderLevel(bmqst::TestUtil::stringVector(data.d_header)); const char * const *rows = data.d_rows; while (*rows) { - tip.addRow(mwcst::TestUtil::stringVector(*rows)); + tip.addRow(bmqst::TestUtil::stringVector(*rows)); ++rows; } @@ -329,21 +329,21 @@ case 3: { P(LINE); - mwcst::TestTableInfoProvider tip; + bmqst::TestTableInfoProvider tip; bsl::vector > expected; - expected.push_back(mwcst::TestUtil::stringVector(data.d_header)); + expected.push_back(bmqst::TestUtil::stringVector(data.d_header)); tip.addHeaderLevel(expected.back()); const char* const* rows = data.d_rows; while (*rows) { - expected.push_back(mwcst::TestUtil::stringVector(*rows)); + expected.push_back(bmqst::TestUtil::stringVector(*rows)); tip.addRow(expected.back()); ++rows; } bsl::vector > output; - int ret = mwcst::TableUtil::outputToVector(&output, tip); + int ret = bmqst::TableUtil::outputToVector(&output, tip); ASSERT_EQUALS(ret, 0); ASSERT_EQUALS(output, expected); } diff --git a/src/groups/mwc/mwcst/mwcst_testtableinfoprovider.cpp b/src/groups/bmq/bmqst/bmqst_testtableinfoprovider.cpp similarity index 96% rename from src/groups/mwc/mwcst/mwcst_testtableinfoprovider.cpp rename to src/groups/bmq/bmqst/bmqst_testtableinfoprovider.cpp index 9e019aa98..2d1539f78 100644 --- a/src/groups/mwc/mwcst/mwcst_testtableinfoprovider.cpp +++ b/src/groups/bmq/bmqst/bmqst_testtableinfoprovider.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_testtableinfoprovider.cpp -*-C++-*- -#include +// bmqst_testtableinfoprovider.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // --------------------------- // class TestTableInfoProvider diff --git a/src/groups/mwc/mwcst/mwcst_testtableinfoprovider.h b/src/groups/bmq/bmqst/bmqst_testtableinfoprovider.h similarity index 86% rename from src/groups/mwc/mwcst/mwcst_testtableinfoprovider.h rename to src/groups/bmq/bmqst/bmqst_testtableinfoprovider.h index bae0c95f1..f9e1cc289 100644 --- a/src/groups/mwc/mwcst/mwcst_testtableinfoprovider.h +++ b/src/groups/bmq/bmqst/bmqst_testtableinfoprovider.h @@ -13,34 +13,34 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_testtableinfoprovider.h -*-C++-*- -#ifndef INCLUDED_MWCST_TESTTABLEINFOPROVIDER -#define INCLUDED_MWCST_TESTTABLEINFOPROVIDER +// bmqst_testtableinfoprovider.h -*-C++-*- +#ifndef INCLUDED_BMQST_TESTTABLEINFOPROVIDER +#define INCLUDED_BMQST_TESTTABLEINFOPROVIDER -//@PURPOSE: Provide a test implementation of 'mwcst::TableInfoProvider' +//@PURPOSE: Provide a test implementation of 'bmqst::TableInfoProvider' // //@CLASSES: -// mwcst::TestTableInfoProvider +// bmqst::TestTableInfoProvider // //@SEE_ALSO: // //@DESCRIPTION: This component defines a mechanism, -// 'mwcst::TestTableInfoProvider', which is a test implementation of the -// 'mwcst::TableInfoProvider' protocol for use in test drivers. It allows the +// 'bmqst::TestTableInfoProvider', which is a test implementation of the +// 'bmqst::TableInfoProvider' protocol for use in test drivers. It allows the // user to specify the values returned by the TIP. +#include #include #include -#include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // =========================== // class TestTableInfoProvider // =========================== -/// Test implementation of `mwcst::TableInfoProvider` +/// Test implementation of `bmqst::TableInfoProvider` class TestTableInfoProvider : public TableInfoProvider { private: // PRIVATE TYPES diff --git a/src/groups/mwc/mwcst/mwcst_testutil.cpp b/src/groups/bmq/bmqst/bmqst_testutil.cpp similarity index 91% rename from src/groups/mwc/mwcst/mwcst_testutil.cpp rename to src/groups/bmq/bmqst/bmqst_testutil.cpp index 439f511cc..06936f2bd 100644 --- a/src/groups/mwc/mwcst/mwcst_testutil.cpp +++ b/src/groups/bmq/bmqst/bmqst_testutil.cpp @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_testutil.cpp -*-C++-*- -#include +// bmqst_testutil.cpp -*-C++-*- +#include #include #include +#include #include -#include #include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // --------------- // struct TestUtil @@ -158,13 +158,13 @@ BlobDataComparer::BlobDataComparer(const bdlbb::Blob* blob, } BlobDataComparer::BlobDataComparer(const bdlbb::Blob* blob, - const mwcu::BlobPosition& start, + const bmqu::BlobPosition& start, bslma::Allocator* allocator) : d_blob_p(blob) , d_offset() , d_allocator_p(allocator) { - mwcu::BlobUtil::positionToOffset(&d_offset, *blob, start); + bmqu::BlobUtil::positionToOffset(&d_offset, *blob, start); } // ACCESSORS @@ -186,8 +186,8 @@ bslma::Allocator* BlobDataComparer::allocator() const } // close package namespace // FREE FUNCTIONS -bool mwcst::operator==(const mwcst::BlobDataComparer& lhs, - const mwcst::BlobDataComparer& rhs) +bool bmqst::operator==(const bmqst::BlobDataComparer& lhs, + const bmqst::BlobDataComparer& rhs) { bdlbb::Blob lhsCopy(lhs.allocator()); bdlbb::BlobUtil::append(&lhsCopy, *lhs.blob(), lhs.offset()); @@ -198,8 +198,8 @@ bool mwcst::operator==(const mwcst::BlobDataComparer& lhs, return bdlbb::BlobUtil::compare(lhsCopy, rhsCopy) == 0; } -bsl::ostream& mwcst::operator<<(bsl::ostream& stream, - const mwcst::BlobDataComparer& val) +bsl::ostream& bmqst::operator<<(bsl::ostream& stream, + const bmqst::BlobDataComparer& val) { int length = val.blob()->length() - val.offset(); return stream << "\n" diff --git a/src/groups/mwc/mwcst/mwcst_testutil.h b/src/groups/bmq/bmqst/bmqst_testutil.h similarity index 84% rename from src/groups/mwc/mwcst/mwcst_testutil.h rename to src/groups/bmq/bmqst/bmqst_testutil.h index 8c437a626..f3acef433 100644 --- a/src/groups/mwc/mwcst/mwcst_testutil.h +++ b/src/groups/bmq/bmqst/bmqst_testutil.h @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_testutil.h -*-C++-*- -#ifndef INCLUDED_MWCST_TESTUTIL -#define INCLUDED_MWCST_TESTUTIL +// bmqst_testutil.h -*-C++-*- +#ifndef INCLUDED_BMQST_TESTUTIL +#define INCLUDED_BMQST_TESTUTIL //@PURPOSE: Provide non-standard macros and utilities for use in test drivers. // //@CLASSES: -// mwcst::TestUtil : utility funcions for test drivers -// mwcst::BlobDataComparer : compares and pretty-print two blobs +// bmqst::TestUtil : utility funcions for test drivers +// bmqst::BlobDataComparer : compares and pretty-print two blobs // //@DESCRIPTION: This component defines macros and utilities useful in test // drivers. @@ -33,10 +33,10 @@ #include #include #include +#include +#include #include #include -#include -#include //============================================================================= // NON-STANDARD ASSERTION MACROS @@ -61,10 +61,9 @@ { \ if (!((X) == (Y))) { \ bsl::cout << "Error " << __FILE__ << "(" << __LINE__ \ - << "): " << #X << " (" << mwcu::PrintUtil::printer(X) \ - << ") == " << #Y << " (" << mwcu::PrintUtil::printer(Y) \ - << ")" \ - << " (failed)" << bsl::endl; \ + << "): " << #X << " (" << bmqu::PrintUtil::printer(X) \ + << ") == " << #Y << " (" << bmqu::PrintUtil::printer(Y) \ + << ")" << " (failed)" << bsl::endl; \ if ((SKIP)) \ testStatus = 254; \ else if (testStatus >= 0 && testStatus <= 100) \ @@ -78,10 +77,9 @@ { \ if ((X) == (Y)) { \ bsl::cout << "Error " << __FILE__ << "(" << __LINE__ \ - << "): " << #X << " (" << mwcu::PrintUtil::printer(X) \ - << ") != " << #Y << " (" << mwcu::PrintUtil::printer(Y) \ - << ")" \ - << " (failed)" << bsl::endl; \ + << "): " << #X << " (" << bmqu::PrintUtil::printer(X) \ + << ") != " << #Y << " (" << bmqu::PrintUtil::printer(Y) \ + << ")" << " (failed)" << bsl::endl; \ if ((SKIP)) \ testStatus = 254; \ else if (testStatus >= 0 && testStatus <= 100) \ @@ -94,10 +92,10 @@ #define LOOP_ASSERT_EQUALS_SKIP(I, X, Y, SKIP) \ { \ if (!((X) == (Y))) { \ - cout << #I << ": " << mwcu::PrintUtil::printer(I) << "\n" \ + cout << #I << ": " << bmqu::PrintUtil::printer(I) << "\n" \ << "Error " << __FILE__ << "(" << __LINE__ << "): " << #X \ - << " (" << mwcu::PrintUtil::printer(X) << ") == " << #Y \ - << " (" << mwcu::PrintUtil::printer(Y) << ")" \ + << " (" << bmqu::PrintUtil::printer(X) << ") == " << #Y \ + << " (" << bmqu::PrintUtil::printer(Y) << ")" \ << " (failed)" << endl; \ if ((SKIP)) \ testStatus = 254; \ @@ -111,10 +109,10 @@ #define LOOP_ASSERT_NOT_EQUALS(I, X, Y) \ { \ if ((X) == (Y)) { \ - cout << #I << ": " << mwcu::PrintUtil::printer(I) << "\n" \ + cout << #I << ": " << bmqu::PrintUtil::printer(I) << "\n" \ << "Error " << __FILE__ << "(" << __LINE__ << "): " << #X \ - << " (" << mwcu::PrintUtil::printer(X) << ") == " << #Y \ - << " (" << mwcu::PrintUtil::printer(Y) << ")" \ + << " (" << bmqu::PrintUtil::printer(X) << ") == " << #Y \ + << " (" << bmqu::PrintUtil::printer(Y) << ")" \ << " (failed)" << endl; \ if (testStatus >= 0 && testStatus <= 100) \ ++testStatus; \ @@ -123,11 +121,11 @@ #define LOOP2_ASSERT_EQUALS(I, J, X, Y) \ { \ if (!((X) == (Y))) { \ - cout << #I << ": " << mwcu::PrintUtil::printer(I) << "\n" \ - << #J << ": " << mwcu::PrintUtil::printer(J) << "\n" \ + cout << #I << ": " << bmqu::PrintUtil::printer(I) << "\n" \ + << #J << ": " << bmqu::PrintUtil::printer(J) << "\n" \ << "Error " << __FILE__ << "(" << __LINE__ << "): " << #X \ - << " (" << mwcu::PrintUtil::printer(X) << ") == " << #Y \ - << " (" << mwcu::PrintUtil::printer(Y) << ")" \ + << " (" << bmqu::PrintUtil::printer(X) << ") == " << #Y \ + << " (" << bmqu::PrintUtil::printer(Y) << ")" \ << " (failed)" << endl; \ if (testStatus >= 0 && testStatus <= 100) \ ++testStatus; \ @@ -139,10 +137,9 @@ { \ if (!((X) < (Y))) { \ bsl::cout << "Error " << __FILE__ << "(" << __LINE__ \ - << "): " << #X << " (" << mwcu::PrintUtil::printer(X) \ - << ") < " << #Y << " (" << mwcu::PrintUtil::printer(Y) \ - << ")" \ - << " (failed)" << bsl::endl; \ + << "): " << #X << " (" << bmqu::PrintUtil::printer(X) \ + << ") < " << #Y << " (" << bmqu::PrintUtil::printer(Y) \ + << ")" << " (failed)" << bsl::endl; \ if ((SKIP)) \ testStatus = 254; \ else if (testStatus >= 0 && testStatus <= 100) \ @@ -155,10 +152,10 @@ #define LOOP_ASSERT_LESS_SKIP(I, X, Y, SKIP) \ { \ if (!((X) < (Y))) { \ - cout << #I << ": " << mwcu::PrintUtil::printer(I) << "\n" \ + cout << #I << ": " << bmqu::PrintUtil::printer(I) << "\n" \ << "Error " << __FILE__ << "(" << __LINE__ << "): " << #X \ - << " (" << mwcu::PrintUtil::printer(X) << ") < " << #Y \ - << " (" << mwcu::PrintUtil::printer(Y) << ")" \ + << " (" << bmqu::PrintUtil::printer(X) << ") < " << #Y \ + << " (" << bmqu::PrintUtil::printer(Y) << ")" \ << " (failed)" << endl; \ if ((SKIP)) \ testStatus = 254; \ @@ -169,11 +166,11 @@ #define LOOP2_ASSERT_LESS_SKIP(I, J, X, Y, SKIP) \ { \ if (!((X) < (Y))) { \ - cout << #I << ": " << mwcu::PrintUtil::printer(I) << "\n" \ - << #J << ": " << mwcu::PrintUtil::printer(J) << "\n" \ + cout << #I << ": " << bmqu::PrintUtil::printer(I) << "\n" \ + << #J << ": " << bmqu::PrintUtil::printer(J) << "\n" \ << "Error " << __FILE__ << "(" << __LINE__ << "): " << #X \ - << " (" << mwcu::PrintUtil::printer(X) << ") < " << #Y \ - << " (" << mwcu::PrintUtil::printer(Y) << ")" \ + << " (" << bmqu::PrintUtil::printer(X) << ") < " << #Y \ + << " (" << bmqu::PrintUtil::printer(Y) << ")" \ << " (failed)" << endl; \ if ((SKIP)) \ testStatus = 254; \ @@ -189,10 +186,9 @@ { \ if (!((X) <= (Y))) { \ bsl::cout << "Error " << __FILE__ << "(" << __LINE__ \ - << "): " << #X << " (" << mwcu::PrintUtil::printer(X) \ - << ") <= " << #Y << " (" << mwcu::PrintUtil::printer(Y) \ - << ")" \ - << " (failed)" << bsl::endl; \ + << "): " << #X << " (" << bmqu::PrintUtil::printer(X) \ + << ") <= " << #Y << " (" << bmqu::PrintUtil::printer(Y) \ + << ")" << " (failed)" << bsl::endl; \ if ((SKIP)) \ testStatus = 254; \ else if (testStatus >= 0 && testStatus <= 100) \ @@ -205,10 +201,10 @@ #define LOOP_ASSERT_LE_SKIP(I, X, Y, SKIP) \ { \ if (!((X) <= (Y))) { \ - cout << #I << ": " << mwcu::PrintUtil::printer(I) << "\n" \ + cout << #I << ": " << bmqu::PrintUtil::printer(I) << "\n" \ << "Error " << __FILE__ << "(" << __LINE__ << "): " << #X \ - << " (" << mwcu::PrintUtil::printer(X) << ") <= " << #Y \ - << " (" << mwcu::PrintUtil::printer(Y) << ")" \ + << " (" << bmqu::PrintUtil::printer(X) << ") <= " << #Y \ + << " (" << bmqu::PrintUtil::printer(Y) << ")" \ << " (failed)" << endl; \ if ((SKIP)) \ testStatus = 254; \ @@ -219,11 +215,11 @@ #define LOOP2_ASSERT_LE_SKIP(I, J, X, Y, SKIP) \ { \ if (!((X) <= (Y))) { \ - cout << #I << ": " << mwcu::PrintUtil::printer(I) << "\n" \ - << #J << ": " << mwcu::PrintUtil::printer(J) << "\n" \ + cout << #I << ": " << bmqu::PrintUtil::printer(I) << "\n" \ + << #J << ": " << bmqu::PrintUtil::printer(J) << "\n" \ << "Error " << __FILE__ << "(" << __LINE__ << "): " << #X \ - << " (" << mwcu::PrintUtil::printer(X) << ") <= " << #Y \ - << " (" << mwcu::PrintUtil::printer(Y) << ")" \ + << " (" << bmqu::PrintUtil::printer(X) << ") <= " << #Y \ + << " (" << bmqu::PrintUtil::printer(Y) << ")" \ << " (failed)" << endl; \ if ((SKIP)) \ testStatus = 254; \ @@ -239,10 +235,9 @@ { \ if (!((X) >= (Y))) { \ bsl::cout << "Error " << __FILE__ << "(" << __LINE__ \ - << "): " << #X << " (" << mwcu::PrintUtil::printer(X) \ - << ") >= " << #Y << " (" << mwcu::PrintUtil::printer(Y) \ - << ")" \ - << " (failed)" << bsl::endl; \ + << "): " << #X << " (" << bmqu::PrintUtil::printer(X) \ + << ") >= " << #Y << " (" << bmqu::PrintUtil::printer(Y) \ + << ")" << " (failed)" << bsl::endl; \ if ((SKIP)) \ testStatus = 254; \ else if (testStatus >= 0 && testStatus <= 100) \ @@ -255,10 +250,10 @@ #define LOOP_ASSERT_GE_SKIP(I, X, Y, SKIP) \ { \ if (!((X) >= (Y))) { \ - cout << #I << ": " << mwcu::PrintUtil::printer(I) << "\n" \ + cout << #I << ": " << bmqu::PrintUtil::printer(I) << "\n" \ << "Error " << __FILE__ << "(" << __LINE__ << "): " << #X \ - << " (" << mwcu::PrintUtil::printer(X) << ") >= " << #Y \ - << " (" << mwcu::PrintUtil::printer(Y) << ")" \ + << " (" << bmqu::PrintUtil::printer(X) << ") >= " << #Y \ + << " (" << bmqu::PrintUtil::printer(Y) << ")" \ << " (failed)" << endl; \ if ((SKIP)) \ testStatus = 254; \ @@ -269,11 +264,11 @@ #define LOOP2_ASSERT_GE_SKIP(I, J, X, Y, SKIP) \ { \ if (!((X) >= (Y))) { \ - cout << #I << ": " << mwcu::PrintUtil::printer(I) << "\n" \ - << #J << ": " << mwcu::PrintUtil::printer(J) << "\n" \ + cout << #I << ": " << bmqu::PrintUtil::printer(I) << "\n" \ + << #J << ": " << bmqu::PrintUtil::printer(J) << "\n" \ << "Error " << __FILE__ << "(" << __LINE__ << "): " << #X \ - << " (" << mwcu::PrintUtil::printer(X) << ") >= " << #Y \ - << " (" << mwcu::PrintUtil::printer(Y) << ")" \ + << " (" << bmqu::PrintUtil::printer(X) << ") >= " << #Y \ + << " (" << bmqu::PrintUtil::printer(Y) << ")" \ << " (failed)" << endl; \ if ((SKIP)) \ testStatus = 254; \ @@ -312,7 +307,7 @@ //----------------------------------------------------------------------------- namespace BloombergLP { -namespace mwcst { +namespace bmqst { // =============== // struct TestUtil @@ -362,7 +357,7 @@ struct TestUtil { /// Compares the data in 2 blobs, and pretty-prints the two blobs if they /// are found not to be equal. /// -/// DEPRECATED. Use `mwcu::BlobComparator` instead. +/// DEPRECATED. Use `bmqu::BlobComparator` instead. class BlobDataComparer { private: // DATA @@ -387,7 +382,7 @@ class BlobDataComparer { /// default allocator is used. The behavior is undefined unless `start` /// is a valid position in `blob`. BlobDataComparer(const bdlbb::Blob* blob, - const mwcu::BlobPosition& start, + const bmqu::BlobPosition& start, bslma::Allocator* allocator = 0); // ACCESSORS diff --git a/src/groups/mwc/mwcst/mwcst_value.cpp b/src/groups/bmq/bmqst/bmqst_value.cpp similarity index 95% rename from src/groups/mwc/mwcst/mwcst_value.cpp rename to src/groups/bmq/bmqst/bmqst_value.cpp index aa3f181f7..d956f53d5 100644 --- a/src/groups/mwc/mwcst/mwcst_value.cpp +++ b/src/groups/bmq/bmqst/bmqst_value.cpp @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_value.cpp -*-C++-*- -#include +// bmqst_value.cpp -*-C++-*- +#include #include #include #include -#include +#include #include namespace BloombergLP { -namespace mwcst { +namespace bmqst { enum { VALUE_NULLTYPE, @@ -127,7 +127,7 @@ size_t Value::hash() const } // close package namespace // FREE OPERATORS -bool mwcst::operator<(const mwcst::Value& lhs, const mwcst::Value& rhs) +bool bmqst::operator<(const bmqst::Value& lhs, const bmqst::Value& rhs) { // give a partial order between types and withint types @@ -195,8 +195,8 @@ bool mwcst::operator<(const mwcst::Value& lhs, const mwcst::Value& rhs) } } -bsl::ostream& mwcst::operator<<(bsl::ostream& stream, - const mwcst::Value& value) +bsl::ostream& bmqst::operator<<(bsl::ostream& stream, + const bmqst::Value& value) { return stream << value.d_value; } diff --git a/src/groups/mwc/mwcst/mwcst_value.h b/src/groups/bmq/bmqst/bmqst_value.h similarity index 94% rename from src/groups/mwc/mwcst/mwcst_value.h rename to src/groups/bmq/bmqst/bmqst_value.h index b279e3e35..d1db0353c 100644 --- a/src/groups/mwc/mwcst/mwcst_value.h +++ b/src/groups/bmq/bmqst/bmqst_value.h @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcst_value.h -*-C++-*- -#ifndef INCLUDED_MWCST_VALUE -#define INCLUDED_MWCST_VALUE +// bmqst_value.h -*-C++-*- +#ifndef INCLUDED_BMQST_VALUE +#define INCLUDED_BMQST_VALUE //@PURPOSE: A variant value able to represent multiple types // //@CLASSES: -// mwcst::Value: a variant value +// bmqst::Value: a variant value // //@DESCRIPTION: // A variant Value that can hold any value of a number of types. It is @@ -46,7 +46,7 @@ #include namespace BloombergLP { -namespace mwcst { +namespace bmqst { // =========== // class Value @@ -263,7 +263,7 @@ inline typename VISITOR::ResultType Value::apply(const VISITOR& visitor) const } // close package namespace // FREE OPERATORS -inline bool mwcst::operator==(const mwcst::Value& lhs, const mwcst::Value& rhs) +inline bool bmqst::operator==(const bmqst::Value& lhs, const bmqst::Value& rhs) { if (lhs.hash() != rhs.hash()) { return false; @@ -272,7 +272,7 @@ inline bool mwcst::operator==(const mwcst::Value& lhs, const mwcst::Value& rhs) return lhs.d_value == rhs.d_value; } -inline bool mwcst::operator!=(const mwcst::Value& lhs, const mwcst::Value& rhs) +inline bool bmqst::operator!=(const bmqst::Value& lhs, const bmqst::Value& rhs) { if (lhs.hash() != rhs.hash()) { return true; @@ -290,14 +290,14 @@ inline bool mwcst::operator!=(const mwcst::Value& lhs, const mwcst::Value& rhs) namespace bsl { template <> -struct hash { +struct hash { // ACCESSORS - size_t operator()(const BloombergLP::mwcst::Value& value) const; + size_t operator()(const BloombergLP::bmqst::Value& value) const; }; // ACCESSORS -inline size_t hash::operator()( - const BloombergLP::mwcst::Value& value) const +inline size_t hash::operator()( + const BloombergLP::bmqst::Value& value) const { return value.hash(); } diff --git a/src/groups/mwc/mwcst/doc/mwcst.txt b/src/groups/bmq/bmqst/doc/bmqst.txt similarity index 64% rename from src/groups/mwc/mwcst/doc/mwcst.txt rename to src/groups/bmq/bmqst/doc/bmqst.txt index d025ab8fe..eab0749f1 100644 --- a/src/groups/mwc/mwcst/doc/mwcst.txt +++ b/src/groups/bmq/bmqst/doc/bmqst.txt @@ -1,5 +1,5 @@ - mwcst.txt + bmqst.txt @PURPOSE: Generic purpose statistics framework. -@MNEMONIC: mwcst +@MNEMONIC: bmqst diff --git a/src/groups/bmq/bmqst/package/bmqst.dep b/src/groups/bmq/bmqst/package/bmqst.dep new file mode 100644 index 000000000..664882191 --- /dev/null +++ b/src/groups/bmq/bmqst/package/bmqst.dep @@ -0,0 +1,3 @@ +bmqscm +bmqstm +bmqu diff --git a/src/groups/bmq/bmqst/package/bmqst.mem b/src/groups/bmq/bmqst/package/bmqst.mem new file mode 100644 index 000000000..23ae5b0c5 --- /dev/null +++ b/src/groups/bmq/bmqst/package/bmqst.mem @@ -0,0 +1,17 @@ +bmqst_basetable +bmqst_basictableinfoprovider +bmqst_printutil +bmqst_statcontext +bmqst_statcontexttableinfoprovider +bmqst_statcontextuserdata +bmqst_statutil +bmqst_statvalue +bmqst_stringkey +bmqst_table +bmqst_tableinfoprovider +bmqst_tablerecords +bmqst_tableschema +bmqst_tableutil +bmqst_testtableinfoprovider +bmqst_testutil +bmqst_value diff --git a/src/groups/mwc/mwcstm/mwcstm.xsd b/src/groups/bmq/bmqstm/bmqstm.xsd similarity index 99% rename from src/groups/mwc/mwcstm/mwcstm.xsd rename to src/groups/bmq/bmqstm/bmqstm.xsd index 8c98023a2..114357f49 100644 --- a/src/groups/mwc/mwcstm/mwcstm.xsd +++ b/src/groups/bmq/bmqstm/bmqstm.xsd @@ -1,7 +1,7 @@ + bdem:package='bmqstm'> diff --git a/src/groups/mwc/mwcstm/mwcstm_values.cpp b/src/groups/bmq/bmqstm/bmqstm_values.cpp similarity index 99% rename from src/groups/mwc/mwcstm/mwcstm_values.cpp rename to src/groups/bmq/bmqstm/bmqstm_values.cpp index 53ca4f37d..52d2a1d26 100644 --- a/src/groups/mwc/mwcstm/mwcstm_values.cpp +++ b/src/groups/bmq/bmqstm/bmqstm_values.cpp @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcstm_values.cpp *DO NOT EDIT* @generated -*-C++-*- +// bmqstm_values.cpp *DO NOT EDIT* @generated -*-C++-*- -#include +#include #include #include @@ -37,7 +37,7 @@ #include namespace BloombergLP { -namespace mwcstm { +namespace bmqstm { // ------------------------------------ // class StatContextConfigurationChoice @@ -1406,4 +1406,4 @@ bsl::ostream& StatContextUpdateList::print(bsl::ostream& stream, // GENERATED BY BLP_BAS_CODEGEN_2024.05.02 // USING bas_codegen.pl -m msg --noAggregateConversion --noExternalization -// --noIdent --package mwcstm --msgComponent values mwcstm.xsd +// --noIdent --package bmqstm --msgComponent values bmqstm.xsd diff --git a/src/groups/mwc/mwcstm/mwcstm_values.h b/src/groups/bmq/bmqstm/bmqstm_values.h similarity index 99% rename from src/groups/mwc/mwcstm/mwcstm_values.h rename to src/groups/bmq/bmqstm/bmqstm_values.h index 58cdd60f6..6e01d5336 100644 --- a/src/groups/mwc/mwcstm/mwcstm_values.h +++ b/src/groups/bmq/bmqstm/bmqstm_values.h @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcstm_values.h *DO NOT EDIT* @generated -*-C++-*- -#ifndef INCLUDED_MWCSTM_VALUES -#define INCLUDED_MWCSTM_VALUES +// bmqstm_values.h *DO NOT EDIT* @generated -*-C++-*- +#ifndef INCLUDED_BMQSTM_VALUES +#define INCLUDED_BMQSTM_VALUES //@PURPOSE: Provide value-semantic attribute classes @@ -56,25 +56,25 @@ namespace bslma { class Allocator; } -namespace mwcstm { +namespace bmqstm { class StatContextConfigurationChoice; } -namespace mwcstm { +namespace bmqstm { class StatValueUpdate; } -namespace mwcstm { +namespace bmqstm { class StatValueDefinition; } -namespace mwcstm { +namespace bmqstm { class StatContextConfiguration; } -namespace mwcstm { +namespace bmqstm { class StatContextUpdate; } -namespace mwcstm { +namespace bmqstm { class StatContextUpdateList; } -namespace mwcstm { +namespace bmqstm { // ==================================== // class StatContextConfigurationChoice @@ -323,9 +323,9 @@ class StatContextConfigurationChoice { // TRAITS BDLAT_DECL_CHOICE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS( - mwcstm::StatContextConfigurationChoice) + bmqstm::StatContextConfigurationChoice) -namespace mwcstm { +namespace bmqstm { // =================================== // class StatContextConfigurationFlags @@ -389,9 +389,9 @@ struct StatContextConfigurationFlags { // TRAITS -BDLAT_DECL_ENUMERATION_TRAITS(mwcstm::StatContextConfigurationFlags) +BDLAT_DECL_ENUMERATION_TRAITS(bmqstm::StatContextConfigurationFlags) -namespace mwcstm { +namespace bmqstm { // ============================ // class StatContextUpdateFlags @@ -455,9 +455,9 @@ struct StatContextUpdateFlags { // TRAITS -BDLAT_DECL_ENUMERATION_TRAITS(mwcstm::StatContextUpdateFlags) +BDLAT_DECL_ENUMERATION_TRAITS(bmqstm::StatContextUpdateFlags) -namespace mwcstm { +namespace bmqstm { // ===================== // class StatValueFields @@ -529,9 +529,9 @@ struct StatValueFields { // TRAITS -BDLAT_DECL_ENUMERATION_TRAITS(mwcstm::StatValueFields) +BDLAT_DECL_ENUMERATION_TRAITS(bmqstm::StatValueFields) -namespace mwcstm { +namespace bmqstm { // =================== // class StatValueType @@ -593,9 +593,9 @@ struct StatValueType { // TRAITS -BDLAT_DECL_ENUMERATION_TRAITS(mwcstm::StatValueType) +BDLAT_DECL_ENUMERATION_TRAITS(bmqstm::StatValueType) -namespace mwcstm { +namespace bmqstm { // ===================== // class StatValueUpdate @@ -820,9 +820,9 @@ class StatValueUpdate { // TRAITS BDLAT_DECL_SEQUENCE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS( - mwcstm::StatValueUpdate) + bmqstm::StatValueUpdate) -namespace mwcstm { +namespace bmqstm { // ========================= // class StatValueDefinition @@ -1063,9 +1063,9 @@ class StatValueDefinition { // TRAITS BDLAT_DECL_SEQUENCE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS( - mwcstm::StatValueDefinition) + bmqstm::StatValueDefinition) -namespace mwcstm { +namespace bmqstm { // ============================== // class StatContextConfiguration @@ -1309,9 +1309,9 @@ class StatContextConfiguration { // TRAITS BDLAT_DECL_SEQUENCE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS( - mwcstm::StatContextConfiguration) + bmqstm::StatContextConfiguration) -namespace mwcstm { +namespace bmqstm { // ======================= // class StatContextUpdate @@ -1596,9 +1596,9 @@ class StatContextUpdate { // TRAITS BDLAT_DECL_SEQUENCE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS( - mwcstm::StatContextUpdate) + bmqstm::StatContextUpdate) -namespace mwcstm { +namespace bmqstm { // =========================== // class StatContextUpdateList @@ -1808,13 +1808,13 @@ class StatContextUpdateList { // TRAITS BDLAT_DECL_SEQUENCE_WITH_ALLOCATOR_BITWISEMOVEABLE_TRAITS( - mwcstm::StatContextUpdateList) + bmqstm::StatContextUpdateList) //============================================================================= // INLINE DEFINITIONS //============================================================================= -namespace mwcstm { +namespace bmqstm { // ------------------------------------ // class StatContextConfigurationChoice @@ -2927,4 +2927,4 @@ StatContextUpdateList::contexts() const // GENERATED BY BLP_BAS_CODEGEN_2024.05.02 // USING bas_codegen.pl -m msg --noAggregateConversion --noExternalization -// --noIdent --package mwcstm --msgComponent values mwcstm.xsd +// --noIdent --package bmqstm --msgComponent values bmqstm.xsd diff --git a/src/groups/mwc/mwcstm/doc/mwcstm.txt b/src/groups/bmq/bmqstm/doc/bmqstm.txt similarity index 73% rename from src/groups/mwc/mwcstm/doc/mwcstm.txt rename to src/groups/bmq/bmqstm/doc/bmqstm.txt index b2c63887b..283edc1d4 100644 --- a/src/groups/mwc/mwcstm/doc/mwcstm.txt +++ b/src/groups/bmq/bmqstm/doc/bmqstm.txt @@ -1,7 +1,7 @@ - mwcstm.txt + bmqstm.txt @PURPOSE: Value semantic types for a generic statistics framework. -@MNEMONIC: mwcstm +@MNEMONIC: bmqstm @DESCRIPTION: diff --git a/src/groups/mwc/mwcscm/package/mwcscm.dep b/src/groups/bmq/bmqstm/package/bmqstm.dep similarity index 100% rename from src/groups/mwc/mwcscm/package/mwcscm.dep rename to src/groups/bmq/bmqstm/package/bmqstm.dep diff --git a/src/groups/bmq/bmqstm/package/bmqstm.mem b/src/groups/bmq/bmqstm/package/bmqstm.mem new file mode 100644 index 000000000..91622ec2b --- /dev/null +++ b/src/groups/bmq/bmqstm/package/bmqstm.mem @@ -0,0 +1 @@ +bmqstm_values diff --git a/src/groups/mwc/mwcsys/mwcsys_executil.cpp b/src/groups/bmq/bmqsys/bmqsys_executil.cpp similarity index 92% rename from src/groups/mwc/mwcsys/mwcsys_executil.cpp rename to src/groups/bmq/bmqsys/bmqsys_executil.cpp index 89fb8e2d9..6400a8355 100644 --- a/src/groups/mwc/mwcsys/mwcsys_executil.cpp +++ b/src/groups/bmq/bmqsys/bmqsys_executil.cpp @@ -13,16 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_executil.cpp -*-C++-*- -#include +// bmqsys_executil.cpp -*-C++-*- +#include -#include +#include // BMQ -#include +#include -// MWC -#include +#include // BDE #include @@ -37,7 +36,7 @@ #include // for WIFEXITED, WEXITSTATUS namespace BloombergLP { -namespace mwcsys { +namespace bmqsys { // --------------- // struct ExecUtil @@ -68,7 +67,7 @@ int ExecUtil::execute(bsl::string* output, const char* command) // Read the output bdlma::LocalSequentialAllocator<2048> localAllocator( bslma::Default::allocator(0)); - mwcu::MemOutStream cmdOutput(&localAllocator); + bmqu::MemOutStream cmdOutput(&localAllocator); char buffer[1024]; while (!feof(pipe)) { @@ -106,7 +105,7 @@ int ExecUtil::outputFromFile(bsl::string* output, bdlma::LocalSequentialAllocator<1024> localAllocator( bslma::Default::allocator()); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); // Ensure the file exist and is a regular file (not a directory or other) if (!bdls::FilesystemUtil::isRegularFile(srcFile, true)) { @@ -128,7 +127,7 @@ int ExecUtil::outputFromFile(bsl::string* output, bsl::string firstLine(&localAllocator); getline(stream, firstLine); - if (!mwcu::StringUtil::startsWith(firstLine, "#!")) { + if (!bmqu::StringUtil::startsWith(firstLine, "#!")) { stream.clear(); // Reset the state (error bits) of the stream, in case // the file was empty, the above readline sets the // failbit, which will prevent the 'tellg' from diff --git a/src/groups/mwc/mwcsys/mwcsys_executil.h b/src/groups/bmq/bmqsys/bmqsys_executil.h similarity index 89% rename from src/groups/mwc/mwcsys/mwcsys_executil.h rename to src/groups/bmq/bmqsys/bmqsys_executil.h index a69417b8a..bbac88d64 100644 --- a/src/groups/mwc/mwcsys/mwcsys_executil.h +++ b/src/groups/bmq/bmqsys/bmqsys_executil.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_executil.h -*-C++-*- -#ifndef INCLUDED_MWCSYS_EXECUTIL -#define INCLUDED_MWCSYS_EXECUTIL +// bmqsys_executil.h -*-C++-*- +#ifndef INCLUDED_BMQSYS_EXECUTIL +#define INCLUDED_BMQSYS_EXECUTIL //@PURPOSE: Provide utilities to execute commands on the system. // //@CLASSES: -// mwcsys::ExecUtil: Utility to execute commands on the system +// bmqsys::ExecUtil: Utility to execute commands on the system // -//@DESCRIPTION: 'mwcsys::ExecUtil' provides a utility namespace for executing +//@DESCRIPTION: 'bmqsys::ExecUtil' provides a utility namespace for executing // commands on the system and retrieving the status code as well as the output. // /// Usage Example @@ -38,7 +38,7 @@ // // // Execute the command // bsl::string output; -// int rc = mwcsys::ExecUtil::execute(&output, command.str().c_str()); +// int rc = bmqsys::ExecUtil::execute(&output, command.str().c_str()); // if (rc != 0) { // // Command failed to execute // BALL_LOG_ERROR << "Error while executing command '" << command.str() @@ -49,13 +49,11 @@ // // Command successfully executed, do something with its 'output'. //.. -// MWC - // BDE #include namespace BloombergLP { -namespace mwcsys { +namespace bmqsys { // =============== // struct ExecUtil diff --git a/src/groups/mwc/mwcsys/mwcsys_executil.t.cpp b/src/groups/bmq/bmqsys/bmqsys_executil.t.cpp similarity index 89% rename from src/groups/mwc/mwcsys/mwcsys_executil.t.cpp rename to src/groups/bmq/bmqsys/bmqsys_executil.t.cpp index 739b357d8..ba234787d 100644 --- a/src/groups/mwc/mwcsys/mwcsys_executil.t.cpp +++ b/src/groups/bmq/bmqsys/bmqsys_executil.t.cpp @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_executil.t.cpp -*-C++-*- -#include +// bmqsys_executil.t.cpp -*-C++-*- +#include // BDE #include @@ -24,7 +24,7 @@ #include // for chmod // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -70,7 +70,7 @@ static void test1_execute() // Proper behavior of the 'execute()' method. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("execute"); + bmqtst::TestHelper::printTestName("execute"); struct Test { int d_line; // Line @@ -97,7 +97,7 @@ static void test1_execute() PVV(test.d_line << ": executing command '" << test.d_command << "'"); bsl::string output(s_allocator_p); - const int rc = mwcsys::ExecUtil::execute(&output, test.d_command); + const int rc = bmqsys::ExecUtil::execute(&output, test.d_command); ASSERT_EQ_D("line " << test.d_line, rc, test.d_expectedRc); ASSERT_EQ_D("line " << test.d_line, output, test.d_expectedOutput); } @@ -123,7 +123,7 @@ static void test2_executeSystemFailure() // Proper behavior of the 'execute()' method in case of system failures. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("execute (system failure)"); + bmqtst::TestHelper::printTestName("execute (system failure)"); bsl::string output(s_allocator_p); int rc; @@ -133,11 +133,11 @@ static void test2_executeSystemFailure() #if defined(BSLS_PLATFORM_OS_SOLARIS) // For Solaris, python2 support is stopped, and alias `python3` // doesn't exist. The final supported release is 3.8. - rc = mwcsys::ExecUtil::execute(&output, + rc = bmqsys::ExecUtil::execute(&output, "python3.8 -c 'import os,signal; " "os.kill(os.getpid(), signal.SIGKILL)'"); #else - rc = mwcsys::ExecUtil::execute(&output, + rc = bmqsys::ExecUtil::execute(&output, "python3 -c 'import os,signal; " "os.kill(os.getpid(), signal.SIGKILL)'"); #endif @@ -150,7 +150,7 @@ static void test2_executeSystemFailure() rc = setrlimit(RLIMIT_NOFILE, &limit); ASSERT_EQ(rc, 0); - rc = mwcsys::ExecUtil::execute(&output, "bash -c \"/bin/echo 'test'\""); + rc = bmqsys::ExecUtil::execute(&output, "bash -c \"/bin/echo 'test'\""); // NOTE: We must force use '/bin/echo' and not just 'echo' to make sure // it will fork and not just run it as a shell built-in. ASSERT_EQ(rc, -1); @@ -174,10 +174,10 @@ static void test3_outputFromFileNoGen() // not a script. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("outputFromFile (noGen)"); + bmqtst::TestHelper::printTestName("outputFromFile (noGen)"); - const char k_TESTFILE[] = "./mwcsys_executil.t.3.in"; - const char k_CONTENT[] = "Test file\ngenerated by mwcsys::ExecUtil.t"; + const char k_TESTFILE[] = "./bmqsys_executil.t.3.in"; + const char k_CONTENT[] = "Test file\ngenerated by bmqsys::ExecUtil.t"; struct Test { int d_line; // Line @@ -204,7 +204,7 @@ static void test3_outputFromFileNoGen() createFile(k_TESTFILE, test.d_content, S_IRWXU); bsl::string output(s_allocator_p); - const int rc = mwcsys::ExecUtil::outputFromFile(&output, + const int rc = bmqsys::ExecUtil::outputFromFile(&output, k_TESTFILE, test.d_arguments); ASSERT_EQ_D("line " << test.d_line, rc, 0); @@ -235,9 +235,9 @@ static void test4_outputFromFileGen() // a script. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("outputFromFile (gen)"); + bmqtst::TestHelper::printTestName("outputFromFile (gen)"); - const char k_TESTFILE[] = "./mwcsys_executil.t.4.in"; + const char k_TESTFILE[] = "./bmqsys_executil.t.4.in"; struct Test { int d_line; @@ -263,7 +263,7 @@ static void test4_outputFromFileGen() createFile(k_TESTFILE, test.d_content, S_IRWXU); bsl::string output(s_allocator_p); - const int rc = mwcsys::ExecUtil::outputFromFile(&output, + const int rc = bmqsys::ExecUtil::outputFromFile(&output, k_TESTFILE, test.d_arguments); ASSERT_EQ_D("line " << test.d_line, (rc == 0), test.d_expectSuccess); @@ -288,9 +288,9 @@ static void test5_outputFromFileError() // invalid. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("outputFromFile (error)"); + bmqtst::TestHelper::printTestName("outputFromFile (error)"); - const char k_TESTFILE[] = "./mwcsys_executil.t.5.in"; + const char k_TESTFILE[] = "./bmqsys_executil.t.5.in"; { PV("Non-existent input file"); @@ -300,7 +300,7 @@ static void test5_outputFromFileError() } bsl::string output(s_allocator_p); - const int rc = mwcsys::ExecUtil::outputFromFile(&output, + const int rc = bmqsys::ExecUtil::outputFromFile(&output, k_TESTFILE, "dummyArgs"); ASSERT_NE(rc, 0); @@ -310,7 +310,7 @@ static void test5_outputFromFileError() PV("Not a regular input file"); bsl::string output(s_allocator_p); - const int rc = mwcsys::ExecUtil::outputFromFile(&output, + const int rc = bmqsys::ExecUtil::outputFromFile(&output, "./", // a directory "dummyArgs"); ASSERT_NE(rc, 0); @@ -322,7 +322,7 @@ static void test5_outputFromFileError() createFile(k_TESTFILE, "#! /bin/bash\necho -n 'yes'", S_IRUSR); bsl::string output(s_allocator_p); - const int rc = mwcsys::ExecUtil::outputFromFile(&output, + const int rc = bmqsys::ExecUtil::outputFromFile(&output, k_TESTFILE, "dummyArgs"); ASSERT_NE(rc, 0); @@ -338,7 +338,7 @@ static void test5_outputFromFileError() S_IRWXU); bsl::string output(s_allocator_p); - const int rc = mwcsys::ExecUtil::outputFromFile(&output, + const int rc = bmqsys::ExecUtil::outputFromFile(&output, k_TESTFILE, "dummyArgs"); ASSERT_NE(rc, 0); @@ -353,7 +353,7 @@ static void test5_outputFromFileError() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -372,5 +372,5 @@ int main(int argc, char* argv[]) // allocator. The string allocates memory in heap if we provide a long // enough filename to the call. It causes the default allocator check to // fail. More details in the ticket 176461860. - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcsys/mwcsys_mocktime.cpp b/src/groups/bmq/bmqsys/bmqsys_mocktime.cpp similarity index 90% rename from src/groups/mwc/mwcsys/mwcsys_mocktime.cpp rename to src/groups/bmq/bmqsys/bmqsys_mocktime.cpp index 0750d1035..850e1b609 100644 --- a/src/groups/mwc/mwcsys/mwcsys_mocktime.cpp +++ b/src/groups/bmq/bmqsys/bmqsys_mocktime.cpp @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_mocktime.cpp -*-C++-*- -#include +// bmqsys_mocktime.cpp -*-C++-*- +#include -#include -// MWC -#include +#include + +#include // BDE #include namespace BloombergLP { -namespace mwcsys { +namespace bmqsys { // -------------- // class MockTime @@ -35,7 +35,7 @@ MockTime::MockTime() , d_monotonicClock(0, 0) , d_highResTimer(0) { - mwcsys::Time::initialize( + bmqsys::Time::initialize( bdlf::MemFnUtil::memFn(&MockTime::realtimeClock, this), bdlf::MemFnUtil::memFn(&MockTime::monotonicClock, this), bdlf::MemFnUtil::memFn(&MockTime::highResTimer, this)); @@ -43,7 +43,7 @@ MockTime::MockTime() MockTime::~MockTime() { - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); } MockTime& MockTime::setRealTimeClock(const bsls::TimeInterval& value) diff --git a/src/groups/mwc/mwcsys/mwcsys_mocktime.h b/src/groups/bmq/bmqsys/bmqsys_mocktime.h similarity index 81% rename from src/groups/mwc/mwcsys/mwcsys_mocktime.h rename to src/groups/bmq/bmqsys/bmqsys_mocktime.h index d8988cc5b..e2434c091 100644 --- a/src/groups/mwc/mwcsys/mwcsys_mocktime.h +++ b/src/groups/bmq/bmqsys/bmqsys_mocktime.h @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_mocktime.h -*-C++-*- -#ifndef INCLUDED_MWCSYS_MOCKTIME -#define INCLUDED_MWCSYS_MOCKTIME +// bmqsys_mocktime.h -*-C++-*- +#ifndef INCLUDED_BMQSYS_MOCKTIME +#define INCLUDED_BMQSYS_MOCKTIME -//@PURPOSE: Provide a mock of the time accessors usable with 'mwcsys::Time'. +//@PURPOSE: Provide a mock of the time accessors usable with 'bmqsys::Time'. // //@CLASSES: -// mwcsys::MockTime: mock utility of the 'mwcsys::Time' accessors +// bmqsys::MockTime: mock utility of the 'bmqsys::Time' accessors // -//@DESCRIPTION: 'mwcsys::MockTime' provides a utility that can be used with -//'mwcsys::Time' to control the time. +//@DESCRIPTION: 'bmqsys::MockTime' provides a utility that can be used with +//'bmqsys::Time' to control the time. // /// Usage Example ///------------- @@ -34,24 +34,22 @@ // // mockTime.advanceHighResTimer(10); // -// mwcsys::Time::shutdown(); +// bmqsys::Time::shutdown(); //.. -// MWC - // BDE #include #include #include namespace BloombergLP { -namespace mwcsys { +namespace bmqsys { // ============== // class MockTime // ============== -/// A mock utility of the time accessors usable with `mwcsys::Time`. +/// A mock utility of the time accessors usable with `bmqsys::Time`. class MockTime { private: // DATA @@ -64,13 +62,13 @@ class MockTime { MockTime(const MockTime&) BSLS_KEYWORD_DELETED; MockTime& operator=(const MockTime&) BSLS_KEYWORD_DELETED; // Copy constructor and assignment operator not implemented (because - // MockTime, for convenience, registers itself to 'mwcsys::Time' in + // MockTime, for convenience, registers itself to 'bmqsys::Time' in // its constructor). public: // CREATORS - /// Default constructor - and register this object to the mwcsys::Time + /// Default constructor - and register this object to the bmqsys::Time MockTime(); /// Destructor diff --git a/src/groups/mwc/mwcsys/mwcsys_mocktime.t.cpp b/src/groups/bmq/bmqsys/bmqsys_mocktime.t.cpp similarity index 88% rename from src/groups/mwc/mwcsys/mwcsys_mocktime.t.cpp rename to src/groups/bmq/bmqsys/bmqsys_mocktime.t.cpp index 5962dda83..f488eb9e3 100644 --- a/src/groups/mwc/mwcsys/mwcsys_mocktime.t.cpp +++ b/src/groups/bmq/bmqsys/bmqsys_mocktime.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_mocktime.t.cpp -*-C++-*- -#include +// bmqsys_mocktime.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -29,9 +29,9 @@ using namespace bsl; static void test1_basicFunctionality() { - mwctst::TestHelper::printTestName("BASIC FUNCTIONALITY"); + bmqtst::TestHelper::printTestName("BASIC FUNCTIONALITY"); - mwcsys::MockTime obj; + bmqsys::MockTime obj; PV("Default constructed state"); ASSERT_EQ(obj.realtimeClock(), bsls::TimeInterval(0)); @@ -67,7 +67,7 @@ static void test1_basicFunctionality() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -78,5 +78,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcsys/mwcsys_statmonitor.cpp b/src/groups/bmq/bmqsys/bmqsys_statmonitor.cpp similarity index 84% rename from src/groups/mwc/mwcsys/mwcsys_statmonitor.cpp rename to src/groups/bmq/bmqsys/bmqsys_statmonitor.cpp index 55621c0f4..783092c61 100644 --- a/src/groups/mwc/mwcsys/mwcsys_statmonitor.cpp +++ b/src/groups/bmq/bmqsys/bmqsys_statmonitor.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_statmonitor.cpp -*-C++-*- -#include +// bmqsys_statmonitor.cpp -*-C++-*- +#include -#include -// MWC -#include -#include +#include + +#include +#include // BDE #include @@ -39,7 +39,7 @@ #include // for getrusage() namespace BloombergLP { -namespace mwcsys { +namespace bmqsys { namespace { @@ -112,9 +112,9 @@ enum { }; typedef bsl::function< - double(const mwcst::StatContext& statCtx, int snapshotId, int statId)> + double(const bmqst::StatContext& statCtx, int snapshotId, int statId)> AccessorDouble; -typedef bsl::function AccessorInt64; @@ -124,13 +124,13 @@ typedef bsl::functionclearValues(); } -mwcst::StatContext* StatMonitor::statContext() +bmqst::StatContext* StatMonitor::statContext() { return &d_systemStatContext; } @@ -326,17 +326,17 @@ void StatMonitor::snapshot() // ---------------------- bsls::Types::Int64 -StatMonitorUtil::getSystemStat(const mwcst::StatContext& statContext, +StatMonitorUtil::getSystemStat(const bmqst::StatContext& statContext, int snapshotId, int statId) { - const mwcst::StatValue& statValue = - statContext.value(mwcst::StatContext::e_TOTAL_VALUE, statId); + const bmqst::StatValue& statValue = + statContext.value(bmqst::StatContext::e_TOTAL_VALUE, statId); - const bsls::Types::Int64 value = mwcst::StatUtil::rangeMax( + const bsls::Types::Int64 value = bmqst::StatUtil::rangeMax( statValue, - mwcst::StatValue::SnapshotLocation(0, 0), - mwcst::StatValue::SnapshotLocation(0, snapshotId)); + bmqst::StatValue::SnapshotLocation(0, 0), + bmqst::StatValue::SnapshotLocation(0, snapshotId)); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( value == bsl::numeric_limits::min())) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; @@ -346,17 +346,17 @@ StatMonitorUtil::getSystemStat(const mwcst::StatContext& statContext, return value; } -double StatMonitorUtil::getCpuStat(const mwcst::StatContext& statContext, +double StatMonitorUtil::getCpuStat(const bmqst::StatContext& statContext, int snapshotId, int statId) { - const mwcst::StatValue::SnapshotLocation firstSnapshot(0, 0); - const mwcst::StatValue::SnapshotLocation secondSnapshot(0, snapshotId); + const bmqst::StatValue::SnapshotLocation firstSnapshot(0, 0); + const bmqst::StatValue::SnapshotLocation secondSnapshot(0, snapshotId); - const mwcst::StatValue& statValue = - statContext.value(mwcst::StatContext::e_TOTAL_VALUE, statId); + const bmqst::StatValue& statValue = + statContext.value(bmqst::StatContext::e_TOTAL_VALUE, statId); - double value = mwcst::StatUtil::averagePerEventReal(statValue, + double value = bmqst::StatUtil::averagePerEventReal(statValue, firstSnapshot, secondSnapshot); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(value != value)) { @@ -371,17 +371,17 @@ double StatMonitorUtil::getCpuStat(const mwcst::StatContext& statContext, } bsls::Types::Int64 -StatMonitorUtil::getMemStat(const mwcst::StatContext& statContext, +StatMonitorUtil::getMemStat(const bmqst::StatContext& statContext, int snapshotId, int statId) { - const mwcst::StatValue& statValue = - statContext.value(mwcst::StatContext::e_TOTAL_VALUE, statId); + const bmqst::StatValue& statValue = + statContext.value(bmqst::StatContext::e_TOTAL_VALUE, statId); - const bsls::Types::Int64 value = mwcst::StatUtil::rangeMax( + const bsls::Types::Int64 value = bmqst::StatUtil::rangeMax( statValue, - mwcst::StatValue::SnapshotLocation(0, 0), - mwcst::StatValue::SnapshotLocation(0, snapshotId)); + bmqst::StatValue::SnapshotLocation(0, 0), + bmqst::StatValue::SnapshotLocation(0, snapshotId)); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( value == bsl::numeric_limits::min())) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; @@ -392,22 +392,22 @@ StatMonitorUtil::getMemStat(const mwcst::StatContext& statContext, } bsls::Types::Int64 -StatMonitorUtil::getOperatingSystemStat(const mwcst::StatContext& statContext, +StatMonitorUtil::getOperatingSystemStat(const bmqst::StatContext& statContext, int snapshotId, int statId) { - const mwcst::StatValue& statValue = - statContext.value(mwcst::StatContext::e_TOTAL_VALUE, statId); + const bmqst::StatValue& statValue = + statContext.value(bmqst::StatContext::e_TOTAL_VALUE, statId); - return mwcst::StatUtil::valueDifference( + return bmqst::StatUtil::valueDifference( statValue, - mwcst::StatValue::SnapshotLocation(0, 0), - mwcst::StatValue::SnapshotLocation(0, snapshotId)); + bmqst::StatValue::SnapshotLocation(0, 0), + bmqst::StatValue::SnapshotLocation(0, snapshotId)); } #define ACCESSOR_METHOD_SYSTEM(NAME, ID) \ bsls::Types::Int64 StatMonitorUtil::NAME( \ - const mwcst::StatContext& statContext, \ + const bmqst::StatContext& statContext, \ int snapshotId) \ { \ const AccessorInt64 accessor = bdlf::BindUtil::bind( \ @@ -419,7 +419,7 @@ StatMonitorUtil::getOperatingSystemStat(const mwcst::StatContext& statContext, } #define ACCESSOR_METHOD_CPU(NAME, ID) \ - double StatMonitorUtil::NAME(const mwcst::StatContext& statContext, \ + double StatMonitorUtil::NAME(const bmqst::StatContext& statContext, \ int snapshotId) \ { \ const AccessorDouble accessor = bdlf::BindUtil::bind( \ @@ -436,7 +436,7 @@ StatMonitorUtil::getOperatingSystemStat(const mwcst::StatContext& statContext, #define ACCESSOR_METHOD_MEM(NAME, ID) \ bsls::Types::Int64 StatMonitorUtil::NAME( \ - const mwcst::StatContext& statContext, \ + const bmqst::StatContext& statContext, \ int snapshotId) \ { \ const AccessorInt64 accessor = bdlf::BindUtil::bind( \ @@ -453,7 +453,7 @@ StatMonitorUtil::getOperatingSystemStat(const mwcst::StatContext& statContext, #define ACCESSOR_METHOD_OS(NAME, ID) \ bsls::Types::Int64 StatMonitorUtil::NAME( \ - const mwcst::StatContext& statContext, \ + const bmqst::StatContext& statContext, \ int snapshotId) \ { \ const AccessorInt64 accessor = bdlf::BindUtil::bind( \ diff --git a/src/groups/mwc/mwcsys/mwcsys_statmonitor.h b/src/groups/bmq/bmqsys/bmqsys_statmonitor.h similarity index 91% rename from src/groups/mwc/mwcsys/mwcsys_statmonitor.h rename to src/groups/bmq/bmqsys/bmqsys_statmonitor.h index 98eb49c60..09e11196b 100644 --- a/src/groups/mwc/mwcsys/mwcsys_statmonitor.h +++ b/src/groups/bmq/bmqsys/bmqsys_statmonitor.h @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_statmonitor.h -*-C++-*- -#ifndef INCLUDED_MWCSYS_STATMONITOR -#define INCLUDED_MWCSYS_STATMONITOR +// bmqsys_statmonitor.h -*-C++-*- +#ifndef INCLUDED_BMQSYS_STATMONITOR +#define INCLUDED_BMQSYS_STATMONITOR //@PURPOSE: Provide a mechanism to monitor cpu, memory, and os stats. // //@CLASSES: -// mwcsys::StatMonitor : Mechanism to monitor cpu, memory, os stats. -// mwcsys::StatMonitorUtil: Utility to access monitor cpu, memory, os stats. +// bmqsys::StatMonitor : Mechanism to monitor cpu, memory, os stats. +// bmqsys::StatMonitorUtil: Utility to access monitor cpu, memory, os stats. // -//@DESCRIPTION: 'mwcsys::StatMonitor' provides a mechanism that takes snapshots +//@DESCRIPTION: 'bmqsys::StatMonitor' provides a mechanism that takes snapshots // of the cpu, memory usage, and context switches of the current process and // provides accessors to those values over a range of historical snapshots. // The last 'maxSnapshots' (from the constructor parameter) values are kept, @@ -32,7 +32,7 @@ // cpu (user, system and all) and the maximum memory (resident and virtual) // used as reported by the 'balb::PerformanceMonitor'. It also tracks page // faults (minor and major) and context switches (voluntary and involuntary) as -// reported by the 'getrusage' system call. 'mwcsys::StatMonitorUtil' provides +// reported by the 'getrusage' system call. 'bmqsys::StatMonitorUtil' provides // a utility namespace for static accessors that allow access of system // statistics from a stat context. //.. @@ -81,16 +81,14 @@ // /// StatContext ///----------- -// Statistics are kept in a 'mwcst::StatContext' having a root level named +// Statistics are kept in a 'bmqst::StatContext' having a root level named // 'System', and three subcontexts 'cpu', 'mem', and 'os'. // /// Thread Safety ///------------- // NOT Thread-Safe. -// MWC - -#include +#include // BDE #include @@ -102,7 +100,7 @@ #include namespace BloombergLP { -namespace mwcsys { +namespace bmqsys { // ================= // class StatMonitor @@ -120,7 +118,7 @@ namespace mwcsys { class StatMonitor { private: // CLASS-SCOPE CATEGORY - BALL_LOG_SET_CLASS_CATEGORY("MWCSYS.STATMONITOR"); + BALL_LOG_SET_CLASS_CATEGORY("BMQSYS.STATMONITOR"); private: // DATA @@ -130,16 +128,16 @@ class StatMonitor { int d_pid; // PID of the current process - mwcst::StatContext d_systemStatContext; + bmqst::StatContext d_systemStatContext; // The root statistic context - bslma::ManagedPtr d_cpuStatContext_mp; + bslma::ManagedPtr d_cpuStatContext_mp; // StatContext for cpu stats - bslma::ManagedPtr d_memStatContext_mp; + bslma::ManagedPtr d_memStatContext_mp; // StatContext for memory stats - bslma::ManagedPtr d_osStatContext_mp; + bslma::ManagedPtr d_osStatContext_mp; // StatContext for operating system // stats ('os' == operating system) @@ -177,7 +175,7 @@ class StatMonitor { void stop(); /// Return the top-level stat context. - mwcst::StatContext* statContext(); + bmqst::StatContext* statContext(); /// Take a snapshot of the system stats. The behavior is undefined if /// `start` was not called (or failed). @@ -288,7 +286,7 @@ struct StatMonitorUtil { /// /// max(value[0, snapshotId]) static bsls::Types::Int64 - getSystemStat(const mwcst::StatContext& statContext, + getSystemStat(const bmqst::StatContext& statContext, int snapshotId, int statId); @@ -300,7 +298,7 @@ struct StatMonitorUtil { /// individual values snapshot-ed over [0, snapshotId]. /// /// avg(value[0, snapshotId]) - static double getCpuStat(const mwcst::StatContext& statContext, + static double getCpuStat(const bmqst::StatContext& statContext, int snapshotId, int statId); @@ -311,7 +309,7 @@ struct StatMonitorUtil { /// snapshotId]: /// /// max(value[0, snapshotId]) - static bsls::Types::Int64 getMemStat(const mwcst::StatContext& statContext, + static bsls::Types::Int64 getMemStat(const bmqst::StatContext& statContext, int snapshotId, int statId); @@ -323,7 +321,7 @@ struct StatMonitorUtil { /// /// difference(value[0], value[snapshotId]). static bsls::Types::Int64 - getOperatingSystemStat(const mwcst::StatContext& statContext, + getOperatingSystemStat(const bmqst::StatContext& statContext, int snapshotId, int statId); @@ -333,7 +331,7 @@ struct StatMonitorUtil { /// Return the amount of time (in seconds) the process has been running. /// Note that since the uptime increases monotonically, the snapshotId /// should be equal to zero. - static bsls::Types::Int64 uptime(const mwcst::StatContext& statContext, + static bsls::Types::Int64 uptime(const bmqst::StatContext& statContext, int snapshotId = 0); /// Return the average cpu system value over the period starting from @@ -343,7 +341,7 @@ struct StatMonitorUtil { /// individual values snapshot-ed over [0, snapshotId]: /// /// avg(value[0, snapshotId]) - static double cpuSystem(const mwcst::StatContext& statContext, + static double cpuSystem(const bmqst::StatContext& statContext, int snapshotId); /// Return the average cpu user value over the period starting from the @@ -353,7 +351,7 @@ struct StatMonitorUtil { /// individual values snapshot-ed over [0, snapshotId]: /// /// avg(value[0, snapshotId]) - static double cpuUser(const mwcst::StatContext& statContext, + static double cpuUser(const bmqst::StatContext& statContext, int snapshotId); /// Return the average cpu all (user + system) value over the period @@ -363,7 +361,7 @@ struct StatMonitorUtil { /// average of the individual values snapshot-ed over [0, snapshotId]: /// /// avg(value[0, snapshotId]) - static double cpuAll(const mwcst::StatContext& statContext, + static double cpuAll(const bmqst::StatContext& statContext, int snapshotId); /// Return the maximum value of resident memory (in bytes) snapshot-ed @@ -372,14 +370,14 @@ struct StatMonitorUtil { /// /// max(value[0, snapshotId]) static bsls::Types::Int64 - memResident(const mwcst::StatContext& statContext, int snapshotId); + memResident(const bmqst::StatContext& statContext, int snapshotId); /// Return the maximum value of virtual memory (bytes on the heap) /// snapshot-ed between the specified `snapshotId` snapshots ago and the /// latest snapshot (i.e., at `snapshotId == 0`), inclusive. /// /// max(value[0, snapshotId]) - static bsls::Types::Int64 memVirtual(const mwcst::StatContext& statContext, + static bsls::Types::Int64 memVirtual(const bmqst::StatContext& statContext, int snapshotId); /// Return the number of minor page faults that occurred between the @@ -388,7 +386,7 @@ struct StatMonitorUtil { /// /// difference(value[0], value[snapshotId]) static bsls::Types::Int64 - minorPageFaults(const mwcst::StatContext& statContext, int snapshotId); + minorPageFaults(const bmqst::StatContext& statContext, int snapshotId); /// Return the number of major page faults that occurred between the /// specified `snapshotId` snapshots ago and the latest snapshot (i.e., @@ -396,14 +394,14 @@ struct StatMonitorUtil { /// /// difference(value[0], value[snapshotId]) static bsls::Types::Int64 - majorPageFaults(const mwcst::StatContext& statContext, int snapshotId); + majorPageFaults(const bmqst::StatContext& statContext, int snapshotId); /// Return the number of swaps that occurred between the specified /// `snapshotId` snapshots ago and the latest snapshot (i.e., at /// `snapshotId == 0`), inclusive. /// /// difference(value[0], value[snapshotId]). - static bsls::Types::Int64 numSwaps(const mwcst::StatContext& statContext, + static bsls::Types::Int64 numSwaps(const bmqst::StatContext& statContext, int snapshotId); /// Return the number of voluntary context switches that occurred @@ -412,7 +410,7 @@ struct StatMonitorUtil { /// /// difference(value[0], value[snapshotId]). static bsls::Types::Int64 - voluntaryContextSwitches(const mwcst::StatContext& statContext, + voluntaryContextSwitches(const bmqst::StatContext& statContext, int snapshotId); /// Return the number of involuntary context switches that occurred @@ -421,7 +419,7 @@ struct StatMonitorUtil { /// /// difference(value[0], value[snapshotId]). static bsls::Types::Int64 - involuntaryContextSwitches(const mwcst::StatContext& statContext, + involuntaryContextSwitches(const bmqst::StatContext& statContext, int snapshotId); }; diff --git a/src/groups/mwc/mwcsys/mwcsys_statmonitor.t.cpp b/src/groups/bmq/bmqsys/bmqsys_statmonitor.t.cpp similarity index 95% rename from src/groups/mwc/mwcsys/mwcsys_statmonitor.t.cpp rename to src/groups/bmq/bmqsys/bmqsys_statmonitor.t.cpp index bbfe8e78b..d16734e23 100644 --- a/src/groups/mwc/mwcsys/mwcsys_statmonitor.t.cpp +++ b/src/groups/bmq/bmqsys/bmqsys_statmonitor.t.cpp @@ -13,11 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_statmonitor.t.cpp -*-C++-*- -#include +// bmqsys_statmonitor.t.cpp -*-C++-*- +#include -// MWC -#include +#include // BDE #include @@ -49,7 +48,7 @@ #endif // BSLS_PLATFORM_OS_DARWIN // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -244,7 +243,7 @@ static void test1_breathingTest() // - Constructor // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); s_ignoreCheckDefAlloc = true; // 'snapshot' passes a string using default alloc @@ -253,8 +252,8 @@ static void test1_breathingTest() { const int k_HISTORY_SIZE = 5; - mwcu::MemOutStream errorDesc(s_allocator_p); - mwcsys::StatMonitor obj(k_HISTORY_SIZE, s_allocator_p); + bmqu::MemOutStream errorDesc(s_allocator_p); + bmqsys::StatMonitor obj(k_HISTORY_SIZE, s_allocator_p); ASSERT(obj.isStarted() == false); ASSERT(obj.statContext() != 0); @@ -300,12 +299,12 @@ static void test2_start() s_ignoreCheckDefAlloc = true; // 'start' passes a string using default alloc - mwctst::TestHelper::printTestName("START"); + bmqtst::TestHelper::printTestName("START"); const int k_HISTORY_SIZE = 5; - mwcu::MemOutStream errorDesc(s_allocator_p); - mwcsys::StatMonitor obj(k_HISTORY_SIZE, s_allocator_p); + bmqu::MemOutStream errorDesc(s_allocator_p); + bmqsys::StatMonitor obj(k_HISTORY_SIZE, s_allocator_p); // Given BSLS_ASSERT_OPT(obj.isStarted() == false); @@ -353,12 +352,12 @@ static void test3_stop() s_ignoreCheckDefAlloc = true; // 'start' passes a string using default alloc - mwctst::TestHelper::printTestName("STOP"); + bmqtst::TestHelper::printTestName("STOP"); const int k_HISTORY_SIZE = 5; - mwcu::MemOutStream errorDesc(s_allocator_p); - mwcsys::StatMonitor obj(k_HISTORY_SIZE, s_allocator_p); + bmqu::MemOutStream errorDesc(s_allocator_p); + bmqsys::StatMonitor obj(k_HISTORY_SIZE, s_allocator_p); // Given BSLS_ASSERT_OPT(obj.start(errorDesc) == 0); @@ -443,12 +442,12 @@ static void test4_snapshot() s_ignoreCheckDefAlloc = true; // 'start' passes a string using default alloc - mwctst::TestHelper::printTestName("SNAPSHOT"); + bmqtst::TestHelper::printTestName("SNAPSHOT"); const int k_HISTORY_SIZE = 5; - mwcu::MemOutStream errorDesc(s_allocator_p); - mwcsys::StatMonitor obj(k_HISTORY_SIZE, s_allocator_p); + bmqu::MemOutStream errorDesc(s_allocator_p); + bmqsys::StatMonitor obj(k_HISTORY_SIZE, s_allocator_p); // Given int rc = obj.start(errorDesc); @@ -565,7 +564,7 @@ static void test4_snapshot() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -579,5 +578,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcsys/mwcsys_statmonitorsnapshotrecorder.cpp b/src/groups/bmq/bmqsys/bmqsys_statmonitorsnapshotrecorder.cpp similarity index 84% rename from src/groups/mwc/mwcsys/mwcsys_statmonitorsnapshotrecorder.cpp rename to src/groups/bmq/bmqsys/bmqsys_statmonitorsnapshotrecorder.cpp index 9cb385456..3a5cf5362 100644 --- a/src/groups/mwc/mwcsys/mwcsys_statmonitorsnapshotrecorder.cpp +++ b/src/groups/bmq/bmqsys/bmqsys_statmonitorsnapshotrecorder.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_statmonitorsnapshotrecorder.cpp -*-C++-*- -#include +// bmqsys_statmonitorsnapshotrecorder.cpp -*-C++-*- +#include -#include -// MWC -#include -#include -#include -#include +#include + +#include +#include +#include +#include // BDE #include @@ -29,12 +29,12 @@ #include namespace BloombergLP { -namespace mwcsys { +namespace bmqsys { namespace { /// Constant for the number of snapshots holding historical values in -/// `mwcsys::StatMonitor`. Only need to keep one snapshot back. +/// `bmqsys::StatMonitor`. Only need to keep one snapshot back. const bsls::Types::Int64 k_HISTORY_SIZE = 1; } // close anonymous namespace @@ -60,7 +60,7 @@ struct StatMonitorSnapshotRecorder::Impl { bsl::string d_header; // Top-level header when printing // statistics - mwcsys::StatMonitor d_statMonitor; // Statistics monitor (for CPU, + bmqsys::StatMonitor d_statMonitor; // Statistics monitor (for CPU, // voluntary context switches) bslma::Allocator* d_allocator_p; // Allocator used to supply memory @@ -96,7 +96,7 @@ StatMonitorSnapshotRecorder::StatMonitorSnapshotRecorder( : d_impl_sp() { // Set the pimpl - const bsls::Types::Int64 now = mwcsys::Time::highResolutionTimer(); + const bsls::Types::Int64 now = bmqsys::Time::highResolutionTimer(); bslma::Allocator* alloc = bslma::Default::allocator(allocator); d_impl_sp.createInplace(alloc, now, now, header, alloc); @@ -104,7 +104,7 @@ StatMonitorSnapshotRecorder::StatMonitorSnapshotRecorder( // Start the StatMonitor to track system stats bdlma::LocalSequentialAllocator<256> localAllocator( d_impl_sp->d_allocator_p); - mwcu::MemOutStream errorDesc(&localAllocator); + bmqu::MemOutStream errorDesc(&localAllocator); if (d_impl_sp->d_statMonitor.start(errorDesc) != 0) { // Failed to start the StatMonitor. We log and simply continue because // this is not fatal. @@ -118,7 +118,7 @@ StatMonitorSnapshotRecorder::StatMonitorSnapshotRecorder( } StatMonitorSnapshotRecorder::StatMonitorSnapshotRecorder( - const mwcsys::StatMonitorSnapshotRecorder& other, + const bmqsys::StatMonitorSnapshotRecorder& other, BSLS_ANNOTATION_UNUSED bslma::Allocator* allocator) : d_impl_sp(other.d_impl_sp) { @@ -132,17 +132,17 @@ void StatMonitorSnapshotRecorder::print(bsl::ostream& os, // PRECONDITIONS BSLS_ASSERT_SAFE(d_impl_sp); - const bsls::Types::Int64 now = mwcsys::Time::highResolutionTimer(); + const bsls::Types::Int64 now = bmqsys::Time::highResolutionTimer(); const bsls::Types::Int64 totalWallTimeNs = now - d_impl_sp->d_startTimeNs; const bsls::Types::Int64 wallTimeNs = now - d_impl_sp->d_lastSnapshotTimeNs; d_impl_sp->d_lastSnapshotTimeNs = now; os << d_impl_sp->d_header << "'" << section << "' (Total elapsed: " - << mwcu::PrintUtil::prettyTimeInterval(totalWallTimeNs) << ", " + << bmqu::PrintUtil::prettyTimeInterval(totalWallTimeNs) << ", " << totalWallTimeNs << " nanoseconds):\n" << " WALL TIME .....................: " - << mwcu::PrintUtil::prettyTimeInterval(wallTimeNs); + << bmqu::PrintUtil::prettyTimeInterval(wallTimeNs); if (!d_impl_sp->d_statMonitor.isStarted()) { os << " ** SYSTEM STATS N/A ** [Reason: 'StatMonitor' not started]"; @@ -160,30 +160,30 @@ void StatMonitorSnapshotRecorder::print(bsl::ostream& os, << " CPU ALL AVG ...................: " << d_impl_sp->d_statMonitor.cpuAll(snapId) << " %\n" << " VOLUNTARY CONTEXT SWITCHES ....: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( d_impl_sp->d_statMonitor.voluntaryContextSwitches(snapId)) << " \n" << " INVOLUNTARY CONTEXT SWITCHES ..: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( d_impl_sp->d_statMonitor.involuntaryContextSwitches(snapId)) << " \n" << " MINOR PAGE FAULTS .............: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( d_impl_sp->d_statMonitor.minorPageFaults(snapId)) << " \n" << " MAJOR PAGE FAULTS .............: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( d_impl_sp->d_statMonitor.majorPageFaults(snapId)) << " \n" << " NUM SWAPS .....................: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( d_impl_sp->d_statMonitor.numSwaps(snapId)); } // ACCESSORS bsls::Types::Int64 StatMonitorSnapshotRecorder::totalElapsed() const { - return mwcsys::Time::highResolutionTimer() - d_impl_sp->d_startTimeNs; + return bmqsys::Time::highResolutionTimer() - d_impl_sp->d_startTimeNs; } } // close package namespace diff --git a/src/groups/mwc/mwcsys/mwcsys_statmonitorsnapshotrecorder.h b/src/groups/bmq/bmqsys/bmqsys_statmonitorsnapshotrecorder.h similarity index 90% rename from src/groups/mwc/mwcsys/mwcsys_statmonitorsnapshotrecorder.h rename to src/groups/bmq/bmqsys/bmqsys_statmonitorsnapshotrecorder.h index 3c6dedf8d..942d713b0 100644 --- a/src/groups/mwc/mwcsys/mwcsys_statmonitorsnapshotrecorder.h +++ b/src/groups/bmq/bmqsys/bmqsys_statmonitorsnapshotrecorder.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_statmonitorsnapshotrecorder.h -*-C++-*- -#ifndef INCLUDED_MWCSYS_STATMONITORSNAPSHOTRECORDER -#define INCLUDED_MWCSYS_STATMONITORSNAPSHOTRECORDER +// bmqsys_statmonitorsnapshotrecorder.h -*-C++-*- +#ifndef INCLUDED_BMQSYS_STATMONITORSNAPSHOTRECORDER +#define INCLUDED_BMQSYS_STATMONITORSNAPSHOTRECORDER //@PURPOSE: Provide a mechanism to record snapshot of time, cpu, ctx switch. // //@CLASSES: -// mwcsys::StatMonitorSnapshotRecorder: Mechanism to record snapshot of stats +// bmqsys::StatMonitorSnapshotRecorder: Mechanism to record snapshot of stats // -//@DESCRIPTION: 'mwcsys::StatMonitorSnapshotRecorder' provides a mechanism to +//@DESCRIPTION: 'bmqsys::StatMonitorSnapshotRecorder' provides a mechanism to // record and report a snapshot of wall time, average CPU utilization // percentage (%) for user, system, and their sum, and voluntary context // switches. The measurements recorded and reported by this object are @@ -63,7 +63,7 @@ // The following code illustrates how to monitor and log stats throughout an // expensive recovery operation. // -// In this example, the 'mwcsys::StatMonitorSnapshotRecorder' is created on the +// In this example, the 'bmqsys::StatMonitorSnapshotRecorder' is created on the // stack before beginning recovery, with a 'header' string that will be used as // the top-level header in its output. Then the first step of recovery is // initiated, and when it is finished, a snapshot of the stats recorded is @@ -77,7 +77,7 @@ // FileStore::recoverMessages(...) // { // ... -// mwcsys::StatMonitorSnapshotRecorder statRecorder( +// bmqsys::StatMonitorSnapshotRecorder statRecorder( // "Cluster (testCluster)"); // // Perform step 1 of recovery // ... @@ -99,8 +99,6 @@ // } //.. -// MWC - // BDE #include #include @@ -113,7 +111,7 @@ namespace BloombergLP { -namespace mwcsys { +namespace bmqsys { // ================================= // class StatMonitorSnapshotRecorder @@ -125,7 +123,7 @@ namespace mwcsys { class StatMonitorSnapshotRecorder { private: // CLASS-SCOPE CATEGORY - BALL_LOG_SET_CLASS_CATEGORY("MWCSYS.STATMONITORSNAPSHOTRECORDER"); + BALL_LOG_SET_CLASS_CATEGORY("BMQSYS.STATMONITORSNAPSHOTRECORDER"); private: // DATA @@ -143,18 +141,18 @@ class StatMonitorSnapshotRecorder { // CREATORS - /// Create a new `mwcsys::StatMonitorSnapshotRecorder` using the + /// Create a new `bmqsys::StatMonitorSnapshotRecorder` using the /// specified `header`, used as the top-level header when printing /// statistics, and begin recording statistics. Use the optionally /// specified `allocator` to supply memory. explicit StatMonitorSnapshotRecorder(const bsl::string& header, bslma::Allocator* allocator = 0); - /// Copy constructor, create a new `mwcsys::StatMonitorSnapshotRecorder` + /// Copy constructor, create a new `bmqsys::StatMonitorSnapshotRecorder` /// having the same values as the specified `other`, and using the /// optionally specified `allocator`. StatMonitorSnapshotRecorder( - const mwcsys::StatMonitorSnapshotRecorder& other, + const bmqsys::StatMonitorSnapshotRecorder& other, bslma::Allocator* allocator = 0); // MANIPULATORS diff --git a/src/groups/mwc/mwcsys/mwcsys_statmonitorsnapshotrecorder.t.cpp b/src/groups/bmq/bmqsys/bmqsys_statmonitorsnapshotrecorder.t.cpp similarity index 88% rename from src/groups/mwc/mwcsys/mwcsys_statmonitorsnapshotrecorder.t.cpp rename to src/groups/bmq/bmqsys/bmqsys_statmonitorsnapshotrecorder.t.cpp index 2bacb1e8a..986edf213 100644 --- a/src/groups/mwc/mwcsys/mwcsys_statmonitorsnapshotrecorder.t.cpp +++ b/src/groups/bmq/bmqsys/bmqsys_statmonitorsnapshotrecorder.t.cpp @@ -13,13 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_statmonitorsnapshotrecorder.t.cpp -*-C++-*- -#include +// bmqsys_statmonitorsnapshotrecorder.t.cpp -*-C++-*- +#include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -29,7 +28,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -128,16 +127,16 @@ static void test1_usageExample() // Usage example // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("USAGE EXAMPLE"); + bmqtst::TestHelper::printTestName("USAGE EXAMPLE"); - mwcsys::Time::initialize(s_allocator_p); + bmqsys::Time::initialize(s_allocator_p); const bsl::string k_HEADER("Cluster (testCluster): ", s_allocator_p); // Begin testing PV("Valued constructor"); { - mwcsys::StatMonitorSnapshotRecorder statRecorder(k_HEADER); + bmqsys::StatMonitorSnapshotRecorder statRecorder(k_HEADER); // Perform some intensive work - step 1 doWork(7500, // rate @@ -146,7 +145,7 @@ static void test1_usageExample() ASSERT_GT(statRecorder.totalElapsed(), 0); // Log stats for step 1 (resets the stat recorder) - mwcu::MemOutStream os1(s_allocator_p); + bmqu::MemOutStream os1(s_allocator_p); statRecorder.print(os1, "EXPENSIVE OPERATION - STEP 1"); PVV(os1.str()); @@ -167,7 +166,7 @@ static void test1_usageExample() 3); // duration // Log stats for step 2 (resets the stat recorder) - mwcu::MemOutStream os2(s_allocator_p); + bmqu::MemOutStream os2(s_allocator_p); statRecorder.print(os2, "EXPENSIVE OPERATION - STEP 2"); PVV(os2.str()); @@ -188,8 +187,8 @@ static void test1_usageExample() PV("Copy constructor"); { - mwcsys::StatMonitorSnapshotRecorder statRecorderTemp(k_HEADER); - mwcsys::StatMonitorSnapshotRecorder statRecorder(statRecorderTemp, + bmqsys::StatMonitorSnapshotRecorder statRecorderTemp(k_HEADER); + bmqsys::StatMonitorSnapshotRecorder statRecorder(statRecorderTemp, s_allocator_p); // Perform some intensive work - step 1 @@ -197,7 +196,7 @@ static void test1_usageExample() 3); // duration // Log stats for step 1 (resets the stat recorder) - mwcu::MemOutStream os1(s_allocator_p); + bmqu::MemOutStream os1(s_allocator_p); statRecorder.print(os1, "EXPENSIVE OPERATION - STEP 1"); PVV(os1.str()); @@ -218,7 +217,7 @@ static void test1_usageExample() 3); // duration // Log stats for step 2 (resets the stat recorder) - mwcu::MemOutStream os2(s_allocator_p); + bmqu::MemOutStream os2(s_allocator_p); statRecorder.print(os2, "EXPENSIVE OPERATION - STEP 2"); PVV(os2.str()); @@ -238,7 +237,7 @@ static void test1_usageExample() ASSERT_NE(os1.str(), os2.str()); } - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); } static void test2_totalElapsed() @@ -249,17 +248,17 @@ static void test2_totalElapsed() // Ensure that the totalElapsed accessor returns the right value. // // Plan: -// 1 Manipulate the time by using custom time accessor with mwcsys::Time +// 1 Manipulate the time by using custom time accessor with bmqsys::Time // // Testing: // 'bsls::Types::Int64 totalElapsed() const' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("TOTAL ELAPSED"); + bmqtst::TestHelper::printTestName("TOTAL ELAPSED"); - mwcsys::MockTime mockTime; + bmqsys::MockTime mockTime; - mwcsys::StatMonitorSnapshotRecorder obj("HEADER"); + bmqsys::StatMonitorSnapshotRecorder obj("HEADER"); ASSERT_EQ(obj.totalElapsed(), 0); @@ -275,10 +274,10 @@ static void test2_totalElapsed() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); s_ignoreCheckDefAlloc = true; - // 'snapshot' in 'mwcsys::StatMonitor' passes a string using default + // 'snapshot' in 'bmqsys::StatMonitor' passes a string using default // alloc. switch (_testCase) { @@ -291,5 +290,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcsys/mwcsys_threadutil.cpp b/src/groups/bmq/bmqsys/bmqsys_threadutil.cpp similarity index 84% rename from src/groups/mwc/mwcsys/mwcsys_threadutil.cpp rename to src/groups/bmq/bmqsys/bmqsys_threadutil.cpp index 61175c48e..4270271ba 100644 --- a/src/groups/mwc/mwcsys/mwcsys_threadutil.cpp +++ b/src/groups/bmq/bmqsys/bmqsys_threadutil.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_threadutil.cpp -*-C++-*- -#include +// bmqsys_threadutil.cpp -*-C++-*- +#include -#include -// MWC -#include +#include + +#include // BDE #include @@ -36,10 +36,10 @@ #endif namespace BloombergLP { -namespace mwcsys { +namespace bmqsys { namespace { -const char k_LOG_CATEGORY[] = "MWCSYS.THREADUTIL"; +const char k_LOG_CATEGORY[] = "BMQSYS.THREADUTIL"; } // close unnamed namespace // ----------------- @@ -65,10 +65,9 @@ void ThreadUtil::setCurrentThreadName(const bsl::string& value) // Bloomberg is a bit old; API was added in glibc 2.12, and we have 2.5. if (rc != 0) { BALL_LOG_SET_CATEGORY(k_LOG_CATEGORY); - BALL_LOG_ERROR << "Failed to set thread name " - << "[name: '" << value << "'" - << ", rc: " << rc << ", strerr: '" << bsl::strerror(rc) - << "']"; + BALL_LOG_ERROR << "Failed to set thread name " << "[name: '" << value + << "'" << ", rc: " << rc << ", strerr: '" + << bsl::strerror(rc) << "']"; } } @@ -79,7 +78,7 @@ void ThreadUtil::setCurrentThreadNameOnce(const bsl::string& value) // static variable 's_named' with Clang-specific attribute. [[clang::no_destroy]] #endif - static mwcu::TLSBool s_named(false, true); + static bmqu::TLSBool s_named(false, true); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!s_named)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; diff --git a/src/groups/mwc/mwcsys/mwcsys_threadutil.h b/src/groups/bmq/bmqsys/bmqsys_threadutil.h similarity index 90% rename from src/groups/mwc/mwcsys/mwcsys_threadutil.h rename to src/groups/bmq/bmqsys/bmqsys_threadutil.h index 04a32ed36..d097a0e3c 100644 --- a/src/groups/mwc/mwcsys/mwcsys_threadutil.h +++ b/src/groups/bmq/bmqsys/bmqsys_threadutil.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_threadutil.h -*-C++-*- -#ifndef INCLUDED_MWCSYS_THREADUTIL -#define INCLUDED_MWCSYS_THREADUTIL +// bmqsys_threadutil.h -*-C++-*- +#ifndef INCLUDED_BMQSYS_THREADUTIL +#define INCLUDED_BMQSYS_THREADUTIL //@PURPOSE: Provide utilities related to thread management. // //@CLASSES: -// mwcsys::ThreadUtil: utilities related to thread management. +// bmqsys::ThreadUtil: utilities related to thread management. // -//@DESCRIPTION: 'mwcsys::ThreadUtil' provide a utility namespace for operations +//@DESCRIPTION: 'bmqsys::ThreadUtil' provide a utility namespace for operations // related to thread management, such as naming threads. Each operation may be // platform specific, please refer to the associated function documentation for // individual support explanation. @@ -34,14 +34,12 @@ // easier to locate the matching core, each thread name we set should start // with a small recognizable prefix ('BMQ'). -// MWC - // BDE #include #include namespace BloombergLP { -namespace mwcsys { +namespace bmqsys { // ================= // struct ThreadUtil diff --git a/src/groups/mwc/mwcsys/mwcsys_time.cpp b/src/groups/bmq/bmqsys/bmqsys_time.cpp similarity index 97% rename from src/groups/mwc/mwcsys/mwcsys_time.cpp rename to src/groups/bmq/bmqsys/bmqsys_time.cpp index 33771053e..caad1a73a 100644 --- a/src/groups/mwc/mwcsys/mwcsys_time.cpp +++ b/src/groups/bmq/bmqsys/bmqsys_time.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_time.cpp -*-C++-*- -#include +// bmqsys_time.cpp -*-C++-*- +#include -#include +#include // BDE #include #include @@ -29,7 +29,7 @@ #include namespace BloombergLP { -namespace mwcsys { +namespace bmqsys { namespace { bsls::ObjectBuffer g_realTimeClock; diff --git a/src/groups/mwc/mwcsys/mwcsys_time.h b/src/groups/bmq/bmqsys/bmqsys_time.h similarity index 94% rename from src/groups/mwc/mwcsys/mwcsys_time.h rename to src/groups/bmq/bmqsys/bmqsys_time.h index 886556b47..70945436a 100644 --- a/src/groups/mwc/mwcsys/mwcsys_time.h +++ b/src/groups/bmq/bmqsys/bmqsys_time.h @@ -13,31 +13,29 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_time.h -*-C++-*- -#ifndef INCLUDED_MWCSYS_TIME -#define INCLUDED_MWCSYS_TIME +// bmqsys_time.h -*-C++-*- +#ifndef INCLUDED_BMQSYS_TIME +#define INCLUDED_BMQSYS_TIME //@PURPOSE: Provide a pluggable functional interface to system clocks. // //@CLASSES: -// mwcsys::Time: namespace for pluggable interface to system clocks +// bmqsys::Time: namespace for pluggable interface to system clocks // -//@DESCRIPTION: This component provides a 'struct', 'mwcsys::Time', in which +//@DESCRIPTION: This component provides a 'struct', 'bmqsys::Time', in which // are defined a series of static methods for retrieving the current system // time from the currently installed mechanism. This component provides access // to monotonic clock, real-time (wall) clock and a high resolution timer. The // mechanism to retrieve system clock and the timer can be overridden, which is // useful while testing components which rely on system clock or timer. -// MWC - // BDE #include #include #include namespace BloombergLP { -namespace mwcsys { +namespace bmqsys { // =========== // struct Time diff --git a/src/groups/mwc/mwcsys/mwcsys_time.t.cpp b/src/groups/bmq/bmqsys/bmqsys_time.t.cpp similarity index 85% rename from src/groups/mwc/mwcsys/mwcsys_time.t.cpp rename to src/groups/bmq/bmqsys/bmqsys_time.t.cpp index d86561727..a63c39749 100644 --- a/src/groups/mwc/mwcsys/mwcsys_time.t.cpp +++ b/src/groups/bmq/bmqsys/bmqsys_time.t.cpp @@ -13,11 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcsys_time.t.cpp -*-C++-*- -#include +// bmqsys_time.t.cpp -*-C++-*- +#include -// MWC -#include +#include // BDE #include @@ -28,7 +27,7 @@ #include // TEST DRIVER -#include +#include // BENCHMARKING LIBRARY #ifdef BSLS_PLATFORM_OS_LINUX @@ -76,17 +75,17 @@ static void test1_breathingTest() // Exercise the basic functionality of the component. // // Plan: -// - Create a TestClock, initialize the mwcsys::TimeUtil with it, and +// - Create a TestClock, initialize the bmqsys::TimeUtil with it, and // verify each timer function returns the properly set value. // // Testing: // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); TestClock testClock; - mwcsys::Time::initialize( + bmqsys::Time::initialize( bdlf::BindUtil::bind(&TestClock::realtimeClock, &testClock), bdlf::BindUtil::bind(&TestClock::monotonicClock, &testClock), bdlf::BindUtil::bind(&TestClock::highResTimer, &testClock)); @@ -94,31 +93,31 @@ static void test1_breathingTest() PV("Testing real time clock"); { testClock.d_realtimeClock.setTotalSeconds(5); - ASSERT_EQ(bsls::TimeInterval(5, 0), mwcsys::Time::nowRealtimeClock()); + ASSERT_EQ(bsls::TimeInterval(5, 0), bmqsys::Time::nowRealtimeClock()); testClock.d_realtimeClock.setTotalSeconds(0); - ASSERT_EQ(bsls::TimeInterval(0, 0), mwcsys::Time::nowRealtimeClock()); + ASSERT_EQ(bsls::TimeInterval(0, 0), bmqsys::Time::nowRealtimeClock()); } PV("Testing monotonic clock"); { testClock.d_monotonicClock.setTotalSeconds(5); - ASSERT_EQ(bsls::TimeInterval(5, 0), mwcsys::Time::nowMonotonicClock()); + ASSERT_EQ(bsls::TimeInterval(5, 0), bmqsys::Time::nowMonotonicClock()); testClock.d_monotonicClock.setTotalSeconds(0); - ASSERT_EQ(bsls::TimeInterval(0, 0), mwcsys::Time::nowMonotonicClock()); + ASSERT_EQ(bsls::TimeInterval(0, 0), bmqsys::Time::nowMonotonicClock()); } PV("Testing high resolution timer"); { testClock.d_highResTimer = 1000000; - ASSERT_EQ(1000000, mwcsys::Time::highResolutionTimer()); + ASSERT_EQ(1000000, bmqsys::Time::highResolutionTimer()); testClock.d_highResTimer = 0; - ASSERT_EQ(0, mwcsys::Time::highResolutionTimer()); + ASSERT_EQ(0, bmqsys::Time::highResolutionTimer()); } - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); } static void test2_defaultInitializeShutdown() @@ -137,22 +136,22 @@ static void test2_defaultInitializeShutdown() // shutdown() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("DEFAULT INITIALIZE & SHUTDOWN"); + bmqtst::TestHelper::printTestName("DEFAULT INITIALIZE & SHUTDOWN"); // Initialize the 'Time'. - ASSERT_SAFE_PASS(mwcsys::Time::initialize()); + ASSERT_SAFE_PASS(bmqsys::Time::initialize()); // Initialize should be a no-op. - ASSERT_SAFE_PASS(mwcsys::Time::initialize()); + ASSERT_SAFE_PASS(bmqsys::Time::initialize()); // Shutdown the Time is a no-op. - ASSERT_SAFE_PASS(mwcsys::Time::shutdown()); + ASSERT_SAFE_PASS(bmqsys::Time::shutdown()); // Shutdown the Time. - ASSERT_SAFE_PASS(mwcsys::Time::shutdown()); + ASSERT_SAFE_PASS(bmqsys::Time::shutdown()); // Shutdown again should assert - ASSERT_SAFE_FAIL(mwcsys::Time::shutdown()); + ASSERT_SAFE_FAIL(bmqsys::Time::shutdown()); } static void test3_customInitializeShutdown() @@ -171,30 +170,30 @@ static void test3_customInitializeShutdown() // shutdown() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CUSTOM INITIALIZE & SHUTDOWN"); + bmqtst::TestHelper::printTestName("CUSTOM INITIALIZE & SHUTDOWN"); TestClock testClock; // Initialize the 'Time'. - ASSERT_SAFE_PASS(mwcsys::Time::initialize( + ASSERT_SAFE_PASS(bmqsys::Time::initialize( bdlf::BindUtil::bind(&TestClock::realtimeClock, &testClock), bdlf::BindUtil::bind(&TestClock::monotonicClock, &testClock), bdlf::BindUtil::bind(&TestClock::highResTimer, &testClock))); // Initialize should be a no-op. - ASSERT_SAFE_PASS(mwcsys::Time::initialize( + ASSERT_SAFE_PASS(bmqsys::Time::initialize( bdlf::BindUtil::bind(&TestClock::realtimeClock, &testClock), bdlf::BindUtil::bind(&TestClock::monotonicClock, &testClock), bdlf::BindUtil::bind(&TestClock::highResTimer, &testClock))); // Shutdown the Time is a no-op. - ASSERT_SAFE_PASS(mwcsys::Time::shutdown()); + ASSERT_SAFE_PASS(bmqsys::Time::shutdown()); // Shutdown the Time. - ASSERT_SAFE_PASS(mwcsys::Time::shutdown()); + ASSERT_SAFE_PASS(bmqsys::Time::shutdown()); // Shutdown again should assert - ASSERT_SAFE_FAIL(mwcsys::Time::shutdown()); + ASSERT_SAFE_FAIL(bmqsys::Time::shutdown()); } // ============================================================================ @@ -239,7 +238,7 @@ static void testN1_performance() // (4) | 100 | 36 | // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PERFORMANCE"); + bmqtst::TestHelper::printTestName("PERFORMANCE"); const bsls::Types::Int64 k_NUM_CALLS = 100000000; // 1O0 million @@ -253,7 +252,7 @@ static void testN1_performance() bsls::Types::Int64 end = bsls::TimeUtil::getTimer(); cout << k_NUM_CALLS << " function calls in " - << mwcu::PrintUtil::prettyTimeInterval(end - start) + << bmqu::PrintUtil::prettyTimeInterval(end - start) << " (average of " << (end - start) / k_NUM_CALLS << " nano seconds per call)." << endl; } @@ -271,7 +270,7 @@ static void testN1_performance() bsls::Types::Int64 end = bsls::TimeUtil::getTimer(); cout << k_NUM_CALLS << " function calls in " - << mwcu::PrintUtil::prettyTimeInterval(end - start) + << bmqu::PrintUtil::prettyTimeInterval(end - start) << " (average of " << (end - start) / k_NUM_CALLS << " nano seconds per call)." << endl; } @@ -289,7 +288,7 @@ static void testN1_performance() bsls::Types::Int64 end = bsls::TimeUtil::getTimer(); cout << k_NUM_CALLS << " function calls in " - << mwcu::PrintUtil::prettyTimeInterval(end - start) + << bmqu::PrintUtil::prettyTimeInterval(end - start) << " (average of " << (end - start) / k_NUM_CALLS << " nano seconds per call)." << endl; } @@ -307,7 +306,7 @@ static void testN1_performance() bsls::Types::Int64 end = bsls::TimeUtil::getTimer(); cout << k_NUM_CALLS << " function calls in " - << mwcu::PrintUtil::prettyTimeInterval(end - start) + << bmqu::PrintUtil::prettyTimeInterval(end - start) << " (average of " << (end - start) / k_NUM_CALLS << " nano seconds per call)." << endl; } @@ -318,7 +317,7 @@ static void testN1_performance() static void testN1_defaultPerformance_GoogleBenchmark(benchmark::State& state) { // Default function call - mwctst::TestHelper::printTestName("PERFORMANCE GOOGLE BENCHMARK"); + bmqtst::TestHelper::printTestName("PERFORMANCE GOOGLE BENCHMARK"); for (auto _ : state) { for (bsls::Types::Int64 i = 0; i < state.range(0); ++i) { @@ -331,7 +330,7 @@ static void testN1_defaultPerformance_GoogleBenchmark(benchmark::State& state) static void testN1_funcptrPerformance_GoogleBenchmark(benchmark::State& state) { // Function pointer - mwctst::TestHelper::printTestName("PERFORMANCE GOOGLE BENCHMARK"); + bmqtst::TestHelper::printTestName("PERFORMANCE GOOGLE BENCHMARK"); bsls::TimeInterval (*fn)(); fn = &bsls::SystemTime::nowMonotonicClock; @@ -347,7 +346,7 @@ static void testN1_funcptrPerformance_GoogleBenchmark(benchmark::State& state) static void testN1_bslPerformance_GoogleBenchmark(benchmark::State& state) { // BSL Typdef performance - mwctst::TestHelper::printTestName("PERFORMANCE GOOGLE BENCHMARK"); + bmqtst::TestHelper::printTestName("PERFORMANCE GOOGLE BENCHMARK"); typedef bsl::function Fn; Fn fn = &bsls::SystemTime::nowMonotonicClock; @@ -363,7 +362,7 @@ static void testN1_bslPerformance_GoogleBenchmark(benchmark::State& state) static void testN1_bindPerformance_GoogleBenchmark(benchmark::State& state) { // Binding performance - mwctst::TestHelper::printTestName("PERFORMANCE GOOGLE BENCHMARK"); + bmqtst::TestHelper::printTestName("PERFORMANCE GOOGLE BENCHMARK"); typedef bsl::function Fn; Fn fn = bdlf::BindUtil::bind(&bsls::SystemTime::nowMonotonicClock); @@ -382,7 +381,7 @@ static void testN1_bindPerformance_GoogleBenchmark(benchmark::State& state) int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -419,7 +418,7 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } // ---------------------------------------------------------------------------- diff --git a/src/groups/mwc/mwcsys/doc/mwcsys.txt b/src/groups/bmq/bmqsys/doc/bmqsys.txt similarity index 59% rename from src/groups/mwc/mwcsys/doc/mwcsys.txt rename to src/groups/bmq/bmqsys/doc/bmqsys.txt index b563f7fb0..c0dbadc9b 100644 --- a/src/groups/mwc/mwcsys/doc/mwcsys.txt +++ b/src/groups/bmq/bmqsys/doc/bmqsys.txt @@ -1,42 +1,42 @@ - mwcsys.txt + bmqsys.txt @PURPOSE: Provide systems utilities and mechanisms. -@MNEMONIC: MiddleWare Core Systems (mwcsys) +@MNEMONIC: BlazingMQ Systems (bmqsys) @DESCRIPTION: This package provides miscellaneous systems related utility components to be reused through various applications. /Hierarchical Synopsis /--------------------- -The 'mwcsys' package currently has 5 components having 2 levels of physical +The 'bmqsys' package currently has 5 components having 2 levels of physical dependency. The list below shows the hierarchal ordering of the components. .. - 2. mwcsys_mocktime - mwcsys_statmonitorsnapshotrecorder + 2. bmqsys_mocktime + bmqsys_statmonitorsnapshotrecorder - 1. mwcsys_executil - mwcsys_statmonitor - mwcsys_threadutil - mwcsys_time + 1. bmqsys_executil + bmqsys_statmonitor + bmqsys_threadutil + bmqsys_time .. /Component Synopsis /------------------ -: 'mwcsys_executil': +: 'bmqsys_executil': : Provide utilities to execute commands on the system. : -: 'mwcsys_mocktime: -: Provide a mock of the time accessors usable with 'mwcsys::Time'. +: 'bmqsys_mocktime: +: Provide a mock of the time accessors usable with 'bmqsys::Time'. : -: 'mwcsys_statmonitor': +: 'bmqsys_statmonitor': : Provide a mechanism to monitor cpu and memory stats. : -: 'mwcsys_statmonitorsnapshotrecorder': +: 'bmqsys_statmonitorsnapshotrecorder': : Provide a mechanism to record snapshot of time, cpu, and ctx switch. : -: 'mwcsys_threadutil': +: 'bmqsys_threadutil': : Provide utilities related to thread management. : -: 'mwcsys_time': +: 'bmqsys_time': : Provide a pluggable functional interface to system clocks. diff --git a/src/groups/bmq/bmqsys/package/bmqsys.dep b/src/groups/bmq/bmqsys/package/bmqsys.dep new file mode 100644 index 000000000..8e6f67c53 --- /dev/null +++ b/src/groups/bmq/bmqsys/package/bmqsys.dep @@ -0,0 +1,3 @@ +bmqu +bmqscm +bmqst \ No newline at end of file diff --git a/src/groups/bmq/bmqsys/package/bmqsys.mem b/src/groups/bmq/bmqsys/package/bmqsys.mem new file mode 100644 index 000000000..22c36b8b1 --- /dev/null +++ b/src/groups/bmq/bmqsys/package/bmqsys.mem @@ -0,0 +1,6 @@ +bmqsys_executil +bmqsys_mocktime +bmqsys_statmonitor +bmqsys_statmonitorsnapshotrecorder +bmqsys_threadutil +bmqsys_time diff --git a/src/groups/bmq/bmqt/README.md b/src/groups/bmq/bmqt/README.dox similarity index 96% rename from src/groups/bmq/bmqt/README.md rename to src/groups/bmq/bmqt/README.dox index 33ce546b2..3c88e8cbd 100644 --- a/src/groups/bmq/bmqt/README.md +++ b/src/groups/bmq/bmqt/README.dox @@ -1,3 +1,4 @@ +/** @dir bmqt @brief The `BMQT` (BlazingMQ (vocabulary) Types) package provides @@ -5,3 +6,4 @@ value-semantic vocabulary types. The ‘bmqt‘ package provides low level value-semantic vocabulary types for use by the BlazingMQ SDK. +*/ diff --git a/src/groups/bmq/bmqt/bmqt_compressionalgorithmtype.t.cpp b/src/groups/bmq/bmqt/bmqt_compressionalgorithmtype.t.cpp index 43927c376..6a32a209d 100644 --- a/src/groups/bmq/bmqt/bmqt_compressionalgorithmtype.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_compressionalgorithmtype.t.cpp @@ -16,11 +16,10 @@ // bmqt_compressionalgorithmtype.t.cpp -*-C++-*- #include -// MWC -#include +#include // TEST DRIVER -#include +#include // BDE #include @@ -54,8 +53,8 @@ static void printEnumHelper(ARRAY (&data)[SIZE]) PVVV("Line [" << test.d_line << "]"); - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); typedef typename ENUM_TYPE::Enum T; @@ -100,7 +99,7 @@ static void test1_enumPrint() // operator<<(bsl::ostream&, CompressionAlgorithmType::Enum) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ENUM LAYOUT"); + bmqtst::TestHelper::printTestName("ENUM LAYOUT"); PV("Test bmqt::CompressionAlgorithmType printing"); { @@ -129,7 +128,7 @@ static void test1_enumPrint() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -140,5 +139,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/bmqt_correlationid.h b/src/groups/bmq/bmqt/bmqt_correlationid.h index 0b9f51034..c040c02e5 100644 --- a/src/groups/bmq/bmqt/bmqt_correlationid.h +++ b/src/groups/bmq/bmqt/bmqt_correlationid.h @@ -171,8 +171,6 @@ /// } /// ``` -// BMQ - // BDE #include @@ -213,12 +211,12 @@ class CorrelationId { typedef bsls::Types::Uint64 AutoValue; // DATA + + /// The variant used to hold the value of a `CorrelationId`, that may + /// either be unset, hold a 64-bit integer, a raw pointer, a shared + /// pointer, or an `AutoValue`. bdlb::Variant4, AutoValue> d_variant; - // The variant used to hold the value of a - // 'CorrelationId', that may either be unset, - // hold a 64-bit integer, a raw pointer, a - // shared pointer, or an 'AutoValue'. // PRIVATE ACCESSORS diff --git a/src/groups/bmq/bmqt/bmqt_correlationid.t.cpp b/src/groups/bmq/bmqt/bmqt_correlationid.t.cpp index 7e85063d1..2f21d077f 100644 --- a/src/groups/bmq/bmqt/bmqt_correlationid.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_correlationid.t.cpp @@ -16,8 +16,7 @@ // bmqt_correlationid.t.cpp -*-C++-*- #include -// MWC -#include +#include // BDE #include @@ -28,7 +27,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -51,7 +50,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // An object for testing pointers bsl::string foo("foo", s_allocator_p); @@ -138,7 +137,7 @@ static void test2_copyAndAssign() // Testing: // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("COPY AND ASSIGN"); + bmqtst::TestHelper::printTestName("COPY AND ASSIGN"); // An object for testing pointers bsl::string foo("foo", s_allocator_p); @@ -197,7 +196,7 @@ static void test3_compare() // Testing: // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("COMPARE"); + bmqtst::TestHelper::printTestName("COMPARE"); // Test compare operator bmqt::CorrelationIdLess less; @@ -261,7 +260,7 @@ static void test4_smartPointers() // Testing: // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SMART POINTERS"); + bmqtst::TestHelper::printTestName("SMART POINTERS"); int value = 153; bmqt::CorrelationId smartIntCorrelation; @@ -291,7 +290,7 @@ static void test5_autoValue() // Testing: // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("AUTO VALUE"); + bmqtst::TestHelper::printTestName("AUTO VALUE"); bmqt::CorrelationId auto1 = bmqt::CorrelationId::autoValue(); bmqt::CorrelationId auto2 = bmqt::CorrelationId::autoValue(); @@ -321,7 +320,7 @@ static void test6_hashAppend() // const bmqt::CorrelationId& corrId) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HASH APPEND"); + bmqtst::TestHelper::printTestName("HASH APPEND"); PV("HASH FUNCTION DETERMINISTIC"); @@ -374,7 +373,7 @@ static void test6_hashAppend() static void test7_printTest() { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); PV("Testing print"); @@ -388,8 +387,8 @@ static void test7_printTest() for (; t < bmqt::CorrelationId::e_UNSET + 1; ++t) { bmqt::CorrelationId obj; - mwcu::MemOutStream patStream(s_allocator_p); - mwcu::MemOutStream objStream(s_allocator_p); + bmqu::MemOutStream patStream(s_allocator_p); + bmqu::MemOutStream objStream(s_allocator_p); switch (t) { case bmqt::CorrelationId::e_NUMERIC: { obj = bmqt::CorrelationId(numeric); @@ -433,7 +432,7 @@ static void test7_printTest() PV("Bad stream test"); bmqt::CorrelationId obj; - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); stream << "BAD STREAM"; stream.clear(bsl::ios_base::badbit); @@ -448,7 +447,7 @@ static void test7_printTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -465,5 +464,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/bmqt_encodingtype.t.cpp b/src/groups/bmq/bmqt/bmqt_encodingtype.t.cpp index e6a106677..1d797b55e 100644 --- a/src/groups/bmq/bmqt/bmqt_encodingtype.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_encodingtype.t.cpp @@ -16,8 +16,7 @@ // bmqt_encodingtype.t.cpp -*-C++-*- #include -// MWC -#include +#include // BDE #include @@ -25,7 +24,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -37,7 +36,7 @@ using namespace bsl; static void test1_toAscii() { - mwctst::TestHelper::printTestName("TO ASCII"); + bmqtst::TestHelper::printTestName("TO ASCII"); struct Test { int d_line; @@ -66,7 +65,7 @@ static void test1_toAscii() static void test2_fromAscii() { - mwctst::TestHelper::printTestName("FROM ASCII"); + bmqtst::TestHelper::printTestName("FROM ASCII"); struct Test { int d_line; @@ -89,7 +88,7 @@ static void test2_fromAscii() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; - mwcu::MemOutStream errorDescription(s_allocator_p); + bmqu::MemOutStream errorDescription(s_allocator_p); bsl::string str(test.d_input, s_allocator_p); bool isValid = bmqt::EncodingType::isValid(&str, errorDescription); @@ -106,7 +105,7 @@ static void test2_fromAscii() static void test3_isomorphism() { - mwctst::TestHelper::printTestName("ISOMORPHISM"); + bmqtst::TestHelper::printTestName("ISOMORPHISM"); bmqt::EncodingType::Enum obj; bsl::string str(s_allocator_p); @@ -128,7 +127,7 @@ static void test3_isomorphism() static void test4_printTest() { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); PV("Testing print"); @@ -156,8 +155,8 @@ static void test4_printTest() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); expected << test.d_expected; @@ -184,7 +183,7 @@ static void test4_printTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -198,5 +197,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/bmqt_hosthealthstate.t.cpp b/src/groups/bmq/bmqt/bmqt_hosthealthstate.t.cpp index 80ddcd565..b1ad4b022 100644 --- a/src/groups/bmq/bmqt/bmqt_hosthealthstate.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_hosthealthstate.t.cpp @@ -16,15 +16,14 @@ // bmqt_hosthealthstate.t.cpp -*-C++-*- #include -// MWC -#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -36,7 +35,7 @@ using namespace bsl; static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bmqt::HostHealthState::Enum obj; bsl::string str; @@ -69,7 +68,7 @@ static void test1_breathingTest() static void test2_printTest() { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); PV("Testing print"); @@ -86,8 +85,8 @@ static void test2_printTest() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); expected << test.d_expected; @@ -114,7 +113,7 @@ static void test2_printTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -126,5 +125,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/bmqt_messageeventtype.t.cpp b/src/groups/bmq/bmqt/bmqt_messageeventtype.t.cpp index 8463d2e49..216803967 100644 --- a/src/groups/bmq/bmqt/bmqt_messageeventtype.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_messageeventtype.t.cpp @@ -16,8 +16,7 @@ // bmqt_messageeventtype.t.cpp -*-C++-*- #include -// MWC -#include +#include // BDE #include @@ -25,7 +24,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -37,7 +36,7 @@ using namespace bsl; static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bmqt::MessageEventType::Enum obj; bsl::string str; @@ -68,7 +67,7 @@ static void test1_breathingTest() static void test2_printTest() { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); PV("Testing print"); @@ -92,8 +91,8 @@ static void test2_printTest() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); expected << test.d_expected; @@ -120,7 +119,7 @@ static void test2_printTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -132,5 +131,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/bmqt_messageguid.h b/src/groups/bmq/bmqt/bmqt_messageguid.h index 2f83aab85..f7098f302 100644 --- a/src/groups/bmq/bmqt/bmqt_messageguid.h +++ b/src/groups/bmq/bmqt/bmqt_messageguid.h @@ -102,13 +102,15 @@ class MessageGUID { public: // TYPES + + /// Enum representing the size of a buffer needed to represent a GUID enum Enum { - // Enum representing the size of a buffer needed to represent a GUID - e_SIZE_BINARY = 16 // Binary format of the GUID + /// Binary format of the GUID + e_SIZE_BINARY = 16 , + /// Hexadecimal string representation of the GUID e_SIZE_HEX = 2 * e_SIZE_BINARY - // Hexadecimal string representation of the GUID }; // TRAITS @@ -118,8 +120,9 @@ class MessageGUID { private: // PRIVATE CONSTANTS + + /// Constant representing an unset GUID static const char k_UNSET_GUID[e_SIZE_BINARY]; - // Constant representing an unset GUID private: // IMPLEMENTATION NOTE: Some structs in bmqp::Protocol.h blindly diff --git a/src/groups/bmq/bmqt/bmqt_messageguid.t.cpp b/src/groups/bmq/bmqt/bmqt_messageguid.t.cpp index d505ad5e7..4cd2e88f1 100644 --- a/src/groups/bmq/bmqt/bmqt_messageguid.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_messageguid.t.cpp @@ -17,13 +17,13 @@ #include // BMQ -#include +#include // BDE #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -44,7 +44,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Test some invalid guids"); bmqt::MessageGUID obj1; @@ -119,7 +119,7 @@ static void test1_breathingTest() static void test2_streamout() { - mwctst::TestHelper::printTestName("STREAM OUT"); + bmqtst::TestHelper::printTestName("STREAM OUT"); // Create guid from valid hex rep @@ -127,7 +127,7 @@ static void test2_streamout() PV("Unset GUID"); bmqt::MessageGUID obj; - mwcu::MemOutStream osstr(s_allocator_p); + bmqu::MemOutStream osstr(s_allocator_p); osstr << obj; ASSERT_EQ("** UNSET **", osstr.str()); @@ -142,7 +142,7 @@ static void test2_streamout() bmqt::MessageGUID obj; obj.fromHex(k_HEX_G); - mwcu::MemOutStream osstr(s_allocator_p); + bmqu::MemOutStream osstr(s_allocator_p); osstr << obj; bsl::string guidStr(k_HEX_G, @@ -164,7 +164,7 @@ static void test2_streamout() bmqt::MessageGUID obj; obj.fromHex(k_HEX_G); - mwcu::MemOutStream osstr(s_allocator_p); + bmqu::MemOutStream osstr(s_allocator_p); obj.print(osstr, 2, 4); ASSERT_EQ(k_EXPECTED, osstr.str()); @@ -177,7 +177,7 @@ static void test2_streamout() bmqt::MessageGUID obj; - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); out.setstate(bsl::ios_base::badbit); obj.print(out, 0, -1); @@ -193,7 +193,7 @@ static void test3_alignment() // Ensure 4 byte alignment of bmqt_messageguid // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ALIGNMENT"); + bmqtst::TestHelper::printTestName("ALIGNMENT"); const size_t k_EXPECTED_ALIGNMENT = 1; const size_t k_REAL_ALIGNMENT = @@ -223,7 +223,7 @@ static void test4_hashAppend() // bmqt::MessageGUIDHashAlgo // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HASH APPEND"); + bmqtst::TestHelper::printTestName("HASH APPEND"); PV("HASH FUNCTION DETERMINISTIC"); @@ -277,7 +277,7 @@ static void test5_comparisonOperators() // const bmqt::MessageGUID& rhs) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("COMPARISON OPERATORS"); + bmqtst::TestHelper::printTestName("COMPARISON OPERATORS"); // Lesser value const char k_HEX_G1[] = "0000000000003039CD8101000000270F"; @@ -311,7 +311,7 @@ static void test5_comparisonOperators() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -326,5 +326,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/bmqt_propertytype.t.cpp b/src/groups/bmq/bmqt/bmqt_propertytype.t.cpp index 7a70a8678..8b2bb2860 100644 --- a/src/groups/bmq/bmqt/bmqt_propertytype.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_propertytype.t.cpp @@ -17,10 +17,9 @@ #include // TEST DRIVER -#include +#include -// MWC -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -32,7 +31,7 @@ using namespace bsl; static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Testing PropertyType"); bmqt::PropertyType::Enum obj; @@ -70,9 +69,9 @@ static void test1_breathingTest() static void test2_printTest() { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); PV("Testing print"); - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); stream << bmqt::PropertyType::e_INT64; ASSERT_EQ(stream.str(), "INT64"); stream.reset(); @@ -86,7 +85,7 @@ static void test2_printTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -98,5 +97,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/bmqt_queueflags.t.cpp b/src/groups/bmq/bmqt/bmqt_queueflags.t.cpp index 8fe636a0d..1b5b97bf2 100644 --- a/src/groups/bmq/bmqt/bmqt_queueflags.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_queueflags.t.cpp @@ -17,10 +17,9 @@ #include // BMQ -#include +#include -// MWC -#include +#include // BDE #include @@ -29,7 +28,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -59,9 +58,9 @@ BSLMF_ASSERT(k_ALL_FLAGS_SETTED < 1 << 10); static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); - mwcu::MemOutStream errorOs(s_allocator_p); + bmqu::MemOutStream errorOs(s_allocator_p); int rc; bsls::Types::Uint64 flags1 = 0; bsls::Types::Uint64 flags2 = 0; @@ -85,7 +84,7 @@ static void test1_breathingTest() errorOs.reset(); PV("Testing prettyPrint"); - mwcu::MemOutStream osPrint(s_allocator_p); + bmqu::MemOutStream osPrint(s_allocator_p); bmqt::QueueFlagsUtil::prettyPrint(osPrint, flags2); ASSERT_EQ(osPrint.str(), ""); @@ -112,7 +111,7 @@ static void test1_breathingTest() static void test2_additionsRemovals() { - mwctst::TestHelper::printTestName("ADDITIONS / REMOVALS"); + bmqtst::TestHelper::printTestName("ADDITIONS / REMOVALS"); // Short alias const int k_ADMIN = bmqt::QueueFlags::e_ADMIN; @@ -166,7 +165,7 @@ static void test2_additionsRemovals() static void test3_printTest() { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); PV("Testing print"); @@ -189,8 +188,8 @@ static void test3_printTest() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); expected << test.d_expected; @@ -213,7 +212,7 @@ static void test3_printTest() static void test4_empty() { - mwctst::TestHelper::printTestName("EMPTY"); + bmqtst::TestHelper::printTestName("EMPTY"); bsls::Types::Uint64 flags = 0; @@ -230,7 +229,7 @@ static void test4_empty() static void test5_setFlag() { - mwctst::TestHelper::printTestName("SET FLAG"); + bmqtst::TestHelper::printTestName("SET FLAG"); PV("Test flag setter") for (bsls::Types::Uint64 flags = 0; flags <= k_ALL_FLAGS_SETTED; flags++) { @@ -262,7 +261,7 @@ static void test5_setFlag() static void test6_unsetFlag() { - mwctst::TestHelper::printTestName("UNSET FLAG"); + bmqtst::TestHelper::printTestName("UNSET FLAG"); PV("Test flag unsetter") for (bsls::Types::Uint64 flags = 0; flags <= k_ALL_FLAGS_SETTED; flags++) { @@ -296,7 +295,7 @@ static void test6_unsetFlag() static void test7_getFlag() { - mwctst::TestHelper::printTestName("GET FLAG"); + bmqtst::TestHelper::printTestName("GET FLAG"); PV("Test flag getter") for (bsls::Types::Uint64 flags = 0; flags <= k_ALL_FLAGS_SETTED; flags++) { @@ -332,7 +331,7 @@ static void test7_getFlag() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -349,5 +348,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/bmqt_queueoptions.cpp b/src/groups/bmq/bmqt/bmqt_queueoptions.cpp index c12d8a060..4970574a8 100644 --- a/src/groups/bmq/bmqt/bmqt_queueoptions.cpp +++ b/src/groups/bmq/bmqt/bmqt_queueoptions.cpp @@ -165,7 +165,7 @@ bool QueueOptions::addOrUpdateSubscription(bsl::string* errorDescription, subscription.expression().text(), context)) { if (errorDescription) { - mwcu::MemOutStream os(d_allocator_p); + bmqu::MemOutStream os(d_allocator_p); os << "Expression validation failed: [ expression: \"" << subscription.expression().text() << "\", rc: " << context.lastError() << ", reason: \"" diff --git a/src/groups/bmq/bmqt/bmqt_queueoptions.h b/src/groups/bmq/bmqt/bmqt_queueoptions.h index 4b7fd6440..7af98bb7b 100644 --- a/src/groups/bmq/bmqt/bmqt_queueoptions.h +++ b/src/groups/bmq/bmqt/bmqt_queueoptions.h @@ -66,13 +66,12 @@ namespace bmqt { class QueueOptions { public: // PUBLIC CONSTANTS + + /// Constant representing the minimum valid consumer priority static const int k_CONSUMER_PRIORITY_MIN; - // Constant representing the minimum - // valid consumer priority + /// Constant representing the maximum valid consumer priority static const int k_CONSUMER_PRIORITY_MAX; - // Constant representing the maximum - // valid consumer priority static const int k_DEFAULT_MAX_UNCONFIRMED_MESSAGES; static const int k_DEFAULT_MAX_UNCONFIRMED_BYTES; @@ -87,19 +86,17 @@ class QueueOptions { // DATA Subscription d_info; + /// Whether the queue suspends operation while the host is unhealthy. bsl::optional d_suspendsOnBadHostHealth; - // Whether the queue suspends operation - // while the host is unhealthy. Subscriptions d_subscriptions; + /// `true` if `d_subscriptions` had a value, `false` otherwise. Emulates + /// `bsl::optional` for `d_subscriptions`. bool d_hadSubscriptions; - // 'true' if 'd_subscriptions' had a value, 'false' - // otherwise. Emulates 'bsl::optional' for - // 'd_subscriptions'. + /// Allocator bslma::Allocator* d_allocator_p; - // Allocator public: // PUBLIC TYPES diff --git a/src/groups/bmq/bmqt/bmqt_queueoptions.t.cpp b/src/groups/bmq/bmqt/bmqt_queueoptions.t.cpp index cc7de61f1..27229a680 100644 --- a/src/groups/bmq/bmqt/bmqt_queueoptions.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_queueoptions.t.cpp @@ -16,11 +16,10 @@ // bmqt_queueoptions.t.cpp -*-C++-*- #include -// MWC -#include +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -32,7 +31,7 @@ using namespace bsl; static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bmqt::QueueOptions obj(s_allocator_p); @@ -88,21 +87,21 @@ static void test1_breathingTest() " suspendsOnBadHostHealth = false ]"; { PVV("Print (print function)"); - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); obj.print(out, 0, -1); ASSERT_EQ(out.str(), expected); } { PVV("Print (stream operator)"); - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); out << obj; ASSERT_EQ(out.str(), expected); } { PVV("Print (bad stream)"); - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); out.setstate(bsl::ios_base::badbit); obj.print(out, 0, -1); ASSERT_EQ(out.str(), ""); @@ -127,7 +126,7 @@ static void test2_defaultsTest() // Basic functionality // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("DEFAULTS TEST"); + bmqtst::TestHelper::printTestName("DEFAULTS TEST"); PVV("Step 1. Construct default instance and test its values"); bmqt::QueueOptions options(s_allocator_p); @@ -172,7 +171,7 @@ static void test3_mergeTest() // - bmqt::QueueOptions::merge // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("MERGE TEST"); + bmqtst::TestHelper::printTestName("MERGE TEST"); PVV("Step 1. Construct two objects"); bmqt::QueueOptions options(s_allocator_p); @@ -202,7 +201,7 @@ static void test3_mergeTest() static void test4_subscriptionsTest() { - mwctst::TestHelper::printTestName("SUBSCRIPTIONS TEST"); + bmqtst::TestHelper::printTestName("SUBSCRIPTIONS TEST"); bmqt::QueueOptions obj(s_allocator_p); @@ -277,7 +276,7 @@ static void test4_subscriptionsTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -291,5 +290,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/bmqt_resultcode.t.cpp b/src/groups/bmq/bmqt/bmqt_resultcode.t.cpp index 3ca38149e..adff143b0 100644 --- a/src/groups/bmq/bmqt/bmqt_resultcode.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_resultcode.t.cpp @@ -24,11 +24,10 @@ #include #include -// MWC -#include +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -55,7 +54,7 @@ struct PrintTestData { static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Testing GenericResult"); bmqt::GenericResult::Enum obj; @@ -89,7 +88,7 @@ static void test1_breathingTest() static void test2_schemaConsistency() { - mwctst::TestHelper::printTestName("SCHEMA CONSISTENCY"); + bmqtst::TestHelper::printTestName("SCHEMA CONSISTENCY"); PV("Ensuring GenericResult and bmqp_ctrlmsg::StatusCategory in sync"); @@ -127,8 +126,8 @@ static void printEnumHelper(ARRAY (&data)[SIZE]) PVVV("Line [" << test.d_line << "]"); - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); typedef typename ENUM_TYPE::Enum T; @@ -155,7 +154,7 @@ static void printEnumHelper(ARRAY (&data)[SIZE]) static void test3_printTest() { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); PV("Testing bmqt::GenericResult print"); { @@ -338,7 +337,7 @@ static void idempotenceHelper(typename RESULT_TYPE::Enum enumVal, static void test4_idempotence() { - mwctst::TestHelper::printTestName("IDEMPOTENCE"); + bmqtst::TestHelper::printTestName("IDEMPOTENCE"); #define TEST_IDEMPOTENCE(ENUM_TYPE, ENUM_VAL) \ { \ PV("Testing idempotence for " #ENUM_VAL " value of " #ENUM_TYPE \ @@ -423,7 +422,7 @@ static void invalidValueFromAsciiHelper() static void test5_invalidValueFromAscii() { - mwctst::TestHelper::printTestName("INVALID VALUES FOR 'fromAscii'"); + bmqtst::TestHelper::printTestName("INVALID VALUES FOR 'fromAscii'"); invalidValueFromAsciiHelper(); invalidValueFromAsciiHelper(); invalidValueFromAsciiHelper(); @@ -438,7 +437,7 @@ static void test5_invalidValueFromAscii() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -453,5 +452,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/bmqt_sessioneventtype.t.cpp b/src/groups/bmq/bmqt/bmqt_sessioneventtype.t.cpp index cab38fc1c..e2b12a352 100644 --- a/src/groups/bmq/bmqt/bmqt_sessioneventtype.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_sessioneventtype.t.cpp @@ -16,15 +16,14 @@ // bmqt_sessioneventtype.t.cpp -*-C++-*- #include -// MWC -#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -36,7 +35,7 @@ using namespace bsl; static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bmqt::SessionEventType::Enum obj; bsl::string str; @@ -69,7 +68,7 @@ static void test1_breathingTest() static void test2_printTest() { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); PV("Testing print"); @@ -107,8 +106,8 @@ static void test2_printTest() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); expected << test.d_expected; @@ -135,7 +134,7 @@ static void test2_printTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -147,5 +146,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/bmqt_sessionoptions.h b/src/groups/bmq/bmqt/bmqt_sessionoptions.h index 74920761d..e311ccd1a 100644 --- a/src/groups/bmq/bmqt/bmqt_sessionoptions.h +++ b/src/groups/bmq/bmqt/bmqt_sessionoptions.h @@ -161,45 +161,40 @@ namespace bmqt { class SessionOptions { public: // CONSTANTS + + /// Default URI of the `bmqbrkr` to connect to. static const char k_BROKER_DEFAULT_URI[]; - // Default URI of the 'bmqbrkr' to connect to. + /// Default port the `bmqbrkr` is listening to for client to connect. static const int k_BROKER_DEFAULT_PORT = 30114; - // Default port the 'bmqbrkr' is listening to for client - // to connect. + /// The default, and minimum recommended, value for queue operations (open, + /// configure, close). static const int k_QUEUE_OPERATION_DEFAULT_TIMEOUT = 5 * bdlt::TimeUnitRatio::k_SECONDS_PER_MINUTE; - // The default, and minimum recommended, value for queue - // operations (open, configure, close). private: // DATA + + /// URI of the broker to connect to (ex: `tcp://localhost:30114`). Default + /// is to connect to the local broker. bsl::string d_brokerUri; - // URI of the broker to connect to (ex: - // 'tcp://localhost:30114'). Default - // is to connect to the local broker. + /// If not empty, use this value for the processName in the identity + /// message (useful for scripted language bindings). bsl::string d_processNameOverride; - // If not empty, use this value for the - // processName in the identity message - // (useful for scripted language - // bindings). + /// Number of processing threads. Default is 1 thread. int d_numProcessingThreads; - // Number of processing threads. - // Default is 1 thread. + /// Size of the blobs buffer. int d_blobBufferSize; - // Size of the blobs buffer. + /// Write cache high watermark to use on the channel bsls::Types::Int64 d_channelHighWatermark; - // Write cache high watermark to use on - // the channel + /// Interval at which to dump stats to log file (0 to disable dump) bsls::TimeInterval d_statsDumpInterval; - // Interval at which to dump stats to - // log file (0 to disable dump) bsls::TimeInterval d_connectTimeout; @@ -209,20 +204,17 @@ class SessionOptions { bsls::TimeInterval d_configureQueueTimeout; + /// Timeout for operations of the corresponding type. bsls::TimeInterval d_closeQueueTimeout; - // Timeout for operations of the - // corresponding type. int d_eventQueueLowWatermark; + /// Parameters to configure the EventQueue. int d_eventQueueHighWatermark; - // Parameters to configure the - // EventQueue. + /// DEPRECATED: This parameter is no longer relevant and will be removed in + /// future release of libbmq. int d_eventQueueSize; - // DEPRECATED: This parameter is no - // longer relevant and will be removed - // in future release of libbmq. bsl::shared_ptr d_hostHealthMonitor_sp; diff --git a/src/groups/bmq/bmqt/bmqt_sessionoptions.t.cpp b/src/groups/bmq/bmqt/bmqt_sessionoptions.t.cpp index 9a68a7838..42e5d1d1a 100644 --- a/src/groups/bmq/bmqt/bmqt_sessionoptions.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_sessionoptions.t.cpp @@ -16,14 +16,13 @@ // bmqt_sessionoptions.t.cpp -*-C++-*- #include -// MWC -#include +#include // BDE #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -35,7 +34,7 @@ using namespace bsl; static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // Create default sessionOptions bmqt::SessionOptions sessionOptions(s_allocator_p); @@ -43,7 +42,7 @@ static void test1_breathingTest() // Make sure 'k_BROKER_DEFAULT_PORT' and the default brokerUri are in sync { PV("CHECKING k_BROKER_DEFAULT_PORT and brokerUri()"); - mwcu::MemOutStream ss(s_allocator_p); + bmqu::MemOutStream ss(s_allocator_p); ss << "tcp://localhost:" << bmqt::SessionOptions::k_BROKER_DEFAULT_PORT; bsl::string str(ss.str().data(), ss.str().length(), s_allocator_p); @@ -62,9 +61,9 @@ static void test2_printTest() "closeQueueTimeout = 300 eventQueueLowWatermark = 50 " "eventQueueHighWatermark = 2000 hasHostHealthMonitor = false " "hasDistributedTracing = false ]"; - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); PV("Testing print"); - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); // Create default sessionOptions bmqt::SessionOptions sessionOptions(s_allocator_p); stream << sessionOptions; @@ -79,7 +78,7 @@ static void test2_printTest() static void test3_setterGetterAndCopyTest() { - mwctst::TestHelper::printTestName("SETTER GETTER"); + bmqtst::TestHelper::printTestName("SETTER GETTER"); PVV("Setter getter test"); // Create default sessionOptions bmqt::SessionOptions obj(s_allocator_p); @@ -170,7 +169,7 @@ static void test3_setterGetterAndCopyTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -183,5 +182,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/bmqt_subscription.h b/src/groups/bmq/bmqt/bmqt_subscription.h index 80fef4db2..ccce47194 100644 --- a/src/groups/bmq/bmqt/bmqt_subscription.h +++ b/src/groups/bmq/bmqt/bmqt_subscription.h @@ -61,17 +61,18 @@ class SubscriptionHandle { friend class bmqa::MessageIterator; public: + /// Initial (invalid) value for `bmqt::SubscriptionHandle::d_id` static const unsigned int k_INVALID_HANDLE_ID = 0; - // Initial (invalid) value for 'bmqt::SubscriptionHandle::d_id' private: // PRIVATE DATA + + /// Internal, unique key unsigned int d_id; - // Internal, unique key + /// User-specified, not required to be unique bmqt::CorrelationId d_correlationId; - // User-specified, not required to be - // unique + private: // PRIVATE CLASS METHODS static unsigned int nextId(); @@ -122,18 +123,22 @@ class SubscriptionHandle { class SubscriptionExpression { public: // TYPES + + /// Enum representing criteria format enum Enum { - // Enum representing criteria format - e_NONE = 0 // EMPTY + /// EMPTY + e_NONE = 0 + , - e_VERSION_1 = 1 // Simple Evaluator + /// Simple Evaluator + e_VERSION_1 = 1 }; private: bsl::string d_expression; // e.g., "firmId == foo" - Enum d_version; // Required to support newer style - // of expressions in future + // Required to support newer style of expressions in future + Enum d_version; public: // CREATORS @@ -164,13 +169,12 @@ class SubscriptionExpression { class Subscription { public: // PUBLIC CONSTANTS + + /// Constant representing the minimum valid consumer priority static const int k_CONSUMER_PRIORITY_MIN; - // Constant representing the minimum - // valid consumer priority + /// Constant representing the maximum valid consumer priority static const int k_CONSUMER_PRIORITY_MAX; - // Constant representing the maximum - // valid consumer priority static const int k_DEFAULT_MAX_UNCONFIRMED_MESSAGES; static const int k_DEFAULT_MAX_UNCONFIRMED_BYTES; @@ -178,25 +182,23 @@ class Subscription { private: // PRIVATE DATA + + /// Maximum number of outstanding messages that can be sent by the broker + /// without being confirmed. bsl::optional d_maxUnconfirmedMessages; - // Maximum number of outstanding - // messages that can be sent by the - // broker without being confirmed. + /// Maximum accumulated bytes of all outstanding messages that can be sent + /// by the broker without being confirmed. bsl::optional d_maxUnconfirmedBytes; - // Maximum accumulated bytes of all - // outstanding messages that can be - // sent by the broker without being - // confirmed. + /// Priority of a consumer with respect to delivery of messages bsl::optional d_consumerPriority; - // Priority of a consumer with respect - // to delivery of messages SubscriptionExpression d_expression; public: // CREATORS + /// Create a new Subscription Subscription(); diff --git a/src/groups/bmq/bmqt/bmqt_uri.cpp b/src/groups/bmq/bmqt/bmqt_uri.cpp index 5840e6110..2ef7fa0d5 100644 --- a/src/groups/bmq/bmqt/bmqt_uri.cpp +++ b/src/groups/bmq/bmqt/bmqt_uri.cpp @@ -18,7 +18,7 @@ #include // BMQ -#include +#include // BDE #include @@ -293,7 +293,7 @@ int UriParser::parse(Uri* result, result->d_uri.length()); if (rc != 0) { if (errorDescription) { - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "invalid format (" << rc << ")"; errorDescription->assign(os.str().data(), os.str().length()); } @@ -383,7 +383,7 @@ int UriParser::parse(Uri* result, // in the test driver. BSLMT_ONCE_DO { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "The queue name part of '" << uriString << "' is exceeding " << "the maximum size limit of " << Uri::k_QUEUENAME_MAX_LENGTH << ". This is only a warning at the moment, but this limit " @@ -445,7 +445,7 @@ int UriBuilder::uri(Uri* result, bsl::string* errorDescription) const bslma::Default::allocator()); // Build the string - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << d_uri.d_scheme << "://" << d_uri.d_domain; if (!d_uri.d_tier.empty()) { os << k_TIER_PREFIX << d_uri.d_tier; diff --git a/src/groups/bmq/bmqt/bmqt_uri.h b/src/groups/bmq/bmqt/bmqt_uri.h index 7f51c631e..50a45096e 100644 --- a/src/groups/bmq/bmqt/bmqt_uri.h +++ b/src/groups/bmq/bmqt/bmqt_uri.h @@ -174,27 +174,31 @@ class Uri { private: // DATA - bsl::string d_uri; // The full URI - bslstl::StringRef d_scheme; // URI scheme (must be "bmq"). + /// The full URI + bsl::string d_uri; - bslstl::StringRef d_authority; // URI authority (domain + optional - // tier) + /// URI scheme (must be "bmq"). + bslstl::StringRef d_scheme; - bslstl::StringRef d_domain; // URI domain + /// URI authority (domain + optional tier) + bslstl::StringRef d_authority; - bslstl::StringRef d_tier; // URI tier + /// URI domain + bslstl::StringRef d_domain; - bslstl::StringRef d_path; // URI path (i.e queue name). + /// URI tier + bslstl::StringRef d_tier; - bslstl::StringRef d_query_id; // Optional application id, part of the - // URI query if present. + /// URI path (i.e queue name). + bslstl::StringRef d_path; + /// Optional application id, part of the URI query if present. + bslstl::StringRef d_query_id; + + /// Flag indicating whether the URI parser was initialized (and whether + /// shutdown should be called on it at destruction) bool d_wasParserInitialized; - // Flag indicating whether the URI - // parser was initialized (and whether - // shutdown should be called on it at - // destruction) private: // PRIVATE MANIPULATORS diff --git a/src/groups/bmq/bmqt/bmqt_uri.t.cpp b/src/groups/bmq/bmqt/bmqt_uri.t.cpp index 340eda616..3d1dcf0a8 100644 --- a/src/groups/bmq/bmqt/bmqt_uri.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_uri.t.cpp @@ -16,9 +16,8 @@ // bmqt_uri.t.cpp -*-C++-*- #include -// MWC -#include -#include +#include +#include // BDE #include @@ -32,7 +31,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -55,8 +54,8 @@ static void threadFunction(int threadId, barrier->wait(); for (int i = 0; i < numIterations; ++i) { - mwcu::MemOutStream osstrDomain(s_allocator_p); - mwcu::MemOutStream osstrQueue(s_allocator_p); + bmqu::MemOutStream osstrDomain(s_allocator_p); + bmqu::MemOutStream osstrQueue(s_allocator_p); osstrDomain << "my.domain." << threadId << "." << i; osstrQueue << "queue-foo-bar-" << threadId << "-" << i; @@ -95,7 +94,7 @@ static void test1_breathingTest() // int Uri::parseUri // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bmqt::UriParser::initialize(s_allocator_p); @@ -315,7 +314,7 @@ static void test1_breathingTest() static void test2_URIBuilder() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bmqt::UriParser::initialize(s_allocator_p); @@ -451,7 +450,7 @@ static void test3_URIBuilderMultiThreaded() // 'bslmt::ThreadUtil::create()' uses the global allocator to allocate // memory. - mwctst::TestHelper::printTestName("MULTI-THREADED URI BUILDER TEST"); + bmqtst::TestHelper::printTestName("MULTI-THREADED URI BUILDER TEST"); bmqt::UriParser::initialize(s_allocator_p); @@ -493,7 +492,7 @@ static void test3_URIBuilderMultiThreaded() threadResults[j].second, 0); // builder rc - mwcu::MemOutStream expectedUriStr(s_allocator_p); + bmqu::MemOutStream expectedUriStr(s_allocator_p); expectedUriStr << "bmq://my.domain." << i << "." << j << "/queue-foo-bar-" << i << "-" << j; bmqt::Uri expectedUri(expectedUriStr.str(), s_allocator_p); @@ -520,7 +519,7 @@ static void test4_initializeShutdown() // again. // ---------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("INITIALIZE / SHUTDOWN"); + bmqtst::TestHelper::printTestName("INITIALIZE / SHUTDOWN"); // Initialize the 'UriParser'. bmqt::UriParser::initialize(s_allocator_p); @@ -541,13 +540,13 @@ static void test4_initializeShutdown() /// Test Uri print method. static void test5_testPrint() { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); bmqt::UriParser::initialize(s_allocator_p); PV("Testing print"); - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); bmqt::Uri obj("bmq://my.domain/myQueue", s_allocator_p); // Test stream output without line feed @@ -587,7 +586,7 @@ static void test6_hashAppend() // hashAppend(HASH_ALGORITHM& hashAlgo, const bmqt::Uri& uri) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HASH APPEND"); + bmqtst::TestHelper::printTestName("HASH APPEND"); bmqt::UriParser::initialize(s_allocator_p); @@ -626,18 +625,18 @@ static void test7_testLongUri() // logged via 'BALL_LOG_ERROR' which allocates using // the default allocator. - mwctst::TestHelper::printTestName("LONG URI TEST"); + bmqtst::TestHelper::printTestName("LONG URI TEST"); bmqt::UriParser::initialize(s_allocator_p); - mwctst::ScopedLogObserver observer(ball::Severity::WARN, s_allocator_p); + bmqtst::ScopedLogObserver observer(ball::Severity::WARN, s_allocator_p); bsl::string domainStr("bmq://my.domain/", s_allocator_p); bsl::string pathStr(bmqt::Uri::k_QUEUENAME_MAX_LENGTH + 1, 'q', s_allocator_p); - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); stream << domainStr << pathStr; bmqt::Uri obj(stream.str(), s_allocator_p); @@ -647,7 +646,7 @@ static void test7_testLongUri() ASSERT_EQ(observer.records()[0].fixedFields().severity(), ball::Severity::ERROR); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( observer.records()[0], pathStr.data(), s_allocator_p)); @@ -663,7 +662,7 @@ static void test7_testLongUri() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -680,5 +679,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/bmqt_version.t.cpp b/src/groups/bmq/bmqt/bmqt_version.t.cpp index 6e4964941..1f01dc93b 100644 --- a/src/groups/bmq/bmqt/bmqt_version.t.cpp +++ b/src/groups/bmq/bmqt/bmqt_version.t.cpp @@ -17,10 +17,10 @@ #include // BMQ -#include +#include // TEST DRIVER -#include +#include // Some GNU header defines these functions as macros for POSIX // compatibility @@ -59,7 +59,7 @@ static void test1_breathingTest() // Printing // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // Creators bmqt::Version a; @@ -114,28 +114,28 @@ static void test1_breathingTest() // Printing { - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); os << a; bsl::string str(s_allocator_p); str.assign(os.str().data(), os.str().length()); ASSERT_EQ(str, "[ major = 0 minor = 0 ]"); } { - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); os << b; bsl::string str(s_allocator_p); str.assign(os.str().data(), os.str().length()); ASSERT_EQ(str, "[ major = 1 minor = 2 ]"); } { - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); os << c; bsl::string str(s_allocator_p); str.assign(os.str().data(), os.str().length()); ASSERT_EQ(str, "[ major = 4 minor = 3 ]"); } { - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); out.setstate(bsl::ios_base::badbit); a.print(out, 0, -1); ASSERT_EQ(out.str(), ""); @@ -148,7 +148,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -159,5 +159,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqt/doc/bmqt.txt b/src/groups/bmq/bmqt/doc/bmqt.txt new file mode 100644 index 000000000..7eea473ad --- /dev/null +++ b/src/groups/bmq/bmqt/doc/bmqt.txt @@ -0,0 +1,39 @@ +@PURPOSE: Provide value-semantic vocabulary types. + +@MNEMONIC: BlazingMQ Types (bmqt) + +@DESCRIPTION: This package provides value-semantic vocabulary types. + +/Hierarchical Synopsis +/--------------------- +The 'bmqt' package currently has 18 components having 2 levels of physical +dependency. The list below shows the hierarchal ordering of the components. +.. + 2. bmqt_subscription + + 1. bmqt_compressionalgorithmtype + bmqt_correlationid + bmqt_encodingtype + bmqt_hosthealthstate + bmqt_messageeventtype + bmqt_messageguid + bmqt_propertytype + bmqt_queueflags + bmqt_queueoptions + bmqt_resultcode + bmqt_sessioneventtype + bmqt_sessionoptions + bmqt_uri + bmqt_version +.. + +/Component Synopsis +/------------------ +: 'bmqt_propertybag': +: Provide a bag of named properties. +: +: 'bmqt_rcdescriptionerror': +: Provide a value-semantic class for a typical error. +: +: 'bmqt_valueorerror': +: Provide a value-semantic class that may hold a value or an error. diff --git a/src/groups/bmq/bmqt/package/bmqt.dep b/src/groups/bmq/bmqt/package/bmqt.dep index ff9785c6b..0ca68bb9d 100644 --- a/src/groups/bmq/bmqt/package/bmqt.dep +++ b/src/groups/bmq/bmqt/package/bmqt.dep @@ -1,2 +1,3 @@ bmqeval bmqscm +bmqu diff --git a/src/groups/bmq/bmqt/package/mwct.mem b/src/groups/bmq/bmqt/package/mwct.mem new file mode 100644 index 000000000..cb42aac79 --- /dev/null +++ b/src/groups/bmq/bmqt/package/mwct.mem @@ -0,0 +1,3 @@ +bmqt_propertybag +bmqt_rcdescriptionerror +bmqt_valueorerror diff --git a/src/groups/mwc/mwctsk/mwctsk_alarmlog.cpp b/src/groups/bmq/bmqtsk/bmqtsk_alarmlog.cpp similarity index 91% rename from src/groups/mwc/mwctsk/mwctsk_alarmlog.cpp rename to src/groups/bmq/bmqtsk/bmqtsk_alarmlog.cpp index b47543922..95c9da3c3 100644 --- a/src/groups/mwc/mwctsk/mwctsk_alarmlog.cpp +++ b/src/groups/bmq/bmqtsk/bmqtsk_alarmlog.cpp @@ -13,14 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctsk_alarmlog.cpp -*-C++-*- -#include +// bmqtsk_alarmlog.cpp -*-C++-*- +#include -#include +#include -// MWC -#include -#include +#include +#include // BDE #include @@ -33,7 +32,7 @@ #include namespace BloombergLP { -namespace mwctsk { +namespace bmqtsk { namespace { const int k_ALARM_INTERVAL = 60; @@ -84,7 +83,7 @@ void AlarmLog::publish(const ball::Record& record, const bsl::string& alarmType = record.customFields()[0].theString(); // Raw version used, no throttling - if (mwcu::StringUtil::startsWith(alarmType, "RAW_")) { + if (bmqu::StringUtil::startsWith(alarmType, "RAW_")) { // We are stripping out the 'RAW_' prefix from the alarm identification // string. const bslstl::StringRef categoryStr(alarmType.c_str() + 4, @@ -95,7 +94,7 @@ void AlarmLog::publish(const ball::Record& record, // Build the log source unique identifier (used for rate-limiting alarms) // by concatenating the file and the line. - mwcu::MemOutStream ss(d_allocator_p); + bmqu::MemOutStream ss(d_allocator_p); ss << record.fixedFields().fileName() << ":" << record.fixedFields().lineNumber() << bsl::ends; diff --git a/src/groups/mwc/mwctsk/mwctsk_alarmlog.h b/src/groups/bmq/bmqtsk/bmqtsk_alarmlog.h similarity index 85% rename from src/groups/mwc/mwctsk/mwctsk_alarmlog.h rename to src/groups/bmq/bmqtsk/bmqtsk_alarmlog.h index 000c72376..a597255b1 100644 --- a/src/groups/mwc/mwctsk/mwctsk_alarmlog.h +++ b/src/groups/bmq/bmqtsk/bmqtsk_alarmlog.h @@ -13,32 +13,32 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctsk_alarmlog.h -*-C++-*- -#ifndef INCLUDED_MWCTSK_ALARMLOG -#define INCLUDED_MWCTSK_ALARMLOG +// bmqtsk_alarmlog.h -*-C++-*- +#ifndef INCLUDED_BMQTSK_ALARMLOG +#define INCLUDED_BMQTSK_ALARMLOG //@PURPOSE: Provide a BALL observer for ALARMS with rate-controlled output. // //@CLASSES: -// mwctsk::AlarmLog: BALL observer emitting alarms to stderr +// bmqtsk::AlarmLog: BALL observer emitting alarms to stderr // //@MACROS: -// MWCTSK_ALARMLOG_ALARM: Macro for emitting a throttled regular alarm -// MWCTSK_ALARMLOG_PANIC: Macro for emitting a throttled 'PANIC' alarm -// MWCTSK_ALARMLOG_RAW_ALARM: Macro for emitting a non-throttled regular alarm -// MWCTSK_ALARMLOG_RAW_PANIC: Macro for emitting a non-throttled 'PANIC' alarm +// BMQTSK_ALARMLOG_ALARM: Macro for emitting a throttled regular alarm +// BMQTSK_ALARMLOG_PANIC: Macro for emitting a throttled 'PANIC' alarm +// BMQTSK_ALARMLOG_RAW_ALARM: Macro for emitting a non-throttled regular alarm +// BMQTSK_ALARMLOG_RAW_PANIC: Macro for emitting a non-throttled 'PANIC' alarm // -//@DESCRIPTION: 'mwctsk::AlarmLog' implements the 'ball::ObserverAdapter' +//@DESCRIPTION: 'bmqtsk::AlarmLog' implements the 'ball::ObserverAdapter' // protocol to monitor ball logs. If a log record matches specific criteria, // it will be dumped to 'stderr' so that some external monitoring systems can // trigger system alerts about those events. Two macros, -// 'MWCTSK_ALARMLOG_ALARM' and 'MWCTSK_ALARMLOG_PANIC' are provided in order to +// 'BMQTSK_ALARMLOG_ALARM' and 'BMQTSK_ALARMLOG_PANIC' are provided in order to // facilitate generation of rate-contolled (throttled) alarms. The alarms are // rate-controlled so that no more than *one* alarm per minute, for the same // source, will be generated. Additionally, two macros, -// 'MWCTSK_ALARMLOG_RAW_ALARM' and 'MWCTSK_ALARMLOG_RAW_PANIC' are provided in +// 'BMQTSK_ALARMLOG_RAW_ALARM' and 'BMQTSK_ALARMLOG_RAW_PANIC' are provided in // order to facilitate generation of non-throttled alarms. These alarms are -// always immediately generated. Finally, note that the 'mwctsk::AlarmLog' +// always immediately generated. Finally, note that the 'bmqtsk::AlarmLog' // must be registered to the BALL logging infrastructure. // /// Thread-safety @@ -49,7 +49,7 @@ /// Implementation Notes ///-------------------- // The implementation leverages the 'customFields' on a ball record: the two -// 'MWCTSK_ALARMLOG_ALARM' and 'MWCTSK_ALARMLOG_PANIC' macros are simply using +// 'BMQTSK_ALARMLOG_ALARM' and 'BMQTSK_ALARMLOG_PANIC' macros are simply using // the default 'BALL_LOG_ERROR_BLOCK' macro to create a 'ballRecord', and // setting its first customField to the corresponding string. // @@ -63,7 +63,7 @@ // // First, we create a 'LogAlarm' object: //.. -// mwctsk::LogAlarm logAlarm(allocator); +// bmqtsk::LogAlarm logAlarm(allocator); //.. // // Then, we need to register this Observer to the BALL logging infrastructure. @@ -85,9 +85,9 @@ // // We can now use the macros to emit alarms: //.. -// MWCTSK_LOGALARM_PANIC("MyErrorCategory") +// BMQTSK_LOGALARM_PANIC("MyErrorCategory") // << "Unable to start task [rc: " << rc << "]" -// << MWCTSK_LOGALARM_END; +// << BMQTSK_LOGALARM_END; //.. // // Finally, before destruction we must unregister the observer. @@ -101,8 +101,6 @@ //.. // -// MWC - // BDE #include #include @@ -125,33 +123,33 @@ // used, exactly the same way as the scope and 'BALL_LOG_OUTPUT_STREAM' in // 'BALL_LOG_ERROR_BLOCK', meaning that: //: o log message is streamed into the macro -//: o the call must be ended by a terminal 'MWCTSK_ALARMLOG_END' -#define MWCTSK_ALARMLOG_ALARM(CATEGORY) \ +//: o the call must be ended by a terminal 'BMQTSK_ALARMLOG_END' +#define BMQTSK_ALARMLOG_ALARM(CATEGORY) \ BALL_LOG_ERROR_BLOCK \ { \ BALL_LOG_OUTPUT_STREAM << "ALARM [" << CATEGORY << "] "; \ BALL_LOG_RECORD->customFields().appendString("ALARM"); \ BALL_LOG_OUTPUT_STREAM -#define MWCTSK_ALARMLOG_PANIC(CATEGORY) \ +#define BMQTSK_ALARMLOG_PANIC(CATEGORY) \ BALL_LOG_ERROR_BLOCK \ { \ BALL_LOG_OUTPUT_STREAM << "PANIC [" << CATEGORY << "] "; \ BALL_LOG_RECORD->customFields().appendString("PANIC"); \ BALL_LOG_OUTPUT_STREAM -#define MWCTSK_ALARMLOG_END \ +#define BMQTSK_ALARMLOG_END \ ""; \ } // The following two macros provide a simple wrapper on top of the // 'BALL_LOG_ERROR_BLOCK' macro as above, setting up the alarm identification // field, only doing so in such a way that alarm generation is not throttled. -#define MWCTSK_ALARMLOG_RAW_ALARM(CATEGORY) \ +#define BMQTSK_ALARMLOG_RAW_ALARM(CATEGORY) \ BALL_LOG_ERROR_BLOCK \ { \ BALL_LOG_OUTPUT_STREAM << "ALARM [" << CATEGORY << "] "; \ BALL_LOG_RECORD->customFields().appendString("RAW_ALARM"); \ BALL_LOG_OUTPUT_STREAM -#define MWCTSK_ALARMLOG_RAW_PANIC(CATEGORY) \ +#define BMQTSK_ALARMLOG_RAW_PANIC(CATEGORY) \ BALL_LOG_ERROR_BLOCK \ { \ BALL_LOG_OUTPUT_STREAM << "PANIC [" << CATEGORY << "] "; \ @@ -159,7 +157,7 @@ BALL_LOG_OUTPUT_STREAM namespace BloombergLP { -namespace mwctsk { +namespace bmqtsk { // ============== // class AlarmLog diff --git a/src/groups/mwc/mwctsk/mwctsk_consoleobserver.cpp b/src/groups/bmq/bmqtsk/bmqtsk_consoleobserver.cpp similarity index 94% rename from src/groups/mwc/mwctsk/mwctsk_consoleobserver.cpp rename to src/groups/bmq/bmqtsk/bmqtsk_consoleobserver.cpp index b7ac6b7f4..5b3aea598 100644 --- a/src/groups/mwc/mwctsk/mwctsk_consoleobserver.cpp +++ b/src/groups/bmq/bmqtsk/bmqtsk_consoleobserver.cpp @@ -13,14 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctsk_consoleobserver.cpp -*-C++-*- -#include +// bmqtsk_consoleobserver.cpp -*-C++-*- +#include -#include +#include -// MWC -#include -#include +#include +#include // BDE #include @@ -40,7 +39,7 @@ #include // for tty detection namespace BloombergLP { -namespace mwctsk { +namespace bmqtsk { namespace { const char k_COLOR_RESET[] = "\033[0m"; @@ -82,8 +81,8 @@ void ConsoleObserver::initializeColorMap() return; // RETURN } - mwcu::MemOutStream osCode; - mwcu::MemOutStream osName; + bmqu::MemOutStream osCode; + bmqu::MemOutStream osName; bsl::string name; // Colors with no background @@ -170,7 +169,7 @@ ConsoleObserver::getColorCodeForRecord(const ball::Record& record) const for (CategoryColorVec::const_iterator it = d_categoryColorVec.begin(); it != d_categoryColorVec.end(); ++it) { - if (mwcu::StringUtil::match(record.fixedFields().category(), + if (bmqu::StringUtil::match(record.fixedFields().category(), it->first)) { return it->second; // RETURN } @@ -230,8 +229,8 @@ ConsoleObserver::setCategoryColor(const bslstl::StringRef& category, // The ball logger may not have been initialized yet, depending on // the initialization sequence performed by the user of this // component. - bsl::cerr << "mwctsk::ConsoleObserver: " - << "Color '" << color << "' not found\n" + bsl::cerr << "bmqtsk::ConsoleObserver: " << "Color '" << color + << "' not found\n" << bsl::flush; } @@ -278,7 +277,7 @@ void ConsoleObserver::publish( // Format record with color information bdlma::LocalSequentialAllocator<1024> localAllocator(d_allocator_p); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); d_formatter(os, record); // Add color information diff --git a/src/groups/mwc/mwctsk/mwctsk_consoleobserver.h b/src/groups/bmq/bmqtsk/bmqtsk_consoleobserver.h similarity index 94% rename from src/groups/mwc/mwctsk/mwctsk_consoleobserver.h rename to src/groups/bmq/bmqtsk/bmqtsk_consoleobserver.h index 08c118764..472727ad1 100644 --- a/src/groups/mwc/mwctsk/mwctsk_consoleobserver.h +++ b/src/groups/bmq/bmqtsk/bmqtsk_consoleobserver.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctsk_consoleobserver.h -*-C++-*- -#ifndef INCLUDED_MWCTSK_CONSOLEOBSERVER -#define INCLUDED_MWCTSK_CONSOLEOBSERVER +// bmqtsk_consoleobserver.h -*-C++-*- +#ifndef INCLUDED_BMQTSK_CONSOLEOBSERVER +#define INCLUDED_BMQTSK_CONSOLEOBSERVER //@PURPOSE: Provide a customizable colorized console output for BALL logging. // //@CLASSES: -// mwctsk::ConsoleObserver: BALL observer printing to stdout +// bmqtsk::ConsoleObserver: BALL observer printing to stdout // -//@DESCRIPTION: 'mwctsk::ConsoleObserver' is a concrete implementation of the +//@DESCRIPTION: 'bmqtsk::ConsoleObserver' is a concrete implementation of the // 'ball::ObserverAdapter' protocol which outputs to stdout and can be // configured to use Unix terminal colors based on categories or severity. // @@ -63,7 +63,7 @@ // First, we create a 'ConsoleObserver' object and configure it with the // severity threshold beyond which to print to stdout, and the format to use. //.. -// mwctsk::ConsoleObserver consoleObserver(allocator); +// bmqtsk::ConsoleObserver consoleObserver(allocator); // // consoleObserver.setSeverityThreshold(ball::Severity::INFO) // .setLogFromat("%d (%t) %s %F:%l %m\n"); @@ -72,8 +72,8 @@ // Then, we can configure some colors to use for specific categories (note that // this step can be done now or at any point in the future): //.. -// consoleObserver.setCategoryColor("MWC*", "green") -// .setCategoryColor("MWCTSK.APPLICATION", "red-on-yellow"); +// consoleObserver.setCategoryColor("MQB*", "green") +// .setCategoryColor("BMQTSK.APPLICATION", "red-on-yellow"); //.. // // Finally, we need to register this Observer to the BALL logging @@ -104,8 +104,6 @@ //.. // -// MWC - // BDE #include #include @@ -122,7 +120,7 @@ namespace BloombergLP { -namespace mwctsk { +namespace bmqtsk { // ===================== // class ConsoleObserver @@ -132,7 +130,7 @@ namespace mwctsk { class ConsoleObserver : public ball::ObserverAdapter { private: // CLASS-SCOPE CATEGORY - BALL_LOG_SET_CLASS_CATEGORY("MWCTSK.CONSOLEOBSERVER"); + BALL_LOG_SET_CLASS_CATEGORY("BMQTSK.CONSOLEOBSERVER"); private: // PRIVATE TYPES diff --git a/src/groups/mwc/mwctsk/mwctsk_logcleaner.cpp b/src/groups/bmq/bmqtsk/bmqtsk_logcleaner.cpp similarity index 90% rename from src/groups/mwc/mwctsk/mwctsk_logcleaner.cpp rename to src/groups/bmq/bmqtsk/bmqtsk_logcleaner.cpp index 8b8597bc4..65b8a193c 100644 --- a/src/groups/mwc/mwctsk/mwctsk_logcleaner.cpp +++ b/src/groups/bmq/bmqtsk/bmqtsk_logcleaner.cpp @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctsk_logcleaner.cpp -*-C++-*- -#include +// bmqtsk_logcleaner.cpp -*-C++-*- +#include -#include -// MWC -#include -#include -#include +#include + +#include +#include +#include // BDE #include @@ -44,7 +44,7 @@ namespace BloombergLP { namespace { -BALL_LOG_SET_NAMESPACE_CATEGORY("MWCTSK.LOGCLEANER"); +BALL_LOG_SET_NAMESPACE_CATEGORY("BMQTSK.LOGCLEANER"); // UTILITY FUNCTIONS @@ -55,7 +55,7 @@ bslmt::ThreadAttributes logsCleaningThreadAttributes() // NOTE: Use low priority scheduling thread, since the log rotation // operation is a background IO cleanup job. - bslmt::ThreadAttributes attr = mwcsys::ThreadUtil::defaultAttributes(); + bslmt::ThreadAttributes attr = bmqsys::ThreadUtil::defaultAttributes(); attr.setInheritSchedule(false); attr.setSchedulingPriority( bslmt::ThreadUtil::getMinSchedulingPriority(attr.schedulingPolicy())); @@ -65,7 +65,7 @@ bslmt::ThreadAttributes logsCleaningThreadAttributes() } // unnamed namespace -namespace mwctsk { +namespace bmqtsk { // ---------------- // class LogCleaner @@ -128,7 +128,7 @@ LogCleaner::LogCleaner(bdlmt::EventScheduler* scheduler, bslma::Allocator* allocator) : d_scheduler_p(scheduler) , d_logsCleaningEvent() -, d_logsCleaningContext(mwcex::SystemExecutor(logsCleaningThreadAttributes(), +, d_logsCleaningContext(bmqex::SystemExecutor(logsCleaningThreadAttributes(), allocator), allocator) , d_filePattern(allocator) @@ -164,8 +164,8 @@ int LogCleaner::start(bslstl::StringRef pattern, d_scheduler_p->scheduleRecurringEvent( &d_logsCleaningEvent, cleanupPeriod, - mwcex::BindUtil::bindExecute( - mwcex::ExecutionPolicyUtil::oneWay().neverBlocking().useExecutor( + bmqex::BindUtil::bindExecute( + bmqex::ExecutionPolicyUtil::oneWay().neverBlocking().useExecutor( d_logsCleaningContext.executor()), bdlf::MemFnUtil::memFn(&LogCleaner::cleanLogs, this)), bsls::SystemTime::now(d_scheduler_p->clockType())); diff --git a/src/groups/mwc/mwctsk/mwctsk_logcleaner.h b/src/groups/bmq/bmqtsk/bmqtsk_logcleaner.h similarity index 91% rename from src/groups/mwc/mwctsk/mwctsk_logcleaner.h rename to src/groups/bmq/bmqtsk/bmqtsk_logcleaner.h index bf6b60501..680b78ab5 100644 --- a/src/groups/mwc/mwctsk/mwctsk_logcleaner.h +++ b/src/groups/bmq/bmqtsk/bmqtsk_logcleaner.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctsk_logcleaner.h -*-C++-*- -#ifndef INCLUDED_MWCTSK_LOGCLEANER -#define INCLUDED_MWCTSK_LOGCLEANER +// bmqtsk_logcleaner.h -*-C++-*- +#ifndef INCLUDED_BMQTSK_LOGCLEANER +#define INCLUDED_BMQTSK_LOGCLEANER //@PURPOSE: Provide a mechanism to periodically clean up old logs. // //@CLASSES: -// mwctsk::LogCleaner: Mechanism to periodically clean up old logs +// bmqtsk::LogCleaner: Mechanism to periodically clean up old logs // -//@DESCRIPTION: 'mwctsk::LogCleaner' is a mechanism to manage periodic +//@DESCRIPTION: 'bmqtsk::LogCleaner' is a mechanism to manage periodic // cleaning of old log files. // /// Threading @@ -42,7 +42,7 @@ // // First, we create a 'LogCleaner' object, and pass it an event scheduler. //.. -// mwctsk::LogCleaner logCleaner(&scheduler); +// bmqtsk::LogCleaner logCleaner(&scheduler); //.. // // We can then start it, but first, we use the 'ball::LogFileCleanerUtil' to @@ -72,10 +72,8 @@ // logCleaner.stop(); //.. -// MWC - -#include -#include +#include +#include // BDE #include @@ -89,7 +87,7 @@ namespace BloombergLP { -namespace mwctsk { +namespace bmqtsk { // ================ // class LogCleaner @@ -110,7 +108,7 @@ class LogCleaner { // This strand is used to perform logs cleaning in the context of a // separate thread. - mwcex::Strand d_logsCleaningContext; + bmqex::Strand d_logsCleaningContext; // Pattern of the files to cleanup. bsl::string d_filePattern; diff --git a/src/groups/mwc/mwctsk/mwctsk_logcontroller.cpp b/src/groups/bmq/bmqtsk/bmqtsk_logcontroller.cpp similarity index 97% rename from src/groups/mwc/mwctsk/mwctsk_logcontroller.cpp rename to src/groups/bmq/bmqtsk/bmqtsk_logcontroller.cpp index fcdf594e2..9f38012bd 100644 --- a/src/groups/mwc/mwctsk/mwctsk_logcontroller.cpp +++ b/src/groups/bmq/bmqtsk/bmqtsk_logcontroller.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctsk_logcontroller.cpp -*-C++-*- -#include +// bmqtsk_logcontroller.cpp -*-C++-*- +#include -#include -// MWC -#include +#include + +#include // BDE #include @@ -54,11 +54,11 @@ #include // symlink() namespace BloombergLP { -namespace mwctsk { +namespace bmqtsk { namespace { -BALL_LOG_SET_NAMESPACE_CATEGORY("MWCTSK.LOGCONTROLLER"); +BALL_LOG_SET_NAMESPACE_CATEGORY("BMQTSK.LOGCONTROLLER"); void printCategoryWithDelimiter(const bsl::shared_ptr& os, ball::Category* category, @@ -198,7 +198,7 @@ int LogControllerConfig::addCategoryProperties(const bsl::string& properties) { // NOTE: //: o the 'properties' parameter *must* remain a string, and not a - // stringRef because it's passed to 'mwcu::StringUtil::strTokenizeRef' + // stringRef because it's passed to 'bmqu::StringUtil::strTokenizeRef' // which returns references to the 'string' passed as parameter (so we // can't have it perform an implicit stringRef to string conversion // because then the returned stringRef would point to a deleted @@ -206,7 +206,7 @@ int LogControllerConfig::addCategoryProperties(const bsl::string& properties) //: the format of 'properties' is: categoryExpression:severity:color bsl::vector tokens = - mwcu::StringUtil::strTokenizeRef(properties, ":"); + bmqu::StringUtil::strTokenizeRef(properties, ":"); if (tokens.size() != 3) { return -1; // RETURN @@ -666,9 +666,8 @@ int LogController::initialize(bsl::ostream& errorDescription, // FileObserver rc = d_fileObserver.enableFileLogging(config.fileName().c_str()); if (rc != 0) { - errorDescription << "Failed enabling file logging " - << "[rc: " << rc << ", file: '" << config.fileName() - << "']"; + errorDescription << "Failed enabling file logging " << "[rc: " << rc + << ", file: '" << config.fileName() << "']"; ball::LoggerManager::shutDownSingleton(); return rc_FILEOBSERVER_ENABLE_FAILED; // RETURN } @@ -689,8 +688,8 @@ int LogController::initialize(bsl::ostream& errorDescription, rc = tryRegisterObserver(&d_fileObserver); if (rc != 0) { - errorDescription << "Failed registering FileObserver " - << "[rc: " << rc << "]"; + errorDescription << "Failed registering FileObserver " << "[rc: " << rc + << "]"; ball::LoggerManager::shutDownSingleton(); return rc_FILEOBSERVER_REGISTRATION_FAILED; // RETURN } @@ -699,8 +698,8 @@ int LogController::initialize(bsl::ostream& errorDescription, // AlarmLog rc = tryRegisterObserver(&d_alarmLog); if (rc != 0) { - errorDescription << "Failed registering AlarmLog " - << "[rc: " << rc << "]"; + errorDescription << "Failed registering AlarmLog " << "[rc: " << rc + << "]"; ball::LoggerManager::shutDownSingleton(); return rc_ALARMLOG_REGISTRATION_FAILED; // RETURN } diff --git a/src/groups/mwc/mwctsk/mwctsk_logcontroller.h b/src/groups/bmq/bmqtsk/bmqtsk_logcontroller.h similarity index 96% rename from src/groups/mwc/mwctsk/mwctsk_logcontroller.h rename to src/groups/bmq/bmqtsk/bmqtsk_logcontroller.h index a966ea638..1c49ec100 100644 --- a/src/groups/mwc/mwctsk/mwctsk_logcontroller.h +++ b/src/groups/bmq/bmqtsk/bmqtsk_logcontroller.h @@ -13,21 +13,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctsk_logcontroller.h -*-C++-*- -#ifndef INCLUDED_MWCTSK_LOGCONTROLLER -#define INCLUDED_MWCTSK_LOGCONTROLLER +// bmqtsk_logcontroller.h -*-C++-*- +#ifndef INCLUDED_BMQTSK_LOGCONTROLLER +#define INCLUDED_BMQTSK_LOGCONTROLLER //@PURPOSE: Provide a mechanism to interface with the ball log infrastructure. // //@CLASSES: -// mwctsk::LogController: mechanism to interface with the ball system -// mwctsk::LogControllerConfig: VST for the configuration of a 'LogController' +// bmqtsk::LogController: mechanism to interface with the ball system +// bmqtsk::LogControllerConfig: VST for the configuration of a 'LogController' // -//@DESCRIPTION: 'mwctsk::LogController' is a mechanism to initialize and -// manipulate the ball log infrastructure. 'mwctsk::LogControllerConfig' is a +//@DESCRIPTION: 'bmqtsk::LogController' is a mechanism to initialize and +// manipulate the ball log infrastructure. 'bmqtsk::LogControllerConfig' is a // value-semantic type object used to provide configuration parameters to an -// 'mwctsk::LogController'. 'LogController' uses a 'ball::AsyncFileObserver' -// to asynchronously write logs to a file, and 'mwctsk::ConsoleObserver' to +// 'bmqtsk::LogController'. 'LogController' uses a 'ball::AsyncFileObserver' +// to asynchronously write logs to a file, and 'bmqtsk::ConsoleObserver' to // write logs to stdout. It offers M-Trap like command processing mechanism to // dynamically interact with the logging facility (change the verbosity level, // the console output severity threshold, or change severity level on a @@ -70,7 +70,7 @@ // /// Logs cleanup ///------------ -// LogController will use an 'mwctsk::LogCleaner' to periodically delete old +// LogController will use an 'bmqtsk::LogCleaner' to periodically delete old // logs: if the 'fileMaxAgeDays' property from the 'LogControllerConfig' is non // 0, all logs older than this parameter will be deleted at startup, as well as // every 24 hours. @@ -90,7 +90,7 @@ // appropriate values. Note that the default values are good, so we just set // the log filename. //.. -// mwctsk::LogControllerConfig config(allocator); +// bmqtsk::LogControllerConfig config(allocator); // // config.setFileName("/tmp/mytask.log.%T"); //.. @@ -100,7 +100,7 @@ // int rc ; // bsl::ostringstream errorDescription; // -// mwctsk::LogController logController(allocator); +// bmqtsk::LogController logController(allocator); // rc = logController.initialize(errorDescription, config); // if (rc != 0) { // bsl::cerr << "Failed to initialize logController [rc: " << rc @@ -119,12 +119,10 @@ //.. // -// MWC - -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -149,7 +147,7 @@ namespace bdlmt { class EventScheduler; } -namespace mwctsk { +namespace bmqtsk { // ========================= // class LogControllerConfig diff --git a/src/groups/mwc/mwctsk/mwctsk_logcontroller.t.cpp b/src/groups/bmq/bmqtsk/bmqtsk_logcontroller.t.cpp similarity index 91% rename from src/groups/mwc/mwctsk/mwctsk_logcontroller.t.cpp rename to src/groups/bmq/bmqtsk/bmqtsk_logcontroller.t.cpp index 907f4f137..20824e1e1 100644 --- a/src/groups/mwc/mwctsk/mwctsk_logcontroller.t.cpp +++ b/src/groups/bmq/bmqtsk/bmqtsk_logcontroller.t.cpp @@ -13,11 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctsk_logcontroller.t.cpp -*-C++-*- -#include +// bmqtsk_logcontroller.t.cpp -*-C++-*- +#include -// MWC -#include +#include // BDE #include @@ -25,7 +24,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -53,7 +52,7 @@ static void test1_logControllerConfigFromDatum() // - LogControllerConfig::fromDatum // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LogControllerConfig::fromDatum Test"); + bmqtst::TestHelper::printTestName("LogControllerConfig::fromDatum Test"); bdld::DatumMapBuilder syslogBuilder(s_allocator_p); syslogBuilder.pushBack("enabled", bdld::Datum::createBoolean(true)); @@ -99,8 +98,8 @@ static void test1_logControllerConfigFromDatum() logControllerBuilder.pushBack("syslog", syslogBuilder.commit()); bdld::Datum datum = logControllerBuilder.commit(); - mwctsk::LogControllerConfig config(s_allocator_p); - mwcu::MemOutStream errorDesc(s_allocator_p); + bmqtsk::LogControllerConfig config(s_allocator_p); + bmqu::MemOutStream errorDesc(s_allocator_p); config.fromDatum(errorDesc, datum); bdld::Datum::destroy(datum, s_allocator_p); @@ -122,7 +121,7 @@ static void test1_logControllerConfigFromDatum() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -134,7 +133,7 @@ int main(int argc, char* argv[]) } // 'e_CHECK_DEF_GBL_ALLOC' check fails because 'fromDatum' function of - // mwctsk::LogControllerConfig allocates bsl::string with default + // bmqtsk::LogControllerConfig allocates bsl::string with default // allocator. - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mwc/mwctsk/mwctsk_syslogobserver.cpp b/src/groups/bmq/bmqtsk/bmqtsk_syslogobserver.cpp similarity index 90% rename from src/groups/mwc/mwctsk/mwctsk_syslogobserver.cpp rename to src/groups/bmq/bmqtsk/bmqtsk_syslogobserver.cpp index a3cce781c..c46042b63 100644 --- a/src/groups/mwc/mwctsk/mwctsk_syslogobserver.cpp +++ b/src/groups/bmq/bmqtsk/bmqtsk_syslogobserver.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctsk_syslogobserver.cpp -*-C++-*- -#include +// bmqtsk_syslogobserver.cpp -*-C++-*- +#include -#include -// MWC -#include +#include + +#include // BDE #include @@ -29,7 +29,7 @@ extern "C" { } namespace BloombergLP { -namespace mwctsk { +namespace bmqtsk { // --------------------- // class SyslogObserver @@ -77,7 +77,7 @@ void SyslogObserver::publish( bslmt::LockGuard guard(&d_mutex); // LOCK bdlma::LocalSequentialAllocator<1024> localAllocator(d_allocator_p); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); d_formatter(os, record); ball::Severity::Level severity = static_cast( diff --git a/src/groups/mwc/mwctsk/mwctsk_syslogobserver.h b/src/groups/bmq/bmqtsk/bmqtsk_syslogobserver.h similarity index 95% rename from src/groups/mwc/mwctsk/mwctsk_syslogobserver.h rename to src/groups/bmq/bmqtsk/bmqtsk_syslogobserver.h index acd451921..7ae9adbde 100644 --- a/src/groups/mwc/mwctsk/mwctsk_syslogobserver.h +++ b/src/groups/bmq/bmqtsk/bmqtsk_syslogobserver.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctsk_syslogobserver.h -*-C++-*- -#ifndef INCLUDED_MWCTSK_SYSLOGOBSERVER -#define INCLUDED_MWCTSK_SYSLOGOBSERVER +// bmqtsk_syslogobserver.h -*-C++-*- +#ifndef INCLUDED_BMQTSK_SYSLOGOBSERVER +#define INCLUDED_BMQTSK_SYSLOGOBSERVER //@PURPOSE: Provide a system log output for BALL logging. // //@CLASSES: -// mwctsk::SyslogObserver: BALL observer printing to a system log +// bmqtsk::SyslogObserver: BALL observer printing to a system log // -//@DESCRIPTION: 'mwctsk::SyslogObserver' is a concrete implementation of the +//@DESCRIPTION: 'bmqtsk::SyslogObserver' is a concrete implementation of the // 'ball::ObserverAdapter' protocol which outputs to a system log. // /// Thread-safety @@ -39,7 +39,7 @@ // severity threshold beyond which to print to a system log, and the format to // use. //.. -// mwctsk::SyslogObserver syslogObserver(allocator); +// bmqtsk::SyslogObserver syslogObserver(allocator); // // syslogObserver.setSeverityThreshold(ball::Severity::INFO) // .setLogFromat("%d (%t) %s %F:%l %m\n"); @@ -74,8 +74,6 @@ //.. // -// MWC - // BDE #include #include @@ -92,7 +90,7 @@ namespace BloombergLP { -namespace mwctsk { +namespace bmqtsk { // ===================== // class SyslogObserver diff --git a/src/groups/mwc/mwctsk/doc/mwctsk.txt b/src/groups/bmq/bmqtsk/doc/bmqtsk.txt similarity index 65% rename from src/groups/mwc/mwctsk/doc/mwctsk.txt rename to src/groups/bmq/bmqtsk/doc/bmqtsk.txt index e1eb78a32..cc1607fc4 100644 --- a/src/groups/mwc/mwctsk/doc/mwctsk.txt +++ b/src/groups/bmq/bmqtsk/doc/bmqtsk.txt @@ -1,33 +1,33 @@ - mwctsk.txt + bmqtsk.txt @PURPOSE: Provide application level mechanisms. -@MNEMONIC: MiddleWare Core Task (mwctsk) +@MNEMONIC: BlazingMQ Task (bmqtsk) @DESCRIPTION: This package provides application level mechanisms. /Hierarchical Synopsis /--------------------- -The 'mwctsk' package currently has 4 components having 2 levels of physical +The 'bmqtsk' package currently has 4 components having 2 levels of physical dependency. The list below shows the hierarchal ordering of the components. .. - 2. mwctsk_logcontroller + 2. bmqtsk_logcontroller - 1. mwctsk_alarmlog - mwctsk_consoleobserver - mwctsk_logcleaner + 1. bmqtsk_alarmlog + bmqtsk_consoleobserver + bmqtsk_logcleaner .. /Component Synopsis /------------------ -: 'mwctsk_alarmlog': +: 'bmqtsk_alarmlog': : Provide a BALL observer for ALARMS with rate-controlled output. : -: 'mwctsk_consoleobserver': +: 'bmqtsk_consoleobserver': : Provide a customizable colorized console output for BALL logging. : -: 'mwctsk_logcleaner: +: 'bmqtsk_logcleaner: : Provide a mechanism to periodically clean up old logs. : -: 'mwctsk_logcontroller': +: 'bmqtsk_logcontroller': : Provide a mechanism to interface with the BALL log infrastructure. diff --git a/src/groups/bmq/bmqtsk/package/bmqtsk.dep b/src/groups/bmq/bmqtsk/package/bmqtsk.dep new file mode 100644 index 000000000..72d6d5ed2 --- /dev/null +++ b/src/groups/bmq/bmqtsk/package/bmqtsk.dep @@ -0,0 +1,4 @@ +bmqex +bmqscm +bmqsys +bmqu diff --git a/src/groups/bmq/bmqtsk/package/bmqtsk.mem b/src/groups/bmq/bmqtsk/package/bmqtsk.mem new file mode 100644 index 000000000..63dc52b1d --- /dev/null +++ b/src/groups/bmq/bmqtsk/package/bmqtsk.mem @@ -0,0 +1,5 @@ +bmqtsk_alarmlog +bmqtsk_consoleobserver +bmqtsk_logcleaner +bmqtsk_logcontroller +bmqtsk_syslogobserver diff --git a/src/groups/bmq/bmqtst/README.md b/src/groups/bmq/bmqtst/README.md new file mode 100644 index 000000000..9bc24e152 --- /dev/null +++ b/src/groups/bmq/bmqtst/README.md @@ -0,0 +1,17 @@ +BMQTST +==== +> The `BMQTST` package provides macros and utilities to assist in writting test +> drivers. + +Description +----------- +The bmqtst' package provides macros and utilities to assist in writting test +drivers. + +Component Synopsis +------------------ +Component | Provides ... +---------------------------|--------------------------------------------------- +`bmqtst_blobtestutil` | blob utilities for use in test drivers. +`bmqtst_scopedlogobserver` | a scoped implementation of the log observer protocol. +`bmqtst_testhelper` | macros and utilities to assist in writing test drivers. diff --git a/src/groups/mwc/mwctst/mwctst_blobtestutil.cpp b/src/groups/bmq/bmqtst/bmqtst_blobtestutil.cpp similarity index 93% rename from src/groups/mwc/mwctst/mwctst_blobtestutil.cpp rename to src/groups/bmq/bmqtst/bmqtst_blobtestutil.cpp index a5ba36b4c..cdb70336f 100644 --- a/src/groups/mwc/mwctst/mwctst_blobtestutil.cpp +++ b/src/groups/bmq/bmqtst/bmqtst_blobtestutil.cpp @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctst_blobtestutil.cpp -*-C++-*- -#include +// bmqtst_blobtestutil.cpp -*-C++-*- +#include // BDE #include @@ -24,7 +24,7 @@ #include namespace BloombergLP { -namespace mwctst { +namespace bmqtst { // ------------------- // struct BlobTestUtil @@ -87,8 +87,8 @@ bsl::string& BlobTestUtil::toString(bsl::string* str, str->reserve(blob.length()); for (int bufferIdx = 0; bufferIdx < blob.numDataBuffers(); ++bufferIdx) { - // NOTE: to avoid dependency on 'mwcu' package, inline implementation - // of 'mwcu::BlobUtil::bufferSize' routine. + // NOTE: to avoid dependency on 'bmqu' package, inline implementation + // of 'bmqu::BlobUtil::bufferSize' routine. const int bufferSize = bufferIdx == blob.numDataBuffers() - 1 ? blob.lastDataBufferLength() : blob.buffer(bufferIdx).size(); diff --git a/src/groups/mwc/mwctst/mwctst_blobtestutil.h b/src/groups/bmq/bmqtst/bmqtst_blobtestutil.h similarity index 91% rename from src/groups/mwc/mwctst/mwctst_blobtestutil.h rename to src/groups/bmq/bmqtst/bmqtst_blobtestutil.h index 6fa3737bc..5bf5b252e 100644 --- a/src/groups/mwc/mwctst/mwctst_blobtestutil.h +++ b/src/groups/bmq/bmqtst/bmqtst_blobtestutil.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctst_blobtestutil.h -*-C++-*- -#ifndef INCLUDED_MWCTST_BLOBTESTUTIL -#define INCLUDED_MWCTST_BLOBTESTUTIL +// bmqtst_blobtestutil.h -*-C++-*- +#ifndef INCLUDED_BMQTST_BLOBTESTUTIL +#define INCLUDED_BMQTST_BLOBTESTUTIL //@PURPOSE: Provide blob utilities for use in test drivers. // //@CLASSES: -// mwctst::BlobTestUtil: namespace for a set of blob utilities +// bmqtst::BlobTestUtil: namespace for a set of blob utilities // -//@DESCRIPTION: 'mwctst::BlobTestUtil' provides a set of blob utilities to +//@DESCRIPTION: 'bmqtst::BlobTestUtil' provides a set of blob utilities to // assist in writing test drivers. // /// Usage Example @@ -36,7 +36,7 @@ // //.. // bdlbb::Blob blob(s_allocator_p); -// mwctst::BlobTestUtil::fromString(&blob, "a|b", s_allocator_p); +// bmqtst::BlobTestUtil::fromString(&blob, "a|b", s_allocator_p); // // ASSERT_EQ(blob.length(), 2); // ASSERT_EQ(blob.numDataBuffers(), 2); @@ -59,14 +59,14 @@ // First, let's put the string 'abcdefg' into the blob. //.. // bdlbb::Blob blob(s_allocator_p); -// mwctst::BlobTestUtil::fromString(&blob, "abcdefg", s_allocator_p); +// bmqtst::BlobTestUtil::fromString(&blob, "abcdefg", s_allocator_p); // BSLS_ASSERT_OPT(blob.length() == 7); // BSLS_ASSERT_OPT(blob.numDataBuffers() == 1); //.. // Finally, we can convert the blob to a string using the 'toString' method. //.. // bsl::string str(s_allocator_p); -// ASSERT_EQ("abcdefg", mwctst::BlobTestUtil::toString(&str, blob)); +// ASSERT_EQ("abcdefg", bmqtst::BlobTestUtil::toString(&str, blob)); //.. // BDE @@ -75,7 +75,7 @@ #include namespace BloombergLP { -namespace mwctst { +namespace bmqtst { // =================== // struct BlobTestUtil diff --git a/src/groups/mwc/mwctst/mwctst_blobtestutil.t.cpp b/src/groups/bmq/bmqtst/bmqtst_blobtestutil.t.cpp similarity index 79% rename from src/groups/mwc/mwctst/mwctst_blobtestutil.t.cpp rename to src/groups/bmq/bmqtst/bmqtst_blobtestutil.t.cpp index 4d8a36ecd..6dcfc2465 100644 --- a/src/groups/mwc/mwctst/mwctst_blobtestutil.t.cpp +++ b/src/groups/bmq/bmqtst/bmqtst_blobtestutil.t.cpp @@ -13,11 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctst_blobtestutil.t.cpp -*-C++-*- -#include +// bmqtst_blobtestutil.t.cpp -*-C++-*- +#include -// MWC -#include +#include // BDE #include @@ -26,7 +25,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -47,13 +46,13 @@ static void test1_fromString() // fromString // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("FROM STRING"); + bmqtst::TestHelper::printTestName("FROM STRING"); { PVV("FROM STRING - ''"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, "", s_allocator_p); + bmqtst::BlobTestUtil::fromString(&blob, "", s_allocator_p); ASSERT_EQ(blob.length(), 0); ASSERT_EQ(blob.numDataBuffers(), 0); @@ -63,7 +62,7 @@ static void test1_fromString() PVV("FROM STRING - 'a|b'"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, "a|b", s_allocator_p); + bmqtst::BlobTestUtil::fromString(&blob, "a|b", s_allocator_p); ASSERT_EQ(blob.length(), 2); ASSERT_EQ(blob.numDataBuffers(), 2); @@ -83,7 +82,7 @@ static void test1_fromString() PVV("FROM STRING - 'ab'"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, "ab", s_allocator_p); + bmqtst::BlobTestUtil::fromString(&blob, "ab", s_allocator_p); ASSERT_EQ(blob.length(), 2); ASSERT_EQ(blob.numDataBuffers(), 1); @@ -96,7 +95,7 @@ static void test1_fromString() { PVV("FROM STRING - 'aXX'"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, "aXX", s_allocator_p); + bmqtst::BlobTestUtil::fromString(&blob, "aXX", s_allocator_p); ASSERT_EQ(blob.length(), 1); ASSERT_EQ(blob.numDataBuffers(), 1); @@ -118,55 +117,55 @@ static void test2_toString() // toString // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("TO STRING"); + bmqtst::TestHelper::printTestName("TO STRING"); { PVV("TO STRING - 'abcdefg'"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, "abcdefg", s_allocator_p); + bmqtst::BlobTestUtil::fromString(&blob, "abcdefg", s_allocator_p); BSLS_ASSERT_OPT(blob.length() == 7); BSLS_ASSERT_OPT(blob.numDataBuffers() == 1); bsl::string out(s_allocator_p); - ASSERT_EQ("abcdefg", mwctst::BlobTestUtil::toString(&out, blob)); + ASSERT_EQ("abcdefg", bmqtst::BlobTestUtil::toString(&out, blob)); } { PVV("TO STRING - 'a|b'"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, "a|b", s_allocator_p); + bmqtst::BlobTestUtil::fromString(&blob, "a|b", s_allocator_p); BSLS_ASSERT_OPT(blob.length() == 2); BSLS_ASSERT_OPT(blob.numDataBuffers() == 2); bsl::string out(s_allocator_p); - ASSERT_EQ("a|b", mwctst::BlobTestUtil::toString(&out, blob, true)); + ASSERT_EQ("a|b", bmqtst::BlobTestUtil::toString(&out, blob, true)); } { PVV("TO STRING - 'a|bXXX'"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, "a|bXXX", s_allocator_p); + bmqtst::BlobTestUtil::fromString(&blob, "a|bXXX", s_allocator_p); BSLS_ASSERT_OPT(blob.length() == 2); BSLS_ASSERT_OPT(blob.numDataBuffers() == 2); BSLS_ASSERT_OPT(blob.totalSize() == 5); bsl::string out(s_allocator_p); - ASSERT_EQ("a|bXXX", mwctst::BlobTestUtil::toString(&out, blob, true)); + ASSERT_EQ("a|bXXX", bmqtst::BlobTestUtil::toString(&out, blob, true)); } { PVV("TO STRING - 'abc|def|g'"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, "abc|def|g", s_allocator_p); + bmqtst::BlobTestUtil::fromString(&blob, "abc|def|g", s_allocator_p); BSLS_ASSERT_OPT(blob.length() == 7); BSLS_ASSERT_OPT(blob.numDataBuffers() == 3); bsl::string out(s_allocator_p); - ASSERT_EQ("abcdefg", mwctst::BlobTestUtil::toString(&out, blob)); + ASSERT_EQ("abcdefg", bmqtst::BlobTestUtil::toString(&out, blob)); } } @@ -176,7 +175,7 @@ static void test2_toString() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -188,5 +187,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwctst/mwctst_scopedlogobserver.cpp b/src/groups/bmq/bmqtst/bmqtst_scopedlogobserver.cpp similarity index 96% rename from src/groups/mwc/mwctst/mwctst_scopedlogobserver.cpp rename to src/groups/bmq/bmqtst/bmqtst_scopedlogobserver.cpp index e74dc88ea..396c82452 100644 --- a/src/groups/mwc/mwctst/mwctst_scopedlogobserver.cpp +++ b/src/groups/bmq/bmqtst/bmqtst_scopedlogobserver.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctst_scopedlogobserver.cpp -*-C++-*- -#include +// bmqtst_scopedlogobserver.cpp -*-C++-*- +#include -#include +#include // BDE #include #include @@ -26,7 +26,7 @@ #include namespace BloombergLP { -namespace mwctst { +namespace bmqtst { namespace { diff --git a/src/groups/mwc/mwctst/mwctst_scopedlogobserver.h b/src/groups/bmq/bmqtst/bmqtst_scopedlogobserver.h similarity index 90% rename from src/groups/mwc/mwctst/mwctst_scopedlogobserver.h rename to src/groups/bmq/bmqtst/bmqtst_scopedlogobserver.h index c78b56af4..39b81c23f 100644 --- a/src/groups/mwc/mwctst/mwctst_scopedlogobserver.h +++ b/src/groups/bmq/bmqtst/bmqtst_scopedlogobserver.h @@ -13,22 +13,22 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctst_scopedlogobserver.h -*-C++-*- -#ifndef INCLUDED_MWCTST_SCOPEDLOGOBSERVER -#define INCLUDED_MWCTST_SCOPEDLOGOBSERVER +// bmqtst_scopedlogobserver.h -*-C++-*- +#ifndef INCLUDED_BMQTST_SCOPEDLOGOBSERVER +#define INCLUDED_BMQTST_SCOPEDLOGOBSERVER //@PURPOSE: provide a scoped implementation of the log observer protocol. // //@CLASSES: -// mwctst::ScopedLogObserver: a scoped log observer for testing purposes -// mwctst::ScopedLogObserverUtil: utilities to check log records +// bmqtst::ScopedLogObserver: a scoped log observer for testing purposes +// bmqtst::ScopedLogObserverUtil: utilities to check log records // //@DESCRIPTION: This component defines a mechanism, -// 'mwctst::ScopedLogObserver', providing an RAII-like implementation of the +// 'bmqtst::ScopedLogObserver', providing an RAII-like implementation of the // BALL observer protocol, automatically registering/unregistering itself with // the installed singleton logger manager instance and keeping track of log // records. It additionally provides utilities, -// 'mwctst::ScopedLogObserverUtil', to simplify checking that log records +// 'bmqtst::ScopedLogObserverUtil', to simplify checking that log records // satisfy certain criteria. // /// Thread Safety @@ -44,11 +44,11 @@ // The following snippets of code illustrate the basic usage of the scoped log // observer object for testing purposes. // -// First, create a 'mwctst::ScopedLogObserver' object having a desired severity +// First, create a 'bmqtst::ScopedLogObserver' object having a desired severity // threshold for capturing log records (in this case, 'ball::Severity::ERROR'). //.. // BALL_LOG_SET_CATEGORY("TEST"); -// mwctst::ScopedLogObserver observer(ball::Severity::ERROR, s_allocator_p); +// bmqtst::ScopedLogObserver observer(ball::Severity::ERROR, s_allocator_p); //.. // Next, publish a log using the BALL logging infrastructure. Note that the // severity threshold should be at or above that of the observer for the log @@ -60,14 +60,12 @@ // associated utilities to verify that the expected log record was emitted. //.. // BSLS_ASSERT(observer.records().size() == 1U); -// BSLS_ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( +// BSLS_ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( // observer.records()[0], // ".*Sample.*", // s_allocator_p)); //.. -// MWC - // BDE #include #include @@ -86,7 +84,7 @@ namespace ball { class Context; } -namespace mwctst { +namespace bmqtst { // ======================= // class ScopedLogObserver diff --git a/src/groups/mwc/mwctst/mwctst_scopedlogobserver.t.cpp b/src/groups/bmq/bmqtst/bmqtst_scopedlogobserver.t.cpp similarity index 88% rename from src/groups/mwc/mwctst/mwctst_scopedlogobserver.t.cpp rename to src/groups/bmq/bmqtst/bmqtst_scopedlogobserver.t.cpp index f04ab93f1..8b2b2608f 100644 --- a/src/groups/mwc/mwctst/mwctst_scopedlogobserver.t.cpp +++ b/src/groups/bmq/bmqtst/bmqtst_scopedlogobserver.t.cpp @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctst_scopedlogobserver.t.cpp -*-C++-*- -#include +// bmqtst_scopedlogobserver.t.cpp -*-C++-*- +#include // BDE #include @@ -24,7 +24,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -50,9 +50,9 @@ static void test1_breathingTest() // Constructor // setSeverityThreshold { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); - mwctst::ScopedLogObserver observer(ball::Severity::OFF, s_allocator_p); + bmqtst::ScopedLogObserver observer(ball::Severity::OFF, s_allocator_p); ASSERT_EQ(observer.severityThreshold(), ball::Severity::OFF); ASSERT(!observer.isEnabled()); @@ -83,14 +83,14 @@ static void test2_publish() // Testing: // publish { - mwctst::TestHelper::printTestName("PUBLISH"); + bmqtst::TestHelper::printTestName("PUBLISH"); ball::Record record1(s_allocator_p); ball::Record record2(s_allocator_p); ball::Context context1(s_allocator_p); ball::Context context2(s_allocator_p); - mwctst::ScopedLogObserver observer(ball::Severity::ERROR, s_allocator_p); + bmqtst::ScopedLogObserver observer(ball::Severity::ERROR, s_allocator_p); ASSERT_EQ(observer.severityThreshold(), ball::Severity::ERROR); ASSERT(observer.isEnabled()); @@ -130,7 +130,7 @@ static void test3_recordMessageMatch() // Testing: // publish { - mwctst::TestHelper::printTestName("RECORD MESSAGE MATCH"); + bmqtst::TestHelper::printTestName("RECORD MESSAGE MATCH"); struct Test { int d_line; @@ -161,7 +161,7 @@ static void test3_recordMessageMatch() record.fixedFields().setMessage(test.d_msg); ASSERT_EQ( - mwctst::ScopedLogObserverUtil::recordMessageMatch(record, + bmqtst::ScopedLogObserverUtil::recordMessageMatch(record, test.d_pattern, s_allocator_p), test.d_isMatch); @@ -186,16 +186,16 @@ static void test4_usageExample() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("USAGE EXAMPLE"); + bmqtst::TestHelper::printTestName("USAGE EXAMPLE"); BALL_LOG_SET_CATEGORY("TEST"); - mwctst::ScopedLogObserver observer(ball::Severity::ERROR, s_allocator_p); + bmqtst::ScopedLogObserver observer(ball::Severity::ERROR, s_allocator_p); BALL_LOG_ERROR << "MySampleError"; ASSERT_EQ(observer.records().size(), 1U); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( observer.records()[0], ".*Sample.*", s_allocator_p)); @@ -207,7 +207,7 @@ static void test4_usageExample() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -221,5 +221,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwctst/mwctst_testhelper.cpp b/src/groups/bmq/bmqtst/bmqtst_testhelper.cpp similarity index 95% rename from src/groups/mwc/mwctst/mwctst_testhelper.cpp rename to src/groups/bmq/bmqtst/bmqtst_testhelper.cpp index 908331089..c968739d6 100644 --- a/src/groups/mwc/mwctst/mwctst_testhelper.cpp +++ b/src/groups/bmq/bmqtst/bmqtst_testhelper.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctst_testhelper.cpp -*-C++-*- -#include +// bmqtst_testhelper.cpp -*-C++-*- +#include -#include +#include // BDE #include #include @@ -33,7 +33,7 @@ bool s_ignoreCheckGblAlloc = false; bslmt::QLock s_serializePrintLock = BSLMT_QLOCK_INITIALIZER; bslma::Allocator* s_allocator_p = 0; -namespace mwctst { +namespace bmqtst { // ----------------- // struct TestHelper diff --git a/src/groups/mwc/mwctst/mwctst_testhelper.h b/src/groups/bmq/bmqtst/bmqtst_testhelper.h similarity index 94% rename from src/groups/mwc/mwctst/mwctst_testhelper.h rename to src/groups/bmq/bmqtst/bmqtst_testhelper.h index e2d72b111..6447edda1 100644 --- a/src/groups/mwc/mwctst/mwctst_testhelper.h +++ b/src/groups/bmq/bmqtst/bmqtst_testhelper.h @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwctst_testhelper.h -*-C++-*- -#ifndef INCLUDED_MWCTST_TESTHELPER -#define INCLUDED_MWCTST_TESTHELPER +// bmqtst_testhelper.h -*-C++-*- +#ifndef INCLUDED_BMQTST_TESTHELPER +#define INCLUDED_BMQTST_TESTHELPER //@PURPOSE: Provide macros and utilities to assist in writting test drivers. // //@CLASSES: // MACROS: see macros definitions and descriptions below -// mwctst::TestHelper: namespace for a set of utilities +// bmqtst::TestHelper: namespace for a set of utilities // //@DESCRIPTION: // This component provides a set of macros and utilities to assist in @@ -34,7 +34,7 @@ // boilerplate (such as parsing arguments, initializing ball logging, // allocators, ensuring no default or global memory was used, ...). Each of // them takes a bitmask flag value (which is a combination of the flags defined -// in the 'mwctst::TestHelper::e_FLAGS' enum to control and alter what gets +// in the 'bmqtst::TestHelper::e_FLAGS' enum to control and alter what gets // initialized and checked. // //: o Prolog flags: @@ -155,7 +155,7 @@ //: code is executed as per the RAII idiom. //: o The same fixture can be reused for multiple tests. // -// Function 'mwctst::runTest()' replaces the traditional BDE switch +// Function 'bmqtst::runTest()' replaces the traditional BDE switch // statement. It runs the i-th test in order of appearance, as specified by the // first command-line argument (extracted by 'TEST_PROLOG' into '_testCase'). // Running a test consists of the following steps: @@ -176,14 +176,14 @@ // /// Example 1: BDE style ///- - - - - - - - - - -// Typical test driver skeleton using this 'mwctst::TestHelper' would look like +// Typical test driver skeleton using this 'bmqtst::TestHelper' would look like // the following: //.. // // grppkg_mycomponent.t.cpp -*-C++-*- // #include // // // TEST_DRIVER -// #include +// #include // // // Any additional includes required by the test driver // @@ -195,7 +195,7 @@ // // ------------------------------------------------------------------------ // // static void test1_breathingTest() { -// mwctst::TestHelper::printTestName("BREATHING TEST"); +// bmqtst::TestHelper::printTestName("BREATHING TEST"); // // grppkg::MyComponent myComponent("name", s_allocator_p); // ASSERT(myComponent.isValid()); @@ -208,7 +208,7 @@ // // int main(int argc, char *argv[]) // { -// TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); +// TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); // // switch (_testCase) { case 0: // case 1: test1_breathingTest(); break; @@ -219,20 +219,20 @@ // } break; // } // -// TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); +// TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); // } //.. // /// Example 2: Google Test style ///- - - - - - - - - - - - - - -// Typical test driver skeleton using this 'mwctst::TestHelper' and the 'TEST' +// Typical test driver skeleton using this 'bmqtst::TestHelper' and the 'TEST' // macros would look like this: //.. // // grppkg_mycomponent.t.cpp -*-C++-*- // #include // // // TEST_DRIVER -// #include +// #include // // // Any additional includes required by the test driver // @@ -243,7 +243,7 @@ // // TESTS // // ------------------------------------------------------------------------ // -// struct FunctionalTest : mwctst::Test { +// struct FunctionalTest : bmqtst::Test { // bdld::Datum config; // MockComponent mock; // @@ -267,16 +267,14 @@ // // int main(int argc, char *argv[]) // { -// TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); +// TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); // -// mwctst::runTest(_testCase); +// bmqtst::runTest(_testCase); // -// TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); +// TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); // } //.. -// MWC - // BDE #include #include @@ -348,11 +346,10 @@ if (!(xResult OP yResult)) { \ bdlsb::MemOutStreamBuf buffer(s_allocator_p); \ bsl::ostream os(&buffer); \ - os << prefix << "'" << xStr << "' " \ - << "(" << mwctst::printer(xResult) << ")" \ - << " " #OP " " \ - << "'" << yStr << "' " \ - << "(" << mwctst::printer(yResult) << ")" << bsl::ends; \ + os << prefix << "'" << xStr << "' " << "(" \ + << bmqtst::printer(xResult) << ")" << " " #OP " " << "'" \ + << yStr << "' " << "(" << bmqtst::printer(yResult) << ")" \ + << bsl::ends; \ bslstl::StringRef str(buffer.data(), buffer.length()); \ BloombergLP::_assert(false, str.data(), file, line); \ } \ @@ -453,10 +450,10 @@ // Assertions using fuzzy comparisons #define ASSERT_EQF(X, Y) \ { \ - if (!(mwctst::TestHelper::areFuzzyEqual((X), (Y)))) { \ + if (!(bmqtst::TestHelper::areFuzzyEqual((X), (Y)))) { \ bsl::cout << "Error " << __FILE__ << "(" << __LINE__ \ - << "): " << #X << " (" << mwctst::printer(X) \ - << ") ~= " << #Y << " (" << mwctst::printer(Y) << ")" \ + << "): " << #X << " (" << bmqtst::printer(X) \ + << ") ~= " << #Y << " (" << bmqtst::printer(Y) << ")" \ << " (failed)" << bsl::endl; \ if (s_testStatus >= 0 && s_testStatus <= 100) \ ++s_testStatus; \ @@ -465,10 +462,10 @@ #define ASSERT_NEF(X, Y) \ { \ - if (mwctst::TestHelper : areFuzzyEqual((X), (Y))) { \ + if (bmqtst::TestHelper : areFuzzyEqual((X), (Y))) { \ bsl::cout << "Error " << __FILE__ << "(" << __LINE__ \ - << "): " << #X << " (" << mwctst::printer(X) \ - << ") !~= " << #Y << " (" << mwctst::printer(Y) << ")" \ + << "): " << #X << " (" << bmqtst::printer(X) \ + << ") !~= " << #Y << " (" << bmqtst::printer(Y) << ")" \ << " (failed)" << bsl::endl; \ if (s_testStatus >= 0 && s_testStatus <= 100) \ ++s_testStatus; \ @@ -634,7 +631,7 @@ balst::StackTraceTestAllocator _stTestAlloc; \ _stTestAlloc.setName("test"); \ \ - if ((F)&mwctst::TestHelper::e_USE_STACKTRACE_ALLOCATOR) { \ + if ((F) & bmqtst::TestHelper::e_USE_STACKTRACE_ALLOCATOR) { \ s_allocator_p = &_stTestAlloc; \ } \ else { \ @@ -649,13 +646,13 @@ ASSERT_EQ(_testAlloc.numBlocksInUse(), 0); \ \ /* Verify no default allocator usage */ \ - if (F & mwctst::TestHelper::e_CHECK_DEF_ALLOC && \ + if (F & bmqtst::TestHelper::e_CHECK_DEF_ALLOC && \ !s_ignoreCheckDefAlloc) { \ ASSERT_EQ(_defAlloc.numBlocksTotal(), 0); \ } \ \ /* Verify no global allocator usage */ \ - if (F & mwctst::TestHelper::e_CHECK_GBL_ALLOC && \ + if (F & bmqtst::TestHelper::e_CHECK_GBL_ALLOC && \ !s_ignoreCheckGblAlloc) { \ ASSERT_EQ(_gblAlloc.numBlocksTotal(), 0); \ } \ @@ -679,52 +676,52 @@ static void run() \ { \ FIXTURE##NAME test; \ - mwctst::TestHelper::printTestName(#NAME); \ + bmqtst::TestHelper::printTestName(#NAME); \ test.SetUp(); \ test.body(); \ test.TearDown(); \ } \ \ - static ::BloombergLP::mwctst::TestHelper_Test s_testItem; \ + static ::BloombergLP::bmqtst::TestHelper_Test s_testItem; \ }; \ \ - ::BloombergLP::mwctst::TestHelper_Test FIXTURE##NAME ::s_testItem( \ + ::BloombergLP::bmqtst::TestHelper_Test FIXTURE##NAME ::s_testItem( \ FIXTURE##NAME ::run); \ void FIXTURE##NAME ::body() #define TEST(NAME) \ - struct Test##NAME : ::BloombergLP::mwctst::Test { \ + struct Test##NAME : ::BloombergLP::bmqtst::Test { \ void body() BSLS_KEYWORD_OVERRIDE; \ \ static void run() \ { \ Test##NAME test; \ - mwctst::TestHelper::printTestName(#NAME); \ + bmqtst::TestHelper::printTestName(#NAME); \ test.SetUp(); \ test.body(); \ test.TearDown(); \ } \ \ - static ::BloombergLP::mwctst::TestHelper_Test s_testItem; \ + static ::BloombergLP::bmqtst::TestHelper_Test s_testItem; \ }; \ \ - ::BloombergLP::mwctst::TestHelper_Test Test##NAME ::s_testItem( \ + ::BloombergLP::bmqtst::TestHelper_Test Test##NAME ::s_testItem( \ Test##NAME ::run); \ void Test##NAME ::body() /*Define benchmarking macros*/ #ifdef BSLS_PLATFORM_OS_LINUX -#define MWC_BENCHMARK_WITH_ARGS(BM_NAME, ARGS) \ +#define BMQTST_BENCHMARK_WITH_ARGS(BM_NAME, ARGS) \ BENCHMARK(BM_NAME##_GoogleBenchmark)->ARGS; -#define MWC_BENCHMARK(BM_NAME) BENCHMARK(BM_NAME##_GoogleBenchmark); +#define BMQTST_BENCHMARK(BM_NAME) BENCHMARK(BM_NAME##_GoogleBenchmark); #else // !BSLS_PLATFORM_OS_LINUX -#define MWC_BENCHMARK(BM_NAME) BM_NAME(); -#define MWC_BENCHMARK_WITH_ARGS(BM_NAME, ARGS) BM_NAME(); +#define BMQTST_BENCHMARK(BM_NAME) BM_NAME(); +#define BMQTST_BENCHMARK_WITH_ARGS(BM_NAME, ARGS) BM_NAME(); #endif // BSLS_PLATFORM_OS_LINUX namespace BloombergLP { -namespace mwctst { +namespace bmqtst { // FORWARD DECLARATION template @@ -802,7 +799,7 @@ ASSERT_COMPARE_DECLARE(LessEquals, <=) ASSERT_COMPARE_DECLARE(Greater, >) ASSERT_COMPARE_DECLARE(GreaterEquals, >=) -namespace mwctst { +namespace bmqtst { // ====================== // struct TestHelper_Test @@ -959,14 +956,14 @@ inline const TYPE& TestHelper_Printer::obj() const // FREE FUNCTIONS template -inline mwctst::TestHelper_Printer mwctst::printer(const TYPE& obj) +inline bmqtst::TestHelper_Printer bmqtst::printer(const TYPE& obj) { return TestHelper_Printer(&obj); } template inline bsl::ostream& -mwctst::operator<<(bsl::ostream& stream, +bmqtst::operator<<(bsl::ostream& stream, const TestHelper_Printer& printer) { return stream << printer.obj(); @@ -974,7 +971,7 @@ mwctst::operator<<(bsl::ostream& stream, template inline bsl::ostream& -mwctst::operator<<(bsl::ostream& stream, +bmqtst::operator<<(bsl::ostream& stream, const TestHelper_Printer >& printer) { stream << "["; @@ -993,7 +990,7 @@ mwctst::operator<<(bsl::ostream& stream, template inline bsl::ostream& -mwctst::operator<<(bsl::ostream& stream, +bmqtst::operator<<(bsl::ostream& stream, const TestHelper_Printer >& printer) { stream << "{"; @@ -1017,7 +1014,7 @@ mwctst::operator<<(bsl::ostream& stream, template inline bsl::ostream& -mwctst::operator<<(bsl::ostream& stream, +bmqtst::operator<<(bsl::ostream& stream, const TestHelper_Printer >& printer) { stream << "{"; @@ -1038,7 +1035,7 @@ mwctst::operator<<(bsl::ostream& stream, } template -inline bsl::ostream& mwctst::operator<<( +inline bsl::ostream& bmqtst::operator<<( bsl::ostream& stream, const TestHelper_Printer >& printer) { @@ -1061,7 +1058,7 @@ inline bsl::ostream& mwctst::operator<<( } template -inline bsl::ostream& mwctst::operator<<( +inline bsl::ostream& bmqtst::operator<<( bsl::ostream& stream, const TestHelper_Printer >& printer) { @@ -1085,7 +1082,7 @@ inline bsl::ostream& mwctst::operator<<( template inline bsl::ostream& -mwctst::operator<<(bsl::ostream& stream, +bmqtst::operator<<(bsl::ostream& stream, const TestHelper_Printer >& printer) { return stream << '<' << printer.obj().first << ", " << printer.obj().second diff --git a/src/groups/mwc/mwctst/doc/mwctst.txt b/src/groups/bmq/bmqtst/doc/bmqtst.txt similarity index 60% rename from src/groups/mwc/mwctst/doc/mwctst.txt rename to src/groups/bmq/bmqtst/doc/bmqtst.txt index 9feaefd40..eb4173c18 100644 --- a/src/groups/mwc/mwctst/doc/mwctst.txt +++ b/src/groups/bmq/bmqtst/doc/bmqtst.txt @@ -1,27 +1,27 @@ - mwctst.txt + bmqtst.txt @PURPOSE: Provide macros and utilities to assist in writing test drivers. -@MNEMONIC: MiddleWare Core Test +@MNEMONIC: BlazingMQ Test -@DESCRIPTION: The mwctst' package provides macros and utilities to assist in +@DESCRIPTION: The bmqtst' package provides macros and utilities to assist in writing test drivers. /Hierarchical Synopsis /--------------------- - The mwctst' package currently has 3 components having 1 level of physical + The bmqtst' package currently has 3 components having 1 level of physical dependency. The list below shows the hierarchical ordering of the components. .. - 1. mwctst_blobtestutil - mwctst_scopedlogobserver - mwctst_testhelper + 1. bmqtst_blobtestutil + bmqtst_scopedlogobserver + bmqtst_testhelper .. /Component Synopsis /------------------ -: 'mwctst_blobtestutil': +: 'bmqtst_blobtestutil': : Provide blob utilities for use in test drivers. -: 'mwctst_scopedlogobserver': +: 'bmqtst_scopedlogobserver': : Provide a scoped tester implementation of the log observer protocol. -: 'mwctst_testhelper': +: 'bmqtst_testhelper': : Provide macros and utilities to assist in writing test drivers. diff --git a/src/groups/bmq/bmqtst/package/bmqtst.dep b/src/groups/bmq/bmqtst/package/bmqtst.dep new file mode 100644 index 000000000..193d5c9dd --- /dev/null +++ b/src/groups/bmq/bmqtst/package/bmqtst.dep @@ -0,0 +1,2 @@ +bmqscm +bmqu diff --git a/src/groups/bmq/bmqtst/package/bmqtst.mem b/src/groups/bmq/bmqtst/package/bmqtst.mem new file mode 100644 index 000000000..4f970954a --- /dev/null +++ b/src/groups/bmq/bmqtst/package/bmqtst.mem @@ -0,0 +1,3 @@ +bmqtst_blobtestutil +bmqtst_scopedlogobserver +bmqtst_testhelper diff --git a/src/groups/bmq/bmqu/README.dox b/src/groups/bmq/bmqu/README.dox new file mode 100644 index 000000000..33ab87387 --- /dev/null +++ b/src/groups/bmq/bmqu/README.dox @@ -0,0 +1,9 @@ +/** +@dir bmqu + +@brief The `BMQU` (BlazingMQ Utility) package provides +value-semantic vocabulary types. + +The ‘bmqu‘ package provides miscellaneous utility components to be +reused through various applications. +*/ diff --git a/src/groups/mwc/mwcu/mwcu_alignedprinter.cpp b/src/groups/bmq/bmqu/bmqu_alignedprinter.cpp similarity index 84% rename from src/groups/mwc/mwcu/mwcu_alignedprinter.cpp rename to src/groups/bmq/bmqu/bmqu_alignedprinter.cpp index fef8f0a38..2fed41ae3 100644 --- a/src/groups/mwc/mwcu/mwcu_alignedprinter.cpp +++ b/src/groups/bmq/bmqu/bmqu_alignedprinter.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_alignedprinter.cpp -*-C++-*- -#include +// bmqu_alignedprinter.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcu { +namespace bmqu { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcu/mwcu_alignedprinter.h b/src/groups/bmq/bmqu/bmqu_alignedprinter.h similarity index 91% rename from src/groups/mwc/mwcu/mwcu_alignedprinter.h rename to src/groups/bmq/bmqu/bmqu_alignedprinter.h index 4b5912ac7..75928accc 100644 --- a/src/groups/mwc/mwcu/mwcu_alignedprinter.h +++ b/src/groups/bmq/bmqu/bmqu_alignedprinter.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_alignedprinter.h -*-C++-*- -#ifndef INCLUDED_MWCU_ALIGNEDPRINTER -#define INCLUDED_MWCU_ALIGNEDPRINTER +// bmqu_alignedprinter.h -*-C++-*- +#ifndef INCLUDED_BMQU_ALIGNEDPRINTER +#define INCLUDED_BMQU_ALIGNEDPRINTER //@PURPOSE: Provide a mechanism to print key-value pairs aligned. // //@CLASSES: -// mwcu::AlignedPrinter: Mechanism to print key-value pairs aligned. +// bmqu::AlignedPrinter: Mechanism to print key-value pairs aligned. // -//@DESCRIPTION: 'mwcu::AlignedPrinter' provides a mechanism to print key-value +//@DESCRIPTION: 'bmqu::AlignedPrinter' provides a mechanism to print key-value // pairs in an aligned manner. // /// Usage @@ -35,11 +35,11 @@ // fields.push_back("Number of AppIds"); //.. // -// Next, create an instance of mwcu::AlignedPrinter: +// Next, create an instance of bmqu::AlignedPrinter: //.. // bsl::stringstream output; // const int indent = 8; -// mwcu::AlignedPrinter printer(output, &fields, indent); +// bmqu::AlignedPrinter printer(output, &fields, indent); //.. // // Last, print field values accordingly: @@ -51,8 +51,6 @@ //.. // -// MWC - // BDE #include #include @@ -62,7 +60,7 @@ #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ==================== // class AlignedPrinter diff --git a/src/groups/mwc/mwcu/mwcu_atomicstate.cpp b/src/groups/bmq/bmqu/bmqu_atomicstate.cpp similarity index 91% rename from src/groups/mwc/mwcu/mwcu_atomicstate.cpp rename to src/groups/bmq/bmqu/bmqu_atomicstate.cpp index 0f60604fa..79cdd867f 100644 --- a/src/groups/mwc/mwcu/mwcu_atomicstate.cpp +++ b/src/groups/bmq/bmqu/bmqu_atomicstate.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_atomicstate.cpp -*-C++-*- -#include +// bmqu_atomicstate.cpp -*-C++-*- +#include -#include +#include // BDE #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { bool AtomicState::process() { diff --git a/src/groups/mwc/mwcu/mwcu_atomicstate.h b/src/groups/bmq/bmqu/bmqu_atomicstate.h similarity index 94% rename from src/groups/mwc/mwcu/mwcu_atomicstate.h rename to src/groups/bmq/bmqu/bmqu_atomicstate.h index 30eccbb5a..0d4ece20f 100644 --- a/src/groups/mwc/mwcu/mwcu_atomicstate.h +++ b/src/groups/bmq/bmqu/bmqu_atomicstate.h @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_atomicstate.h -*-C++-*- -#ifndef INCLUDED_MWCU_ATOMICSTATE -#define INCLUDED_MWCU_ATOMICSTATE +// bmqu_atomicstate.h -*-C++-*- +#ifndef INCLUDED_BMQU_ATOMICSTATE +#define INCLUDED_BMQU_ATOMICSTATE //@PURPOSE: Provide a mechanism to change a state atomically. // //@CLASSES: -// mwcu::AtomicState: maintain the state +// bmqu::AtomicState: maintain the state // //@DESCRIPTION: This mechanism assists sharing a resource between multiple // clients. It supports four atomic operations: 'process', 'cancel', @@ -32,14 +32,12 @@ // 'process' and modifying un-processed and un-canceled resource under lock. // -// MWC - // BDE #include #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ============================= // class DispatcherRecoveryEvent diff --git a/src/groups/mwc/mwcu/mwcu_atomicstate.t.cpp b/src/groups/bmq/bmqu/bmqu_atomicstate.t.cpp similarity index 91% rename from src/groups/mwc/mwcu/mwcu_atomicstate.t.cpp rename to src/groups/bmq/bmqu/bmqu_atomicstate.t.cpp index 48516d284..f8db517e6 100644 --- a/src/groups/mwc/mwcu/mwcu_atomicstate.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_atomicstate.t.cpp @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_atomicstate.t.cpp -*-C++-*- -#include +// bmqu_atomicstate.t.cpp -*-C++-*- +#include // BDE #include @@ -22,7 +22,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -31,7 +31,7 @@ using namespace bsl; namespace { void threadFn(bool* result, - mwcu::AtomicState* state, + bmqu::AtomicState* state, bslmt::Semaphore* semaphore) { semaphore->post(); @@ -53,7 +53,7 @@ static void test1_cancelThenProcess() // // ------------------------------------------------------------------------ - mwcu::AtomicState state; + bmqu::AtomicState state; bool result; result = state.cancel(); @@ -71,7 +71,7 @@ static void test2_processThenCancel() // // ------------------------------------------------------------------------ - mwcu::AtomicState state; + bmqu::AtomicState state; bool result; result = state.process(); @@ -89,7 +89,7 @@ static void test3_lockThenProcess() // // ------------------------------------------------------------------------ - mwcu::AtomicState state; + bmqu::AtomicState state; bool result; bool result2; bslmt::Semaphore semaphore; @@ -126,7 +126,7 @@ static void test4_lockThenCancelThenProcess() // // ------------------------------------------------------------------------ - mwcu::AtomicState state; + bmqu::AtomicState state; bool result; result = state.tryLock(); @@ -145,7 +145,7 @@ static void test4_lockThenCancelThenProcess() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_PROLOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); switch (_testCase) { case 0: @@ -159,5 +159,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/mwcu_atomicvalidator.cpp b/src/groups/bmq/bmqu/bmqu_atomicvalidator.cpp similarity index 93% rename from src/groups/mwc/mwcu/mwcu_atomicvalidator.cpp rename to src/groups/bmq/bmqu/bmqu_atomicvalidator.cpp index 8e6d5e18e..7cd14924b 100644 --- a/src/groups/mwc/mwcu/mwcu_atomicvalidator.cpp +++ b/src/groups/bmq/bmqu/bmqu_atomicvalidator.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_atomicvalidator.cpp -*-C++-*- -#include +// bmqu_atomicvalidator.cpp -*-C++-*- +#include -#include +#include // BDE #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // --------------------- // class AtomicValidator diff --git a/src/groups/mwc/mwcu/mwcu_atomicvalidator.h b/src/groups/bmq/bmqu/bmqu_atomicvalidator.h similarity index 92% rename from src/groups/mwc/mwcu/mwcu_atomicvalidator.h rename to src/groups/bmq/bmqu/bmqu_atomicvalidator.h index c361123e8..4d33a00ef 100644 --- a/src/groups/mwc/mwcu/mwcu_atomicvalidator.h +++ b/src/groups/bmq/bmqu/bmqu_atomicvalidator.h @@ -13,21 +13,21 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_atomicvalidator.h -*-C++-*- -#ifndef INCLUDED_MWCU_ATOMICVALIDATOR -#define INCLUDED_MWCU_ATOMICVALIDATOR +// bmqu_atomicvalidator.h -*-C++-*- +#ifndef INCLUDED_BMQU_ATOMICVALIDATOR +#define INCLUDED_BMQU_ATOMICVALIDATOR //@PURPOSE: Provide a mechanism to acquire/release and invalidate a resource. // //@CLASSES: -// mwcu::AtomicValidator: acquire/release/invalidate a resource -// mwcu::AtomicValidatorSp: shared pointer to an 'mwcu::AtomicValidator' -// mwcu::AtomicValidatorGuard: guard for on a 'mwcu::AtomicValidator' object +// bmqu::AtomicValidator: acquire/release/invalidate a resource +// bmqu::AtomicValidatorSp: shared pointer to an 'bmqu::AtomicValidator' +// bmqu::AtomicValidatorGuard: guard for on a 'bmqu::AtomicValidator' object // //@DESCRIPTION: The mechanisms provided by this component allows to manage the -// lifecycle of a resource thanks to the 'mwcu::AtomicValidator' object, which -// can be acquired with the associated 'mwcu::AtomicValidatorGuard'. For usage -// convenience, a 'mwcu::AtomicValidatorSp' typedef is provided. The resource +// lifecycle of a resource thanks to the 'bmqu::AtomicValidator' object, which +// can be acquired with the associated 'bmqu::AtomicValidatorGuard'. For usage +// convenience, a 'bmqu::AtomicValidatorSp' typedef is provided. The resource // can be acquired by many objects, but once invalidated, it cannot be acquired // again until a subsequent reset. This is particularly useful in asynchronous // and multi-threaded applications to ensure a specific object is still valid @@ -40,7 +40,7 @@ // check: //.. // class MyResource { -// typedef bsl::shared_ptr AtomicValidatorSp; +// typedef bsl::shared_ptr AtomicValidatorSp; // AtomicValidatorSp d_validator_sp; // // public: @@ -53,7 +53,7 @@ // In the construction, we create the validator: //.. // MyResource::MyResource() -// : d_validator_sp(new(*allocator) mwcu::AtomicValidator(), allocator) +// : d_validator_sp(new(*allocator) bmqu::AtomicValidator(), allocator) // { // // Nothing // } @@ -78,12 +78,12 @@ // } //.. // Finally, in the callback method, before using the resource object, we first -// create a 'mwcu::AtomicValidatorGuard' on the validator, and check whether +// create a 'bmqu::AtomicValidatorGuard' on the validator, and check whether // acquisition was successful or not: //.. // void MyResource::myCallbackFunction(const AtomicValidatorSp& validator) // { -// mwcu::AtomicValidatorGuard guard(validator.ptr()); +// bmqu::AtomicValidatorGuard guard(validator.ptr()); // if (!guard.isValid()) { // // 'this' got destroyed before the callback and is not usable // return; @@ -93,8 +93,6 @@ // } //.. -// MWC - // BDE #include #include @@ -102,7 +100,7 @@ #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ===================== // class AtomicValidator diff --git a/src/groups/mwc/mwcu/mwcu_atomicvalidator.t.cpp b/src/groups/bmq/bmqu/bmqu_atomicvalidator.t.cpp similarity index 87% rename from src/groups/mwc/mwcu/mwcu_atomicvalidator.t.cpp rename to src/groups/bmq/bmqu/bmqu_atomicvalidator.t.cpp index 85e9c3a05..f610f49b6 100644 --- a/src/groups/mwc/mwcu/mwcu_atomicvalidator.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_atomicvalidator.t.cpp @@ -13,11 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_atomicvalidator.t.cpp -*-C++-*- -#include +// bmqu_atomicvalidator.t.cpp -*-C++-*- +#include -// MWC -#include +#include // BDE #include @@ -25,7 +24,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -48,11 +47,11 @@ using namespace bsl; namespace { -void acquireReleaseThread(mwcu::AtomicValidator* validator, +void acquireReleaseThread(bmqu::AtomicValidator* validator, bsls::AtomicInt* runningThreads); // FUNCTIONS -void acquireReleaseThread(mwcu::AtomicValidator* validator, +void acquireReleaseThread(bmqu::AtomicValidator* validator, bsls::AtomicInt* runningThreads) { bool reported = false; @@ -103,12 +102,12 @@ static void test1_breathingTest() // Basic Functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { PV("ATOMIC VALIDATOR"); - mwcu::AtomicValidator obj; + bmqu::AtomicValidator obj; // Acquire ASSERT(obj.acquire()); @@ -133,21 +132,21 @@ static void test1_breathingTest() PVV("- VALIDATOR NULL"); { - mwcu::AtomicValidatorGuard obj0(0); + bmqu::AtomicValidatorGuard obj0(0); ASSERT(obj0.isValid()); ASSERT(obj0.release() == 0); ASSERT(obj0.isValid()); } - mwcu::AtomicValidator validator; + bmqu::AtomicValidator validator; PVV("- VALIDATOR VALID"); { - mwcu::AtomicValidatorGuard obj(&validator); // ACQUIRE #1 + bmqu::AtomicValidatorGuard obj(&validator); // ACQUIRE #1 ASSERT(obj.isValid()); - mwcu::AtomicValidator* releaseRC = obj.release(); + bmqu::AtomicValidator* releaseRC = obj.release(); ASSERT(releaseRC == &validator); ASSERT(obj.isValid()); @@ -158,7 +157,7 @@ static void test1_breathingTest() { validator.invalidate(); - mwcu::AtomicValidatorGuard obj(&validator); + bmqu::AtomicValidatorGuard obj(&validator); ASSERT(!obj.isValid()); ASSERT(obj.release() == 0); @@ -170,7 +169,7 @@ static void test1_breathingTest() validator.reset(); validator.acquire(); // ACQUIRE #2 - mwcu::AtomicValidatorGuard obj(&validator, 1); // no acquisition + bmqu::AtomicValidatorGuard obj(&validator, 1); // no acquisition ASSERT(obj.isValid()); // obj.~AtomicValidatorGuard() // RELEASE #2 } @@ -179,7 +178,7 @@ static void test1_breathingTest() PVV("- VALIDATOR VALID, NOT PRE-ACQUIRED"); { - mwcu::AtomicValidatorGuard obj(&validator, 0); // ACQUIRE #3 + bmqu::AtomicValidatorGuard obj(&validator, 0); // ACQUIRE #3 ASSERT(obj.isValid()); // obj.~AtomicValidatorGuard() // RELEASE #3 } @@ -204,11 +203,11 @@ static void test2_atomicValidatorMultiThreaded() // AtomicValidator // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ATOMIC VALIDATOR - MULTI-THREADED"); + bmqtst::TestHelper::printTestName("ATOMIC VALIDATOR - MULTI-THREADED"); const int k_NUM_THREADS = 16; - mwcu::AtomicValidator validator; + bmqu::AtomicValidator validator; bsls::AtomicInt numRunningThreads; bslmt::ThreadUtil::Handle handles[k_NUM_THREADS]; @@ -216,7 +215,7 @@ static void test2_atomicValidatorMultiThreaded() for (int i = 0; i < k_NUM_THREADS; ++i) { int ret = bslmt::ThreadUtil::createWithAllocator( &handles[i], - mwcsys::ThreadUtil::defaultAttributes(), + bmqsys::ThreadUtil::defaultAttributes(), bdlf::BindUtil::bindS(s_allocator_p, &acquireReleaseThread, &validator, @@ -260,7 +259,7 @@ static void test2_atomicValidatorMultiThreaded() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -272,5 +271,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/mwcu_blob.cpp b/src/groups/bmq/bmqu/bmqu_blob.cpp similarity index 98% rename from src/groups/mwc/mwcu/mwcu_blob.cpp rename to src/groups/bmq/bmqu/bmqu_blob.cpp index ac49efe37..a967bb4b0 100644 --- a/src/groups/mwc/mwcu/mwcu_blob.cpp +++ b/src/groups/bmq/bmqu/bmqu_blob.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_blob.cpp -*-C++-*- -#include +// bmqu_blob.cpp -*-C++-*- +#include -#include +#include // BDE #include #include @@ -24,7 +24,7 @@ #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ------------------ // class BlobPosition @@ -506,7 +506,7 @@ int BlobUtil::readUpToNBytes(char* buf, char* outPosition = buf; const int numBuffers = blob.numDataBuffers(); - mwcu::BlobPosition cursor(start); + bmqu::BlobPosition cursor(start); while (length != 0 && (cursor.buffer() != numBuffers)) { const bdlbb::BlobBuffer& buffer = blob.buffer(cursor.buffer()); @@ -631,8 +631,8 @@ BlobStartHexDumper::BlobStartHexDumper(const bdlbb::Blob* blob, int length) } // close package namespace // FREE OPERATORS -bsl::ostream& mwcu::operator<<(bsl::ostream& stream, - const mwcu::BlobStartHexDumper& src) +bsl::ostream& bmqu::operator<<(bsl::ostream& stream, + const bmqu::BlobStartHexDumper& src) { if (src.d_blob_p->totalSize() == 0) { // Workaround for {internal-ticket D165124836} BDE assertion in diff --git a/src/groups/mwc/mwcu/mwcu_blob.h b/src/groups/bmq/bmqu/bmqu_blob.h similarity index 97% rename from src/groups/mwc/mwcu/mwcu_blob.h rename to src/groups/bmq/bmqu/bmqu_blob.h index 013936b71..fa5e59695 100644 --- a/src/groups/mwc/mwcu/mwcu_blob.h +++ b/src/groups/bmq/bmqu/bmqu_blob.h @@ -13,32 +13,30 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_blob.h -*-C++-*- -#ifndef INCLUDED_MWCU_BLOB -#define INCLUDED_MWCU_BLOB +// bmqu_blob.h -*-C++-*- +#ifndef INCLUDED_BMQU_BLOB +#define INCLUDED_BMQU_BLOB //@PURPOSE: Provide utility functions for working with Blobs. // //@CLASSES: -// mwcu::BlobPosition : POD defining a position in a blob. -// mwcu::BlobSection : POD defining a range of bytes in a blob. -// mwcu::BlobUtil : Static blob manipulation functions. -// mwcu::BlobStartHexDumper : Pretty printer for blobs. +// bmqu::BlobPosition : POD defining a position in a blob. +// bmqu::BlobSection : POD defining a range of bytes in a blob. +// bmqu::BlobUtil : Static blob manipulation functions. +// bmqu::BlobStartHexDumper : Pretty printer for blobs. // -//@DESCRIPTION: This component provides a utility, 'mwcu::BlobUtil', which +//@DESCRIPTION: This component provides a utility, 'bmqu::BlobUtil', which // implements a set of static utility functions allowing to copy data from // 'bdlbb::Blob' objects to raw memory buffers, or copy data from one blob // object to another blob object causing the data actually to be copied // instead of duplicating buffer references. -// MWC - // BDE #include #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ================== // class BlobPosition @@ -644,14 +642,14 @@ TYPE* BlobUtil::getAlignedObject(TYPE* storage, } // close package namespace // FREE OPERATORS -inline bsl::ostream& mwcu::operator<<(bsl::ostream& stream, - const mwcu::BlobPosition& object) +inline bsl::ostream& bmqu::operator<<(bsl::ostream& stream, + const bmqu::BlobPosition& object) { return object.print(stream, 0, -1); } -inline bsl::ostream& mwcu::operator<<(bsl::ostream& stream, - const mwcu::BlobSection& object) +inline bsl::ostream& bmqu::operator<<(bsl::ostream& stream, + const bmqu::BlobSection& object) { return object.print(stream, 0, -1); } diff --git a/src/groups/mwc/mwcu/mwcu_blob.t.cpp b/src/groups/bmq/bmqu/bmqu_blob.t.cpp similarity index 77% rename from src/groups/mwc/mwcu/mwcu_blob.t.cpp rename to src/groups/bmq/bmqu/bmqu_blob.t.cpp index 2c877b957..16149d822 100644 --- a/src/groups/mwc/mwcu/mwcu_blob.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_blob.t.cpp @@ -13,19 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_blob.t.cpp -*-C++-*- -#include - -// MWC -#include -#include +// bmqu_blob.t.cpp -*-C++-*- +#include +#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -74,11 +72,11 @@ static void test1_positionBreathingTest() // BlobPosition // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Position Breathing Test"); + bmqtst::TestHelper::printTestName("Position Breathing Test"); { PVV("Default constructor"); - mwcu::BlobPosition obj; + bmqu::BlobPosition obj; ASSERT_EQ(obj.buffer(), 0); ASSERT_EQ(obj.byte(), 0); obj.setBuffer(123); @@ -89,7 +87,7 @@ static void test1_positionBreathingTest() { PVV("Initialized constructor"); - mwcu::BlobPosition obj(12, 98); + bmqu::BlobPosition obj(12, 98); ASSERT_EQ(obj.buffer(), 12); ASSERT_EQ(obj.byte(), 98); obj.setBuffer(123); @@ -99,16 +97,16 @@ static void test1_positionBreathingTest() } // Verifying printing - mwcu::BlobPosition position(1, 2); + bmqu::BlobPosition position(1, 2); { - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); os << position; PV("position = " << os.str()); ASSERT_EQ(os.str(), "[ buffer = 1 byte = 2 ]"); } { - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); bslim::Printer printer(&os, 0, -1); printer.start(); printer.printAttribute("position", position); @@ -132,9 +130,9 @@ static void test2_positionComparison() // '<', '==' and '!=' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Position Comparison Test"); + bmqtst::TestHelper::printTestName("Position Comparison Test"); - using namespace mwcu; + using namespace bmqu; struct Test { int d_line; BlobPosition d_lhs; @@ -191,35 +189,35 @@ static void test3_sectionBreathingTest() // BlobSection // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Section Breathing Test"); + bmqtst::TestHelper::printTestName("Section Breathing Test"); { PVV("Default constructor"); - mwcu::BlobSection obj; - ASSERT_EQ(obj.start(), mwcu::BlobPosition()); - ASSERT_EQ(obj.end(), mwcu::BlobPosition()); - obj.start() = mwcu::BlobPosition(1, 2); - obj.end() = mwcu::BlobPosition(9, 8); - ASSERT_EQ(obj.start(), mwcu::BlobPosition(1, 2)); - ASSERT_EQ(obj.end(), mwcu::BlobPosition(9, 8)); + bmqu::BlobSection obj; + ASSERT_EQ(obj.start(), bmqu::BlobPosition()); + ASSERT_EQ(obj.end(), bmqu::BlobPosition()); + obj.start() = bmqu::BlobPosition(1, 2); + obj.end() = bmqu::BlobPosition(9, 8); + ASSERT_EQ(obj.start(), bmqu::BlobPosition(1, 2)); + ASSERT_EQ(obj.end(), bmqu::BlobPosition(9, 8)); } { PVV("Initialized constructor"); - mwcu::BlobSection obj(mwcu::BlobPosition(1, 2), - mwcu::BlobPosition(9, 8)); - ASSERT_EQ(obj.start(), mwcu::BlobPosition(1, 2)); - ASSERT_EQ(obj.end(), mwcu::BlobPosition(9, 8)); - obj.start() = mwcu::BlobPosition(3, 4); - obj.end() = mwcu::BlobPosition(8, 9); - ASSERT_EQ(obj.start(), mwcu::BlobPosition(3, 4)); - ASSERT_EQ(obj.end(), mwcu::BlobPosition(8, 9)); + bmqu::BlobSection obj(bmqu::BlobPosition(1, 2), + bmqu::BlobPosition(9, 8)); + ASSERT_EQ(obj.start(), bmqu::BlobPosition(1, 2)); + ASSERT_EQ(obj.end(), bmqu::BlobPosition(9, 8)); + obj.start() = bmqu::BlobPosition(3, 4); + obj.end() = bmqu::BlobPosition(8, 9); + ASSERT_EQ(obj.start(), bmqu::BlobPosition(3, 4)); + ASSERT_EQ(obj.end(), bmqu::BlobPosition(8, 9)); } // Verifying printing - mwcu::BlobSection obj(mwcu::BlobPosition(1, 2), mwcu::BlobPosition(9, 8)); + bmqu::BlobSection obj(bmqu::BlobPosition(1, 2), bmqu::BlobPosition(9, 8)); { - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); os << obj; PV("section = " << os.str()); ASSERT_EQ(os.str(), @@ -228,7 +226,7 @@ static void test3_sectionBreathingTest() } { - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); bslim::Printer printer(&os, 0, -1); printer.start(); printer.printAttribute("section", obj); @@ -256,7 +254,7 @@ static void test4_bufferSize() // bufferSize // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Buffer Size Test"); + bmqtst::TestHelper::printTestName("Buffer Size Test"); struct Test { int d_line; // Line @@ -279,13 +277,13 @@ static void test4_bufferSize() PVV(test.d_line << ": checking blob '" << test.d_blobFormat << "'"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, test.d_blobFormat, s_allocator_p); for (int bufIdx = 0; test.d_bufSizes[bufIdx] != -1; ++bufIdx) { ASSERT_EQ_D("line " << test.d_line << ", bufIdx " << bufIdx, - mwcu::BlobUtil::bufferSize(blob, bufIdx), + bmqu::BlobUtil::bufferSize(blob, bufIdx), test.d_bufSizes[bufIdx]); } } @@ -306,35 +304,35 @@ static void test5_isValidPos() // isValidPos // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Is Valid Pos Test"); + bmqtst::TestHelper::printTestName("Is Valid Pos Test"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, "ab|cde|f|ghiXX", s_allocator_p); + bmqtst::BlobTestUtil::fromString(&blob, "ab|cde|f|ghiXX", s_allocator_p); struct Test { int d_line; - mwcu::BlobPosition d_position; + bmqu::BlobPosition d_position; bool d_expected; // expected result } k_DATA[] = { // All valid positions - {L_, mwcu::BlobPosition(0, 0), true}, - {L_, mwcu::BlobPosition(0, 1), true}, - {L_, mwcu::BlobPosition(1, 0), true}, - {L_, mwcu::BlobPosition(1, 1), true}, - {L_, mwcu::BlobPosition(1, 2), true}, - {L_, mwcu::BlobPosition(2, 0), true}, - {L_, mwcu::BlobPosition(3, 0), true}, - {L_, mwcu::BlobPosition(3, 1), true}, - {L_, mwcu::BlobPosition(3, 2), true}, - {L_, mwcu::BlobPosition(4, 0), true}, // One past the end + {L_, bmqu::BlobPosition(0, 0), true}, + {L_, bmqu::BlobPosition(0, 1), true}, + {L_, bmqu::BlobPosition(1, 0), true}, + {L_, bmqu::BlobPosition(1, 1), true}, + {L_, bmqu::BlobPosition(1, 2), true}, + {L_, bmqu::BlobPosition(2, 0), true}, + {L_, bmqu::BlobPosition(3, 0), true}, + {L_, bmqu::BlobPosition(3, 1), true}, + {L_, bmqu::BlobPosition(3, 2), true}, + {L_, bmqu::BlobPosition(4, 0), true}, // One past the end // Invalid positions - {L_, mwcu::BlobPosition(0, 2), false}, - {L_, mwcu::BlobPosition(0, 3), false}, - {L_, mwcu::BlobPosition(1, 3), false}, - {L_, mwcu::BlobPosition(3, 3), false}, - {L_, mwcu::BlobPosition(4, 1), false}, - {L_, mwcu::BlobPosition(5, 0), false}, - {L_, mwcu::BlobPosition(5, 1), false}, + {L_, bmqu::BlobPosition(0, 2), false}, + {L_, bmqu::BlobPosition(0, 3), false}, + {L_, bmqu::BlobPosition(1, 3), false}, + {L_, bmqu::BlobPosition(3, 3), false}, + {L_, bmqu::BlobPosition(4, 1), false}, + {L_, bmqu::BlobPosition(5, 0), false}, + {L_, bmqu::BlobPosition(5, 1), false}, }; const size_t k_NUM_DATA = sizeof(k_DATA) / sizeof(*k_DATA); @@ -344,7 +342,7 @@ static void test5_isValidPos() PVV(test.d_line << ": checking validity of " << test.d_position); ASSERT_EQ_D("line " << test.d_line, - mwcu::BlobUtil::isValidPos(blob, test.d_position), + bmqu::BlobUtil::isValidPos(blob, test.d_position), test.d_expected); } } @@ -366,35 +364,35 @@ static void test6_positionToOffset() // positionToOffset // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Position To Offset Test"); + bmqtst::TestHelper::printTestName("Position To Offset Test"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, "ab|cde|f|ghiXX", s_allocator_p); + bmqtst::BlobTestUtil::fromString(&blob, "ab|cde|f|ghiXX", s_allocator_p); struct Test { int d_line; - mwcu::BlobPosition d_position; + bmqu::BlobPosition d_position; int d_expected; } k_DATA[] = { // All valid positions - {L_, mwcu::BlobPosition(0, 0), 0}, - {L_, mwcu::BlobPosition(0, 1), 1}, - {L_, mwcu::BlobPosition(1, 0), 2}, - {L_, mwcu::BlobPosition(1, 1), 3}, - {L_, mwcu::BlobPosition(1, 2), 4}, - {L_, mwcu::BlobPosition(2, 0), 5}, - {L_, mwcu::BlobPosition(3, 0), 6}, - {L_, mwcu::BlobPosition(3, 1), 7}, - {L_, mwcu::BlobPosition(3, 2), 8}, - {L_, mwcu::BlobPosition(4, 0), 9}, // One past the end + {L_, bmqu::BlobPosition(0, 0), 0}, + {L_, bmqu::BlobPosition(0, 1), 1}, + {L_, bmqu::BlobPosition(1, 0), 2}, + {L_, bmqu::BlobPosition(1, 1), 3}, + {L_, bmqu::BlobPosition(1, 2), 4}, + {L_, bmqu::BlobPosition(2, 0), 5}, + {L_, bmqu::BlobPosition(3, 0), 6}, + {L_, bmqu::BlobPosition(3, 1), 7}, + {L_, bmqu::BlobPosition(3, 2), 8}, + {L_, bmqu::BlobPosition(4, 0), 9}, // One past the end // Invalid positions - {L_, mwcu::BlobPosition(0, 2), -1}, - {L_, mwcu::BlobPosition(0, 3), -1}, - {L_, mwcu::BlobPosition(1, 3), -1}, - {L_, mwcu::BlobPosition(3, 3), -1}, - {L_, mwcu::BlobPosition(4, 1), -1}, - {L_, mwcu::BlobPosition(5, 0), -1}, - {L_, mwcu::BlobPosition(5, 1), -1}, + {L_, bmqu::BlobPosition(0, 2), -1}, + {L_, bmqu::BlobPosition(0, 3), -1}, + {L_, bmqu::BlobPosition(1, 3), -1}, + {L_, bmqu::BlobPosition(3, 3), -1}, + {L_, bmqu::BlobPosition(4, 1), -1}, + {L_, bmqu::BlobPosition(5, 0), -1}, + {L_, bmqu::BlobPosition(5, 1), -1}, }; const size_t k_NUM_DATA = sizeof(k_DATA) / sizeof(*k_DATA); @@ -405,7 +403,7 @@ static void test6_positionToOffset() PVV(test.d_line << ": checking offset of " << test.d_position); int offset = -1; - int rc = mwcu::BlobUtil::positionToOffsetSafe(&offset, + int rc = bmqu::BlobUtil::positionToOffsetSafe(&offset, blob, test.d_position); ASSERT_EQ_D("line " << test.d_line, offset, test.d_expected); @@ -415,7 +413,7 @@ static void test6_positionToOffset() // If valid, also ensure 'raw' isOffset works offset = -1; - mwcu::BlobUtil::positionToOffset(&offset, blob, test.d_position); + bmqu::BlobUtil::positionToOffset(&offset, blob, test.d_position); ASSERT_EQ_D("line " << test.d_line, offset, test.d_expected); } else { @@ -441,10 +439,10 @@ static void test7_findOffset() // findOffset // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Find Offset Test"); + bmqtst::TestHelper::printTestName("Find Offset Test"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, "ab|cde|f|ghiXX", s_allocator_p); + bmqtst::BlobTestUtil::fromString(&blob, "ab|cde|f|ghiXX", s_allocator_p); PV("Without a start offset"); { @@ -452,22 +450,22 @@ static void test7_findOffset() int d_line; int d_offset; int d_expectedRc; - mwcu::BlobPosition d_expected; + bmqu::BlobPosition d_expected; } k_DATA[] = { // Valid offsets - {L_, 0, 0, mwcu::BlobPosition(0, 0)}, - {L_, 1, 0, mwcu::BlobPosition(0, 1)}, - {L_, 2, 0, mwcu::BlobPosition(1, 0)}, - {L_, 3, 0, mwcu::BlobPosition(1, 1)}, - {L_, 4, 0, mwcu::BlobPosition(1, 2)}, - {L_, 5, 0, mwcu::BlobPosition(2, 0)}, - {L_, 6, 0, mwcu::BlobPosition(3, 0)}, - {L_, 7, 0, mwcu::BlobPosition(3, 1)}, - {L_, 8, 0, mwcu::BlobPosition(3, 2)}, - {L_, 9, 0, mwcu::BlobPosition(4, 0)}, + {L_, 0, 0, bmqu::BlobPosition(0, 0)}, + {L_, 1, 0, bmqu::BlobPosition(0, 1)}, + {L_, 2, 0, bmqu::BlobPosition(1, 0)}, + {L_, 3, 0, bmqu::BlobPosition(1, 1)}, + {L_, 4, 0, bmqu::BlobPosition(1, 2)}, + {L_, 5, 0, bmqu::BlobPosition(2, 0)}, + {L_, 6, 0, bmqu::BlobPosition(3, 0)}, + {L_, 7, 0, bmqu::BlobPosition(3, 1)}, + {L_, 8, 0, bmqu::BlobPosition(3, 2)}, + {L_, 9, 0, bmqu::BlobPosition(4, 0)}, // Invalid offsets - {L_, 10, -3, mwcu::BlobPosition(0, 0)}, - {L_, 11, -3, mwcu::BlobPosition(0, 0)}, + {L_, 10, -3, bmqu::BlobPosition(0, 0)}, + {L_, 11, -3, bmqu::BlobPosition(0, 0)}, }; const size_t k_NUM_DATA = sizeof(k_DATA) / sizeof(*k_DATA); @@ -478,8 +476,8 @@ static void test7_findOffset() PVV(test.d_line << ": checking position of offset " << test.d_offset); - mwcu::BlobPosition position; - int rc = mwcu::BlobUtil::findOffsetSafe(&position, + bmqu::BlobPosition position; + int rc = bmqu::BlobUtil::findOffsetSafe(&position, blob, test.d_offset); ASSERT_EQ_D("line " << test.d_line, rc, test.d_expectedRc); @@ -488,7 +486,7 @@ static void test7_findOffset() ASSERT_EQ_D("line " << test.d_line, position, test.d_expected); // Verify the non-safe method - rc = mwcu::BlobUtil::findOffset(&position, + rc = bmqu::BlobUtil::findOffset(&position, blob, test.d_offset); ASSERT_EQ_D("line " << test.d_line, rc, test.d_expectedRc); @@ -501,54 +499,54 @@ static void test7_findOffset() { struct Test { int d_line; - mwcu::BlobPosition d_start; + bmqu::BlobPosition d_start; int d_offset; int d_expectedRc; - mwcu::BlobPosition d_expected; + bmqu::BlobPosition d_expected; } k_DATA[] = { // Start of (0, 1) - {L_, mwcu::BlobPosition(0, 1), 0, 0, mwcu::BlobPosition(0, 1)}, - {L_, mwcu::BlobPosition(0, 1), 1, 0, mwcu::BlobPosition(1, 0)}, - {L_, mwcu::BlobPosition(0, 1), 2, 0, mwcu::BlobPosition(1, 1)}, - {L_, mwcu::BlobPosition(0, 1), 3, 0, mwcu::BlobPosition(1, 2)}, - {L_, mwcu::BlobPosition(0, 1), 4, 0, mwcu::BlobPosition(2, 0)}, - {L_, mwcu::BlobPosition(0, 1), 5, 0, mwcu::BlobPosition(3, 0)}, - {L_, mwcu::BlobPosition(0, 1), 6, 0, mwcu::BlobPosition(3, 1)}, - {L_, mwcu::BlobPosition(0, 1), 7, 0, mwcu::BlobPosition(3, 2)}, - {L_, mwcu::BlobPosition(0, 1), 8, 0, mwcu::BlobPosition(4, 0)}, - {L_, mwcu::BlobPosition(0, 1), 9, -3, mwcu::BlobPosition(0, 0)}, - {L_, mwcu::BlobPosition(0, 1), 10, -3, mwcu::BlobPosition(0, 0)}, + {L_, bmqu::BlobPosition(0, 1), 0, 0, bmqu::BlobPosition(0, 1)}, + {L_, bmqu::BlobPosition(0, 1), 1, 0, bmqu::BlobPosition(1, 0)}, + {L_, bmqu::BlobPosition(0, 1), 2, 0, bmqu::BlobPosition(1, 1)}, + {L_, bmqu::BlobPosition(0, 1), 3, 0, bmqu::BlobPosition(1, 2)}, + {L_, bmqu::BlobPosition(0, 1), 4, 0, bmqu::BlobPosition(2, 0)}, + {L_, bmqu::BlobPosition(0, 1), 5, 0, bmqu::BlobPosition(3, 0)}, + {L_, bmqu::BlobPosition(0, 1), 6, 0, bmqu::BlobPosition(3, 1)}, + {L_, bmqu::BlobPosition(0, 1), 7, 0, bmqu::BlobPosition(3, 2)}, + {L_, bmqu::BlobPosition(0, 1), 8, 0, bmqu::BlobPosition(4, 0)}, + {L_, bmqu::BlobPosition(0, 1), 9, -3, bmqu::BlobPosition(0, 0)}, + {L_, bmqu::BlobPosition(0, 1), 10, -3, bmqu::BlobPosition(0, 0)}, // Start at (1,0) - {L_, mwcu::BlobPosition(1, 0), 0, 0, mwcu::BlobPosition(1, 0)}, - {L_, mwcu::BlobPosition(1, 0), 1, 0, mwcu::BlobPosition(1, 1)}, - {L_, mwcu::BlobPosition(1, 0), 2, 0, mwcu::BlobPosition(1, 2)}, - {L_, mwcu::BlobPosition(1, 0), 3, 0, mwcu::BlobPosition(2, 0)}, - {L_, mwcu::BlobPosition(1, 0), 4, 0, mwcu::BlobPosition(3, 0)}, - {L_, mwcu::BlobPosition(1, 0), 5, 0, mwcu::BlobPosition(3, 1)}, - {L_, mwcu::BlobPosition(1, 0), 6, 0, mwcu::BlobPosition(3, 2)}, - {L_, mwcu::BlobPosition(1, 0), 7, 0, mwcu::BlobPosition(4, 0)}, - {L_, mwcu::BlobPosition(1, 0), 8, -3, mwcu::BlobPosition(0, 0)}, - {L_, mwcu::BlobPosition(1, 0), 9, -3, mwcu::BlobPosition(0, 0)}, + {L_, bmqu::BlobPosition(1, 0), 0, 0, bmqu::BlobPosition(1, 0)}, + {L_, bmqu::BlobPosition(1, 0), 1, 0, bmqu::BlobPosition(1, 1)}, + {L_, bmqu::BlobPosition(1, 0), 2, 0, bmqu::BlobPosition(1, 2)}, + {L_, bmqu::BlobPosition(1, 0), 3, 0, bmqu::BlobPosition(2, 0)}, + {L_, bmqu::BlobPosition(1, 0), 4, 0, bmqu::BlobPosition(3, 0)}, + {L_, bmqu::BlobPosition(1, 0), 5, 0, bmqu::BlobPosition(3, 1)}, + {L_, bmqu::BlobPosition(1, 0), 6, 0, bmqu::BlobPosition(3, 2)}, + {L_, bmqu::BlobPosition(1, 0), 7, 0, bmqu::BlobPosition(4, 0)}, + {L_, bmqu::BlobPosition(1, 0), 8, -3, bmqu::BlobPosition(0, 0)}, + {L_, bmqu::BlobPosition(1, 0), 9, -3, bmqu::BlobPosition(0, 0)}, // Start at (1, 2) - {L_, mwcu::BlobPosition(1, 2), 0, 0, mwcu::BlobPosition(1, 2)}, - {L_, mwcu::BlobPosition(1, 2), 1, 0, mwcu::BlobPosition(2, 0)}, - {L_, mwcu::BlobPosition(1, 2), 2, 0, mwcu::BlobPosition(3, 0)}, - {L_, mwcu::BlobPosition(1, 2), 3, 0, mwcu::BlobPosition(3, 1)}, - {L_, mwcu::BlobPosition(1, 2), 4, 0, mwcu::BlobPosition(3, 2)}, - {L_, mwcu::BlobPosition(1, 2), 5, 0, mwcu::BlobPosition(4, 0)}, - {L_, mwcu::BlobPosition(1, 2), 6, -3, mwcu::BlobPosition(0, 0)}, - {L_, mwcu::BlobPosition(1, 2), 7, -3, mwcu::BlobPosition(0, 0)}, + {L_, bmqu::BlobPosition(1, 2), 0, 0, bmqu::BlobPosition(1, 2)}, + {L_, bmqu::BlobPosition(1, 2), 1, 0, bmqu::BlobPosition(2, 0)}, + {L_, bmqu::BlobPosition(1, 2), 2, 0, bmqu::BlobPosition(3, 0)}, + {L_, bmqu::BlobPosition(1, 2), 3, 0, bmqu::BlobPosition(3, 1)}, + {L_, bmqu::BlobPosition(1, 2), 4, 0, bmqu::BlobPosition(3, 2)}, + {L_, bmqu::BlobPosition(1, 2), 5, 0, bmqu::BlobPosition(4, 0)}, + {L_, bmqu::BlobPosition(1, 2), 6, -3, bmqu::BlobPosition(0, 0)}, + {L_, bmqu::BlobPosition(1, 2), 7, -3, bmqu::BlobPosition(0, 0)}, // Start at (3, 2) - {L_, mwcu::BlobPosition(3, 2), 0, 0, mwcu::BlobPosition(3, 2)}, - {L_, mwcu::BlobPosition(3, 2), 1, 0, mwcu::BlobPosition(4, 0)}, - {L_, mwcu::BlobPosition(3, 2), 2, -3, mwcu::BlobPosition(0, 0)}, - {L_, mwcu::BlobPosition(3, 2), 3, -3, mwcu::BlobPosition(0, 0)}, + {L_, bmqu::BlobPosition(3, 2), 0, 0, bmqu::BlobPosition(3, 2)}, + {L_, bmqu::BlobPosition(3, 2), 1, 0, bmqu::BlobPosition(4, 0)}, + {L_, bmqu::BlobPosition(3, 2), 2, -3, bmqu::BlobPosition(0, 0)}, + {L_, bmqu::BlobPosition(3, 2), 3, -3, bmqu::BlobPosition(0, 0)}, // Start at (4, 0) (i.e. one past the end) - {L_, mwcu::BlobPosition(4, 0), 0, 0, mwcu::BlobPosition(4, 0)}, - {L_, mwcu::BlobPosition(4, 0), 1, -2, mwcu::BlobPosition(0, 0)}, + {L_, bmqu::BlobPosition(4, 0), 0, 0, bmqu::BlobPosition(4, 0)}, + {L_, bmqu::BlobPosition(4, 0), 1, -2, bmqu::BlobPosition(0, 0)}, // Invalid start - {L_, mwcu::BlobPosition(5, 2), 0, -1, mwcu::BlobPosition(0, 0)}, - {L_, mwcu::BlobPosition(5, 2), 1, -1, mwcu::BlobPosition(0, 0)}}; + {L_, bmqu::BlobPosition(5, 2), 0, -1, bmqu::BlobPosition(0, 0)}, + {L_, bmqu::BlobPosition(5, 2), 1, -1, bmqu::BlobPosition(0, 0)}}; const size_t k_NUM_DATA = sizeof(k_DATA) / sizeof(*k_DATA); @@ -558,8 +556,8 @@ static void test7_findOffset() PVV(test.d_line << ": checking position of offset " << test.d_offset << " from " << test.d_start); - mwcu::BlobPosition position; - int rc = mwcu::BlobUtil::findOffsetSafe(&position, + bmqu::BlobPosition position; + int rc = bmqu::BlobUtil::findOffsetSafe(&position, blob, test.d_start, test.d_offset); @@ -569,7 +567,7 @@ static void test7_findOffset() ASSERT_EQ_D("line " << test.d_line, position, test.d_expected); // Verify the non-safe method - rc = mwcu::BlobUtil::findOffset(&position, + rc = bmqu::BlobUtil::findOffset(&position, blob, test.d_start, test.d_offset); @@ -594,7 +592,7 @@ static void test8_reserve() // reserve // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Reserve Test"); + bmqtst::TestHelper::printTestName("Reserve Test"); bdlbb::PooledBlobBufferFactory bufferFactory(4, s_allocator_p); @@ -602,15 +600,15 @@ static void test8_reserve() int d_line; const char* d_blobPattern; int d_reserveLength; - mwcu::BlobPosition d_expected; + bmqu::BlobPosition d_expected; } k_DATA[] = { - {L_, "", 1, mwcu::BlobPosition(0, 0)}, - {L_, "a", 3, mwcu::BlobPosition(1, 0)}, - {L_, "abcd", 3, mwcu::BlobPosition(1, 0)}, - {L_, "abcd|e", 3, mwcu::BlobPosition(2, 0)}, - {L_, "abcd|efg", 3, mwcu::BlobPosition(2, 0)}, - {L_, "abcd|efgX", 1, mwcu::BlobPosition(1, 3)}, - {L_, "abcd|efgX", 2, mwcu::BlobPosition(1, 3)}, + {L_, "", 1, bmqu::BlobPosition(0, 0)}, + {L_, "a", 3, bmqu::BlobPosition(1, 0)}, + {L_, "abcd", 3, bmqu::BlobPosition(1, 0)}, + {L_, "abcd|e", 3, bmqu::BlobPosition(2, 0)}, + {L_, "abcd|efg", 3, bmqu::BlobPosition(2, 0)}, + {L_, "abcd|efgX", 1, bmqu::BlobPosition(1, 3)}, + {L_, "abcd|efgX", 2, bmqu::BlobPosition(1, 3)}, }; const size_t k_NUM_DATA = sizeof(k_DATA) / sizeof(*k_DATA); @@ -623,12 +621,12 @@ static void test8_reserve() PVVV("reserve"); { bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, test.d_blobPattern, s_allocator_p); int length = blob.length(); - mwcu::BlobUtil::reserve(&blob, test.d_reserveLength); + bmqu::BlobUtil::reserve(&blob, test.d_reserveLength); ASSERT_EQ_D("line " << test.d_line, blob.length(), length + test.d_reserveLength); @@ -636,13 +634,13 @@ static void test8_reserve() PVVV("reserve and load the position"); { bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, test.d_blobPattern, s_allocator_p); int length = blob.length(); - mwcu::BlobPosition pos; - mwcu::BlobUtil::reserve(&pos, &blob, test.d_reserveLength); + bmqu::BlobPosition pos; + bmqu::BlobUtil::reserve(&pos, &blob, test.d_reserveLength); ASSERT_EQ_D("line " << test.d_line, blob.length(), length + test.d_reserveLength); @@ -666,14 +664,14 @@ static void test9_writeBytes() // writeBytes // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Write Bytes Test"); + bmqtst::TestHelper::printTestName("Write Bytes Test"); - using namespace mwcu; + using namespace bmqu; struct Test { int d_line; const char* d_blobPattern; - mwcu::BlobPosition d_position; + bmqu::BlobPosition d_position; const char* d_data; const char* d_resultBlob; int d_expectedRc; @@ -715,18 +713,18 @@ static void test9_writeBytes() << test.d_position); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, test.d_blobPattern, s_allocator_p); - int rc = mwcu::BlobUtil::writeBytes(&blob, + int rc = bmqu::BlobUtil::writeBytes(&blob, test.d_position, test.d_data, bsl::strlen(test.d_data)); ASSERT_EQ_D("line " << test.d_line, rc, test.d_expectedRc); bsl::string resultBlob(s_allocator_p); - mwctst::BlobTestUtil::toString(&resultBlob, blob); + bmqtst::BlobTestUtil::toString(&resultBlob, blob); ASSERT_EQ_D("line " << test.d_line, resultBlob, bsl::string(test.d_resultBlob, s_allocator_p)); @@ -748,9 +746,9 @@ static void test10_appendBlobFromIndex() // appendBlobFromIndex // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Append Blob From Index Test"); + bmqtst::TestHelper::printTestName("Append Blob From Index Test"); - using namespace mwcu; + using namespace bmqu; bdlbb::PooledBlobBufferFactory bufferFactory(4, s_allocator_p); @@ -787,21 +785,21 @@ static void test10_appendBlobFromIndex() << test.d_byte << ") position"); bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, test.d_blobPattern, s_allocator_p); bdlbb::Blob src(s_allocator_p); - mwctst::BlobTestUtil::fromString(&src, test.d_data, s_allocator_p); + bmqtst::BlobTestUtil::fromString(&src, test.d_data, s_allocator_p); - mwcu::BlobUtil::appendBlobFromIndex(&blob, + bmqu::BlobUtil::appendBlobFromIndex(&blob, src, test.d_index, test.d_byte, test.d_length); bsl::string resultBlob(s_allocator_p); - mwctst::BlobTestUtil::toString(&resultBlob, blob, true); + bmqtst::BlobTestUtil::toString(&resultBlob, blob, true); ASSERT_EQ_D("line " << test.d_line, resultBlob, bsl::string(test.d_resultBlob, s_allocator_p)); @@ -823,9 +821,9 @@ static void test11_sectionSize() // sectionSize // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Section Size Test"); + bmqtst::TestHelper::printTestName("Section Size Test"); - using namespace mwcu; + using namespace bmqu; struct Test { int d_line; @@ -854,13 +852,13 @@ static void test11_sectionSize() << test.d_end); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, test.d_blobPattern, s_allocator_p); const BlobSection section(test.d_start, test.d_end); int size = 0; - const int rc = mwcu::BlobUtil::sectionSize(&size, blob, section); + const int rc = bmqu::BlobUtil::sectionSize(&size, blob, section); ASSERT_EQ_D("line " << test.d_line, rc, test.d_rc); ASSERT_EQ_D("line " << test.d_line, size, test.d_size); @@ -882,9 +880,9 @@ static void test12_compareSection() // compareSection // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Compare Section Test"); + bmqtst::TestHelper::printTestName("Compare Section Test"); - using namespace mwcu; + using namespace bmqu; struct Test { int d_line; @@ -911,12 +909,12 @@ static void test12_compareSection() << "' starting from " << test.d_pos); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, test.d_blobPattern, s_allocator_p); int cmpResult = 0; - const int rc = mwcu::BlobUtil::compareSection(&cmpResult, + const int rc = bmqu::BlobUtil::compareSection(&cmpResult, blob, test.d_pos, test.d_data, @@ -943,9 +941,9 @@ static void test13_copyToRawBufferFromIndex() // copyToRawBufferFromIndex // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Copy To Raw Buffer From Index Test"); + bmqtst::TestHelper::printTestName("Copy To Raw Buffer From Index Test"); - using namespace mwcu; + using namespace bmqu; struct Test { int d_line; @@ -987,11 +985,11 @@ static void test13_copyToRawBufferFromIndex() << test.d_byte << ") position"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, test.d_blobPattern, s_allocator_p); - mwcu::BlobUtil::copyToRawBufferFromIndex(dst + test.d_rawBufferOffset, + bmqu::BlobUtil::copyToRawBufferFromIndex(dst + test.d_rawBufferOffset, blob, test.d_index, test.d_byte, @@ -1019,43 +1017,43 @@ static void test14_readUpToNBytes() // readUpToNBytes // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Read Up To N Bytes Test"); + bmqtst::TestHelper::printTestName("Read Up To N Bytes Test"); - using namespace mwcu; + using namespace bmqu; bdlbb::Blob blob(s_allocator_p); const char* blobPattern = "ab|cde|f|ghiXX"; - mwctst::BlobTestUtil::fromString(&blob, blobPattern, s_allocator_p); + bmqtst::BlobTestUtil::fromString(&blob, blobPattern, s_allocator_p); struct Test { int d_line; - mwcu::BlobPosition d_start; + bmqu::BlobPosition d_start; int d_length; int d_expectedRc; const char* d_expected; } k_DATA[] = { - {L_, mwcu::BlobPosition(0, 0), 0, 0, ""}, - {L_, mwcu::BlobPosition(0, 0), 1, 1, "a"}, - {L_, mwcu::BlobPosition(0, 0), 2, 2, "ab"}, - {L_, mwcu::BlobPosition(0, 0), 3, 3, "abc"}, - {L_, mwcu::BlobPosition(0, 0), 4, 4, "abcd"}, - {L_, mwcu::BlobPosition(0, 0), 5, 5, "abcde"}, - {L_, mwcu::BlobPosition(0, 0), 6, 6, "abcdef"}, - {L_, mwcu::BlobPosition(0, 0), 7, 7, "abcdefg"}, - {L_, mwcu::BlobPosition(0, 0), 8, 8, "abcdefgh"}, - {L_, mwcu::BlobPosition(0, 0), 9, 9, "abcdefghi"}, - {L_, mwcu::BlobPosition(0, 0), 10, 9, "abcdefghi"}, - {L_, mwcu::BlobPosition(0, 1), 1, 1, "b"}, - {L_, mwcu::BlobPosition(0, 1), 5, 5, "bcdef"}, - {L_, mwcu::BlobPosition(2, 0), 3, 3, "fgh"}, - {L_, mwcu::BlobPosition(3, 0), 0, 0, ""}, - {L_, mwcu::BlobPosition(3, 0), 1, 1, "g"}, - {L_, mwcu::BlobPosition(3, 0), 2, 2, "gh"}, - {L_, mwcu::BlobPosition(3, 0), 3, 3, "ghi"}, - {L_, mwcu::BlobPosition(3, 0), 12, 3, "ghi"}, - {L_, mwcu::BlobPosition(4, 0), 0, 0, ""}, - {L_, mwcu::BlobPosition(4, 0), 1, -2, ""}, // invalid length - {L_, mwcu::BlobPosition(5, 1), 0, -1, ""}, // invalid start + {L_, bmqu::BlobPosition(0, 0), 0, 0, ""}, + {L_, bmqu::BlobPosition(0, 0), 1, 1, "a"}, + {L_, bmqu::BlobPosition(0, 0), 2, 2, "ab"}, + {L_, bmqu::BlobPosition(0, 0), 3, 3, "abc"}, + {L_, bmqu::BlobPosition(0, 0), 4, 4, "abcd"}, + {L_, bmqu::BlobPosition(0, 0), 5, 5, "abcde"}, + {L_, bmqu::BlobPosition(0, 0), 6, 6, "abcdef"}, + {L_, bmqu::BlobPosition(0, 0), 7, 7, "abcdefg"}, + {L_, bmqu::BlobPosition(0, 0), 8, 8, "abcdefgh"}, + {L_, bmqu::BlobPosition(0, 0), 9, 9, "abcdefghi"}, + {L_, bmqu::BlobPosition(0, 0), 10, 9, "abcdefghi"}, + {L_, bmqu::BlobPosition(0, 1), 1, 1, "b"}, + {L_, bmqu::BlobPosition(0, 1), 5, 5, "bcdef"}, + {L_, bmqu::BlobPosition(2, 0), 3, 3, "fgh"}, + {L_, bmqu::BlobPosition(3, 0), 0, 0, ""}, + {L_, bmqu::BlobPosition(3, 0), 1, 1, "g"}, + {L_, bmqu::BlobPosition(3, 0), 2, 2, "gh"}, + {L_, bmqu::BlobPosition(3, 0), 3, 3, "ghi"}, + {L_, bmqu::BlobPosition(3, 0), 12, 3, "ghi"}, + {L_, bmqu::BlobPosition(4, 0), 0, 0, ""}, + {L_, bmqu::BlobPosition(4, 0), 1, -2, ""}, // invalid length + {L_, bmqu::BlobPosition(5, 1), 0, -1, ""}, // invalid start }; const size_t k_NUM_DATA = sizeof(k_DATA) / sizeof(*k_DATA); @@ -1069,7 +1067,7 @@ static void test14_readUpToNBytes() char buffer[32]; - int rc = mwcu::BlobUtil::readUpToNBytes(buffer, + int rc = bmqu::BlobUtil::readUpToNBytes(buffer, blob, test.d_start, test.d_length); @@ -1100,44 +1098,44 @@ static void test15_readNBytes() // readNBytes // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Read N Bytes Test"); + bmqtst::TestHelper::printTestName("Read N Bytes Test"); - using namespace mwcu; + using namespace bmqu; bdlbb::Blob blob(s_allocator_p); const char* blobPattern = "ab|cde|f|ghiXX"; - mwctst::BlobTestUtil::fromString(&blob, blobPattern, s_allocator_p); + bmqtst::BlobTestUtil::fromString(&blob, blobPattern, s_allocator_p); struct Test { int d_line; - mwcu::BlobPosition d_start; + bmqu::BlobPosition d_start; int d_length; int d_expectedRc; const char* d_expected; } k_DATA[] = { - {L_, mwcu::BlobPosition(0, 0), 0, 0, ""}, - {L_, mwcu::BlobPosition(0, 0), 1, 0, "a"}, - {L_, mwcu::BlobPosition(0, 0), 2, 0, "ab"}, - {L_, mwcu::BlobPosition(0, 0), 3, 0, "abc"}, - {L_, mwcu::BlobPosition(0, 0), 4, 0, "abcd"}, - {L_, mwcu::BlobPosition(0, 0), 5, 0, "abcde"}, - {L_, mwcu::BlobPosition(0, 0), 6, 0, "abcdef"}, - {L_, mwcu::BlobPosition(0, 0), 7, 0, "abcdefg"}, - {L_, mwcu::BlobPosition(0, 0), 8, 0, "abcdefgh"}, - {L_, mwcu::BlobPosition(0, 0), 9, 0, "abcdefghi"}, - {L_, mwcu::BlobPosition(0, 0), 10, -2, "abcdefghi"}, // invalid end - {L_, mwcu::BlobPosition(0, 1), 1, 0, "b"}, - {L_, mwcu::BlobPosition(0, 1), 5, 0, "bcdef"}, - {L_, mwcu::BlobPosition(2, 0), 3, 0, "fgh"}, - {L_, mwcu::BlobPosition(3, 0), 0, 0, ""}, - {L_, mwcu::BlobPosition(3, 0), 1, 0, "g"}, - {L_, mwcu::BlobPosition(3, 0), 2, 0, "gh"}, - {L_, mwcu::BlobPosition(3, 0), 3, 0, "ghi"}, - {L_, mwcu::BlobPosition(3, 0), 12, -2, "ghi"}, - {L_, mwcu::BlobPosition(4, 0), 0, 0, ""}, - {L_, mwcu::BlobPosition(4, 0), 1, -21, ""}, + {L_, bmqu::BlobPosition(0, 0), 0, 0, ""}, + {L_, bmqu::BlobPosition(0, 0), 1, 0, "a"}, + {L_, bmqu::BlobPosition(0, 0), 2, 0, "ab"}, + {L_, bmqu::BlobPosition(0, 0), 3, 0, "abc"}, + {L_, bmqu::BlobPosition(0, 0), 4, 0, "abcd"}, + {L_, bmqu::BlobPosition(0, 0), 5, 0, "abcde"}, + {L_, bmqu::BlobPosition(0, 0), 6, 0, "abcdef"}, + {L_, bmqu::BlobPosition(0, 0), 7, 0, "abcdefg"}, + {L_, bmqu::BlobPosition(0, 0), 8, 0, "abcdefgh"}, + {L_, bmqu::BlobPosition(0, 0), 9, 0, "abcdefghi"}, + {L_, bmqu::BlobPosition(0, 0), 10, -2, "abcdefghi"}, // invalid end + {L_, bmqu::BlobPosition(0, 1), 1, 0, "b"}, + {L_, bmqu::BlobPosition(0, 1), 5, 0, "bcdef"}, + {L_, bmqu::BlobPosition(2, 0), 3, 0, "fgh"}, + {L_, bmqu::BlobPosition(3, 0), 0, 0, ""}, + {L_, bmqu::BlobPosition(3, 0), 1, 0, "g"}, + {L_, bmqu::BlobPosition(3, 0), 2, 0, "gh"}, + {L_, bmqu::BlobPosition(3, 0), 3, 0, "ghi"}, + {L_, bmqu::BlobPosition(3, 0), 12, -2, "ghi"}, + {L_, bmqu::BlobPosition(4, 0), 0, 0, ""}, + {L_, bmqu::BlobPosition(4, 0), 1, -21, ""}, // invalid length - {L_, mwcu::BlobPosition(5, 1), 0, -11, ""}, + {L_, bmqu::BlobPosition(5, 1), 0, -11, ""}, // invalid start }; @@ -1152,7 +1150,7 @@ static void test15_readNBytes() char buffer[32]; - int rc = mwcu::BlobUtil::readNBytes(buffer, + int rc = bmqu::BlobUtil::readNBytes(buffer, blob, test.d_start, test.d_length); @@ -1182,9 +1180,9 @@ static void test16_appendToBlob() // appendToBlob // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Append To Blob Test"); + bmqtst::TestHelper::printTestName("Append To Blob Test"); - using namespace mwcu; + using namespace bmqu; bdlbb::PooledBlobBufferFactory bufferFactory(4, s_allocator_p); @@ -1224,22 +1222,22 @@ static void test16_appendToBlob() << ") position"); bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, test.d_destPattern, s_allocator_p); bdlbb::Blob src(s_allocator_p); - mwctst::BlobTestUtil::fromString(&src, + bmqtst::BlobTestUtil::fromString(&src, test.d_srcPattern, s_allocator_p); const BlobPosition start(test.d_index, test.d_byte); const int rc = - mwcu::BlobUtil::appendToBlob(&blob, src, start, test.d_length); + bmqu::BlobUtil::appendToBlob(&blob, src, start, test.d_length); bsl::string resultBlob(s_allocator_p); - mwctst::BlobTestUtil::toString(&resultBlob, blob, true); + bmqtst::BlobTestUtil::toString(&resultBlob, blob, true); ASSERT_EQ_D("line " << test.d_line, rc, test.d_rc); ASSERT_EQ_D("line " << test.d_line, @@ -1280,21 +1278,21 @@ static void test16_appendToBlob() << ", " << test.d_byte << ") position"); bdlbb::Blob blob(&bufferFactory, s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, test.d_destPattern, s_allocator_p); bdlbb::Blob src(s_allocator_p); - mwctst::BlobTestUtil::fromString(&src, + bmqtst::BlobTestUtil::fromString(&src, test.d_srcPattern, s_allocator_p); const BlobPosition start(test.d_index, test.d_byte); - const int rc = mwcu::BlobUtil::appendToBlob(&blob, src, start); + const int rc = bmqu::BlobUtil::appendToBlob(&blob, src, start); bsl::string resultBlob(s_allocator_p); - mwctst::BlobTestUtil::toString(&resultBlob, blob, true); + bmqtst::BlobTestUtil::toString(&resultBlob, blob, true); ASSERT_EQ_D("line " << test.d_line, rc, test.d_rc); ASSERT_EQ_D("line " << test.d_line, @@ -1321,9 +1319,9 @@ static void test17_getAlignedSection() // getAlignedSection // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Get Aligned Section Test"); + bmqtst::TestHelper::printTestName("Get Aligned Section Test"); - using namespace mwcu; + using namespace bmqu; const int k_ALIGNMENT = 1; @@ -1366,14 +1364,14 @@ static void test17_getAlignedSection() << ") position with copy: " << test.d_copyFromBlob); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, test.d_blobPattern, s_allocator_p); const BlobPosition start(test.d_index, test.d_byte); char storageSafe[10]; - const char* resSafe = mwcu::BlobUtil::getAlignedSectionSafe( + const char* resSafe = bmqu::BlobUtil::getAlignedSectionSafe( storageSafe, blob, start, @@ -1389,7 +1387,7 @@ static void test17_getAlignedSection() // Also call "unsafe" version char storage[10]; - const char* res = mwcu::BlobUtil::getAlignedSection( + const char* res = bmqu::BlobUtil::getAlignedSection( storage, blob, start, @@ -1399,7 +1397,7 @@ static void test17_getAlignedSection() char expected[10]; const int rc = - mwcu::BlobUtil::readNBytes(expected, blob, start, test.d_length); + bmqu::BlobUtil::readNBytes(expected, blob, start, test.d_length); ASSERT_EQ_D("line " << test.d_line, rc, 0); if (test.d_res == Test::e_BUFFER) { @@ -1447,13 +1445,13 @@ static void test18_getAlignedObject() // getAlignedObject // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Get Aligned Object Test"); + bmqtst::TestHelper::printTestName("Get Aligned Object Test"); // It is assumed that TestObject alignment is 1. size_t alignment = bsls::AlignmentFromType::VALUE; ASSERT_EQ_D("TestObject alignment", size_t(1), alignment); - using namespace mwcu; + using namespace bmqu; struct Test { int d_line; @@ -1486,14 +1484,14 @@ static void test18_getAlignedObject() << ") position with copy: " << test.d_copyFromBlob); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, test.d_blobPattern, s_allocator_p); const BlobPosition start(test.d_index, test.d_byte); TestObject storageSafe = {'_', '_'}; - TestObject* resSafe = mwcu::BlobUtil::getAlignedObjectSafe( + TestObject* resSafe = bmqu::BlobUtil::getAlignedObjectSafe( &storageSafe, blob, start, @@ -1510,7 +1508,7 @@ static void test18_getAlignedObject() // Also call "unsafe" version TestObject storage = {'_', '_'}; - TestObject* res = mwcu::BlobUtil::getAlignedObject( + TestObject* res = bmqu::BlobUtil::getAlignedObject( &storage, blob, start, @@ -1536,26 +1534,26 @@ static void test19_blobStartHexDumper() // BlobStartHexDumper // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Blob Start Hex Dumper Test"); + bmqtst::TestHelper::printTestName("Blob Start Hex Dumper Test"); { PVV("Print zero length blob"); bdlbb::Blob blob(s_allocator_p); - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); - os << mwcu::BlobStartHexDumper(&blob); + os << bmqu::BlobStartHexDumper(&blob); ASSERT_EQ(os.str(), ""); } { PVV("Print the whole blob (size <= limit)"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, "abcd|efghXXXX", s_allocator_p); - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); - os << mwcu::BlobStartHexDumper(&blob, 8); + os << bmqu::BlobStartHexDumper(&blob, 8); ASSERT_EQ(os.str(), " 0: " "61626364 65666768 " @@ -1565,12 +1563,12 @@ static void test19_blobStartHexDumper() { PVV("Print the whole blob (size > limit)"); bdlbb::Blob blob(s_allocator_p); - mwctst::BlobTestUtil::fromString(&blob, + bmqtst::BlobTestUtil::fromString(&blob, "abcd|efghXXXX", s_allocator_p); - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); - os << mwcu::BlobStartHexDumper(&blob, 6); + os << bmqu::BlobStartHexDumper(&blob, 6); ASSERT_EQ(os.str(), " 0: " "61626364 6566 " @@ -1585,7 +1583,7 @@ static void test19_blobStartHexDumper() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -1614,5 +1612,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/mwcu_blobiterator.cpp b/src/groups/bmq/bmqu/bmqu_blobiterator.cpp similarity index 85% rename from src/groups/mwc/mwcu/mwcu_blobiterator.cpp rename to src/groups/bmq/bmqu/bmqu_blobiterator.cpp index 920640943..bcbb3e1b0 100644 --- a/src/groups/mwc/mwcu/mwcu_blobiterator.cpp +++ b/src/groups/bmq/bmqu/bmqu_blobiterator.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_blobiterator.cpp -*-C++-*- -#include +// bmqu_blobiterator.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ------------------ // class BlobIterator diff --git a/src/groups/mwc/mwcu/mwcu_blobiterator.h b/src/groups/bmq/bmqu/bmqu_blobiterator.h similarity index 92% rename from src/groups/mwc/mwcu/mwcu_blobiterator.h rename to src/groups/bmq/bmqu/bmqu_blobiterator.h index f24507bd7..8c7afe485 100644 --- a/src/groups/mwc/mwcu/mwcu_blobiterator.h +++ b/src/groups/bmq/bmqu/bmqu_blobiterator.h @@ -13,30 +13,28 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_blobiterator.h -*-C++-*- -#ifndef INCLUDED_MWCU_BLOBITERATOR -#define INCLUDED_MWCU_BLOBITERATOR +// bmqu_blobiterator.h -*-C++-*- +#ifndef INCLUDED_BMQU_BLOBITERATOR +#define INCLUDED_BMQU_BLOBITERATOR //@PURPOSE: Provide an iterator over a section of a blob // //@CLASSES: -// mwcu::BlobIterator: a blob iterator +// bmqu::BlobIterator: a blob iterator // //@DESCRIPTION: -// This component defines a mechanism, 'mwcu::BlobIterator', useful for +// This component defines a mechanism, 'bmqu::BlobIterator', useful for // iterating over a section of a blob, starting at a given position, and // proceeding either for a specified length, or for a specified number of // calls to 'advance'. -// MWC - -#include +#include // BDE #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ================== // class BlobIterator @@ -57,7 +55,7 @@ class BlobIterator { // DATA const bdlbb::Blob* d_blob_p; // the blob we're iterating over - mwcu::BlobPosition d_pos; // current position + bmqu::BlobPosition d_pos; // current position int d_remaining; // distance to travel, or number of // advancements remaining until we're @@ -83,7 +81,7 @@ class BlobIterator { /// `lengthOrSteps` calls to `advance` if `advancingLength` is false, /// until reaching its end. BlobIterator(const bdlbb::Blob* blob, - const mwcu::BlobPosition& start, + const bmqu::BlobPosition& start, int lengthOrSteps, bool advancingLength); @@ -106,7 +104,7 @@ class BlobIterator { /// `lengthOrSteps` calls to `advance` if `advancingLength` is false, /// until reaching its end. void reset(const bdlbb::Blob* blob, - const mwcu::BlobPosition& start, + const bmqu::BlobPosition& start, int lengthOrSteps, bool advancingLength); @@ -148,7 +146,7 @@ class BlobIterator { /// Return a non-modifiable reference to the current position of this /// iterator in the `blob`. Note that it is legal to call this when /// `atEnd` returns true. - const mwcu::BlobPosition& position() const; + const bmqu::BlobPosition& position() const; /// Return the distance or number of steps remaining before this /// iterator reaches its end. @@ -187,7 +185,7 @@ bsl::ostream& operator<<(bsl::ostream& stream, const BlobIterator& object); // CREATORS inline BlobIterator::BlobIterator(const bdlbb::Blob* blob, - const mwcu::BlobPosition& start, + const bmqu::BlobPosition& start, int lengthOrSteps, bool advancingLength) : d_blob_p(blob) @@ -237,7 +235,7 @@ inline BlobIterator BlobIterator::operator++(int) } inline void BlobIterator::reset(const bdlbb::Blob* blob, - const mwcu::BlobPosition& start, + const bmqu::BlobPosition& start, int lengthOrSteps, bool advancingLength) { @@ -249,7 +247,7 @@ inline void BlobIterator::reset(const bdlbb::Blob* blob, inline bool BlobIterator::advance(int length) { - int rc = mwcu::BlobUtil::findOffsetSafe(&d_pos, *d_blob_p, d_pos, length); + int rc = bmqu::BlobUtil::findOffsetSafe(&d_pos, *d_blob_p, d_pos, length); if (rc != 0) { d_remaining = -1; return false; // RETURN @@ -260,7 +258,7 @@ inline bool BlobIterator::advance(int length) inline bool BlobIterator::advanceRaw(int length) { - int rc = mwcu::BlobUtil::findOffset(&d_pos, *d_blob_p, d_pos, length); + int rc = bmqu::BlobUtil::findOffset(&d_pos, *d_blob_p, d_pos, length); if (rc != 0) { d_remaining = -1; return false; // RETURN @@ -296,7 +294,7 @@ inline bool BlobIterator::atEnd() const return d_remaining <= 0; } -inline const mwcu::BlobPosition& BlobIterator::position() const +inline const bmqu::BlobPosition& BlobIterator::position() const { return d_pos; } diff --git a/src/groups/mwc/mwcu/mwcu_blobiterator.t.cpp b/src/groups/bmq/bmqu/bmqu_blobiterator.t.cpp similarity index 86% rename from src/groups/mwc/mwcu/mwcu_blobiterator.t.cpp rename to src/groups/bmq/bmqu/bmqu_blobiterator.t.cpp index d674089c6..04b863c5a 100644 --- a/src/groups/mwc/mwcu/mwcu_blobiterator.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_blobiterator.t.cpp @@ -13,19 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_blobiterator.t.cpp -*-C++-*- -#include +// bmqu_blobiterator.t.cpp -*-C++-*- +#include -// MWC -#include -#include +#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -57,22 +56,22 @@ static void test1_breathingTest() // Testing: // BlobPosition() // BlobPosition(const bdlbb::Blob *, -// const mwcu::BlobPosition&, +// const bmqu::BlobPosition&, // int, // bool) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Breathing Test"); + bmqtst::TestHelper::printTestName("Breathing Test"); { PVV("Default ctor"); - mwcu::BlobIterator obj; + bmqu::BlobIterator obj; PVVV("iterator = " << obj); ASSERT_EQ(true, obj.atEnd()); ASSERT_EQ(0, obj.remaining()); - ASSERT_EQ(mwcu::BlobPosition(), obj.position()); + ASSERT_EQ(bmqu::BlobPosition(), obj.position()); ASSERT(!obj.blob()); } @@ -86,13 +85,13 @@ static void test1_breathingTest() bdlbb::Blob blob(&factory, s_allocator_p); blob.setLength(BLOB_LENGTH); - mwcu::BlobIterator obj(&blob, mwcu::BlobPosition(12, 0), 4, true); + bmqu::BlobIterator obj(&blob, bmqu::BlobPosition(12, 0), 4, true); PVVV("iterator = " << obj); ASSERT_EQ(false, obj.atEnd()); ASSERT_EQ(4, obj.remaining()); - ASSERT_EQ(mwcu::BlobPosition(12, 0), obj.position()); + ASSERT_EQ(bmqu::BlobPosition(12, 0), obj.position()); ASSERT_EQ(&blob, obj.blob()); } } @@ -119,7 +118,7 @@ static void test2_advance() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Advance Test"); + bmqtst::TestHelper::printTestName("Advance Test"); const int BUFFER_SIZE = 10; const int BLOB_LENGTH = 124; @@ -162,8 +161,8 @@ static void test2_advance() bdlbb::Blob blob(&factory, s_allocator_p); blob.setLength(BLOB_LENGTH); - mwcu::BlobPosition startPos(data.d_startBuffer, data.d_startByte); - mwcu::BlobIterator iter(&blob, + bmqu::BlobPosition startPos(data.d_startBuffer, data.d_startByte); + bmqu::BlobIterator iter(&blob, startPos, data.d_lengthOrSteps, data.d_advancingLength); @@ -177,7 +176,7 @@ static void test2_advance() iter.atEnd(), data.d_expectedAtEnd); - mwcu::BlobPosition expectedPos(data.d_expectedBuffer, + bmqu::BlobPosition expectedPos(data.d_expectedBuffer, data.d_expectedByte); ASSERT_EQ_D("line " << data.d_line, expectedPos, iter.position()); } @@ -216,7 +215,7 @@ static void test3_forwardIterator() // bsl::iterator_traits::reference // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("Forward Iterator Test"); + bmqtst::TestHelper::printTestName("Forward Iterator Test"); const int BUFFER_SIZE = 10; const int BLOB_LENGTH = 124; @@ -249,20 +248,20 @@ static void test3_forwardIterator() bdlbb::PooledBlobBufferFactory factory(BUFFER_SIZE, s_allocator_p); bdlbb::Blob blob(&factory, s_allocator_p); blob.setLength(BLOB_LENGTH); - mwcu::BlobIterator iter(&blob, - mwcu::BlobPosition(data.d_startBuffer, + bmqu::BlobIterator iter(&blob, + bmqu::BlobPosition(data.d_startBuffer, data.d_startByte), data.d_length, true); - mwcu::BlobIterator iter2(iter), iter3(iter), iter4, end; + bmqu::BlobIterator iter2(iter), iter3(iter), iter4, end; iter4 = iter; ASSERT_EQ_D("line " << data.d_line, iter, iter4); for (int i = 0; i < data.d_length; ++i) { ASSERT_NE_D("line " << data.d_line, iter, end); - const mwcu::BlobPosition p(iter.position()); + const bmqu::BlobPosition p(iter.position()); char c; - const int rc = mwcu::BlobUtil::readNBytes(&c, blob, p, 1); + const int rc = bmqu::BlobUtil::readNBytes(&c, blob, p, 1); ASSERT_EQ_D("line " << data.d_line, 0, rc); ASSERT_EQ_D("line " << data.d_line, c, *iter); ++iter; @@ -272,11 +271,11 @@ static void test3_forwardIterator() for (int i = 0; i < data.d_length; ++i, ++iter3) { ASSERT_EQ_D("line " << data.d_line, iter2, iter3); ASSERT_NE_D("line " << data.d_line, iter2, end); - const mwcu::BlobPosition p(iter2.position()); - const mwcu::BlobIterator it(iter2++); - bsl::iterator_traits::reference r(*it); + const bmqu::BlobPosition p(iter2.position()); + const bmqu::BlobIterator it(iter2++); + bsl::iterator_traits::reference r(*it); char c; - mwcu::BlobUtil::readNBytes(&c, blob, p, 1); + bmqu::BlobUtil::readNBytes(&c, blob, p, 1); ASSERT_EQ_D("line " << data.d_line, c, r); } ASSERT_EQ_D("line " << data.d_line, iter2, iter3); @@ -298,7 +297,7 @@ static void test3_forwardIterator() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -311,5 +310,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/mwcu_blobobjectproxy.cpp b/src/groups/bmq/bmqu/bmqu_blobobjectproxy.cpp similarity index 86% rename from src/groups/mwc/mwcu/mwcu_blobobjectproxy.cpp rename to src/groups/bmq/bmqu/bmqu_blobobjectproxy.cpp index efcb75bba..bce4d1c58 100644 --- a/src/groups/mwc/mwcu/mwcu_blobobjectproxy.cpp +++ b/src/groups/bmq/bmqu/bmqu_blobobjectproxy.cpp @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_blobobjectproxy.cpp -*-C++-*- -#include +// bmqu_blobobjectproxy.cpp -*-C++-*- +#include -#include +#include /// IMPLEMENTATION NOTES ///-------------------- // namespace BloombergLP { -namespace mwcu { +namespace bmqu { // --------------------- // class BlobObjectProxy diff --git a/src/groups/mwc/mwcu/mwcu_blobobjectproxy.h b/src/groups/bmq/bmqu/bmqu_blobobjectproxy.h similarity index 93% rename from src/groups/mwc/mwcu/mwcu_blobobjectproxy.h rename to src/groups/bmq/bmqu/bmqu_blobobjectproxy.h index 45031a535..932304a3f 100644 --- a/src/groups/mwc/mwcu/mwcu_blobobjectproxy.h +++ b/src/groups/bmq/bmqu/bmqu_blobobjectproxy.h @@ -13,19 +13,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_blobobjectproxy.h -*-C++-*- -#ifndef INCLUDED_MWCU_BLOBOBJECTPROXY -#define INCLUDED_MWCU_BLOBOBJECTPROXY +// bmqu_blobobjectproxy.h -*-C++-*- +#ifndef INCLUDED_BMQU_BLOBOBJECTPROXY +#define INCLUDED_BMQU_BLOBOBJECTPROXY //@PURPOSE: Provide a utility for reading/writing structures in 'bdlbb::Blob's // //@CLASSES: -// mwcu::BlobObjectProxy +// bmqu::BlobObjectProxy // //@SEE_ALSO: -// mwcu_blob +// bmqu_blob // -//@DESCRIPTION: This component defines a mechanism, 'mwcu::BlobObjectProxy', +//@DESCRIPTION: This component defines a mechanism, 'bmqu::BlobObjectProxy', // which allows the user to efficiently read and modify sections of a blob by // treating them as a POD struct. This is useful when processing binary // messages which are often created by apppending together various headers @@ -239,9 +239,7 @@ // assert(!bdlbb::BlobUtil::compare(blob, expectedBlob)); //.. -// MWC - -#include +#include // BDE #include @@ -251,7 +249,7 @@ #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ===================== // class BlobObjectProxy @@ -269,7 +267,7 @@ class BlobObjectProxy { const bdlbb::Blob* d_blob_p; // the blob our object resides in - mwcu::BlobPosition d_position; // the position of our object in + bmqu::BlobPosition d_position; // the position of our object in // 'd_blob_p' int d_length; // the length of the object in the @@ -289,7 +287,7 @@ class BlobObjectProxy { /// Reset this blob object. Refer to the documentation of the /// constructor for a description of the arguments. bool resetImp(const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, int length, bool read, bool write, @@ -329,11 +327,11 @@ class BlobObjectProxy { bool read = true, bool write = false); BlobObjectProxy(const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, bool read = true, bool write = false); BlobObjectProxy(const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, int length, bool read = true, bool write = false); @@ -361,11 +359,11 @@ class BlobObjectProxy { bool read = true, bool write = false); bool reset(const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, bool read = true, bool write = false); bool reset(const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, int length, bool read = true, bool write = false); @@ -385,11 +383,11 @@ class BlobObjectProxy { bool read = true, bool write = false); bool resetRaw(const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, bool read = true, bool write = false); bool resetRaw(const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, int length, bool read = true, bool write = false); @@ -420,7 +418,7 @@ class BlobObjectProxy { const bdlbb::Blob* blob() const; /// Return the position of our object in the blob. - const mwcu::BlobPosition& position() const; + const bmqu::BlobPosition& position() const; /// Load into the specified `pos` the position in the `blob()` that is /// right after the end of the object being proxied. This is @@ -428,7 +426,7 @@ class BlobObjectProxy { /// object immediately following the object being proxied by this /// `BlobObjectProxy`. The behavior is undefiend unless `isSet()` /// return `true`. - void loadEndPosition(mwcu::BlobPosition* pos) const; + void loadEndPosition(bmqu::BlobPosition* pos) const; /// Return the length of the object in the blob. int length() const; @@ -473,7 +471,7 @@ template inline void BlobObjectProxy::writeOutIfNecessary() { if (d_writeMode && (d_object_p == &d_buffer.object())) { - mwcu::BlobUtil::writeBytes(d_blob_p, + bmqu::BlobUtil::writeBytes(d_blob_p, d_position, reinterpret_cast(&d_buffer.object()), d_length); @@ -482,7 +480,7 @@ inline void BlobObjectProxy::writeOutIfNecessary() template inline bool BlobObjectProxy::resetImp(const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, int length, bool read, bool write, @@ -497,11 +495,11 @@ inline bool BlobObjectProxy::resetImp(const bdlbb::Blob* blob, if (BSLS_PERFORMANCEHINT_PREDICT_LIKELY(length >= static_cast(sizeof(TYPE)))) { d_object_p = (raw) - ? mwcu::BlobUtil::getAlignedObject(&d_buffer.object(), + ? bmqu::BlobUtil::getAlignedObject(&d_buffer.object(), *blob, position, read) - : mwcu::BlobUtil::getAlignedObjectSafe( + : bmqu::BlobUtil::getAlignedObjectSafe( &d_buffer.object(), *blob, position, @@ -510,11 +508,11 @@ inline bool BlobObjectProxy::resetImp(const bdlbb::Blob* blob, } else if (length < 0) { d_object_p = (raw) - ? mwcu::BlobUtil::getAlignedObject(&d_buffer.object(), + ? bmqu::BlobUtil::getAlignedObject(&d_buffer.object(), *blob, position, read) - : mwcu::BlobUtil::getAlignedObjectSafe( + : bmqu::BlobUtil::getAlignedObjectSafe( &d_buffer.object(), *blob, position, @@ -523,7 +521,7 @@ inline bool BlobObjectProxy::resetImp(const bdlbb::Blob* blob, d_length = sizeof(TYPE); } else { - d_length = mwcu::BlobUtil::readUpToNBytes(d_buffer.buffer(), + d_length = bmqu::BlobUtil::readUpToNBytes(d_buffer.buffer(), *blob, position, sizeof(TYPE)); @@ -533,7 +531,7 @@ inline bool BlobObjectProxy::resetImp(const bdlbb::Blob* blob, } } else { - const int ret = mwcu::BlobUtil::readNBytes(d_buffer.buffer(), + const int ret = bmqu::BlobUtil::readNBytes(d_buffer.buffer(), *blob, position, length); @@ -565,7 +563,7 @@ inline BlobObjectProxy::BlobObjectProxy(const bdlbb::Blob* blob, bool read, bool write) { - resetImp(blob, mwcu::BlobPosition(), sizeof(TYPE), read, write, false); + resetImp(blob, bmqu::BlobPosition(), sizeof(TYPE), read, write, false); } template @@ -574,13 +572,13 @@ inline BlobObjectProxy::BlobObjectProxy(const bdlbb::Blob* blob, bool read, bool write) { - resetImp(blob, mwcu::BlobPosition(), length, read, write, false); + resetImp(blob, bmqu::BlobPosition(), length, read, write, false); } template inline BlobObjectProxy::BlobObjectProxy( const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, bool read, bool write) { @@ -590,7 +588,7 @@ inline BlobObjectProxy::BlobObjectProxy( template inline BlobObjectProxy::BlobObjectProxy( const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, int length, bool read, bool write) @@ -623,7 +621,7 @@ BlobObjectProxy::reset(const bdlbb::Blob* blob, bool read, bool write) { writeOutIfNecessary(); return resetImp(blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), sizeof(TYPE), read, write, @@ -637,12 +635,12 @@ inline bool BlobObjectProxy::reset(const bdlbb::Blob* blob, bool write) { writeOutIfNecessary(); - return resetImp(blob, mwcu::BlobPosition(), length, read, write, false); + return resetImp(blob, bmqu::BlobPosition(), length, read, write, false); } template inline bool BlobObjectProxy::reset(const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, bool read, bool write) { @@ -652,7 +650,7 @@ inline bool BlobObjectProxy::reset(const bdlbb::Blob* blob, template inline bool BlobObjectProxy::reset(const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, int length, bool read, bool write) @@ -667,7 +665,7 @@ BlobObjectProxy::resetRaw(const bdlbb::Blob* blob, bool read, bool write) { writeOutIfNecessary(); return resetImp(blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), sizeof(TYPE), read, write, @@ -681,12 +679,12 @@ inline bool BlobObjectProxy::resetRaw(const bdlbb::Blob* blob, bool write) { writeOutIfNecessary(); - return resetImp(blob, mwcu::BlobPosition(), length, read, write, true); + return resetImp(blob, bmqu::BlobPosition(), length, read, write, true); } template inline bool BlobObjectProxy::resetRaw(const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, bool read, bool write) { @@ -696,7 +694,7 @@ inline bool BlobObjectProxy::resetRaw(const bdlbb::Blob* blob, template inline bool BlobObjectProxy::resetRaw(const bdlbb::Blob* blob, - const mwcu::BlobPosition& position, + const bmqu::BlobPosition& position, int length, bool read, bool write) @@ -798,16 +796,16 @@ inline const bdlbb::Blob* BlobObjectProxy::blob() const } template -inline const mwcu::BlobPosition& BlobObjectProxy::position() const +inline const bmqu::BlobPosition& BlobObjectProxy::position() const { return d_position; } template inline void -BlobObjectProxy::loadEndPosition(mwcu::BlobPosition* pos) const +BlobObjectProxy::loadEndPosition(bmqu::BlobPosition* pos) const { - int ret = mwcu::BlobUtil::findOffset(pos, *d_blob_p, d_position, d_length); + int ret = bmqu::BlobUtil::findOffset(pos, *d_blob_p, d_position, d_length); (void)ret; // This should never fail since 'isSet()' will only be true if there are // 'd_length' bytes in the blob. diff --git a/src/groups/mwc/mwcu/mwcu_blobobjectproxy.t.cpp b/src/groups/bmq/bmqu/bmqu_blobobjectproxy.t.cpp similarity index 91% rename from src/groups/mwc/mwcu/mwcu_blobobjectproxy.t.cpp rename to src/groups/bmq/bmqu/bmqu_blobobjectproxy.t.cpp index 74cb9aac4..28b731c88 100644 --- a/src/groups/mwc/mwcu/mwcu_blobobjectproxy.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_blobobjectproxy.t.cpp @@ -13,12 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_blobobjectproxy.t.cpp -*-C++-*- -#include +// bmqu_blobobjectproxy.t.cpp -*-C++-*- +#include -// MWC -#include -#include +#include +#include // BDE #include @@ -27,7 +26,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -103,7 +102,7 @@ static void test1_breathingTest() // Testing: // everything { - mwctst::TestHelper::printTestName("Breathing Test"); + bmqtst::TestHelper::printTestName("Breathing Test"); bdlbb::PooledBlobBufferFactory smallFactory(2, s_allocator_p); bdlbb::PooledBlobBufferFactory bigFactory(128, s_allocator_p); @@ -118,7 +117,7 @@ static void test1_breathingTest() hdr.reset(sizeof(hdr), 1, 2); bdlbb::BlobUtil::append(&blob, ptr, sizeof(hdr)); - mwcu::BlobObjectProxy pxy(&blob); + bmqu::BlobObjectProxy pxy(&blob); ASSERT(pxy.isInBlob()); ASSERT_EQ(pxy->d_member1, 1u); ASSERT_EQ(pxy->d_member2, 2u); @@ -133,7 +132,7 @@ static void test1_breathingTest() hdr.reset(9, 1, 2); bdlbb::BlobUtil::append(&blob, ptr, sizeof(hdr)); - mwcu::BlobObjectProxy pxy(&blob, 9); + bmqu::BlobObjectProxy pxy(&blob, 9); ASSERT(!pxy.isInBlob()); ASSERT_EQ(pxy->d_member1, 1u); ASSERT_EQ(pxy->d_member2, 0u); @@ -148,7 +147,7 @@ static void test1_breathingTest() hdr.reset(sizeof(hdr), 1, 2); bdlbb::BlobUtil::append(&blob, ptr, sizeof(hdr)); - mwcu::BlobObjectProxy pxy(&blob, -1); + bmqu::BlobObjectProxy pxy(&blob, -1); ASSERT(pxy.isInBlob()); pxy.resize(128); @@ -170,7 +169,7 @@ static void test1_breathingTest() bdlbb::BlobUtil::append(&blob, ptr, sizeof(hdr)); // Modify without 'write' mode - mwcu::BlobObjectProxy pxy(&blob, 8); + bmqu::BlobObjectProxy pxy(&blob, 8); ASSERT(!pxy.isInBlob()); ASSERT(pxy.hasMember(&TestHeader::d_member1)); ASSERT(!pxy.hasMember(&TestHeader::d_member2)); @@ -208,9 +207,9 @@ static void test1_breathingTest() bdlbb::BlobUtil::append(&blob, "a", 1); ASSERT_EQ(1, blob.length()); - mwcu::BlobObjectProxy pxy; + bmqu::BlobObjectProxy pxy; pxy.reset(&blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), -1, // read as many bytes as possible true, // read false); // write @@ -226,9 +225,9 @@ static void test1_breathingTest() bdlbb::Blob blob(&bigFactory, s_allocator_p); bdlbb::BlobUtil::append(&blob, ptr, sizeof(hdr)); - mwcu::BlobObjectProxy pxy; + bmqu::BlobObjectProxy pxy; pxy.reset(&blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), -4, // read at least 4 bytes true, // read false); // write @@ -242,7 +241,7 @@ static void test1_breathingTest() // Reset proxy to read more bytes than present in the blob pxy.reset(&blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), -8, // read at least 8 bytes true, // read false); // write @@ -260,23 +259,23 @@ static void test1_breathingTest() hdr.reset(4, 5, 6); bdlbb::BlobUtil::append(&blob, ptr, sizeof(hdr)); - mwcu::BlobObjectProxy pxy; - mwcu::BlobPosition pos; + bmqu::BlobObjectProxy pxy; + bmqu::BlobPosition pos; // Looking at whole object pxy.reset(&blob); pxy.loadEndPosition(&pos); - ASSERT_EQ(pos, mwcu::BlobPosition(0, sizeof(TestHeader))); + ASSERT_EQ(pos, bmqu::BlobPosition(0, sizeof(TestHeader))); // Looking at part of an object pxy.reset(&blob, 10); pxy.loadEndPosition(&pos); - ASSERT_EQ(pos, mwcu::BlobPosition(0, 10)); + ASSERT_EQ(pos, bmqu::BlobPosition(0, 10)); // Looking at an object at the end of the blob - pxy.reset(&blob, mwcu::BlobPosition(0, sizeof(TestHeader))); + pxy.reset(&blob, bmqu::BlobPosition(0, sizeof(TestHeader))); pxy.loadEndPosition(&pos); - ASSERT_EQ(pos, mwcu::BlobPosition(1, 0)); + ASSERT_EQ(pos, bmqu::BlobPosition(1, 0)); } } @@ -294,7 +293,7 @@ static void test2_usageExample1() // Usage Example 1 // { - mwctst::TestHelper::printTestName("Usage Example 1 Test"); + bmqtst::TestHelper::printTestName("Usage Example 1 Test"); /// Example 1: Reading objects from blobs ///- - - - - - - - - - - - - - - - - - - @@ -319,7 +318,7 @@ static void test2_usageExample1() // Next, we can construct a 'BlobObjectProxy' for a 'TestHeader' object // contained at the beginning of 'blob' and access its fields. //.. - mwcu::BlobObjectProxy pxy(&blob); + bmqu::BlobObjectProxy pxy(&blob); ASSERT(pxy.isSet()); ASSERT(pxy->d_length == sizeof(hdr)); ASSERT(pxy->d_member1 == 1); @@ -394,7 +393,7 @@ static void test3_usageExample2() // Usage Example 2 // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("Usage Example 2 Test"); + bmqtst::TestHelper::printTestName("Usage Example 2 Test"); /// Example 2: Modify blob objects /// - - - - - - - - - - - - - - - @@ -412,7 +411,7 @@ static void test3_usageExample2() // With the blob in this uninitialized state, first, we must create a // 'BlobObjectProxy' for writing. //.. - mwcu::BlobObjectProxy pxy( + bmqu::BlobObjectProxy pxy( &blob, false, // don't read current contents true); // write out changes upon @@ -448,7 +447,7 @@ static void test3_usageExample2() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -461,5 +460,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/mwcu_memoutstream.cpp b/src/groups/bmq/bmqu/bmqu_memoutstream.cpp similarity index 87% rename from src/groups/mwc/mwcu/mwcu_memoutstream.cpp rename to src/groups/bmq/bmqu/bmqu_memoutstream.cpp index 21cd44dc6..c1f0b543e 100644 --- a/src/groups/mwc/mwcu/mwcu_memoutstream.cpp +++ b/src/groups/bmq/bmqu/bmqu_memoutstream.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_memoutstream.cpp -*-C++-*- -#include +// bmqu_memoutstream.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcu { +namespace bmqu { MemOutStream::~MemOutStream() { diff --git a/src/groups/mwc/mwcu/mwcu_memoutstream.h b/src/groups/bmq/bmqu/bmqu_memoutstream.h similarity index 97% rename from src/groups/mwc/mwcu/mwcu_memoutstream.h rename to src/groups/bmq/bmqu/bmqu_memoutstream.h index 1fc2a9c16..7266a06ca 100644 --- a/src/groups/mwc/mwcu/mwcu_memoutstream.h +++ b/src/groups/bmq/bmqu/bmqu_memoutstream.h @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_memoutstream.h -*-C++-*- -#ifndef INCLUDED_MWCU_MEMOUTSTREAM -#define INCLUDED_MWCU_MEMOUTSTREAM +// bmqu_memoutstream.h -*-C++-*- +#ifndef INCLUDED_BMQU_MEMOUTSTREAM +#define INCLUDED_BMQU_MEMOUTSTREAM //@PURPOSE: provides an 'ostream' exposing a StringRef to its internal buffer. // @@ -52,7 +52,7 @@ namespace BloombergLP { -namespace mwcu { +namespace bmqu { // =============================== // class MemOutStream_BufferHolder diff --git a/src/groups/mwc/mwcu/mwcu_memoutstream.t.cpp b/src/groups/bmq/bmqu/bmqu_memoutstream.t.cpp similarity index 90% rename from src/groups/mwc/mwcu/mwcu_memoutstream.t.cpp rename to src/groups/bmq/bmqu/bmqu_memoutstream.t.cpp index 106740664..bdd8e5933 100644 --- a/src/groups/mwc/mwcu/mwcu_memoutstream.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_memoutstream.t.cpp @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_memoutstream.t.cpp -*-C++-*- -#include +// bmqu_memoutstream.t.cpp -*-C++-*- +#include // BDE #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -31,7 +31,7 @@ using namespace bsl; // ---------------------------------------------------------------------------- static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // In this test case we do some very strict/precise assertions on // allocations/allocator use. This is to ensure that the stream @@ -46,7 +46,7 @@ static void test1_breathingTest() // `bdesb_MemOutStreamBuf` as it is. bslma::TestAllocator alloc(s_allocator_p); - mwcu::MemOutStream obj(&alloc); + bmqu::MemOutStream obj(&alloc); { PV("Test printing"); @@ -104,9 +104,9 @@ static void test2_usageExample() // This is the test case from the usage example. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("USAGE EXAMPLE"); + bmqtst::TestHelper::printTestName("USAGE EXAMPLE"); - mwcu::MemOutStream obj(30, s_allocator_p); + bmqu::MemOutStream obj(30, s_allocator_p); obj << "hello world"; ASSERT_EQ(obj.str(), "hello world"); } @@ -117,7 +117,7 @@ static void test2_usageExample() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -129,5 +129,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/mwcu_objectplaceholder.cpp b/src/groups/bmq/bmqu/bmqu_objectplaceholder.cpp similarity index 83% rename from src/groups/mwc/mwcu/mwcu_objectplaceholder.cpp rename to src/groups/bmq/bmqu/bmqu_objectplaceholder.cpp index 996a7335f..ab987a4a4 100644 --- a/src/groups/mwc/mwcu/mwcu_objectplaceholder.cpp +++ b/src/groups/bmq/bmqu/bmqu_objectplaceholder.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_objectplaceholder.cpp -*-C++-*- -#include +// bmqu_objectplaceholder.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcu { +namespace bmqu { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcu/mwcu_objectplaceholder.h b/src/groups/bmq/bmqu/bmqu_objectplaceholder.h similarity index 96% rename from src/groups/mwc/mwcu/mwcu_objectplaceholder.h rename to src/groups/bmq/bmqu/bmqu_objectplaceholder.h index b2af9e530..6d4948f1b 100644 --- a/src/groups/mwc/mwcu/mwcu_objectplaceholder.h +++ b/src/groups/bmq/bmqu/bmqu_objectplaceholder.h @@ -13,26 +13,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_objectplaceholder.h -*-C++-*- -#ifndef INCLUDED_MWCU_OBJECTPLACEHOLDER -#define INCLUDED_MWCU_OBJECTPLACEHOLDER +// bmqu_objectplaceholder.h -*-C++-*- +#ifndef INCLUDED_BMQU_OBJECTPLACEHOLDER +#define INCLUDED_BMQU_OBJECTPLACEHOLDER //@PURPOSE: Provides a placeholder for any object. // //@CLASSES: -// mwcu::ObjectPlaceHolder: a placeholder for any object. +// bmqu::ObjectPlaceHolder: a placeholder for any object. // //@DESCRIPTION: -// This component provides a mechanism, 'mwcu::ObjectPlaceHolder', that may +// This component provides a mechanism, 'bmqu::ObjectPlaceHolder', that may // hold an object of any type, either in the internal (on-stack), or in an // an external (dynamically allocated) buffer, depending on whether or not the // object fits in the fixed-size internal buffer. // // The main purpose of this component is to facilitate the implementation of // type-erasure with small buffer optimization. For an example of how this -// component is intended to be used, see 'mwcex_job'. - -// MWC +// component is intended to be used, see 'bmqex_job'. // BDE #include // bsl::forward @@ -47,15 +45,15 @@ #if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES // Include version that can be compiled with C++03 -// Generated on Wed Jun 29 04:09:58 2022 -// Command line: sim_cpp11_features.pl mwcu_objectplaceholder.h -#define COMPILING_MWCU_OBJECTPLACEHOLDER_H -#include -#undef COMPILING_MWCU_OBJECTPLACEHOLDER_H +// Generated on Tue Oct 15 17:38:31 2024 +// Command line: sim_cpp11_features.pl bmqu_objectplaceholder.h +#define COMPILING_BMQU_OBJECTPLACEHOLDER_H +#include +#undef COMPILING_BMQU_OBJECTPLACEHOLDER_H #else namespace BloombergLP { -namespace mwcu { +namespace bmqu { // =================================== // class ObjectPlaceHolder_ObjectGuard diff --git a/src/groups/mwc/mwcu/mwcu_objectplaceholder.t.cpp b/src/groups/bmq/bmqu/bmqu_objectplaceholder.t.cpp similarity index 94% rename from src/groups/mwc/mwcu/mwcu_objectplaceholder.t.cpp rename to src/groups/bmq/bmqu/bmqu_objectplaceholder.t.cpp index 313235cb0..1908e77bf 100644 --- a/src/groups/mwc/mwcu/mwcu_objectplaceholder.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_objectplaceholder.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_objectplaceholder.t.cpp -*-C++-*- -#include +// bmqu_objectplaceholder.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -100,8 +100,8 @@ static void test1_createDeleteObject() // 2. Ensure that 'createObject' provides strong exception guarantee. // // Testing: -// mwcu::ObjectPlaceHolder::createObject -// mwcu::ObjectPlaceHolder::deleteObject +// bmqu::ObjectPlaceHolder::createObject +// bmqu::ObjectPlaceHolder::deleteObject // ------------------------------------------------------------------------ { static const int k_BUFFER_SIZE = 64; @@ -116,7 +116,7 @@ static void test1_createDeleteObject() bslma::TestAllocator storageAllocator; // create placeholder - mwcu::ObjectPlaceHolder placeHolder; + bmqu::ObjectPlaceHolder placeHolder; // placeholder is empty ASSERT_EQ(placeHolder.objectAddress(), k_ZERO_P); @@ -182,7 +182,7 @@ static void test1_createDeleteObject() bslma::TestAllocator storageAllocator; // create placeholder - mwcu::ObjectPlaceHolder placeHolder; + bmqu::ObjectPlaceHolder placeHolder; bool objectInitialized = false; bool exceptionThrown = false; @@ -232,7 +232,7 @@ static void test1_createDeleteObject() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_createDeleteObject(); break; @@ -244,5 +244,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqu/bmqu_objectplaceholder_cpp03.cpp b/src/groups/bmq/bmqu/bmqu_objectplaceholder_cpp03.cpp new file mode 100644 index 000000000..a420ca01a --- /dev/null +++ b/src/groups/bmq/bmqu/bmqu_objectplaceholder_cpp03.cpp @@ -0,0 +1,34 @@ +// Copyright 2021-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// bmqu_objectplaceholder_cpp03.cpp -*-C++-*- + +// Automatically generated file. **DO NOT EDIT** + +// Generated on Thu Oct 17 16:05:19 2024 +// Command line: sim_cpp11_features.pl bmqu_objectplaceholder.cpp + +#define INCLUDED_BMQU_OBJECTPLACEHOLDER_CPP03 // Disable inclusion +#include // Pro-forma #include + +// Empty file except when compiling bmqu_objectplaceholder.cpp +#ifdef COMPILING_BMQU_OBJECTPLACEHOLDER_CPP + +// No C++03 Expansion + +#endif // defined(COMPILING_BMQU_OBJECTPLACEHOLDER_CPP) + +// SCRIPT-SHA: 60926cad35f1091c31a7d8cc9d33acc38edd25e4891f3e1d41fe7c40fd6e02f5 +// SOURCE-SHA: 4bb706357ef3e32b44b49a314a75e3d2087e62772510513d6eb5a4da1a61d1e9 diff --git a/src/groups/mwc/mwcu/mwcu_objectplaceholder_cpp03.h b/src/groups/bmq/bmqu/bmqu_objectplaceholder_cpp03.h similarity index 78% rename from src/groups/mwc/mwcu/mwcu_objectplaceholder_cpp03.h rename to src/groups/bmq/bmqu/bmqu_objectplaceholder_cpp03.h index e7b2d6da6..fa5668931 100644 --- a/src/groups/mwc/mwcu/mwcu_objectplaceholder_cpp03.h +++ b/src/groups/bmq/bmqu/bmqu_objectplaceholder_cpp03.h @@ -1,4 +1,4 @@ -// Copyright 2022-2023 Bloomberg Finance L.P. +// Copyright 2021-2023 Bloomberg Finance L.P. // SPDX-License-Identifier: Apache-2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_objectplaceholder_cpp03.h -*-C++-*- +// bmqu_objectplaceholder_cpp03.h -*-C++-*- // Automatically generated file. **DO NOT EDIT** -#ifndef INCLUDED_MWCU_OBJECTPLACEHOLDER_CPP03 -#define INCLUDED_MWCU_OBJECTPLACEHOLDER_CPP03 +#ifndef INCLUDED_BMQU_OBJECTPLACEHOLDER_CPP03 +#define INCLUDED_BMQU_OBJECTPLACEHOLDER_CPP03 -//@PURPOSE: Provide C++03 implementation for mwcu_objectplaceholder.h +//@PURPOSE: Provide C++03 implementation for bmqu_objectplaceholder.h // -//@CLASSES: See mwcu_objectplaceholder.h for list of classes +//@CLASSES: See bmqu_objectplaceholder.h for list of classes // -//@SEE_ALSO: mwcu_objectplaceholder +//@SEE_ALSO: bmqu_objectplaceholder // //@DESCRIPTION: This component is the C++03 translation of a C++11 component, // generated by the 'sim_cpp11_features.pl' program. If the original header @@ -36,52 +36,52 @@ // regions of C++11 code, then this header contains no code and is not // '#include'd in the original header. // -// Generated on Wed Jun 29 04:11:12 2022 -// Command line: sim_cpp11_features.pl mwcu_objectplaceholder.h +// Generated on Thu Oct 17 16:05:19 2024 +// Command line: sim_cpp11_features.pl bmqu_objectplaceholder.h -#ifdef COMPILING_MWCU_OBJECTPLACEHOLDER_H +#ifdef COMPILING_BMQU_OBJECTPLACEHOLDER_H namespace BloombergLP { -namespace mwcu { +namespace bmqu { // =================================== // class ObjectPlaceHolder_ObjectGuard // =================================== +/// A guard to deallocate an object in case of exception. template class ObjectPlaceHolder_ObjectGuard { - // A guard to deallocate an object in case of exception. - private: // PRIVATE DATA PLACEHOLDER* d_placeholder_p; public: // CREATORS + + /// Create a `ObjectPlaceHolder_ObjectGuard` object initialized with + /// the specified `placeholder`. explicit ObjectPlaceHolder_ObjectGuard(PLACEHOLDER* placeholder) BSLS_KEYWORD_NOEXCEPT; - // Create a 'ObjectPlaceHolder_ObjectGuard' object initialized with - // the specified 'placeholder'. + /// Destroy this object. Deallocate the object unless the guard was + /// released. ~ObjectPlaceHolder_ObjectGuard(); - // Destroy this object. Deallocate the object unless the guard was - // released. public: // MANIPULATORS + + /// Release this guard. void release() BSLS_KEYWORD_NOEXCEPT; - // Release this guard. }; // ======================= // class ObjectPlaceHolder // ======================= +/// A placeholder for any object with a local buffer of (at least) the +/// specified `SIZE`. template class ObjectPlaceHolder { - // A placeholder for any object with a local buffer of (at least) the - // specified 'SIZE'. - private: // PRIVATE TYPES enum State { @@ -94,67 +94,71 @@ class ObjectPlaceHolder { e_FULL_EXT = 2 // The placeholder contains an external object. }; + /// An aligned buffer large enough to hold two pointers - the allocator + /// pointer and the object pointer. typedef bsls::AlignedBuffer<( SIZE > (sizeof(void*) * 2) ? SIZE : (sizeof(void*) * 2))> Buffer; - // An aligned buffer large enough to hold two pointers - the allocator - // pointer and the object pointer. + /// A guard to deallocate an object in case of exception. typedef ObjectPlaceHolder_ObjectGuard > ObjectGuard; - // A guard to deallocate an object in case of exception. // FRIENDS friend class ObjectPlaceHolder_ObjectGuard >; private: // PRIVATE CLASS DATA - static const size_t k_BUFFER_SIZE = sizeof(Buffer); + // The effective buffer size. + static const size_t k_BUFFER_SIZE = sizeof(Buffer); private: // PRIVATE DATA - Buffer d_buffer; + // Unless the placeholder is empty, contains either a pair of pointers // - the allocator pointer and the object pointer, or the object itself. + Buffer d_buffer; - char d_state; - // Placeholder state. Use 'char' instead of 'State' to reduce memory + // Placeholder state. Use `char` instead of `State` to reduce memory // footprint. + char d_state; private: // PRIVATE MANIPULATORS + + /// Store the specified `allocator` used to allocate the contained + /// external object into the local buffer. void storeAllocator(bslma::Allocator* allocator) BSLS_KEYWORD_NOEXCEPT; - // Store the specified 'allocator' used to allocate the contained - // external object into the local buffer. + /// Save the specified `address` of the contained external object into + /// the local buffer. void storeObjectAddress(void* address) BSLS_KEYWORD_NOEXCEPT; - // Save the specified 'address' of the contained external object into - // the local buffer. + /// Return the address of a contiguous block of memory large enough to + /// accommodate an object of the specified `TYPE`. If the allocation + /// request exceeds the local buffer capacity, use memory obtained + /// from the specified `allocator`. On exception, this function has no + /// effect. The behavior is undefined if memory was already allocated, + /// and has not already been released. template TYPE* allocateObject(bslma::Allocator* allocator); - // Return the address of a contiguous block of memory large enough to - // accommodate an object of the specified 'TYPE'. If the allocation - // request exceeds the local buffer capacity, use memory obtained - // from the specified 'allocator'. On exception, this function has no - // effect. The behavior is undefined if memory was already allocated, - // and has not already been released. + /// Release memory allocated during the last successful call to + /// `allocateObject`. The behavior is undefined if no memory was + /// allocated, or if the memory has already been released. void deallocateObject() BSLS_KEYWORD_NOEXCEPT; - // Release memory allocated during the last successful call to - // 'allocateObject'. The behavior is undefined if no memory was - // allocated, or if the memory has already been released. private: // PRIVATE ACCESSORS + + /// Load the allocator used to allocate the contained object from the + /// local buffer, and return it. bslma::Allocator* loadAllocator() const BSLS_KEYWORD_NOEXCEPT; - // Load the allocator used to allocate the contained object from the - // local buffer, and return it. + /// Load the address of the contained object from the local buffer, and + /// return it. void* loadObjectAddress() const BSLS_KEYWORD_NOEXCEPT; - // Load the address of the contained object from the local buffer, and - // return it. private: // NOT IMPLEMENTED @@ -164,52 +168,54 @@ class ObjectPlaceHolder { public: // CREATORS + + /// Create a `ObjectPlaceHolder` object containing nothing. ObjectPlaceHolder() BSLS_KEYWORD_NOEXCEPT; - // Create a 'ObjectPlaceHolder' object containing nothing. + /// Destroy this object. The behavior is undefined unless the + /// placeholder is empty. ~ObjectPlaceHolder(); - // Destroy this object. The behavior is undefined unless the - // placeholder is empty. public: // MANIPULATORS #if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES // {{{ BEGIN GENERATED CODE -// Command line: sim_cpp11_features.pl mwcu_objectplaceholder.h -#ifndef MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT -#define MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT 9 +// Command line: sim_cpp11_features.pl bmqu_objectplaceholder.h +#ifndef BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT +#define BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT 9 #endif -#ifndef MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A -#define MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A \ - MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT +#ifndef BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A +#define BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A \ + BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT #endif -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 0 + +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 0 template void createObject(bslma::Allocator* allocator); -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 0 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 0 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 1 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 1 template void createObject(bslma::Allocator* allocator, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1); -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 1 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 1 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 2 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 2 template void createObject(bslma::Allocator* allocator, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_2) args_2); -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 2 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 2 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 3 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 3 template void createObject(bslma::Allocator* allocator, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_2) args_2, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_3) args_3); -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 3 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 3 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 4 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 4 template = 4 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 4 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 5 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 5 template = 5 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 5 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 6 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 6 template = 6 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 6 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 7 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 7 template = 7 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 7 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 8 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 8 template = 8 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 8 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 9 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 9 template = 9 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_A >= 9 #else // The generated code below is a workaround for the absence of perfect // forwarding in some compilers. + template void createObject(bslma::Allocator* allocator, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... args); // }}} END GENERATED CODE #endif + /// Destroy the object of the specified `TYPE` contained in this + /// placeholder, leaving the placeholder empty. The behavior is + /// undefined unless the placeholder contains an object of the specified + /// `TYPE`. + /// + /// Note that `TYPE` does not necessarily has to be the same as the + /// original type specified on object creation, as long as `TYPE` is + /// polymorphic and is the base class of the original type. template void deleteObject() BSLS_KEYWORD_NOEXCEPT; - // Destroy the object of the specified 'TYPE' contained in this - // placeholder, leaving the placeholder empty. The behavior is - // undefined unless the placeholder contains an object of the specified - // 'TYPE'. - // - // Note that 'TYPE' does not necessarily has to be the same as the - // original type specified on object creation, as long as 'TYPE' is - // polymorphic and is the base class of the original type. public: // ACCESSORS template TYPE* object() BSLS_KEYWORD_NOEXCEPT; + + /// Return a pointer to the contained object of the specified `TYPE`, + /// or 0 if the placeholder is empty. The behavior is undefined unless + /// the placeholder is empty, or contains an object of the specified + /// `TYPE`. + /// + /// Note that `TYPE` does not necessarily has to be the same as the + /// original type specified on object creation, as long as `TYPE` is + /// polymorphic and is the base class of the original type. template const TYPE* object() const BSLS_KEYWORD_NOEXCEPT; - // Return a pointer to the contained object of the specified 'TYPE', - // or 0 if the placeholder is empty. The behavior is undefined unless - // the placeholder is empty, or contains an object of the specified - // 'TYPE'. - // - // Note that 'TYPE' does not necessarily has to be the same as the - // original type specified on object creation, as long as 'TYPE' is - // polymorphic and is the base class of the original type. - - void* objectAddress() BSLS_KEYWORD_NOEXCEPT; + + void* objectAddress() BSLS_KEYWORD_NOEXCEPT; + + /// Return the address of the contained object, or 0 if the placeholder + /// is empty. const void* objectAddress() const BSLS_KEYWORD_NOEXCEPT; - // Return the address of the contained object, or 0 if the placeholder - // is empty. }; // ============================================================================ @@ -509,16 +518,16 @@ inline ObjectPlaceHolder::~ObjectPlaceHolder() // MANIPULATORS #if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES // {{{ BEGIN GENERATED CODE -// Command line: sim_cpp11_features.pl mwcu_objectplaceholder.h -#ifndef MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT -#define MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT 9 +// Command line: sim_cpp11_features.pl bmqu_objectplaceholder.h +#ifndef BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT +#define BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT 9 #endif -#ifndef MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B -#define MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B \ - MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT +#ifndef BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B +#define BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B \ + BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT #endif -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 0 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 0 template template inline void ObjectPlaceHolder::createObject(bslma::Allocator* allocator) @@ -533,9 +542,9 @@ inline void ObjectPlaceHolder::createObject(bslma::Allocator* allocator) objectGuard.release(); } -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 0 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 0 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 1 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 1 template template inline void @@ -556,9 +565,9 @@ ObjectPlaceHolder::createObject(bslma::Allocator* allocator, objectGuard.release(); } -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 1 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 1 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 2 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 2 template template inline void ObjectPlaceHolder::createObject( @@ -580,9 +589,9 @@ inline void ObjectPlaceHolder::createObject( objectGuard.release(); } -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 2 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 2 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 3 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 3 template template inline void ObjectPlaceHolder::createObject( @@ -606,9 +615,9 @@ inline void ObjectPlaceHolder::createObject( objectGuard.release(); } -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 3 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 3 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 4 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 4 template template inline void ObjectPlaceHolder::createObject( @@ -634,9 +643,9 @@ inline void ObjectPlaceHolder::createObject( objectGuard.release(); } -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 4 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 4 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 5 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 5 template template ::createObject( objectGuard.release(); } -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 5 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 5 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 6 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 6 template template ::createObject( objectGuard.release(); } -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 6 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 6 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 7 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 7 template template ::createObject( objectGuard.release(); } -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 7 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 7 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 8 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 8 template template ::createObject( objectGuard.release(); } -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 8 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 8 -#if MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 9 +#if BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 9 template template ::createObject( objectGuard.release(); } -#endif // MWCU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 9 +#endif // BMQU_OBJECTPLACEHOLDER_VARIADIC_LIMIT_B >= 9 #else // The generated code below is a workaround for the absence of perfect @@ -854,7 +863,7 @@ inline void ObjectPlaceHolder::createObject( BSLS_ASSERT_SAFE(allocator); BSLS_ASSERT_SAFE(d_state == e_EMPTY); - TYPE* object = allocateObject(allocator); + TYPE* object = allocateObject(allocator); ObjectGuard objectGuard(this); bslma::ConstructionUtil::construct( @@ -925,24 +934,11 @@ ObjectPlaceHolder::objectAddress() const BSLS_KEYWORD_NOEXCEPT } // close package namespace } // close enterprise namespace -#else // if ! defined(DEFINED_MWCU_OBJECTPLACEHOLDER_H) -#error Not valid except when included from mwcu_objectplaceholder.h -#endif // ! defined(COMPILING_MWCU_OBJECTPLACEHOLDER_H) +#else // if ! defined(DEFINED_BMQU_OBJECTPLACEHOLDER_H) +#error Not valid except when included from bmqu_objectplaceholder.h +#endif // ! defined(COMPILING_BMQU_OBJECTPLACEHOLDER_H) -#endif // ! defined(INCLUDED_MWCU_OBJECTPLACEHOLDER_CPP03) +#endif // ! defined(INCLUDED_BMQU_OBJECTPLACEHOLDER_CPP03) -// ---------------------------------------------------------------------------- -// Copyright 2022-2023 Bloomberg Finance L.P. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ----------------------------- END-OF-FILE ---------------------------------- +// SCRIPT-SHA: 60926cad35f1091c31a7d8cc9d33acc38edd25e4891f3e1d41fe7c40fd6e02f5 +// SOURCE-SHA: efa0e98699d54a0d81108c550e5b40870cd35b454e40f32fa57800ba233d5a88 diff --git a/src/groups/mwc/mwcu/mwcu_operationchain.cpp b/src/groups/bmq/bmqu/bmqu_operationchain.cpp similarity index 98% rename from src/groups/mwc/mwcu/mwcu_operationchain.cpp rename to src/groups/bmq/bmqu/bmqu_operationchain.cpp index 2cbed43c3..fcebb04c3 100644 --- a/src/groups/mwc/mwcu/mwcu_operationchain.cpp +++ b/src/groups/bmq/bmqu/bmqu_operationchain.cpp @@ -13,18 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_operationchain.cpp -*-C++-*- -#include +// bmqu_operationchain.cpp -*-C++-*- +#include -// MWC -#include +#include // BDE #include #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ------------------------------------ // class OperationChain_Job::TargetBase diff --git a/src/groups/mwc/mwcu/mwcu_operationchain.h b/src/groups/bmq/bmqu/bmqu_operationchain.h similarity index 97% rename from src/groups/mwc/mwcu/mwcu_operationchain.h rename to src/groups/bmq/bmqu/bmqu_operationchain.h index 7adbe23e9..b6381266d 100644 --- a/src/groups/mwc/mwcu/mwcu_operationchain.h +++ b/src/groups/bmq/bmqu/bmqu_operationchain.h @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_operationchain.h -*-C++-*- -#ifndef INCLUDED_MWCU_OPERATIONCHAIN -#define INCLUDED_MWCU_OPERATIONCHAIN +// bmqu_operationchain.h -*-C++-*- +#ifndef INCLUDED_BMQU_OPERATIONCHAIN +#define INCLUDED_BMQU_OPERATIONCHAIN //@PURPOSE: Provide a mechanism to serialize execution of async operations. // @@ -24,7 +24,7 @@ // OperationChainLink: a link in the chain // //@DESCRIPTION: -// This component provides a mechanism, 'mwcu::OperationChain', to serialize +// This component provides a mechanism, 'bmqu::OperationChain', to serialize // execution of groups of asynchronous operations in a way that each next group // starts executing after the completion of all operations in the previous // group. Inline with this component's terminology, a group of operations is @@ -56,7 +56,7 @@ // /// Operations ///---------- -// An asynchronous operation submitted to 'mwcu::OperationChain' is represented +// An asynchronous operation submitted to 'bmqu::OperationChain' is represented // by two functors, the "operation callback" and the "completion callback". An // operation callback initiates execution of the async operation, and should // accept exactly one argument - the completion callback, which is passed to @@ -68,7 +68,7 @@ // /// Links ///----- -// A link in the operation chain is represented by 'mwcu::OperationChainLink', +// A link in the operation chain is represented by 'bmqu::OperationChainLink', // which is a move-only container for operations. A link can be atomically // appended to or removed from the back of the chain. // @@ -88,8 +88,8 @@ // /// Thread safety ///------------- -//: o 'mwcu::OperationChain' is fully thread-safe. -//: o 'mwcu::OperationChainLink' is not thread-safe. +//: o 'bmqu::OperationChain' is fully thread-safe. +//: o 'bmqu::OperationChainLink' is not thread-safe. // /// Usage ///----- @@ -127,16 +127,16 @@ //.. // Lets say we want to "receive" data from 10 clients, and then "send" data // to some other client. The code below demonstrates the way to do that using -// 'mwcu::OperationChain'. +// 'bmqu::OperationChain'. //.. // // create a chain -// mwcu::OperationChain chain(s_allocator_p); +// bmqu::OperationChain chain(s_allocator_p); // // static const int k_MY_PAYLOAD = 42; // static const int k_MY_CLIENT_ID = 42; // // // receive data from 10 clients -// mwcu::OperationChainLink link(chain.allocator()); +// bmqu::OperationChainLink link(chain.allocator()); // for (int i = 0; i < 10; ++i) { // link.insert(&createNewLink, // bdlf::BindUtil::bind(&UsageExample::receive, @@ -160,8 +160,7 @@ // chain.join(); //.. -// MWC -#include +#include // BDE #include @@ -193,16 +192,16 @@ #if BSLS_COMPILERFEATURES_SIMULATE_CPP11_FEATURES // Include version that can be compiled with C++03 -// Generated on Wed Jul 17 13:47:07 2024 -// Command line: sim_cpp11_features.pl mwcu_operationchain.h -#define COMPILING_MWCU_OPERATIONCHAIN_H -#include -#undef COMPILING_MWCU_OPERATIONCHAIN_H +// Generated on Tue Oct 15 17:39:53 2024 +// Command line: sim_cpp11_features.pl bmqu_operationchain.h +#define COMPILING_BMQU_OPERATIONCHAIN_H +#include +#undef COMPILING_BMQU_OPERATIONCHAIN_H #else namespace BloombergLP { -namespace mwcu { +namespace bmqu { // FORWARD DECLARATION class OperationChain; @@ -403,7 +402,7 @@ class OperationChain_Job { // falls back to requesting memory from the supplied allocator if // the buffer is not large enough. Note that the size of the on-stack // buffer is an arbitrary value. - mwcu::ObjectPlaceHolder)> d_target; + bmqu::ObjectPlaceHolder)> d_target; private: // NOT IMPLEMENTED @@ -1014,7 +1013,7 @@ inline void OperationChainLink::insert( } // close package namespace // FREE OPERATORS -inline void mwcu::swap(OperationChainLink& lhs, +inline void bmqu::swap(OperationChainLink& lhs, OperationChainLink& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); diff --git a/src/groups/mwc/mwcu/mwcu_operationchain.t.cpp b/src/groups/bmq/bmqu/bmqu_operationchain.t.cpp similarity index 92% rename from src/groups/mwc/mwcu/mwcu_operationchain.t.cpp rename to src/groups/bmq/bmqu/bmqu_operationchain.t.cpp index 6169071e6..76a796b13 100644 --- a/src/groups/mwc/mwcu/mwcu_operationchain.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_operationchain.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_operationchain.t.cpp -*-C++-*- -#include +// bmqu_operationchain.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -304,13 +304,13 @@ static void test1_usageExample() // ------------------------------------------------------------------------ { // create a chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); static const int k_MY_PAYLOAD = 42; static const int k_MY_CLIENT_ID = 42; // receive data from 10 clients - mwcu::OperationChainLink link(chain.allocator()); + bmqu::OperationChainLink link(chain.allocator()); for (int i = 0; i < 10; ++i) { link.insert(bdlf::BindUtil::bind(&UsageExample::receive, bdlf::PlaceHolders::_1), @@ -341,7 +341,7 @@ static void test2_chain_creators(bdlmt::ThreadPool* threadPool) // Ensure proper behavior of creators. // // Plan: -// Create a 'mwcu::OperationChain' object and check postconditions. +// Create a 'bmqu::OperationChain' object and check postconditions. // ------------------------------------------------------------------------ { // PRECONDITIONS @@ -350,7 +350,7 @@ static void test2_chain_creators(bdlmt::ThreadPool* threadPool) // constructor #1 { // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // check postconditions ASSERT_EQ(chain.isStarted(), false); @@ -363,7 +363,7 @@ static void test2_chain_creators(bdlmt::ThreadPool* threadPool) // constructor #2 { // create chain - mwcu::OperationChain chain(true, s_allocator_p); + bmqu::OperationChain chain(true, s_allocator_p); // check postconditions ASSERT_EQ(chain.isStarted(), true); @@ -399,7 +399,7 @@ static void test3_chain_startStop(bdlmt::ThreadPool* threadPool) bsls::SystemClockType::e_MONOTONIC); // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // number of operations in the chain static const unsigned k_NUM_OPERATIONS = 3; @@ -443,7 +443,7 @@ static void test3_chain_startStop(bdlmt::ThreadPool* threadPool) bsls::SystemClockType::e_MONOTONIC); // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // used for synchronization bslmt::Semaphore semaphore; @@ -512,7 +512,7 @@ static void test4_chain_join(bdlmt::ThreadPool* threadPool) bdlcc::Deque completionIds(bsls::SystemClockType::e_MONOTONIC); // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // number of operations in the chain static const unsigned k_NUM_OPERATIONS = 32; @@ -567,10 +567,10 @@ static void test5_chain_append1(bdlmt::ThreadPool* threadPool) // 1. append single empty link { // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // create empty link - mwcu::OperationChainLink link(chain.allocator()); + bmqu::OperationChainLink link(chain.allocator()); // append link chain.append(&link); @@ -591,10 +591,10 @@ static void test5_chain_append1(bdlmt::ThreadPool* threadPool) static const unsigned k_NUM_LINKS = 8; // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // append several links - mwcu::OperationChainLink link(chain.allocator()); + bmqu::OperationChainLink link(chain.allocator()); for (unsigned i = 0; i < k_NUM_LINKS; ++i) { // number of operations in the link const unsigned k_NUM_OPERATIONS = i + 1; @@ -619,7 +619,7 @@ static void test5_chain_append1(bdlmt::ThreadPool* threadPool) // 3. append non-empty link to a started chain { // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // start executing operations chain.start(); @@ -690,11 +690,11 @@ static void test6_chain_append2(bdlmt::ThreadPool* threadPool) // 1. append empty link list { // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // append links - mwcu::OperationChainLink** links = - reinterpret_cast(0x01); + bmqu::OperationChainLink** links = + reinterpret_cast(0x01); chain.append(links, 0); @@ -706,15 +706,15 @@ static void test6_chain_append2(bdlmt::ThreadPool* threadPool) // 2. append non-empty link list containing empty links { // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // create empty links - mwcu::OperationChainLink link1(chain.allocator()); - mwcu::OperationChainLink link2(chain.allocator()); - mwcu::OperationChainLink link3(chain.allocator()); + bmqu::OperationChainLink link1(chain.allocator()); + bmqu::OperationChainLink link2(chain.allocator()); + bmqu::OperationChainLink link3(chain.allocator()); // append links - mwcu::OperationChainLink* links[] = {&link1, &link2, &link3}; + bmqu::OperationChainLink* links[] = {&link1, &link2, &link3}; chain.append(links, 3); // the operation had no effect @@ -730,23 +730,23 @@ static void test6_chain_append2(bdlmt::ThreadPool* threadPool) // way we know which link is which. // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // create links - mwcu::OperationChainLink link1(chain.allocator()); + bmqu::OperationChainLink link1(chain.allocator()); link1.insert(NullOperation()); - mwcu::OperationChainLink link2(chain.allocator()); + bmqu::OperationChainLink link2(chain.allocator()); link2.insert(NullOperation()); link2.insert(NullOperation()); - mwcu::OperationChainLink link3(chain.allocator()); + bmqu::OperationChainLink link3(chain.allocator()); link3.insert(NullOperation()); link3.insert(NullOperation()); link3.insert(NullOperation()); // append links - mwcu::OperationChainLink* links[] = {&link1, &link2, &link3}; + bmqu::OperationChainLink* links[] = {&link1, &link2, &link3}; chain.append(links, 3); // make sure links are appended in the right order @@ -783,7 +783,7 @@ static void test7_chain_appendInplace(bdlmt::ThreadPool* threadPool) // 1. append-inplace a link { // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // append-inplace a link (use first overload) chain.appendInplace(NullOperation()); @@ -841,10 +841,10 @@ static void test8_chain_popBack(bdlmt::ThreadPool* threadPool) static const unsigned k_NUM_LINKS = 8; // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // append several links - mwcu::OperationChainLink link(chain.allocator()); + bmqu::OperationChainLink link(chain.allocator()); for (unsigned i = 0; i < k_NUM_LINKS; ++i) { // number of operations in the link const unsigned k_NUM_OPERATIONS = i + 1; @@ -879,7 +879,7 @@ static void test8_chain_popBack(bdlmt::ThreadPool* threadPool) // 2. try extract last link from an empty chain { // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // try extract link int rc = chain.popBack(); @@ -890,7 +890,7 @@ static void test8_chain_popBack(bdlmt::ThreadPool* threadPool) ASSERT_EQ(chain.numOperations(), 0u); // try extract link again, this time transfer operations ownership - mwcu::OperationChainLink link(chain.allocator()); + bmqu::OperationChainLink link(chain.allocator()); link.insert(NullOperation()); rc = chain.popBack(&link); @@ -907,7 +907,7 @@ static void test8_chain_popBack(bdlmt::ThreadPool* threadPool) // 3. try extract last link while associated operations are executing { // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // start executing operations chain.start(); @@ -936,7 +936,7 @@ static void test8_chain_popBack(bdlmt::ThreadPool* threadPool) ASSERT_EQ(chain.numOperationsExecuting(), 1u); // try extract link again, this time transfer operations ownership - mwcu::OperationChainLink link(chain.allocator()); + bmqu::OperationChainLink link(chain.allocator()); link.insert(NullOperation()); rc = chain.popBack(&link); ASSERT(rc != 0); @@ -981,14 +981,14 @@ static void test9_chain_removeAll(bdlmt::ThreadPool* threadPool) // 1. remove all links { // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // number of links and operations in each link static const unsigned k_NUM_LINKS = 3; static const unsigned k_NUM_OPERATIONS = 5; // fill the chain - mwcu::OperationChainLink link(chain.allocator()); + bmqu::OperationChainLink link(chain.allocator()); for (unsigned i = 0; i < k_NUM_LINKS; ++i) { for (unsigned j = 0; j < k_NUM_OPERATIONS; ++j) { link.insert(NullOperation()); @@ -1013,7 +1013,7 @@ static void test9_chain_removeAll(bdlmt::ThreadPool* threadPool) // 2. try remove all operations from an empty chain { // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // try remove all links unsigned count = chain.removeAll(); @@ -1023,7 +1023,7 @@ static void test9_chain_removeAll(bdlmt::ThreadPool* threadPool) // 3. try remove all operations while some of them are executing { // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // start executing operations chain.start(); @@ -1084,14 +1084,14 @@ static void test10_chain_serialization(bdlmt::ThreadPool* threadPool) bdlcc::Deque completionIds(bsls::SystemClockType::e_MONOTONIC); // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // number of links and operations in each link static const unsigned k_NUM_LINKS = 8; static const unsigned k_NUM_OPERATIONS = 32; // fill the chain - mwcu::OperationChainLink link(chain.allocator()); + bmqu::OperationChainLink link(chain.allocator()); for (unsigned i = 0; i < k_NUM_LINKS; ++i) { for (unsigned j = 0; j < k_NUM_OPERATIONS; ++j) { unsigned operationId = i * k_NUM_OPERATIONS + j; @@ -1144,7 +1144,7 @@ static void test11_chain_exceptionHandling(bdlmt::ThreadPool* threadPool) BSLS_ASSERT(threadPool); // create chain - mwcu::OperationChain chain(s_allocator_p); + bmqu::OperationChain chain(s_allocator_p); // add several operations, each handling an exception thrown from the // completion callback @@ -1186,7 +1186,7 @@ static void test12_link_creators() // 1. default constructor { // create link - mwcu::OperationChainLink link(s_allocator_p); + bmqu::OperationChainLink link(s_allocator_p); // check postconditions ASSERT_EQ(link.numOperations(), 0u); @@ -1196,12 +1196,12 @@ static void test12_link_creators() // 2. move constructor { // create link containing several operations - mwcu::OperationChainLink original(s_allocator_p); + bmqu::OperationChainLink original(s_allocator_p); original.insert(NullOperation()); original.insert(NullOperation()); // move-construct another link - mwcu::OperationChainLink copy(bslmf::MovableRefUtil::move(original)); + bmqu::OperationChainLink copy(bslmf::MovableRefUtil::move(original)); // the copy now contains the state of the original ASSERT_EQ(copy.numOperations(), 2u); @@ -1232,12 +1232,12 @@ static void test13_link_assignment() // 1. regular move-assignment { // create link containing one operation - mwcu::OperationChainLink link1(s_allocator_p); + bmqu::OperationChainLink link1(s_allocator_p); link1.insert(NullOperation()); // create another link containing two operations - mwcu::OperationChainLink link2(s_allocator_p); + bmqu::OperationChainLink link2(s_allocator_p); link2.insert(NullOperation()); link2.insert(NullOperation()); @@ -1256,7 +1256,7 @@ static void test13_link_assignment() // 2. move-assign to self { // create link containing several operations - mwcu::OperationChainLink link(s_allocator_p); + bmqu::OperationChainLink link(s_allocator_p); link.insert(NullOperation()); link.insert(NullOperation()); @@ -1280,7 +1280,7 @@ static void test14_link_insert() // ------------------------------------------------------------------------ { // create an empty link - mwcu::OperationChainLink link(s_allocator_p); + bmqu::OperationChainLink link(s_allocator_p); ASSERT_EQ(link.numOperations(), 0u); static const unsigned k_NUM_OPERATIONS = 10; @@ -1315,7 +1315,7 @@ static void test15_link_removeAll() // ------------------------------------------------------------------------ { // create link containing several operations - mwcu::OperationChainLink link(s_allocator_p); + bmqu::OperationChainLink link(s_allocator_p); link.insert(NullOperation()); link.insert(NullOperation()); @@ -1344,8 +1344,8 @@ static void test16_link_swap() { // both empty { - mwcu::OperationChainLink link1(s_allocator_p); - mwcu::OperationChainLink link2(s_allocator_p); + bmqu::OperationChainLink link1(s_allocator_p); + bmqu::OperationChainLink link2(s_allocator_p); link1.swap(link2); ASSERT_EQ(link1.numOperations(), 0u); @@ -1354,9 +1354,9 @@ static void test16_link_swap() // first empty { - mwcu::OperationChainLink link1(s_allocator_p); + bmqu::OperationChainLink link1(s_allocator_p); - mwcu::OperationChainLink link2(s_allocator_p); + bmqu::OperationChainLink link2(s_allocator_p); link2.insert(NullOperation()); link2.insert(NullOperation()); @@ -1367,11 +1367,11 @@ static void test16_link_swap() // second empty { - mwcu::OperationChainLink link1(s_allocator_p); + bmqu::OperationChainLink link1(s_allocator_p); link1.insert(NullOperation()); link1.insert(NullOperation()); - mwcu::OperationChainLink link2(s_allocator_p); + bmqu::OperationChainLink link2(s_allocator_p); link1.swap(link2); ASSERT_EQ(link1.numOperations(), 0u); @@ -1380,11 +1380,11 @@ static void test16_link_swap() // none empty { - mwcu::OperationChainLink link1(s_allocator_p); + bmqu::OperationChainLink link1(s_allocator_p); link1.insert(NullOperation()); link1.insert(NullOperation()); - mwcu::OperationChainLink link2(s_allocator_p); + bmqu::OperationChainLink link2(s_allocator_p); link2.insert(NullOperation()); link2.insert(NullOperation()); link2.insert(NullOperation()); @@ -1401,7 +1401,7 @@ static void test16_link_swap() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); // utility mechanisms bdlmt::ThreadPool threadPool(bslmt::ThreadAttributes(), @@ -1415,7 +1415,7 @@ int main(int argc, char* argv[]) // usage example case 1: test1_usageExample(); break; - // 'mwcu::OperationChain' + // 'bmqu::OperationChain' case 2: test2_chain_creators(&threadPool); break; case 3: test3_chain_startStop(&threadPool); break; case 4: test4_chain_join(&threadPool); break; @@ -1427,7 +1427,7 @@ int main(int argc, char* argv[]) case 10: test10_chain_serialization(&threadPool); break; case 11: test11_chain_exceptionHandling(&threadPool); break; - // 'mwcu::OperationChainLink' + // 'bmqu::OperationChainLink' case 12: test12_link_creators(); break; case 13: test13_link_assignment(); break; case 14: test14_link_insert(); break; @@ -1444,5 +1444,5 @@ int main(int argc, char* argv[]) // shutdown threadPool.stop(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/bmq/bmqu/bmqu_operationchain_cpp03.cpp b/src/groups/bmq/bmqu/bmqu_operationchain_cpp03.cpp new file mode 100644 index 000000000..0d394407c --- /dev/null +++ b/src/groups/bmq/bmqu/bmqu_operationchain_cpp03.cpp @@ -0,0 +1,34 @@ +// Copyright 2021-2023 Bloomberg Finance L.P. +// SPDX-License-Identifier: Apache-2.0 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// bmqu_operationchain_cpp03.cpp -*-C++-*- + +// Automatically generated file. **DO NOT EDIT** + +// Generated on Thu Oct 17 15:40:13 2024 +// Command line: sim_cpp11_features.pl bmqu_operationchain.cpp + +#define INCLUDED_BMQU_OPERATIONCHAIN_CPP03 // Disable inclusion +#include // Pro-forma #include + +// Empty file except when compiling bmqu_operationchain.cpp +#ifdef COMPILING_BMQU_OPERATIONCHAIN_CPP + +// No C++03 Expansion + +#endif // defined(COMPILING_BMQU_OPERATIONCHAIN_CPP) + +// SCRIPT-SHA: 60926cad35f1091c31a7d8cc9d33acc38edd25e4891f3e1d41fe7c40fd6e02f5 +// SOURCE-SHA: e12029cd114eba008f63ef66ad814e4c905d2347c6d6940222d8b6e67cbf7a00 diff --git a/src/groups/mwc/mwcu/mwcu_operationchain_cpp03.h b/src/groups/bmq/bmqu/bmqu_operationchain_cpp03.h similarity index 92% rename from src/groups/mwc/mwcu/mwcu_operationchain_cpp03.h rename to src/groups/bmq/bmqu/bmqu_operationchain_cpp03.h index b401b5771..dd69f868d 100644 --- a/src/groups/mwc/mwcu/mwcu_operationchain_cpp03.h +++ b/src/groups/bmq/bmqu/bmqu_operationchain_cpp03.h @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_operationchain_cpp03.h -*-C++-*- +// bmqu_operationchain_cpp03.h -*-C++-*- // Automatically generated file. **DO NOT EDIT** -#ifndef INCLUDED_MWCU_OPERATIONCHAIN_CPP03 -#define INCLUDED_MWCU_OPERATIONCHAIN_CPP03 +#ifndef INCLUDED_BMQU_OPERATIONCHAIN_CPP03 +#define INCLUDED_BMQU_OPERATIONCHAIN_CPP03 -//@PURPOSE: Provide C++03 implementation for mwcu_operationchain.h +//@PURPOSE: Provide C++03 implementation for bmqu_operationchain.h // -//@CLASSES: See mwcu_operationchain.h for list of classes +//@CLASSES: See bmqu_operationchain.h for list of classes // -//@SEE_ALSO: mwcu_operationchain +//@SEE_ALSO: bmqu_operationchain // //@DESCRIPTION: This component is the C++03 translation of a C++11 component, // generated by the 'sim_cpp11_features.pl' program. If the original header @@ -36,14 +36,14 @@ // regions of C++11 code, then this header contains no code and is not // '#include'd in the original header. // -// Generated on Wed Jul 17 13:47:07 2024 -// Command line: sim_cpp11_features.pl mwcu_operationchain.h +// Generated on Thu Oct 17 16:05:19 2024 +// Command line: sim_cpp11_features.pl bmqu_operationchain.h -#ifdef COMPILING_MWCU_OPERATIONCHAIN_H +#ifdef COMPILING_BMQU_OPERATIONCHAIN_H namespace BloombergLP { -namespace mwcu { +namespace bmqu { // FORWARD DECLARATION class OperationChain; @@ -145,45 +145,45 @@ class OperationChain_CompletionCallbackWrapper { // ACCESSORS #if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES // {{{ BEGIN GENERATED CODE -// Command line: sim_cpp11_features.pl mwcu_operationchain.h -#ifndef MWCU_OPERATIONCHAIN_VARIADIC_LIMIT -#define MWCU_OPERATIONCHAIN_VARIADIC_LIMIT 9 +// Command line: sim_cpp11_features.pl bmqu_operationchain.h +#ifndef BMQU_OPERATIONCHAIN_VARIADIC_LIMIT +#define BMQU_OPERATIONCHAIN_VARIADIC_LIMIT 9 #endif -#ifndef MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A -#define MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A MWCU_OPERATIONCHAIN_VARIADIC_LIMIT +#ifndef BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A +#define BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A BMQU_OPERATIONCHAIN_VARIADIC_LIMIT #endif -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 0 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 0 void operator()() const; -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 0 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 0 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 1 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 1 template void operator()(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1) const; -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 1 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 1 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 2 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 2 template void operator()(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_2) args_2) const; -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 2 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 2 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 3 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 3 template void operator()(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_2) args_2, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_3) args_3) const; -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 3 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 3 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 4 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 4 template void operator()(BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_1) args_1, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_2) args_2, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_3) args_3, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS_4) args_4) const; -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 4 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 4 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 5 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 5 template = 5 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 5 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 6 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 6 template = 6 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 6 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 7 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 7 template = 7 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 7 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 8 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 8 template = 8 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 8 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 9 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 9 template = 9 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_A >= 9 #else // The generated code below is a workaround for the absence of perfect @@ -369,7 +369,7 @@ class OperationChain_Job { // falls back to requesting memory from the supplied allocator if // the buffer is not large enough. Note that the size of the on-stack // buffer is an arbitrary value. - mwcu::ObjectPlaceHolder)> d_target; + bmqu::ObjectPlaceHolder)> d_target; private: // NOT IMPLEMENTED @@ -775,14 +775,14 @@ inline OperationChain_CompletionCallbackWrapper:: // ACCESSORS #if BSLS_COMPILERFEATURES_SIMULATE_VARIADIC_TEMPLATES // {{{ BEGIN GENERATED CODE -// Command line: sim_cpp11_features.pl mwcu_operationchain.h -#ifndef MWCU_OPERATIONCHAIN_VARIADIC_LIMIT -#define MWCU_OPERATIONCHAIN_VARIADIC_LIMIT 9 +// Command line: sim_cpp11_features.pl bmqu_operationchain.h +#ifndef BMQU_OPERATIONCHAIN_VARIADIC_LIMIT +#define BMQU_OPERATIONCHAIN_VARIADIC_LIMIT 9 #endif -#ifndef MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B -#define MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B MWCU_OPERATIONCHAIN_VARIADIC_LIMIT +#ifndef BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B +#define BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B BMQU_OPERATIONCHAIN_VARIADIC_LIMIT #endif -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 0 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 0 template inline void OperationChain_CompletionCallbackWrapper::operator()() const @@ -797,9 +797,9 @@ OperationChain_CompletionCallbackWrapper::operator()() const d_chain_p->onOperationCompleted(d_jobHandle); } -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 0 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 0 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 1 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 1 template template inline void OperationChain_CompletionCallbackWrapper::operator()( @@ -816,9 +816,9 @@ inline void OperationChain_CompletionCallbackWrapper::operator()( d_chain_p->onOperationCompleted(d_jobHandle); } -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 1 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 1 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 2 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 2 template template inline void OperationChain_CompletionCallbackWrapper::operator()( @@ -837,9 +837,9 @@ inline void OperationChain_CompletionCallbackWrapper::operator()( d_chain_p->onOperationCompleted(d_jobHandle); } -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 2 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 2 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 3 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 3 template template inline void OperationChain_CompletionCallbackWrapper::operator()( @@ -860,9 +860,9 @@ inline void OperationChain_CompletionCallbackWrapper::operator()( d_chain_p->onOperationCompleted(d_jobHandle); } -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 3 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 3 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 4 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 4 template template inline void OperationChain_CompletionCallbackWrapper::operator()( @@ -885,9 +885,9 @@ inline void OperationChain_CompletionCallbackWrapper::operator()( d_chain_p->onOperationCompleted(d_jobHandle); } -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 4 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 4 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 5 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 5 template template inline void OperationChain_CompletionCallbackWrapper::operator()( @@ -912,9 +912,9 @@ inline void OperationChain_CompletionCallbackWrapper::operator()( d_chain_p->onOperationCompleted(d_jobHandle); } -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 5 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 5 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 6 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 6 template template ::operator()( d_chain_p->onOperationCompleted(d_jobHandle); } -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 6 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 6 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 7 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 7 template template ::operator()( d_chain_p->onOperationCompleted(d_jobHandle); } -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 7 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 7 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 8 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 8 template template ::operator()( d_chain_p->onOperationCompleted(d_jobHandle); } -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 8 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 8 -#if MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 9 +#if BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 9 template template ::operator()( d_chain_p->onOperationCompleted(d_jobHandle); } -#endif // MWCU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 9 +#endif // BMQU_OPERATIONCHAIN_VARIADIC_LIMIT_B >= 9 #else // The generated code below is a workaround for the absence of perfect @@ -1275,7 +1275,7 @@ inline void OperationChainLink::insert( } // close package namespace // FREE OPERATORS -inline void mwcu::swap(OperationChainLink& lhs, +inline void bmqu::swap(OperationChainLink& lhs, OperationChainLink& rhs) BSLS_KEYWORD_NOEXCEPT { lhs.swap(rhs); @@ -1283,8 +1283,11 @@ inline void mwcu::swap(OperationChainLink& lhs, } // close enterprise namespace -#else // if ! defined(DEFINED_MWCU_OPERATIONCHAIN_H) -#error Not valid except when included from mwcu_operationchain.h -#endif // ! defined(COMPILING_MWCU_OPERATIONCHAIN_H) +#else // if ! defined(DEFINED_BMQU_OPERATIONCHAIN_H) +#error Not valid except when included from bmqu_operationchain.h +#endif // ! defined(COMPILING_BMQU_OPERATIONCHAIN_H) -#endif // ! defined(INCLUDED_MWCU_OPERATIONCHAIN_CPP03) +#endif // ! defined(INCLUDED_BMQU_OPERATIONCHAIN_CPP03) + +// SCRIPT-SHA: 60926cad35f1091c31a7d8cc9d33acc38edd25e4891f3e1d41fe7c40fd6e02f5 +// SOURCE-SHA: 7610aa7a0ecb116c786702dfc71b197eda2f52aa0f3efa66433723466764a626 diff --git a/src/groups/mwc/mwcu/mwcu_outstreamformatsaver.cpp b/src/groups/bmq/bmqu/bmqu_outstreamformatsaver.cpp similarity index 84% rename from src/groups/mwc/mwcu/mwcu_outstreamformatsaver.cpp rename to src/groups/bmq/bmqu/bmqu_outstreamformatsaver.cpp index 9c2a6fd0b..6673b8f7b 100644 --- a/src/groups/mwc/mwcu/mwcu_outstreamformatsaver.cpp +++ b/src/groups/bmq/bmqu/bmqu_outstreamformatsaver.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_outstreamformatsaver.cpp -*-C++-*- -#include +// bmqu_outstreamformatsaver.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // CREATORS OutStreamFormatSaver::~OutStreamFormatSaver() diff --git a/src/groups/mwc/mwcu/mwcu_outstreamformatsaver.h b/src/groups/bmq/bmqu/bmqu_outstreamformatsaver.h similarity index 96% rename from src/groups/mwc/mwcu/mwcu_outstreamformatsaver.h rename to src/groups/bmq/bmqu/bmqu_outstreamformatsaver.h index f98b51dae..9589ec3b0 100644 --- a/src/groups/mwc/mwcu/mwcu_outstreamformatsaver.h +++ b/src/groups/bmq/bmqu/bmqu_outstreamformatsaver.h @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_outstreamformatsaver.h -*-C++-*- -#ifndef INCLUDED_MWCU_OUTSTREAMFORMATSAVER -#define INCLUDED_MWCU_OUTSTREAMFORMATSAVER +// bmqu_outstreamformatsaver.h -*-C++-*- +#ifndef INCLUDED_BMQU_OUTSTREAMFORMATSAVER +#define INCLUDED_BMQU_OUTSTREAMFORMATSAVER //@PURPOSE: provide a scoped guard for an ostream's format state. // @@ -108,14 +108,12 @@ // // Output w/o call to 'restore': "+1.235e+04" //.. -// MWC - // BDE #include #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ==================== // OutStreamFormatSaver diff --git a/src/groups/mwc/mwcu/mwcu_outstreamformatsaver.t.cpp b/src/groups/bmq/bmqu/bmqu_outstreamformatsaver.t.cpp similarity index 86% rename from src/groups/mwc/mwcu/mwcu_outstreamformatsaver.t.cpp rename to src/groups/bmq/bmqu/bmqu_outstreamformatsaver.t.cpp index deb08328d..787f6a583 100644 --- a/src/groups/mwc/mwcu/mwcu_outstreamformatsaver.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_outstreamformatsaver.t.cpp @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_outstreamformatsaver.t.cpp -*-C++-*- -#include +// bmqu_outstreamformatsaver.t.cpp -*-C++-*- +#include -// MWCU -#include +// BMQU +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -46,13 +46,13 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); const unsigned int k_FIFTY = 50; - mwcu::MemOutStream obj(s_allocator_p); + bmqu::MemOutStream obj(s_allocator_p); { - mwcu::OutStreamFormatSaver fmtSaver(obj); + bmqu::OutStreamFormatSaver fmtSaver(obj); // Set formatting and print obj << bsl::nouppercase << bsl::showbase << bsl::hex; @@ -89,7 +89,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -100,5 +100,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/mwcu_printutil.cpp b/src/groups/bmq/bmqu/bmqu_printutil.cpp similarity index 96% rename from src/groups/mwc/mwcu/mwcu_printutil.cpp rename to src/groups/bmq/bmqu/bmqu_printutil.cpp index e95d5f456..4211bbdff 100644 --- a/src/groups/mwc/mwcu/mwcu_printutil.cpp +++ b/src/groups/bmq/bmqu/bmqu_printutil.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_printutil.cpp -*-C++-*- -#include +// bmqu_printutil.cpp -*-C++-*- +#include -#include -// MWC -#include -#include +#include + +#include +#include // BDE #include @@ -33,7 +33,7 @@ #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { namespace { @@ -151,7 +151,7 @@ prettyBytes(bsl::ostream& stream, bsls::Types::Int64 bytes, int precision) bdlma::LocalSequentialAllocator<1024> localAllocator( bslma::Default::allocator()); - mwcu::MemOutStream temp(&localAllocator); + bmqu::MemOutStream temp(&localAllocator); // Handle negative 'bytes' if (bytes < 0) { @@ -239,7 +239,7 @@ bsl::ostream& prettyTimeInterval(bsl::ostream& stream, bdlma::LocalSequentialAllocator<1024> localAllocator( bslma::Default::allocator()); - mwcu::MemOutStream temp(&localAllocator); + bmqu::MemOutStream temp(&localAllocator); // Handle negative 'timeNs' if (timeNs < 0) { diff --git a/src/groups/mwc/mwcu/mwcu_printutil.h b/src/groups/bmq/bmqu/bmqu_printutil.h similarity index 97% rename from src/groups/mwc/mwcu/mwcu_printutil.h rename to src/groups/bmq/bmqu/bmqu_printutil.h index 212ccfc06..f4d30decc 100644 --- a/src/groups/mwc/mwcu/mwcu_printutil.h +++ b/src/groups/bmq/bmqu/bmqu_printutil.h @@ -13,14 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_printutil.h -*-C++-*- -#ifndef INCLUDED_MWCU_PRINTUTIL -#define INCLUDED_MWCU_PRINTUTIL +// bmqu_printutil.h -*-C++-*- +#ifndef INCLUDED_BMQU_PRINTUTIL +#define INCLUDED_BMQU_PRINTUTIL //@PURPOSE: Provide utilities for printing things. // //@NAMESPACES: -// mwcu::PrintUtil +// bmqu::PrintUtil // //@FUNCTIONS: // indent: write characters for indenting as per BDE 'indent' @@ -31,7 +31,7 @@ // prettyTimeInterval: write a time interval (in nanosecs) using the best unit // //@CLASSES: -// mwcu::Printer +// bmqu::Printer // //@DESCRIPTION: // This component provides a set of utility functions and stream manipulators @@ -75,8 +75,6 @@ // os << prettyTimeInterval(12432); // 12.43 us //.. -// MWC - // BDE #include #include @@ -88,7 +86,7 @@ #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // FORWARD DECLARATIONS template @@ -722,7 +720,7 @@ Printer::print(bsl::ostream& stream, int level, int spacesPerLevel) const // FREE OPERATORS template -inline bsl::ostream& mwcu::operator<<(bsl::ostream& stream, +inline bsl::ostream& bmqu::operator<<(bsl::ostream& stream, const Printer& printer) { return stream << printer.obj(); @@ -730,7 +728,7 @@ inline bsl::ostream& mwcu::operator<<(bsl::ostream& stream, template inline bsl::ostream& -mwcu::operator<<(bsl::ostream& stream, +bmqu::operator<<(bsl::ostream& stream, const Printer >& printer) { stream << "["; @@ -750,7 +748,7 @@ mwcu::operator<<(bsl::ostream& stream, template inline bsl::ostream& -mwcu::operator<<(bsl::ostream& stream, +bmqu::operator<<(bsl::ostream& stream, const Printer >& printer) { stream << "{"; @@ -775,7 +773,7 @@ mwcu::operator<<(bsl::ostream& stream, template inline bsl::ostream& -mwcu::operator<<(bsl::ostream& stream, +bmqu::operator<<(bsl::ostream& stream, const Printer >& printer) { stream << "{"; @@ -797,7 +795,7 @@ mwcu::operator<<(bsl::ostream& stream, } template -inline bsl::ostream& mwcu::operator<<( +inline bsl::ostream& bmqu::operator<<( bsl::ostream& stream, const Printer >& printer) { @@ -826,7 +824,7 @@ template -inline bsl::ostream& mwcu::operator<<( +inline bsl::ostream& bmqu::operator<<( bsl::ostream& stream, const Printer >& printer) { @@ -852,7 +850,7 @@ inline bsl::ostream& mwcu::operator<<( template inline bsl::ostream& -mwcu::operator<<(bsl::ostream& stream, +bmqu::operator<<(bsl::ostream& stream, const Printer >& printer) { return stream << '<' << printer.obj().first << ", " << printer.obj().second diff --git a/src/groups/mwc/mwcu/mwcu_printutil.t.cpp b/src/groups/bmq/bmqu/bmqu_printutil.t.cpp similarity index 88% rename from src/groups/mwc/mwcu/mwcu_printutil.t.cpp rename to src/groups/bmq/bmqu/bmqu_printutil.t.cpp index ebc7162c3..4ac243955 100644 --- a/src/groups/mwc/mwcu/mwcu_printutil.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_printutil.t.cpp @@ -13,18 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_printutil.t.cpp -*-C++-*- -#include +// bmqu_printutil.t.cpp -*-C++-*- +#include -// MWC -#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -48,7 +47,7 @@ static void test1_prettyNumberInt64() // 'prettyNumber(stream, value, groupSize, separator)' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("prettyNumber (Int64)"); + bmqtst::TestHelper::printTestName("prettyNumber (Int64)"); const bsls::Types::Int64 k_INTMAX = bsl::numeric_limits::max(); @@ -86,8 +85,8 @@ static void test1_prettyNumberInt64() << ", separator: '" << test.d_separator << "', function)"); - mwcu::MemOutStream buf(s_allocator_p); - mwcu::PrintUtil::prettyNumber(buf, + bmqu::MemOutStream buf(s_allocator_p); + bmqu::PrintUtil::prettyNumber(buf, test.d_value, test.d_groupSize, test.d_separator); @@ -101,8 +100,8 @@ static void test1_prettyNumberInt64() << ", separator: '" << test.d_separator << "', manipulator)"); - mwcu::MemOutStream buf(s_allocator_p); - buf << mwcu::PrintUtil::prettyNumber(test.d_value, + bmqu::MemOutStream buf(s_allocator_p); + buf << bmqu::PrintUtil::prettyNumber(test.d_value, test.d_groupSize, test.d_separator); ASSERT_EQ_D(test.d_line, buf.str(), test.d_expected); @@ -112,9 +111,9 @@ static void test1_prettyNumberInt64() PV("Ensure assertion when group size <= 0"); { ASSERT_SAFE_FAIL( - mwcu::PrintUtil::prettyNumber(bsl::cout, 123, 0, ',')); + bmqu::PrintUtil::prettyNumber(bsl::cout, 123, 0, ',')); ASSERT_SAFE_FAIL( - mwcu::PrintUtil::prettyNumber(bsl::cout, 123, -2, ',')); + bmqu::PrintUtil::prettyNumber(bsl::cout, 123, -2, ',')); } } @@ -133,7 +132,7 @@ static void test2_prettyNumberDouble() // 'prettyNumber(stream, value, precision, groupSize, sep)' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("prettyNumber (Double)"); + bmqtst::TestHelper::printTestName("prettyNumber (Double)"); struct Test { int d_line; @@ -168,8 +167,8 @@ static void test2_prettyNumberDouble() << ", separator: '" << test.d_separator << "', function)"); - mwcu::MemOutStream buf(s_allocator_p); - mwcu::PrintUtil::prettyNumber(buf, + bmqu::MemOutStream buf(s_allocator_p); + bmqu::PrintUtil::prettyNumber(buf, test.d_value, test.d_precision, test.d_groupSize, @@ -185,8 +184,8 @@ static void test2_prettyNumberDouble() << ", separator: '" << test.d_separator << "', manipulator)"); - mwcu::MemOutStream buf(s_allocator_p); - buf << mwcu::PrintUtil::prettyNumber(test.d_value, + bmqu::MemOutStream buf(s_allocator_p); + buf << bmqu::PrintUtil::prettyNumber(test.d_value, test.d_precision, test.d_groupSize, test.d_separator); @@ -197,9 +196,9 @@ static void test2_prettyNumberDouble() PV("Ensure assertion when group size <= 0"); { ASSERT_SAFE_FAIL( - mwcu::PrintUtil::prettyNumber(bsl::cout, 123.0, 0, 0, ',')); + bmqu::PrintUtil::prettyNumber(bsl::cout, 123.0, 0, 0, ',')); ASSERT_SAFE_FAIL( - mwcu::PrintUtil::prettyNumber(bsl::cout, 123.0, 0, -2, ',')); + bmqu::PrintUtil::prettyNumber(bsl::cout, 123.0, 0, -2, ',')); } } @@ -217,7 +216,7 @@ static void test3_prettyBytes() // Proper behavior of 'prettyBytes(stream, bytes, precision)' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("prettyBytes"); + bmqtst::TestHelper::printTestName("prettyBytes"); const bsls::Types::Int64 k_INTMAX = bsl::numeric_limits::max(); @@ -273,8 +272,8 @@ static void test3_prettyBytes() << " (precision: " << test.d_precision << ", function)"); - mwcu::MemOutStream buf(s_allocator_p); - mwcu::PrintUtil::prettyBytes(buf, test.d_value, test.d_precision); + bmqu::MemOutStream buf(s_allocator_p); + bmqu::PrintUtil::prettyBytes(buf, test.d_value, test.d_precision); ASSERT_EQ_D(test.d_line, buf.str(), test.d_expected); } @@ -284,8 +283,8 @@ static void test3_prettyBytes() << " (precision: " << test.d_precision << ", function)"); - mwcu::MemOutStream buf(s_allocator_p); - buf << mwcu::PrintUtil::prettyBytes(test.d_value, + bmqu::MemOutStream buf(s_allocator_p); + buf << bmqu::PrintUtil::prettyBytes(test.d_value, test.d_precision); ASSERT_EQ_D(test.d_line, buf.str(), test.d_expected); } @@ -306,7 +305,7 @@ static void test4_prettyTimeInterval() // Proper behavior of 'prettyTimeInterval(stream, timeNs, precision)' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("prettyTimeInterval"); + bmqtst::TestHelper::printTestName("prettyTimeInterval"); const bsls::Types::Int64 k_INTMAX = bsl::numeric_limits::max(); @@ -355,8 +354,8 @@ static void test4_prettyTimeInterval() << " (precision: " << test.d_precision << ", function)"); - mwcu::MemOutStream buf(s_allocator_p); - mwcu::PrintUtil::prettyTimeInterval(buf, + bmqu::MemOutStream buf(s_allocator_p); + bmqu::PrintUtil::prettyTimeInterval(buf, test.d_value, test.d_precision); ASSERT_EQ_D(test.d_line, buf.str(), test.d_expected); @@ -368,8 +367,8 @@ static void test4_prettyTimeInterval() << " (precision: " << test.d_precision << ", function)"); - mwcu::MemOutStream buf(s_allocator_p); - buf << mwcu::PrintUtil::prettyTimeInterval(test.d_value, + bmqu::MemOutStream buf(s_allocator_p); + buf << bmqu::PrintUtil::prettyTimeInterval(test.d_value, test.d_precision); ASSERT_EQ_D(test.d_line, buf.str(), test.d_expected); } @@ -382,7 +381,7 @@ static void test4_prettyTimeInterval() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -396,5 +395,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/mwcu_samethreadchecker.cpp b/src/groups/bmq/bmqu/bmqu_samethreadchecker.cpp similarity index 92% rename from src/groups/mwc/mwcu/mwcu_samethreadchecker.cpp rename to src/groups/bmq/bmqu/bmqu_samethreadchecker.cpp index 5bee0f61f..3e48a781a 100644 --- a/src/groups/mwc/mwcu/mwcu_samethreadchecker.cpp +++ b/src/groups/bmq/bmqu/bmqu_samethreadchecker.cpp @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_samethreadchecker.cpp -*-C++-*- -#include +// bmqu_samethreadchecker.cpp -*-C++-*- +#include -#include +#include // BDE #include #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { namespace { diff --git a/src/groups/mwc/mwcu/mwcu_samethreadchecker.h b/src/groups/bmq/bmqu/bmqu_samethreadchecker.h similarity index 94% rename from src/groups/mwc/mwcu/mwcu_samethreadchecker.h rename to src/groups/bmq/bmqu/bmqu_samethreadchecker.h index ec3cb1e82..758ad8423 100644 --- a/src/groups/mwc/mwcu/mwcu_samethreadchecker.h +++ b/src/groups/bmq/bmqu/bmqu_samethreadchecker.h @@ -13,9 +13,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_samethreadchecker.h -*-C++-*- -#ifndef INCLUDED_MWCU_SAMETHREADCHECKER -#define INCLUDED_MWCU_SAMETHREADCHECKER +// bmqu_samethreadchecker.h -*-C++-*- +#ifndef INCLUDED_BMQU_SAMETHREADCHECKER +#define INCLUDED_BMQU_SAMETHREADCHECKER //@PURPOSE: Provide a mechanism to check if a call is performed in same thread. // @@ -23,12 +23,12 @@ // SameThreadChecker: the checker mechanism // //@DESCRIPTION: -// This component provides a mechanism, 'mwcu::SameThreadChecker', to check if +// This component provides a mechanism, 'bmqu::SameThreadChecker', to check if // a function call is always performed in the same thread. // /// Thread safety ///------------- -// 'mwcu::SameThreadChecker' is fully thread-safe, meaning that multiple +// 'bmqu::SameThreadChecker' is fully thread-safe, meaning that multiple // threads may use their own instances of the class or use a shared instance // without further synchronization. // @@ -69,7 +69,7 @@ // MessageProvider *d_messageProvider_p; // // Used to read messages. // -// mwcu::SameThreadChecker d_ioThreadChecker; +// bmqu::SameThreadChecker d_ioThreadChecker; // // Used to check is the message callback is always invoked from the // // same thread. // @@ -154,14 +154,12 @@ // } //.. -// MWC - // BDE #include #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ======================= // class SameThreadChecker diff --git a/src/groups/mwc/mwcu/mwcu_samethreadchecker.t.cpp b/src/groups/bmq/bmqu/bmqu_samethreadchecker.t.cpp similarity index 85% rename from src/groups/mwc/mwcu/mwcu_samethreadchecker.t.cpp rename to src/groups/bmq/bmqu/bmqu_samethreadchecker.t.cpp index 6fd1f8496..13ed96204 100644 --- a/src/groups/mwc/mwcu/mwcu_samethreadchecker.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_samethreadchecker.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_samethreadchecker.t.cpp -*-C++-*- -#include +// bmqu_samethreadchecker.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -36,7 +36,7 @@ static void test1_breathingTest() // BREATHING TEST // // Concerns: -// Ensure proper behavior of 'mwcu::SameThreadChecker' in a common +// Ensure proper behavior of 'bmqu::SameThreadChecker' in a common // use-case. // // Plan: @@ -46,7 +46,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwcu::SameThreadChecker sameThreadChecker; + bmqu::SameThreadChecker sameThreadChecker; // set the checker's thread to be this thread ASSERT_EQ(sameThreadChecker.inSameThread(), true); @@ -60,7 +60,7 @@ static void test1_breathingTest() bslmt::ThreadUtil::Handle thread; int rc = bslmt::ThreadUtil::createWithAllocator( &thread, - bdlf::MemFnUtil::memFn(&mwcu::SameThreadChecker::inSameThread, + bdlf::MemFnUtil::memFn(&bmqu::SameThreadChecker::inSameThread, &sameThreadChecker), s_allocator_p); BSLS_ASSERT_OPT(rc == 0); @@ -78,7 +78,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_breathingTest(); break; @@ -90,5 +90,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/mwcu_sharedresource.cpp b/src/groups/bmq/bmqu/bmqu_sharedresource.cpp similarity index 97% rename from src/groups/mwc/mwcu/mwcu_sharedresource.cpp rename to src/groups/bmq/bmqu/bmqu_sharedresource.cpp index face4e8c4..9c5c9374b 100644 --- a/src/groups/mwc/mwcu/mwcu_sharedresource.cpp +++ b/src/groups/bmq/bmqu/bmqu_sharedresource.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_sharedresource.cpp -*-C++-*- -#include +// bmqu_sharedresource.cpp -*-C++-*- +#include -#include +#include // BDE #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { namespace { diff --git a/src/groups/mwc/mwcu/mwcu_sharedresource.h b/src/groups/bmq/bmqu/bmqu_sharedresource.h similarity index 95% rename from src/groups/mwc/mwcu/mwcu_sharedresource.h rename to src/groups/bmq/bmqu/bmqu_sharedresource.h index 4723b8c42..bbc263b0c 100644 --- a/src/groups/mwc/mwcu/mwcu_sharedresource.h +++ b/src/groups/bmq/bmqu/bmqu_sharedresource.h @@ -13,23 +13,23 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_sharedresource.h -*-C++-*- -#ifndef INCLUDED_MWCU_SHAREDRESOURCE -#define INCLUDED_MWCU_SHAREDRESOURCE +// bmqu_sharedresource.h -*-C++-*- +#ifndef INCLUDED_BMQU_SHAREDRESOURCE +#define INCLUDED_BMQU_SHAREDRESOURCE //@PURPOSE: Provides a mechanism to manage the lifetime of a shared resource. // //@CLASSES: -// mwcu::SharedResource: a shared resource +// bmqu::SharedResource: a shared resource // //@SEE ALSO: -// mwcu_weakmemfn +// bmqu_weakmemfn // //@DESCRIPTION: -// This component provides a utility mechanism 'mwcu::SharedResource' used to +// This component provides a utility mechanism 'bmqu::SharedResource' used to // manage the lifetime of a shared resource. // -// The way this works is that a 'mwcu::SharedResource' holds a shared +// The way this works is that a 'bmqu::SharedResource' holds a shared // pointer to the target resource of type 'R'. The shared pointer doesn't own // that resource, but keeps track of its usage, containing a custom deleter // that will signal when all copies of the pointer are invalidated. The user @@ -41,19 +41,19 @@ /// Deleter ///------- // This components also provides two deleter class that can be used with -// 'mwcu::SharedResource' to free the resource upon invalidation. +// 'bmqu::SharedResource' to free the resource upon invalidation. // -// The first one, used by default, is 'mwcu::SharedResourceNoOpDeleter'. As +// The first one, used by default, is 'bmqu::SharedResourceNoOpDeleter'. As // the name suggests this deleter does nothing to the managed resource. // -// The second one, 'mwcu::SharedResourceFactoryDeleter', is a wrapper around a +// The second one, 'bmqu::SharedResourceFactoryDeleter', is a wrapper around a // pointer to any factory-like type, i.e. a type that has a 'deleteObject' // function. All types implementing the 'bslma::Allocator' or 'bdlma::Deleter' // protocol fall into this category. // -/// Comparison to 'mwcu::AtomicValidator' +/// Comparison to 'bmqu::AtomicValidator' ///------------------------------------- -// This component is intended as a replacement for 'mwcu_atomicvalidator'. +// This component is intended as a replacement for 'bmqu_atomicvalidator'. // What the validator can do, this component can do better. The two main // differences are the interface and the approach to synchronization. // @@ -66,7 +66,7 @@ //.. // void MyResource::myCallbackFunction(const AtomicValidatorSp& validator) // { -// mwcu::AtomicValidatorGuard guard(validator.ptr()); +// bmqu::AtomicValidatorGuard guard(validator.ptr()); // if (!guard.isValid()) { // // 'this' got destroyed before the callback and is not usable // return; @@ -75,7 +75,7 @@ // // the entire lifecycle of guard. // } //.. -// 'mwcu::SharedResource', on the other hand, is less intrusive, as will be +// 'bmqu::SharedResource', on the other hand, is less intrusive, as will be // shown in in the usage example below. // // Implementation wise, the validator relies on atomics and implements the @@ -87,7 +87,7 @@ /// Thread safety ///------------- // With the exception of the 'reset' and (partially) 'invalidate' member -// functions, 'mwcu::SharedResource' is fully thread-safe, meaning that +// functions, 'bmqu::SharedResource' is fully thread-safe, meaning that // multiple threads may use their own instances of the class or use a shared // instance without further synchronization. 'invalidate' may be invoked // concurrently with other thread-safe function, but not with itself. @@ -103,7 +103,7 @@ // bdlmt::ThreadPool *d_threadPool_p; // // Used to spawn async operations. // -// mwcu::SharedResource d_self; +// bmqu::SharedResource d_self; // // Used to synchronize with async operations completion on // // destruction. // @@ -137,7 +137,7 @@ // as long as there is at least one operation in progress. Hence, lets make // the destructor block until all async operation are completed. // -// For that we'll need a 'mwcu::SharedResource' object held as a +// For that we'll need a 'bmqu::SharedResource' object held as a // data member of 'MyService'. The Object is initialized in the constructor. //.. // MyService::MyService(bdlmt::ThreadPool *threadPool) @@ -172,14 +172,14 @@ // So far so good. But what if we don't want the destructor to wait for async // operations to complete? In that case we might bind a weak pointer to the // async operation. Unfortunately, 'bind' doesn't work with weak pointers the -// same way it does with shared pointers. Helpfully, the 'mwcu' package -// provides an utility component 'mwcu_weakmemfn', that can help us with that. +// same way it does with shared pointers. Helpfully, the 'bmqu' package +// provides an utility component 'bmqu_weakmemfn', that can help us with that. //.. // void // MyService::asyncDoStuff() // { // // acquire the shared resource and bind to the async operation -// d_threadPool_p->enqueueJob(mwcu::WeakMemFnUtil::weakMemFn( +// d_threadPool_p->enqueueJob(bmqu::WeakMemFnUtil::weakMemFn( // &MyService::doStuff, // d_self.acquireWeak())); // } @@ -190,8 +190,6 @@ // an invocation of 'MyService::doStuff' in progress, the destructor of // 'MyService' will no block. -// MWC - // BDE #include #include @@ -211,7 +209,7 @@ namespace bslma { class SharedPtrRep; } -namespace mwcu { +namespace bmqu { template class SharedResourceFactoryDeleter; diff --git a/src/groups/mwc/mwcu/mwcu_sharedresource.t.cpp b/src/groups/bmq/bmqu/bmqu_sharedresource.t.cpp similarity index 86% rename from src/groups/mwc/mwcu/mwcu_sharedresource.t.cpp rename to src/groups/bmq/bmqu/bmqu_sharedresource.t.cpp index 99675a3f8..0585ae6eb 100644 --- a/src/groups/mwc/mwcu/mwcu_sharedresource.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_sharedresource.t.cpp @@ -13,15 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_sharedresource.t.cpp -*-C++-*- -#include +// bmqu_sharedresource.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include -// MWC -#include -#include +#include +#include // BDE #include @@ -53,7 +52,7 @@ class MyService { // Used to synchronize with async operations completion on // destruction. - mwcu::SharedResource d_self; + bmqu::SharedResource d_self; private: // PRIVATE MANIPULATORS @@ -104,7 +103,7 @@ void MyService::asyncDoStuff() { // acquire the shared resource and bind to the async operation d_threadPool_p->enqueueJob( - mwcu::WeakMemFnUtil::weakMemFn(&MyService::doStuff, + bmqu::WeakMemFnUtil::weakMemFn(&MyService::doStuff, d_self.acquireWeak())); } @@ -134,28 +133,28 @@ static void test1_resource_creators() // Ensure proper behavior of the creator methods. // // Plan: -// 1. Create a 'mwcu::SharedResource' managing no resource by default- -// constructing a 'mwcu::SharedResource'. Check that no memory was +// 1. Create a 'bmqu::SharedResource' managing no resource by default- +// constructing a 'bmqu::SharedResource'. Check that no memory was // allocated and that the resource is invalid. // -// 2. Create a 'mwcu::SharedResource' managing no resource by nullptr- -// constructing a 'mwcu::SharedResource'. Check that no memory was +// 2. Create a 'bmqu::SharedResource' managing no resource by nullptr- +// constructing a 'bmqu::SharedResource'. Check that no memory was // allocated and that the resource is invalid. // -// 3. Create a 'mwcu::SharedResource' managing a resource. Check that +// 3. Create a 'bmqu::SharedResource' managing a resource. Check that // memory was allocated and that the resource is valid and can be // acquired. Then destroy the object and check that all allocated // memory was released. // -// 4. Try create a 'mwcu::SharedResource' object specifying a resource, a +// 4. Try create a 'bmqu::SharedResource' object specifying a resource, a // deleter and an allocator that will throw on use. Check that the // deleter is used to free the resource. // // Testing: -// mwcu::SharedResource's default constructor -// mwcu::SharedResource's nullptr constructor -// mwcu::SharedResource's resource constructor -// mwcu::SharedResource's destructor +// bmqu::SharedResource's default constructor +// bmqu::SharedResource's nullptr constructor +// bmqu::SharedResource's resource constructor +// bmqu::SharedResource's destructor // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -167,7 +166,7 @@ static void test1_resource_creators() { // create shared resource - mwcu::SharedResource sharedResource(&alloc); + bmqu::SharedResource sharedResource(&alloc); // no memory allocated still ASSERT(alloc.numBytesInUse() == 0); @@ -184,7 +183,7 @@ static void test1_resource_creators() { // create shared resource - mwcu::SharedResource sharedResource(bsl::nullptr_t(), &alloc); + bmqu::SharedResource sharedResource(bsl::nullptr_t(), &alloc); // no memory allocated still ASSERT(alloc.numBytesInUse() == 0); @@ -203,7 +202,7 @@ static void test1_resource_creators() int resource = 42; // create shared resource - mwcu::SharedResource sharedResource(&resource, &alloc); + bmqu::SharedResource sharedResource(&resource, &alloc); // memory allocated ASSERT(alloc.numBytesInUse() != 0); @@ -238,7 +237,7 @@ static void test1_resource_creators() #endif if (!skipTest) { - typedef mwcu::SharedResourceFactoryDeleter + typedef bmqu::SharedResourceFactoryDeleter Deleter; // this allocator is used to allocate the shared state and will throw @@ -252,10 +251,10 @@ static void test1_resource_creators() int* resource = new (resourceFactory) int(42); ASSERT(resourceFactory.numBytesInUse() != 0); - // try to create a 'mwcu::SharedResource', which should fail + // try to create a 'bmqu::SharedResource', which should fail bool exceptionThrown = false; try { - mwcu::SharedResource sharedResource( + bmqu::SharedResource sharedResource( resource, Deleter(&resourceFactory), &badAlloc); @@ -290,15 +289,15 @@ static void test2_resource_acquire() // 'acquireWeak' return invalid pointers. // // Testing: -// mwcu::SharedResource::acquire -// mwcu::SharedResource::acquireWeak +// bmqu::SharedResource::acquire +// bmqu::SharedResource::acquireWeak // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; int resource = 42; // create shared resource - mwcu::SharedResource sharedResource(&resource, &alloc); + bmqu::SharedResource sharedResource(&resource, &alloc); // 1. acquire before invalidating { @@ -311,7 +310,7 @@ static void test2_resource_acquire() // 2. acquire while invalidating { - mwcex::SequentialContext context(&alloc); + bmqex::SequentialContext context(&alloc); int rc = context.start(); BSLS_ASSERT_OPT(rc == 0); @@ -320,7 +319,7 @@ static void test2_resource_acquire() // invalidate the resource from another thread context.executor().post( - bdlf::MemFnUtil::memFn(&mwcu::SharedResource::invalidate, + bdlf::MemFnUtil::memFn(&bmqu::SharedResource::invalidate, &sharedResource)); // wait till 'invalidate' starts executing @@ -364,7 +363,7 @@ static void test3_resource_invalidate() // that the resource is freed using the supplied deleter. // // Testing: -// mwcu::SharedResource::invalidate +// bmqu::SharedResource::invalidate // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -374,7 +373,7 @@ static void test3_resource_invalidate() int resource = 42; // create shared resource - mwcu::SharedResource sharedResource(&resource, &alloc); + bmqu::SharedResource sharedResource(&resource, &alloc); // invalidate it sharedResource.invalidate(); @@ -385,10 +384,10 @@ static void test3_resource_invalidate() // 2. invalidate used resource { - typedef mwcu::SharedResourceFactoryDeleter + typedef bmqu::SharedResourceFactoryDeleter Deleter; - mwcex::SequentialContext context(&alloc); + bmqex::SequentialContext context(&alloc); int rc = context.start(); BSLS_ASSERT_OPT(rc == 0); @@ -398,7 +397,7 @@ static void test3_resource_invalidate() ASSERT(resourceFactory.numBytesInUse() != 0); // create shared resource - mwcu::SharedResource sharedResource( + bmqu::SharedResource sharedResource( sleep, Deleter(&resourceFactory), &alloc); @@ -447,15 +446,15 @@ static void test4_resource_reset() // 4. Reset a non-empty resource to a non-empty state. Check that the // resource now manages the new target. // -// 5. Create a 'mwcu::SharedResource' object specifying a resource, a +// 5. Create a 'bmqu::SharedResource' object specifying a resource, a // deleter and an allocator that will throw on second use. Then try // reset the resource also supplying a second deleter, which should // fail. Check that the first resource was freed using the first // deleter, the second resource was feed using the second deleter, and -// the 'mwcu::SharedResource' object is left in managing no resource. +// the 'bmqu::SharedResource' object is left in managing no resource. // // Testing: -// mwcu::SharedResource::reset +// bmqu::SharedResource::reset // ------------------------------------------------------------------------ { bslma::TestAllocator alloc; @@ -463,7 +462,7 @@ static void test4_resource_reset() // 1. reset empty to empty { // create shared resource - mwcu::SharedResource sharedResource(&alloc); + bmqu::SharedResource sharedResource(&alloc); // reset it sharedResource.reset(); @@ -477,7 +476,7 @@ static void test4_resource_reset() int resource1 = 100; // create shared resource - mwcu::SharedResource sharedResource(&resource1, &alloc); + bmqu::SharedResource sharedResource(&resource1, &alloc); // reset it sharedResource.reset(); @@ -494,7 +493,7 @@ static void test4_resource_reset() int resource1 = 100; // create shared resource - mwcu::SharedResource sharedResource(&alloc); + bmqu::SharedResource sharedResource(&alloc); // reset it sharedResource.reset(&resource1); @@ -510,7 +509,7 @@ static void test4_resource_reset() int resource2 = 200; // create shared resource - mwcu::SharedResource sharedResource(&resource1, &alloc); + bmqu::SharedResource sharedResource(&resource1, &alloc); // reset it sharedResource.reset(&resource2); @@ -539,7 +538,7 @@ static void test4_resource_reset() #endif if (!skipTest) { - typedef mwcu::SharedResourceFactoryDeleter + typedef bmqu::SharedResourceFactoryDeleter Deleter; // this allocator is used to allocate the shared state and will @@ -557,8 +556,8 @@ static void test4_resource_reset() ASSERT(resourceFactory1.numBytesInUse() != 0); ASSERT(resourceFactory2.numBytesInUse() != 0); - // create a 'mwcu::SharedResource' - mwcu::SharedResource sharedResource( + // create a 'bmqu::SharedResource' + bmqu::SharedResource sharedResource( resource1, Deleter(&resourceFactory1), &onceAlloc); @@ -579,7 +578,7 @@ static void test4_resource_reset() ASSERT(resourceFactory1.numBytesInUse() == 0); ASSERT(resourceFactory2.numBytesInUse() == 0); - // the 'mwcu::SharedResource' is left invalid + // the 'bmqu::SharedResource' is left invalid ASSERT(!sharedResource.isValid()); } } @@ -589,7 +588,7 @@ static void test5_factoryDeleter() // FACTORY DELETER // // Concerns: -// Ensure proper behavior of the 'mwcu::SharedResourceFactoryDeleter' +// Ensure proper behavior of the 'bmqu::SharedResourceFactoryDeleter' // class. // // Plan: @@ -597,7 +596,7 @@ static void test5_factoryDeleter() // resource previously created using that allocator. // // Testing: -// mwcu::SharedResourceFactoryDeleter +// bmqu::SharedResourceFactoryDeleter // ------------------------------------------------------------------------ { // create factory and allocate resource @@ -608,7 +607,7 @@ static void test5_factoryDeleter() ASSERT(factory.numBytesInUse() != 0); // create deleter and free resource - mwcu::SharedResourceFactoryDeleter deleter( + bmqu::SharedResourceFactoryDeleter deleter( &factory); deleter(resource); @@ -622,16 +621,16 @@ static void test5_factoryDeleter() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { - // mwcu::SharedResource + // bmqu::SharedResource case 1: test1_resource_creators(); break; case 2: test2_resource_acquire(); break; case 3: test3_resource_invalidate(); break; case 4: test4_resource_reset(); break; - // mwcu::SharedResourceFactoryDeleter + // bmqu::SharedResourceFactoryDeleter case 5: test5_factoryDeleter(); break; default: { @@ -641,5 +640,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/mwcu_stringutil.cpp b/src/groups/bmq/bmqu/bmqu_stringutil.cpp similarity index 98% rename from src/groups/mwc/mwcu/mwcu_stringutil.cpp rename to src/groups/bmq/bmqu/bmqu_stringutil.cpp index 9e40c2b7e..a195a6f92 100644 --- a/src/groups/mwc/mwcu/mwcu_stringutil.cpp +++ b/src/groups/bmq/bmqu/bmqu_stringutil.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_stringutil.cpp -*-C++-*- -#include +// bmqu_stringutil.cpp -*-C++-*- +#include -#include +#include // BDE #include #include @@ -26,7 +26,7 @@ #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { namespace { /// Rearrange characters in place within the contiguous sequence indicated diff --git a/src/groups/mwc/mwcu/mwcu_stringutil.h b/src/groups/bmq/bmqu/bmqu_stringutil.h similarity index 93% rename from src/groups/mwc/mwcu/mwcu_stringutil.h rename to src/groups/bmq/bmqu/bmqu_stringutil.h index 2bd16cfbf..986268a28 100644 --- a/src/groups/mwc/mwcu/mwcu_stringutil.h +++ b/src/groups/bmq/bmqu/bmqu_stringutil.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_stringutil.h -*-C++-*- -#ifndef INCLUDED_MWCU_STRINGUTIL -#define INCLUDED_MWCU_STRINGUTIL +// bmqu_stringutil.h -*-C++-*- +#ifndef INCLUDED_BMQU_STRINGUTIL +#define INCLUDED_BMQU_STRINGUTIL //@PURPOSE: Provide utility functions for string manipulation. // //@CLASSES: -// mwcu::StringUtil: namespace for string manipulation utility functions. +// bmqu::StringUtil: namespace for string manipulation utility functions. // -//@DESCRIPTION: 'mwcu::StringUtil' provides a utility namespace for string +//@DESCRIPTION: 'bmqu::StringUtil' provides a utility namespace for string // manipulation functions. // BDE @@ -31,7 +31,7 @@ #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ================= // struct StringUtil diff --git a/src/groups/mwc/mwcu/mwcu_stringutil.t.cpp b/src/groups/bmq/bmqu/bmqu_stringutil.t.cpp similarity index 91% rename from src/groups/mwc/mwcu/mwcu_stringutil.t.cpp rename to src/groups/bmq/bmqu/bmqu_stringutil.t.cpp index 6e1a90280..b87bbc2b4 100644 --- a/src/groups/mwc/mwcu/mwcu_stringutil.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_stringutil.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_stringutil.t.cpp -*-C++-*- -#include +// bmqu_stringutil.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -28,7 +28,7 @@ using namespace bsl; // ---------------------------------------------------------------------------- static void test1_contains() // ------------------------------------------------------------------------ -// mwcu::StringUtil::contains +// bmqu::StringUtil::contains // // Concerns: // Ensure proper behavior of the 'contains' method. @@ -40,7 +40,7 @@ static void test1_contains() // Proper behavior of the 'contains(str, substr)' method. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("contains"); + bmqtst::TestHelper::printTestName("contains"); struct Test { int d_line; @@ -67,14 +67,14 @@ static void test1_contains() bsl::string str(test.d_str, s_allocator_p); ASSERT_EQ_D("line " << test.d_line, - mwcu::StringUtil::contains(str, test.d_substr), + bmqu::StringUtil::contains(str, test.d_substr), test.d_result); } } static void test2_startsWith() // ------------------------------------------------------------------------ -// mwcu::StringUtil::startsWith +// bmqu::StringUtil::startsWith // // Concerns: // Ensure proper behavior of the 'startsWith' method. @@ -86,7 +86,7 @@ static void test2_startsWith() // Proper behavior of the 'startsWith(str, prefix, offset)' method. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("startsWith"); + bmqtst::TestHelper::printTestName("startsWith"); struct Test { int d_line; @@ -117,7 +117,7 @@ static void test2_startsWith() << "from offset " << test.d_offset); ASSERT_EQ_D("line " << test.d_line, - mwcu::StringUtil::startsWith(test.d_str, + bmqu::StringUtil::startsWith(test.d_str, test.d_prefix, test.d_offset), test.d_result); @@ -126,7 +126,7 @@ static void test2_startsWith() static void test3_endsWith() // ------------------------------------------------------------------------ -// mwcu::StringUtil::endsWith +// bmqu::StringUtil::endsWith // // Concerns: // Ensure proper behavior of the 'endsWith' method. @@ -138,7 +138,7 @@ static void test3_endsWith() // Proper behavior of the 'endsWith(str, suffix)' method. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("endsWith"); + bmqtst::TestHelper::printTestName("endsWith"); struct Test { int d_line; @@ -164,14 +164,14 @@ static void test3_endsWith() << "ends with '" << test.d_suffix << "'"); ASSERT_EQ_D("line " << test.d_line, - mwcu::StringUtil::endsWith(test.d_str, test.d_suffix), + bmqu::StringUtil::endsWith(test.d_str, test.d_suffix), test.d_result); } } static void test4_trim() // ------------------------------------------------------------------------ -// mwcu::StringUtil::trim +// bmqu::StringUtil::trim // // Concerns: // Ensure proper behavior of the 'trim' method. @@ -183,7 +183,7 @@ static void test4_trim() // Proper behavior of the 'trim(str)' method. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("trim"); + bmqtst::TestHelper::printTestName("trim"); struct Test { int d_line; @@ -205,14 +205,14 @@ static void test4_trim() PVV(test.d_line << ": trimming '" << test.d_str << "'"); bsl::string input(test.d_str, s_allocator_p); - mwcu::StringUtil::trim(&input); + bmqu::StringUtil::trim(&input); ASSERT_EQ_D("line " << test.d_line, input, test.d_expected); } } static void test5_ltrim() // ------------------------------------------------------------------------ -// mwcu::StringUtil::ltrim +// bmqu::StringUtil::ltrim // // Concerns: // Ensure proper behavior of the 'ltrim' method. @@ -224,7 +224,7 @@ static void test5_ltrim() // Proper behavior of the 'ltrim(str)' method. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ltrim"); + bmqtst::TestHelper::printTestName("ltrim"); struct Test { int d_line; @@ -246,14 +246,14 @@ static void test5_ltrim() PVV(test.d_line << ": ltrimming '" << test.d_str << "'"); bsl::string input(test.d_str, s_allocator_p); - mwcu::StringUtil::ltrim(&input); + bmqu::StringUtil::ltrim(&input); ASSERT_EQ_D("line " << test.d_line, input, test.d_expected); } } static void test6_rtrim() // ------------------------------------------------------------------------ -// mwcu::StringUtil::rtrim +// bmqu::StringUtil::rtrim // // Concerns: // Ensure proper behavior of the 'rtrim' method. @@ -265,7 +265,7 @@ static void test6_rtrim() // Proper behavior of the 'rtrim(str)' method. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("rtrim"); + bmqtst::TestHelper::printTestName("rtrim"); struct Test { int d_line; @@ -287,14 +287,14 @@ static void test6_rtrim() PVV(test.d_line << ": rtrimming '" << test.d_str << "'"); bsl::string input(test.d_str, s_allocator_p); - mwcu::StringUtil::rtrim(&input); + bmqu::StringUtil::rtrim(&input); ASSERT_EQ_D("line " << test.d_line, input, test.d_expected); } } static void test7_strTokenizeRef() // ------------------------------------------------------------------------ -// mwcu::StringUtil::strTokenizeRef +// bmqu::StringUtil::strTokenizeRef // // Concerns: // Ensure proper behavior of the 'strTokenizeRef' method. @@ -307,10 +307,10 @@ static void test7_strTokenizeRef() // ------------------------------------------------------------------------ { s_ignoreCheckDefAlloc = true; - // The vector returned by 'mwcu::StringUtil::strTokenizeRef' uses the + // The vector returned by 'bmqu::StringUtil::strTokenizeRef' uses the // default allocator. - mwctst::TestHelper::printTestName("strTokenizeRef"); + bmqtst::TestHelper::printTestName("strTokenizeRef"); bsl::string string(s_allocator_p); bsl::vector tokens(s_allocator_p); @@ -344,7 +344,7 @@ static void test7_strTokenizeRef() PVV(test.d_line << ": tokenizing '" << test.d_input << "'"); bsl::string input(test.d_input, s_allocator_p); - tokens = mwcu::StringUtil::strTokenizeRef(input, test.d_delims); + tokens = bmqu::StringUtil::strTokenizeRef(input, test.d_delims); ASSERT_EQ_D("line " << test.d_line, tokens.size(), test.d_nbTokens); if (test.d_nbTokens >= 1) { @@ -361,7 +361,7 @@ static void test7_strTokenizeRef() static void test8_match() // ------------------------------------------------------------------------ -// mwcu::StringUtil::match +// bmqu::StringUtil::match // // Concerns: // Ensure proper behavior of the 'match' method. @@ -373,7 +373,7 @@ static void test8_match() // Proper behavior of the 'match(str, pattern)' method. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("match"); + bmqtst::TestHelper::printTestName("match"); struct Test { int d_line; @@ -451,20 +451,20 @@ static void test8_match() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; - PVV(test.d_line << ": matching '" << test.d_input << "'" - << " with '" << test.d_pattern << "'"); + PVV(test.d_line << ": matching '" << test.d_input << "'" << " with '" + << test.d_pattern << "'"); ASSERT_EQ_D("line " << test.d_line << ": when matching '" << test.d_input << "' against the pattern '" << test.d_pattern << "'", - mwcu::StringUtil::match(test.d_input, test.d_pattern), + bmqu::StringUtil::match(test.d_input, test.d_pattern), test.d_expected); } } static void test9_squeeze() // ------------------------------------------------------------------------ -// mwcu::StringUtil::squeeze +// bmqu::StringUtil::squeeze // // Concerns: // Ensure proper behavior of the 'squeeze' method. @@ -476,7 +476,7 @@ static void test9_squeeze() // Proper behavior of the 'squeeze(str, characters)' method. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("squeeze"); + bmqtst::TestHelper::printTestName("squeeze"); struct Test { int d_line; @@ -511,7 +511,7 @@ static void test9_squeeze() << test.d_characters << "\")"); ASSERT_EQ_D("line " << test.d_line, - mwcu::StringUtil::squeeze(&str, test.d_characters), + bmqu::StringUtil::squeeze(&str, test.d_characters), test.d_expected); } } @@ -522,7 +522,7 @@ static void test9_squeeze() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -541,5 +541,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/mwcu_tempdirectory.cpp b/src/groups/bmq/bmqu/bmqu_tempdirectory.cpp similarity index 84% rename from src/groups/mwc/mwcu/mwcu_tempdirectory.cpp rename to src/groups/bmq/bmqu/bmqu_tempdirectory.cpp index bcea3cd2e..1564e04df 100644 --- a/src/groups/mwc/mwcu/mwcu_tempdirectory.cpp +++ b/src/groups/bmq/bmqu/bmqu_tempdirectory.cpp @@ -13,19 +13,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_tempdirectory.cpp -*-C++-*- -#include +// bmqu_tempdirectory.cpp -*-C++-*- +#include -#include -// MWC -#include +#include + +#include // BDE #include #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ------------------- // class TempDirectory @@ -35,7 +35,7 @@ namespace mwcu { TempDirectory::TempDirectory(bslma::Allocator* basicAllocator) : d_path(basicAllocator) { - const bsl::string prefix = mwcu::TempUtil::tempDir(); + const bsl::string prefix = bmqu::TempUtil::tempDir(); int rc = bdls::FilesystemUtil::createTemporaryDirectory(&d_path, prefix); BSLS_ASSERT_OPT(rc == 0); diff --git a/src/groups/mwc/mwcu/mwcu_tempdirectory.h b/src/groups/bmq/bmqu/bmqu_tempdirectory.h similarity index 84% rename from src/groups/mwc/mwcu/mwcu_tempdirectory.h rename to src/groups/bmq/bmqu/bmqu_tempdirectory.h index 8f1caf19e..16f4ac886 100644 --- a/src/groups/mwc/mwcu/mwcu_tempdirectory.h +++ b/src/groups/bmq/bmqu/bmqu_tempdirectory.h @@ -13,24 +13,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_tempdirectory.h -*-C++-*- -#ifndef INCLUDED_MWCU_TEMPDIRECTORY -#define INCLUDED_MWCU_TEMPDIRECTORY +// bmqu_tempdirectory.h -*-C++-*- +#ifndef INCLUDED_BMQU_TEMPDIRECTORY +#define INCLUDED_BMQU_TEMPDIRECTORY //@PURPOSE: Provide a guard for creating a temporary directory. // //@CLASSES: -// mwcu::TempDirectory: Guard for a temporary directory +// bmqu::TempDirectory: Guard for a temporary directory // -//@SEE_ALSO: mwcu_temputil +//@SEE_ALSO: bmqu_temputil // -//@DESCRIPTION: This component provides a guard, 'mwcu::TempDirectory', that +//@DESCRIPTION: This component provides a guard, 'bmqu::TempDirectory', that // creates a directory in the effective temporary directory for the current // process whose name is randomly assigned to guarantee no collisions with // other directories or files in the effective temporary directory. The guarded -// directory is automatically removed when the 'mwcu::TempDirectory' object is +// directory is automatically removed when the 'bmqu::TempDirectory' object is // destroyed. For the definition of the effective temporary directory for the -// current process, see the mwcu_temputil component documentation. +// current process, see the bmqu_temputil component documentation. // /// Thread Safety ///------------- @@ -43,26 +43,24 @@ /// Usage Example 1: Creating a Temporary Directory ///- - - - - - - - - - - - - - - - - - - - - // This example shows how to create a temporary directory which is -// automatically deleted by a 'mwcu::TempDirectory' guard. +// automatically deleted by a 'bmqu::TempDirectory' guard. //.. // bsl::string dirPath; // { -// mwcu::TempDirectory tempDirectory; +// bmqu::TempDirectory tempDirectory; // dirPath = tempDirectory.path(); // } // // BSLS_ASSERT(!bdls::FileSystemUtil::exists(dirPath)); //.. -// MWC - // BDE #include #include #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // =================== // class TempDirectory diff --git a/src/groups/mwc/mwcu/mwcu_tempfile.cpp b/src/groups/bmq/bmqu/bmqu_tempfile.cpp similarity index 86% rename from src/groups/mwc/mwcu/mwcu_tempfile.cpp rename to src/groups/bmq/bmqu/bmqu_tempfile.cpp index 1bcf8460d..9f82710a5 100644 --- a/src/groups/mwc/mwcu/mwcu_tempfile.cpp +++ b/src/groups/bmq/bmqu/bmqu_tempfile.cpp @@ -13,19 +13,19 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_tempfile.cpp -*-C++-*- -#include +// bmqu_tempfile.cpp -*-C++-*- +#include -#include -// MWC -#include +#include + +#include // BDE #include #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // -------------- // class TempFile @@ -35,7 +35,7 @@ namespace mwcu { TempFile::TempFile(bslma::Allocator* basicAllocator) : d_path(basicAllocator) { - const bsl::string prefix = mwcu::TempUtil::tempDir(); + const bsl::string prefix = bmqu::TempUtil::tempDir(); bdls::FilesystemUtil::FileDescriptor descriptor = bdls::FilesystemUtil::createTemporaryFile(&d_path, prefix); diff --git a/src/groups/mwc/mwcu/mwcu_tempfile.h b/src/groups/bmq/bmqu/bmqu_tempfile.h similarity index 85% rename from src/groups/mwc/mwcu/mwcu_tempfile.h rename to src/groups/bmq/bmqu/bmqu_tempfile.h index ed036523d..5335e7f00 100644 --- a/src/groups/mwc/mwcu/mwcu_tempfile.h +++ b/src/groups/bmq/bmqu/bmqu_tempfile.h @@ -13,24 +13,24 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_tempfile.h -*-C++-*- -#ifndef INCLUDED_MWCU_TEMPFILE -#define INCLUDED_MWCU_TEMPFILE +// bmqu_tempfile.h -*-C++-*- +#ifndef INCLUDED_BMQU_TEMPFILE +#define INCLUDED_BMQU_TEMPFILE //@PURPOSE: Provide a guard for creating a temporary file. // //@CLASSES: -// mwcu::TempFile: Guard for a temporary file +// bmqu::TempFile: Guard for a temporary file // -//@SEE_ALSO: mwcu_temputil +//@SEE_ALSO: bmqu_temputil // -//@DESCRIPTION: This component provides a guard, 'mwcu::TempFile', that creates +//@DESCRIPTION: This component provides a guard, 'bmqu::TempFile', that creates // a file in the effective temporary directory for the current process whose // name is randomly assigned to guarantee no collisions with other directories // or files in the effective temporary directory. The guarded file is -// automatically removed when the 'mwcu::TempFile' object is destroyed. For +// automatically removed when the 'bmqu::TempFile' object is destroyed. For // the definition of the effective temporary directory for the current process, -// see the mwcu_temputil component documentation. +// see the bmqu_temputil component documentation. // /// Thread Safety ///------------- @@ -43,11 +43,11 @@ /// Usage Example 1: Creating a Temporary File ///- - - - - - - - - - - - - - - - - - - - - // This example shows how to create a temporary file which is automatically -// deleted by a 'mwcu::TemporaryFile' guard. +// deleted by a 'bmqu::TemporaryFile' guard. //.. // bsl::string filePath; // { -// mwcu::TempFile tempFile; +// bmqu::TempFile tempFile; // filePath = tempFile.path(); // // bsl::ofstream ofs(filePath.c_str()); @@ -59,15 +59,13 @@ // BSLS_ASSERT(!bdls::FileSystemUtil::exists(filePath)); //.. -// MWC - // BDE #include #include #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ============== // class TempFile diff --git a/src/groups/mwc/mwcu/mwcu_temputil.cpp b/src/groups/bmq/bmqu/bmqu_temputil.cpp similarity index 95% rename from src/groups/mwc/mwcu/mwcu_temputil.cpp rename to src/groups/bmq/bmqu/bmqu_temputil.cpp index 4ca698385..af97aeb37 100644 --- a/src/groups/mwc/mwcu/mwcu_temputil.cpp +++ b/src/groups/bmq/bmqu/bmqu_temputil.cpp @@ -13,10 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_temputil.cpp -*-C++-*- -#include +// bmqu_temputil.cpp -*-C++-*- +#include -#include +#include // BDE #include #include @@ -28,7 +28,7 @@ #endif namespace BloombergLP { -namespace mwcu { +namespace bmqu { // --------------- // struct TempUtil diff --git a/src/groups/mwc/mwcu/mwcu_temputil.h b/src/groups/bmq/bmqu/bmqu_temputil.h similarity index 90% rename from src/groups/mwc/mwcu/mwcu_temputil.h rename to src/groups/bmq/bmqu/bmqu_temputil.h index 3c669093b..598697852 100644 --- a/src/groups/mwc/mwcu/mwcu_temputil.h +++ b/src/groups/bmq/bmqu/bmqu_temputil.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_temputil.h -*-C++-*- -#ifndef INCLUDED_MWCU_TEMPUTIL -#define INCLUDED_MWCU_TEMPUTIL +// bmqu_temputil.h -*-C++-*- +#ifndef INCLUDED_BMQU_TEMPUTIL +#define INCLUDED_BMQU_TEMPUTIL //@PURPOSE: Provide an utility for resolving the effective temporary directory. // //@CLASSES: -// mwcu::TempUtil: Utilities for temporary directories and files. +// bmqu::TempUtil: Utilities for temporary directories and files. // -//@DESCRIPTION: This component provides an utility, 'mwcu::TempUtil', to +//@DESCRIPTION: This component provides an utility, 'bmqu::TempUtil', to // resolve the effective temporary directory. This directory is defined by one // of a set of environment variables, overriding each other in a pre-defined // order. The definition of the default effective temporary directory is @@ -48,13 +48,11 @@ ///------------- // This component is thread safe. -// MWC - // BDE #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // =============== // struct TempUtil diff --git a/src/groups/mwc/mwcu/mwcu_throttledaction.cpp b/src/groups/bmq/bmqu/bmqu_throttledaction.cpp similarity index 91% rename from src/groups/mwc/mwcu/mwcu_throttledaction.cpp rename to src/groups/bmq/bmqu/bmqu_throttledaction.cpp index 8aa0754c0..e730cf834 100644 --- a/src/groups/mwc/mwcu/mwcu_throttledaction.cpp +++ b/src/groups/bmq/bmqu/bmqu_throttledaction.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_throttledaction.cpp -*-C++-*- -#include +// bmqu_throttledaction.cpp -*-C++-*- +#include -#include +#include // BDE #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ---------------------------- // struct ThrottledActionParams diff --git a/src/groups/mwc/mwcu/mwcu_throttledaction.h b/src/groups/bmq/bmqu/bmqu_throttledaction.h similarity index 86% rename from src/groups/mwc/mwcu/mwcu_throttledaction.h rename to src/groups/bmq/bmqu/bmqu_throttledaction.h index 6cf76a665..755dfae85 100644 --- a/src/groups/mwc/mwcu/mwcu_throttledaction.h +++ b/src/groups/bmq/bmqu/bmqu_throttledaction.h @@ -13,20 +13,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_throttledaction.h -*-C++-*- -#ifndef INCLUDED_MWCU_THROTTLEDACTION -#define INCLUDED_MWCU_THROTTLEDACTION +// bmqu_throttledaction.h -*-C++-*- +#ifndef INCLUDED_BMQU_THROTTLEDACTION +#define INCLUDED_BMQU_THROTTLEDACTION //@PURPOSE: Provide macros and utilities to throttle an action. // //@CLASSES: -// mwcu::ThrottledActionParams: struct holding the state of a throttleable +// bmqu::ThrottledActionParams: struct holding the state of a throttleable // action. // //@MACROS: -// MWCU_THROTTLEDACTION_THROTTLE(P, ACTION): Reference below -// MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET(P, ACTION, RESET): Reference below -// MWCU_THROTTLEDACTION_THROTTLE_NO_RESET(P, ACTION): Reference below +// BMQU_THROTTLEDACTION_THROTTLE(P, ACTION): Reference below +// BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET(P, ACTION, RESET): Reference below +// BMQU_THROTTLEDACTION_THROTTLE_NO_RESET(P, ACTION): Reference below // //@DESCRIPTION: This component provides preprocessor macros and utility // functions to throttle a user specified action. A throttled action is a @@ -55,21 +55,21 @@ ///---------------- // This component defines the following macros: //.. -// MWCU_THROTTLEDACTION_THROTTLE(P, ACTION) +// BMQU_THROTTLEDACTION_THROTTLE(P, ACTION) // // Execute the specified 'ACTION' having the specified throttling // // parameters 'P' and use the default reset function. The default // // reset function will print a BALL_LOG_INFO having the name of the // // variable 'P' (to identify the throttled action) and the number of // // items that have been skipped since the last reset. // -// MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET(P, ACTION, RESET) +// BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET(P, ACTION, RESET) // // Execute the specified 'ACTION' having the specified throttling // // parameters 'P' and execute the specify 'RESET' code when the // // throttling gets reset. Inside the context of the 'RESET' code, the // // '_numSkipped' variable represents the number of times 'ACTION' has // // been skipped due to throttling since the last reset. // -// MWCU_THROTTLEDACTION_THROTTLE_NO_RESET(P, ACTION) +// BMQU_THROTTLEDACTION_THROTTLE_NO_RESET(P, ACTION) // // Execute the specified 'ACTION' having the specified throttling // // parameters 'P' and don't do anything for reset. //.. @@ -78,17 +78,15 @@ ///----------- // The following code fragments illustrate the standard pattern of macro usage. //.. -// mwcu::ThrottledActionParams myThrottledLog(5000, 3); // No more than 3 logs +// bmqu::ThrottledActionParams myThrottledLog(5000, 3); // No more than 3 logs // // in a 5s timeframe // // Note that the ThrottledActionParams should be a class member, or a // // static variable. // -// MWCU_THROTTLEDACTION_THROTTLE(myThrottledLog, +// BMQU_THROTTLEDACTION_THROTTLE(myThrottledLog, // BALL_LOG_ERROR << "An error occurred"); //.. -// MWC - // BDE #include #include @@ -96,7 +94,7 @@ #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ============================ // struct ThrottledActionParams @@ -125,7 +123,7 @@ struct ThrottledActionParams { // CREATORS - /// Helper constructor to create a `mwcu::ThrottledActionParams` object + /// Helper constructor to create a `bmqu::ThrottledActionParams` object /// defining an action that should be executed at most the specified /// `maxCountPerInterval` times during the specified `intervalMs` /// milliseconds time frame. @@ -137,8 +135,8 @@ struct ThrottledActionParams { // MACROS // ====== -#define MWCU_THROTTLEDACTION_THROTTLE(P, ACTION) \ - MWCU_THROTTLEDACTION_THROTTLE_INTERNAL(P, ACTION, { \ +#define BMQU_THROTTLEDACTION_THROTTLE(P, ACTION) \ + BMQU_THROTTLEDACTION_THROTTLE_INTERNAL(P, ACTION, { \ BALL_LOG_INFO << "THROTTLED_ACTION - resetting throttling " \ << "counter '" << #P << "' (" << _numSkipped \ << " actions skipped)."; \ @@ -147,19 +145,19 @@ struct ThrottledActionParams { // use a standard 'RESET' action that displays a BALL_LOG_INFO of the // number of times 'ACTION' got skipped due to throttling. -#define MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET(P, ACTION, RESET) \ - MWCU_THROTTLEDACTION_THROTTLE_INTERNAL(P, ACTION, RESET) +#define BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET(P, ACTION, RESET) \ + BMQU_THROTTLEDACTION_THROTTLE_INTERNAL(P, ACTION, RESET) // Throttle the specified 'ACTION' using the specified parameters 'P' and // use the specified 'RESET' code. The variable '_numSkipped' can be used // inside the 'RESET' code to reference the number of times 'ACTION' got // skipped due to throttling. -#define MWCU_THROTTLEDACTION_THROTTLE_NO_RESET(P, ACTION) \ - MWCU_THROTTLEDACTION_THROTTLE_INTERNAL(P, ACTION, {}) +#define BMQU_THROTTLEDACTION_THROTTLE_NO_RESET(P, ACTION) \ + BMQU_THROTTLEDACTION_THROTTLE_INTERNAL(P, ACTION, {}) // Throttle the specified 'ACTION' using the specified parameters 'P' and // use a void reset action. -#define MWCU_THROTTLEDACTION_THROTTLE_INTERNAL(P, ACTION, RESET) \ +#define BMQU_THROTTLEDACTION_THROTTLE_INTERNAL(P, ACTION, RESET) \ { \ const bsls::Types::Int64 _now = \ BloombergLP::bsls::TimeUtil::getTimer(); \ diff --git a/src/groups/mwc/mwcu/mwcu_throttledaction.t.cpp b/src/groups/bmq/bmqu/bmqu_throttledaction.t.cpp similarity index 82% rename from src/groups/mwc/mwcu/mwcu_throttledaction.t.cpp rename to src/groups/bmq/bmqu/bmqu_throttledaction.t.cpp index 9b94eafb8..e5bfb4530 100644 --- a/src/groups/mwc/mwcu/mwcu_throttledaction.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_throttledaction.t.cpp @@ -13,11 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_throttledaction.t.cpp -*-C++-*- -#include +// bmqu_throttledaction.t.cpp -*-C++-*- +#include -// MWC -#include +#include // BDE #include @@ -29,7 +28,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -41,7 +40,7 @@ using namespace bsl; namespace { -const char k_LOG_CATEGORY[] = "MWCU.THROTTLEDACTION.TESTDRIVER"; +const char k_LOG_CATEGORY[] = "BMQU.THROTTLEDACTION.TESTDRIVER"; /// Increment the specified `n` by one. static void incrementInteger(int* n) @@ -75,16 +74,16 @@ static void test1_breathingTest() // Exercise the basic functionality of the component. // // Plan: -// 1. Instantiate an 'mwcu::ThrottledActionParams' with parameters and +// 1. Instantiate an 'bmqu::ThrottledActionParams' with parameters and // verify expected state. -// 2. Do a 'MWCU_THROTTLEDACTION_THROTTLE' and ensure the specified +// 2. Do a 'BMQU_THROTTLEDACTION_THROTTLE' and ensure the specified // 'ACTION' was executed. // // Testing: // ThrottledActionParams // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); BALL_LOG_SET_CATEGORY(k_LOG_CATEGORY); @@ -92,11 +91,11 @@ static void test1_breathingTest() const int k_INTERVAL_MS = 2000; const int k_MAX_COUNT_PER_INTERVAL = 3; - // 1. Instantiate an 'mwcu::ThrottledActionParams' with parameters and + // 1. Instantiate an 'bmqu::ThrottledActionParams' with parameters and // verify expected state. // No more than 3 logs in a 5s timeframe - mwcu::ThrottledActionParams obj(k_INTERVAL_MS, k_MAX_COUNT_PER_INTERVAL); + bmqu::ThrottledActionParams obj(k_INTERVAL_MS, k_MAX_COUNT_PER_INTERVAL); ASSERT_EQ(obj.d_intervalNano, k_INTERVAL_MS * bdlt::TimeUnitRatio::k_NANOSECONDS_PER_MILLISECOND); @@ -104,10 +103,10 @@ static void test1_breathingTest() ASSERT_EQ(obj.d_countSinceLastReset, 0); ASSERT_GE(obj.d_lastResetTime, 0); - // 2. Do a 'MWCU_THROTTLEDACTION_THROTTLE' and ensure the specified + // 2. Do a 'BMQU_THROTTLEDACTION_THROTTLE' and ensure the specified // 'ACTION' was executed. int n = 0; - MWCU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); + BMQU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); ASSERT_EQ(n, 1); ASSERT_EQ(obj.d_intervalNano, @@ -129,38 +128,38 @@ static void test2_throttleNoReset() // 2. Throttling with no reset action does nothing upon reset. // // Plan: -// 1. Do a 'MWCU_THROTTLEDACTION_THROTTLE_NO_RESET' up to and including +// 1. Do a 'BMQU_THROTTLEDACTION_THROTTLE_NO_RESET' up to and including // the maximum number of times (within the specified time interval) // and ensure that the specified 'ACTION' was executed exactly the // maximum number of times. -// 2. Do more 'MWCU_THROTTLEDACTION_THROTTLE_NO_RESET' (withing the +// 2. Do more 'BMQU_THROTTLEDACTION_THROTTLE_NO_RESET' (withing the // specified time interval) and ensure that the specified 'ACTION' was // *not* executed and nor reset action was taken. // 3. Wait until the specified time interval elapses (as determined by // 'bsls::TimeUtil::getTimer') and repeat steps 1-2 above. // // Testing: -// MWCU_THROTTLEDACTION_THROTTLE_NO_RESET(P, ACTION) +// BMQU_THROTTLEDACTION_THROTTLE_NO_RESET(P, ACTION) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("THROTTLE NO RESET"); + bmqtst::TestHelper::printTestName("THROTTLE NO RESET"); // CONSTANTS const int k_INTERVAL_MS = 2000; const int k_MAX_COUNT_PER_INTERVAL = 3; - mwctst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); + bmqtst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); // No more than 3 logs in a 5s timeframe - mwcu::ThrottledActionParams obj(k_INTERVAL_MS, k_MAX_COUNT_PER_INTERVAL); + bmqu::ThrottledActionParams obj(k_INTERVAL_MS, k_MAX_COUNT_PER_INTERVAL); - // 1. Do a 'MWCU_THROTTLEDACTION_THROTTLE_NO_RESET' up to and including the + // 1. Do a 'BMQU_THROTTLEDACTION_THROTTLE_NO_RESET' up to and including the // maximum number of times (within the specified time interval) and // ensure that the specified 'ACTION' was executed exactly the maximum // number of times. int n = 0; for (int i = 0; i < k_MAX_COUNT_PER_INTERVAL; ++i) { - MWCU_THROTTLEDACTION_THROTTLE_NO_RESET(obj, incrementInteger(&n)); + BMQU_THROTTLEDACTION_THROTTLE_NO_RESET(obj, incrementInteger(&n)); } ASSERT_EQ(n, k_MAX_COUNT_PER_INTERVAL); @@ -171,11 +170,11 @@ static void test2_throttleNoReset() ASSERT_EQ(obj.d_countSinceLastReset, k_MAX_COUNT_PER_INTERVAL); ASSERT_GE(obj.d_lastResetTime, 0LL); - // 2. Do more 'MWCU_THROTTLEDACTION_THROTTLE_NO_RESET' (withing the + // 2. Do more 'BMQU_THROTTLEDACTION_THROTTLE_NO_RESET' (withing the // specified time interval) and ensure that the specified 'ACTION' was // *not* executed and no reset action was taken. - MWCU_THROTTLEDACTION_THROTTLE_NO_RESET(obj, incrementInteger(&n)); - MWCU_THROTTLEDACTION_THROTTLE_NO_RESET(obj, incrementInteger(&n)); + BMQU_THROTTLEDACTION_THROTTLE_NO_RESET(obj, incrementInteger(&n)); + BMQU_THROTTLEDACTION_THROTTLE_NO_RESET(obj, incrementInteger(&n)); ASSERT_EQ(n, k_MAX_COUNT_PER_INTERVAL); // 'n' is unchanged @@ -193,13 +192,13 @@ static void test2_throttleNoReset() now = BloombergLP::bsls::TimeUtil::getTimer(); } - // Do a 'MWCU_THROTTLEDACTION_THROTTLE_NO_RESET' up to and including the + // Do a 'BMQU_THROTTLEDACTION_THROTTLE_NO_RESET' up to and including the // maximum number of times (within the specified time interval) and // ensure that the specified 'ACTION' was executed exactly the maximum // number of times. n = 0; for (int i = 0; i < k_MAX_COUNT_PER_INTERVAL; ++i) { - MWCU_THROTTLEDACTION_THROTTLE_NO_RESET(obj, incrementInteger(&n)); + BMQU_THROTTLEDACTION_THROTTLE_NO_RESET(obj, incrementInteger(&n)); } ASSERT_EQ(logObserver.records().size(), @@ -212,11 +211,11 @@ static void test2_throttleNoReset() ASSERT_EQ(obj.d_countSinceLastReset, k_MAX_COUNT_PER_INTERVAL); ASSERT_GT(obj.d_lastResetTime, 0); - // Do more 'MWCU_THROTTLEDACTION_THROTTLE_NO_RESET' (withing the specified + // Do more 'BMQU_THROTTLEDACTION_THROTTLE_NO_RESET' (withing the specified // time interval) and ensure that the specified 'ACTION' was *not* executed // and no reset action was taken. - MWCU_THROTTLEDACTION_THROTTLE_NO_RESET(obj, incrementInteger(&n)); - MWCU_THROTTLEDACTION_THROTTLE_NO_RESET(obj, incrementInteger(&n)); + BMQU_THROTTLEDACTION_THROTTLE_NO_RESET(obj, incrementInteger(&n)); + BMQU_THROTTLEDACTION_THROTTLE_NO_RESET(obj, incrementInteger(&n)); ASSERT_EQ(logObserver.records().size(), 0U); // Nothing was logged on reset @@ -239,16 +238,16 @@ static void test3_throttleWithDefaultReset() // 'ACTION' no more than the specified number of times during the // specified time interval. // 2. Upon reset, the default reset function should print a BALL_LOG_INFO -// having the name of the 'mwcu::ThrottledActionParams' variable and +// having the name of the 'bmqu::ThrottledActionParams' variable and // the number of items that have been skipped since last reset. // // Plan: -// 1. Do a 'MWCU_THROTTLEDACTION_THROTTLE' up to and including the +// 1. Do a 'BMQU_THROTTLEDACTION_THROTTLE' up to and including the // maximum number of times (within the specified time interval) and // ensure that the specified 'ACTION' was executed exactly the // maximum number of times and the default reset function was not // called. -// 2. Do more 'MWCU_THROTTLEDACTION_THROTTLE' (withing the specified time +// 2. Do more 'BMQU_THROTTLEDACTION_THROTTLE' (withing the specified time // interval) and ensure that the specified 'ACTION' was *not* executed // and nor was the default reset function called. // 3. Wait until the specified time interval elapses (as determined by @@ -257,14 +256,14 @@ static void test3_throttleWithDefaultReset() // invoked. // // Testing: -// MWCU_THROTTLEDACTION_THROTTLE(P, ACTION) +// BMQU_THROTTLEDACTION_THROTTLE(P, ACTION) // ------------------------------------------------------------------------ { s_ignoreCheckDefAlloc = true; // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("THROTTLE WITH DEFAULT RESET"); + bmqtst::TestHelper::printTestName("THROTTLE WITH DEFAULT RESET"); BALL_LOG_SET_CATEGORY(k_LOG_CATEGORY); @@ -272,19 +271,19 @@ static void test3_throttleWithDefaultReset() const int k_INTERVAL_MS = 2000; const int k_MAX_COUNT_PER_INTERVAL = 3; - mwctst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); + bmqtst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); // No more than 3 logs in a 5s timeframe - mwcu::ThrottledActionParams obj(k_INTERVAL_MS, k_MAX_COUNT_PER_INTERVAL); + bmqu::ThrottledActionParams obj(k_INTERVAL_MS, k_MAX_COUNT_PER_INTERVAL); - // 1. Do a 'MWCU_THROTTLEDACTION_THROTTLE' up to and including the + // 1. Do a 'BMQU_THROTTLEDACTION_THROTTLE' up to and including the // maximum number of times (within the specified time interval) // and ensure that the specified 'ACTION' was executed exactly the // maximum number of times and the default reset function was not // called. int n = 0; for (int i = 0; i < k_MAX_COUNT_PER_INTERVAL; ++i) { - MWCU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); + BMQU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); } ASSERT_EQ(n, k_MAX_COUNT_PER_INTERVAL); @@ -295,11 +294,11 @@ static void test3_throttleWithDefaultReset() ASSERT_EQ(obj.d_countSinceLastReset, k_MAX_COUNT_PER_INTERVAL); ASSERT_GE(obj.d_lastResetTime, 0); - // 2. Do more 'MWCU_THROTTLEDACTION_THROTTLE' (withing the specified time + // 2. Do more 'BMQU_THROTTLEDACTION_THROTTLE' (withing the specified time // interval) and ensure that the specified 'ACTION' was *not* executed // and nor was the default reset function called. - MWCU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); - MWCU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); + BMQU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); + BMQU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); ASSERT_EQ(logObserver.records().size(), 0U); ASSERT_EQ(n, k_MAX_COUNT_PER_INTERVAL); @@ -318,19 +317,19 @@ static void test3_throttleWithDefaultReset() now = BloombergLP::bsls::TimeUtil::getTimer(); } - // Do a 'MWCU_THROTTLEDACTION_THROTTLE' up to and including the maximum + // Do a 'BMQU_THROTTLEDACTION_THROTTLE' up to and including the maximum // number of times (within the specified time interval) and ensure that the // specified 'ACTION' was executed exactly the maximum number of times. n = 0; for (int i = 0; i < k_MAX_COUNT_PER_INTERVAL; ++i) { - MWCU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); + BMQU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); } // Ensure the default reset function was invoked. if (s_verbosityLevel >= 1) { ASSERT_EQ(logObserver.records().size(), 1U); PV("Logged during reset: " << logObserver.records()[0]); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( logObserver.records()[0], "'obj'.*2", s_allocator_p)); @@ -343,11 +342,11 @@ static void test3_throttleWithDefaultReset() ASSERT_EQ(obj.d_countSinceLastReset, k_MAX_COUNT_PER_INTERVAL); ASSERT_GT(obj.d_lastResetTime, 0LL); - // Do more 'MWCU_THROTTLEDACTION_THROTTLE' (withing the specified time + // Do more 'BMQU_THROTTLEDACTION_THROTTLE' (withing the specified time // interval) and ensure that the specified 'ACTION' was *not* executed // and no additional reset action was taken. - MWCU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); - MWCU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); + BMQU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); + BMQU_THROTTLEDACTION_THROTTLE(obj, incrementInteger(&n)); if (s_verbosityLevel >= 1) { ASSERT_EQ(logObserver.records().size(), 1U); @@ -373,12 +372,12 @@ static void test4_throttleWithCustomReset() // 2. Upon reset, the custom reset action is performed. // // Plan: -// 1. Do a 'MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET' up to and including +// 1. Do a 'BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET' up to and including // the maximum number of times (within the specified time interval) // and ensure that the specified 'ACTION' was executed exactly the // maximum number of times and the custom reset action was not // performed. -// 2. Do more 'MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET' (within the +// 2. Do more 'BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET' (within the // specified time interval) and ensure that the specified 'ACTION' was // *not* executed and nor was the custom reset action performed. // 3. Wait until the specified time interval elapses (as determined by @@ -387,31 +386,31 @@ static void test4_throttleWithCustomReset() // performed. // // Testing: -// MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET(P, ACTION) +// BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET(P, ACTION) // ------------------------------------------------------------------------ { s_ignoreCheckDefAlloc = true; // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("THROTTLE WITH CUSTOM RESET"); + bmqtst::TestHelper::printTestName("THROTTLE WITH CUSTOM RESET"); // CONSTANTS const int k_INTERVAL_MS = 2000; const int k_MAX_COUNT_PER_INTERVAL = 3; - mwctst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); + bmqtst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); // No more than 3 logs in a 5s timeframe - mwcu::ThrottledActionParams obj(k_INTERVAL_MS, k_MAX_COUNT_PER_INTERVAL); + bmqu::ThrottledActionParams obj(k_INTERVAL_MS, k_MAX_COUNT_PER_INTERVAL); - // 1. Do a 'MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET' up to and including + // 1. Do a 'BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET' up to and including // the maximum number of times (within the specified time interval) // and ensure that the specified 'ACTION' was executed exactly the // maximum number of times and the custom reset function was not called. int n = 0; for (int i = 0; i < k_MAX_COUNT_PER_INTERVAL; ++i) { - MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET(obj, + BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET(obj, incrementInteger(&n), resetInteger(&n)); } @@ -424,13 +423,13 @@ static void test4_throttleWithCustomReset() ASSERT_EQ(obj.d_countSinceLastReset, k_MAX_COUNT_PER_INTERVAL); ASSERT_GE(obj.d_lastResetTime, 0LL); - // 2. Do more 'MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET' (within the + // 2. Do more 'BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET' (within the // specified time interval) and ensure that the specified 'ACTION' was // *not* executed and nor was the custom reset action performed. - MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET(obj, + BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET(obj, incrementInteger(&n), resetInteger(&n)); - MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET(obj, + BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET(obj, incrementInteger(&n), resetInteger(&n)); @@ -452,12 +451,12 @@ static void test4_throttleWithCustomReset() now = BloombergLP::bsls::TimeUtil::getTimer(); } - // 1. Do a 'MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET' up to and including + // 1. Do a 'BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET' up to and including // the maximum number of times (within the specified time interval) // and ensure that the specified 'ACTION' was executed exactly the // maximum number of times and the custom reset function was not called. for (int i = 0; i < k_MAX_COUNT_PER_INTERVAL; ++i) { - MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET(obj, + BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET(obj, incrementInteger(&n), resetInteger(&n)); } @@ -475,13 +474,13 @@ static void test4_throttleWithCustomReset() ASSERT_EQ(obj.d_countSinceLastReset, k_MAX_COUNT_PER_INTERVAL); ASSERT_GT(obj.d_lastResetTime, 0LL); - // Do more 'MWCU_THROTTLEDACTION_THROTTLE' (withing the specified time + // Do more 'BMQU_THROTTLEDACTION_THROTTLE' (withing the specified time // interval) and ensure that the specified 'ACTION' was *not* executed // and no additional reset action was taken. - MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET(obj, + BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET(obj, incrementInteger(&n), resetInteger(&n)); - MWCU_THROTTLEDACTION_THROTTLE_WITH_RESET(obj, + BMQU_THROTTLEDACTION_THROTTLE_WITH_RESET(obj, incrementInteger(&n), resetInteger(&n)); @@ -503,7 +502,7 @@ static void test4_throttleWithCustomReset() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bsls::TimeUtil::initialize(); @@ -519,5 +518,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/mwcu_tlsbool.cpp b/src/groups/bmq/bmqu/bmqu_tlsbool.cpp similarity index 84% rename from src/groups/mwc/mwcu/mwcu_tlsbool.cpp rename to src/groups/bmq/bmqu/bmqu_tlsbool.cpp index 0c06ac3a5..b026b68ff 100644 --- a/src/groups/mwc/mwcu/mwcu_tlsbool.cpp +++ b/src/groups/bmq/bmqu/bmqu_tlsbool.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_tlsbool.cpp -*-C++-*- -#include +// bmqu_tlsbool.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcu { +namespace bmqu { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcu/mwcu_tlsbool.h b/src/groups/bmq/bmqu/bmqu_tlsbool.h similarity index 96% rename from src/groups/mwc/mwcu/mwcu_tlsbool.h rename to src/groups/bmq/bmqu/bmqu_tlsbool.h index d10098b4d..a79198d25 100644 --- a/src/groups/mwc/mwcu/mwcu_tlsbool.h +++ b/src/groups/bmq/bmqu/bmqu_tlsbool.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_tlsbool.h -*-C++-*- -#ifndef INCLUDED_MWCU_TLSBOOL -#define INCLUDED_MWCU_TLSBOOL +// bmqu_tlsbool.h -*-C++-*- +#ifndef INCLUDED_BMQU_TLSBOOL +#define INCLUDED_BMQU_TLSBOOL //@PURPOSE: Provide a mechanism representing a boolean in ThreadLocalStorage. // //@CLASSES: -// mwcu::TLSBool: mechanism representing a boolean value in ThreadLocalStorage +// bmqu::TLSBool: mechanism representing a boolean value in ThreadLocalStorage // -//@DESCRIPTION: 'mwcu::TLSBool' is a mechanism representing a boolean value, +//@DESCRIPTION: 'bmqu::TLSBool' is a mechanism representing a boolean value, // stored in ThreadLocalStorage (that is a bool having a value per thread), // using the POSIX compliant pthread 'specifics' functionality. // @@ -42,8 +42,6 @@ ///- - - - - - - - // TBD: -// MWC - // BDE #include #include @@ -52,7 +50,7 @@ #include namespace BloombergLP { -namespace mwcu { +namespace bmqu { // ============= // class TLSBool diff --git a/src/groups/mwc/mwcu/mwcu_tlsbool.t.cpp b/src/groups/bmq/bmqu/bmqu_tlsbool.t.cpp similarity index 91% rename from src/groups/mwc/mwcu/mwcu_tlsbool.t.cpp rename to src/groups/bmq/bmqu/bmqu_tlsbool.t.cpp index 9fb4d7813..84ea2ac15 100644 --- a/src/groups/mwc/mwcu/mwcu_tlsbool.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_tlsbool.t.cpp @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_tlsbool.t.cpp -*-C++-*- -#include +// bmqu_tlsbool.t.cpp -*-C++-*- +#include // BDE #include @@ -26,7 +26,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -42,7 +42,7 @@ namespace { /// for synchronization with the other thread. static void threadFunction(bslmt::Barrier* barrier, const bsl::vector& values, - mwcu::TLSBool* obj) + bmqu::TLSBool* obj) { // Make sure value is default initialized to 'false' ASSERT_EQ(*obj, false); @@ -75,12 +75,12 @@ static void threadFunction(bslmt::Barrier* barrier, static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { PV("Testing default constructor"); - mwcu::TLSBool obj; + bmqu::TLSBool obj; ASSERT_EQ(obj.isValid(), true); // Initialized to false by default @@ -102,7 +102,7 @@ static void test1_breathingTest() { PV("Testing constructor with 'false' value"); - mwcu::TLSBool obj(false); + bmqu::TLSBool obj(false); ASSERT_EQ(obj.isValid(), true); // Initialized to false by default @@ -124,7 +124,7 @@ static void test1_breathingTest() { PV("Testing constructor with 'true' value"); - mwcu::TLSBool obj(true); + bmqu::TLSBool obj(true); ASSERT_EQ(obj.isValid(), true); // Initialized to true by default @@ -146,7 +146,7 @@ static void test1_breathingTest() static void test2_isValid() { - mwctst::TestHelper::printTestName("TESTING IS VALID"); + bmqtst::TestHelper::printTestName("TESTING IS VALID"); // MemorySanitizer links with libc++, which allocates a pthread-key at time // of first exception. Forcing an exception here prevents a fatal error @@ -158,8 +158,8 @@ static void test2_isValid() catch (int) { }; - // Test isValid and default values. There is a limit of - // PTHREAD_KEYS_MAX (1024 on Linux) keys that can be created. + // Test isValid and default values. There is a limit of + // PTHREAD_KEYS_MAX (1024 on Linux) keys that can be created. #if !defined PTHREAD_KEYS_MAX // Somehow, some platforms (e.g., SunOs) don't define that variable so skip @@ -216,14 +216,14 @@ static void test2_isValid() // ASSERT, so skip that check on those platforms. { // Constructor without a value, should assert - ASSERT_OPT_FAIL(mwcu::TLSBool obj); - ASSERT_OPT_FAIL(mwcu::TLSBool obj(true)); + ASSERT_OPT_FAIL(bmqu::TLSBool obj); + ASSERT_OPT_FAIL(bmqu::TLSBool obj(true)); } #endif { PV("Invalid TLSBool with Initial default value of 'true'"); - mwcu::TLSBool obj(true, true); + bmqu::TLSBool obj(true, true); ASSERT_EQ(obj.isValid(), false); // Initialized to true @@ -241,7 +241,7 @@ static void test2_isValid() { PV("Invalid TLSBool with Initial default value of 'false'"); - mwcu::TLSBool obj(true, false); + bmqu::TLSBool obj(true, false); ASSERT_EQ(obj.isValid(), false); // Initialized to true @@ -273,10 +273,10 @@ static void test3_multithread() // 'bslmt::ThreadUtil::create()' uses the global allocator to allocate // memory. - mwctst::TestHelper::printTestName("MULTITHREAD"); + bmqtst::TestHelper::printTestName("MULTITHREAD"); bslmt::Barrier barrier(2); - mwcu::TLSBool obj; + bmqu::TLSBool obj; bslmt::ThreadGroup threadGroup(s_allocator_p); @@ -310,7 +310,7 @@ static void test3_multithread() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -323,5 +323,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/mwcu_weakmemfn.cpp b/src/groups/bmq/bmqu/bmqu_weakmemfn.cpp similarity index 84% rename from src/groups/mwc/mwcu/mwcu_weakmemfn.cpp rename to src/groups/bmq/bmqu/bmqu_weakmemfn.cpp index 26ca93eb0..15616b0a7 100644 --- a/src/groups/mwc/mwcu/mwcu_weakmemfn.cpp +++ b/src/groups/bmq/bmqu/bmqu_weakmemfn.cpp @@ -13,13 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_weakmemfn.cpp -*-C++-*- -#include +// bmqu_weakmemfn.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwcu { +namespace bmqu { } // close package namespace } // close enterprise namespace diff --git a/src/groups/mwc/mwcu/mwcu_weakmemfn.h b/src/groups/bmq/bmqu/bmqu_weakmemfn.h similarity index 98% rename from src/groups/mwc/mwcu/mwcu_weakmemfn.h rename to src/groups/bmq/bmqu/bmqu_weakmemfn.h index 504deef62..9da452167 100644 --- a/src/groups/mwc/mwcu/mwcu_weakmemfn.h +++ b/src/groups/bmq/bmqu/bmqu_weakmemfn.h @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_weakmemfn.h -*-C++-*- -#ifndef INCLUDED_MWCU_WEAKMEMFN -#define INCLUDED_MWCU_WEAKMEMFN +// bmqu_weakmemfn.h -*-C++-*- +#ifndef INCLUDED_BMQU_WEAKMEMFN +#define INCLUDED_BMQU_WEAKMEMFN //@PURPOSE: Provides a wrapper type for invoking member functions on a weak_ptr // //@CLASSES: -// mwcu::WeakMemFn: mem. fn. wrapper -// mwcu::WeakMemFnInstance: mem. fn. wrapper with embedded instance pointer -// mwcu::WeakMemFnResult: result of a mem. fn. wrapper invocation -// mwcu::WeakMemFnUtil: utility for constructing wrapper objects +// bmqu::WeakMemFn: mem. fn. wrapper +// bmqu::WeakMemFnInstance: mem. fn. wrapper with embedded instance pointer +// bmqu::WeakMemFnResult: result of a mem. fn. wrapper invocation +// bmqu::WeakMemFnUtil: utility for constructing wrapper objects // //@DESCRIPTION: // This component provides a member function pointer wrapper that wraps a @@ -32,7 +32,7 @@ // each supporting member function pointers that accept from zero to nine // arguments are provided, as well as a utility to create such wrappers. // -// The first wrapper, 'mwcu::WeakMemFn', contains a member function pointer and +// The first wrapper, 'bmqu::WeakMemFn', contains a member function pointer and // must be invoked with the first argument being a weak pointer to the instance // on which the function should be invoked, with the remaining arguments passed // as arguments to the member function; that is, a wrapper 'weakMemFn' @@ -43,28 +43,28 @@ // on that shared pointer as if by 'objPtr->memberFunction(args...)'. // Otherwise, the member function is not invoked. // -// The second wrapper, 'mwcu::WeakMemFnInstance', contains both the member +// The second wrapper, 'bmqu::WeakMemFnInstance', contains both the member // function pointer and a weak pointer to an instance of the type which // contains the member, and is invoked with arguments which are passed as // arguments to the member function; that is, a wrapper 'weakMemFnInstance' // containing pointers to both, a given 'memberFunction' and to an 'object' // instance can be invoked as 'weakMemFnInstance(args...)', which results in -// the exact same behavior as described for 'mwcu::WeakMemFn'. +// the exact same behavior as described for 'bmqu::WeakMemFn'. // -// The result of a 'mwcu::WeakMemFn' or 'mwcu::WeakMemFnInstance' wrapper -// invocation is represented by an instance of 'mwcu::WeakMemFnResult'. This +// The result of a 'bmqu::WeakMemFn' or 'bmqu::WeakMemFnInstance' wrapper +// invocation is represented by an instance of 'bmqu::WeakMemFnResult'. This // class is semantically similar to 'bdlb::NullableValue' (or 'std::optional'), // but also supports 'void' and reference value types. Like a nullable value, // the state of such object may be either null, or not null (i.e. contain the // invocation result), depending on whether the target object's weak pointer // has expired or not. // -// Finally, the 'mwcu::WeakMemFnUtil' utility class provides utility functions -// for constructing 'mwcu::WeakMemFn' and 'mwcu::WeakMemFnInstance' objects. +// Finally, the 'bmqu::WeakMemFnUtil' utility class provides utility functions +// for constructing 'bmqu::WeakMemFn' and 'bmqu::WeakMemFnInstance' objects. // -///'mwcu::WeakMemFn' call operator +///'bmqu::WeakMemFn' call operator ///------------------------------------- -// 'mwcu::WeakMemFn' provides a call operator that, in C++11, would be defined +// 'bmqu::WeakMemFn' provides a call operator that, in C++11, would be defined // and behave exactly as follows: //.. // template @@ -73,17 +73,17 @@ // ARGS&&... args) const; // // If 'obj' has not expired, return the result of // // '((*obj.lock()).*d_memFn)(bsl::forward(args)...)' wrapped in -// // an instance of 'mwcu::WeakMemFnResult', where 'd_memFn' is the +// // an instance of 'bmqu::WeakMemFnResult', where 'd_memFn' is the // // stored member function pointer. Otherwise, return a null -// // 'mwcu::WeakMemFnResult' object. +// // 'bmqu::WeakMemFnResult' object. //.. // The actual behavior of the call operator is virtually identical to the // description below, except that the maximum number of arguments is limited // to 9. // -///'mwcu::WeakMemFnInstance' call operator +///'bmqu::WeakMemFnInstance' call operator ///--------------------------------------------- -// 'mwcu::WeakMemFnInstance' provides a call operator that, in C++11, would be +// 'bmqu::WeakMemFnInstance' provides a call operator that, in C++11, would be // defined and behave exactly as follows: //.. // template @@ -91,9 +91,9 @@ // operator()(ARGS&&... args) const; // // If the stored weak pointer 'd_obj' has not expired, return the // // result of '((*d_obj.lock()).*d_memFn)(bsl::forward(args)...)' -// // wrapped in an instance of 'mwcu::WeakMemFnResult', where 'd_memFn' +// // wrapped in an instance of 'bmqu::WeakMemFnResult', where 'd_memFn' // // is the stored member function pointer. Otherwise, return a null -// // 'mwcu::WeakMemFnResult' object. +// // 'bmqu::WeakMemFnResult' object. //.. // The actual behavior of the call operator is virtually identical to the // description below, except that the maximum number of arguments is limited @@ -165,12 +165,10 @@ // // TBD: //----- -//: o Provide a move c-tor for 'mwcu::WeakMemFnResult' that does not take an +//: o Provide a move c-tor for 'bmqu::WeakMemFnResult' that does not take an //: allocator parameter, but borrows it's allocator from the moved-from //: object? -// MWC - // BDE #include #include @@ -189,7 +187,7 @@ namespace BloombergLP { -namespace mwcu { +namespace bmqu { // FORWARD DECLARATION template @@ -199,12 +197,11 @@ class WeakMemFnResult; // struct WeakMemFn_Invocable // ========================== -/// Provides a call operator for the derived class `mwcu::WeakMemFn`, such +/// Provides a call operator for the derived class `bmqu::WeakMemFn`, such /// that its call signature is compatible with the specified return type /// `RET` and the specified argument types `ARGS`. template -struct WeakMemFn_Invocable { -}; +struct WeakMemFn_Invocable {}; /// Provides a specialization of `WeakMemFn_Invocable` for a non-void return /// types and 0 argument types. @@ -615,12 +612,11 @@ struct WeakMemFn_Invocable< // ================================== /// Provides a call operator for the derived class -/// `mwcu::WeakMemFnInstance`, such that its call signature is compatible +/// `bmqu::WeakMemFnInstance`, such that its call signature is compatible /// with the specified return type `RET` and the specified argument types /// `ARGS`. template -struct WeakMemFnInstance_Invocable { -}; +struct WeakMemFnInstance_Invocable {}; /// Provides a specialization of `WeakMemFnInstance_Invocable` for 0 /// argument types. @@ -915,7 +911,7 @@ class WeakMemFnInstance // ===================== /// Provides a value-semantic type to be returned by an invocation of -/// `mwcu::WeakMemFn` or `mwcu::WeakMemFnInstance`, that is semantically +/// `bmqu::WeakMemFn` or `bmqu::WeakMemFnInstance`, that is semantically /// similar to `bdlb::NullableValue` (or `std::optional`), but also supports /// `void` and reference value types. /// diff --git a/src/groups/mwc/mwcu/mwcu_weakmemfn.t.cpp b/src/groups/bmq/bmqu/bmqu_weakmemfn.t.cpp similarity index 70% rename from src/groups/mwc/mwcu/mwcu_weakmemfn.t.cpp rename to src/groups/bmq/bmqu/bmqu_weakmemfn.t.cpp index 047fdfd19..93d64e27d 100644 --- a/src/groups/mwc/mwcu/mwcu_weakmemfn.t.cpp +++ b/src/groups/bmq/bmqu/bmqu_weakmemfn.t.cpp @@ -13,11 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwcu_weakmemfn.t.cpp -*-C++-*- -#include +// bmqu_weakmemfn.t.cpp -*-C++-*- +#include // TEST DRIVER -#include +#include // BDE #include @@ -74,11 +74,11 @@ static void test1_weakMemFn_resultType() // WEAKMEMFN RESULT TYPE // // Concerns: -// Ensure that the result type of 'mwcu::WeakMemFn' conforms to the +// Ensure that the result type of 'bmqu::WeakMemFn' conforms to the // specification. // // Plan: -// Check the result type of the 'mwcu::WeakMemFn' class template, given +// Check the result type of the 'bmqu::WeakMemFn' class template, given // different member function prototypes, including the ones which return // type is: // - 'void'; @@ -86,43 +86,43 @@ static void test1_weakMemFn_resultType() // - a (possibly const / volatile) lvalue. // // Testing: -// mwcu::WeakMemFn::ResultType +// bmqu::WeakMemFn::ResultType // ------------------------------------------------------------------------ { typedef int R; typedef Empty C; - // void -> mwcu::WeakMemFnResult - ASSERT((bsl::is_same, - mwcu::WeakMemFn::ResultType>::value)); + // void -> bmqu::WeakMemFnResult + ASSERT((bsl::is_same, + bmqu::WeakMemFn::ResultType>::value)); - // R -> mwcu::WeakMemFnResult - ASSERT((bsl::is_same, - mwcu::WeakMemFn::ResultType>::value)); + // R -> bmqu::WeakMemFnResult + ASSERT((bsl::is_same, + bmqu::WeakMemFn::ResultType>::value)); - // const R -> mwcu::WeakMemFnResult + // const R -> bmqu::WeakMemFnResult ASSERT( - (bsl::is_same, - mwcu::WeakMemFn::ResultType>::value)); + (bsl::is_same, + bmqu::WeakMemFn::ResultType>::value)); - // R& -> mwcu::WeakMemFnResult - ASSERT((bsl::is_same, - mwcu::WeakMemFn::ResultType>::value)); + // R& -> bmqu::WeakMemFnResult + ASSERT((bsl::is_same, + bmqu::WeakMemFn::ResultType>::value)); - // const R& -> mwcu::WeakMemFnResult + // const R& -> bmqu::WeakMemFnResult ASSERT( - (bsl::is_same, - mwcu::WeakMemFn::ResultType>::value)); + (bsl::is_same, + bmqu::WeakMemFn::ResultType>::value)); - // volatile R& -> mwcu::WeakMemFnResult + // volatile R& -> bmqu::WeakMemFnResult ASSERT((bsl::is_same< - mwcu::WeakMemFnResult, - mwcu::WeakMemFn::ResultType>::value)); + bmqu::WeakMemFnResult, + bmqu::WeakMemFn::ResultType>::value)); - // const volatile R& -> mwcu::WeakMemFnResult + // const volatile R& -> bmqu::WeakMemFnResult ASSERT((bsl::is_same< - mwcu::WeakMemFnResult, - mwcu::WeakMemFn::ResultType>::value)); + bmqu::WeakMemFnResult, + bmqu::WeakMemFn::ResultType>::value)); } static void test2_weakMemFn_callOperator() @@ -130,7 +130,7 @@ static void test2_weakMemFn_callOperator() // WEAKMEMFN CALL OPERATOR // // Concerns: -// Ensure proper behavior of the 'mwcu::WeakMemFn's call operator. +// Ensure proper behavior of the 'bmqu::WeakMemFn's call operator. // // Plan: // Legend: @@ -142,7 +142,7 @@ static void test2_weakMemFn_callOperator() // 'Args...' - arguments types of 'MemFn' // 'args...' - values of types 'Args...' // -// Construct an instance of 'mwcu::WeakMemFn', 'weakMemFn', +// Construct an instance of 'bmqu::WeakMemFn', 'weakMemFn', // specifying a member function pointer 'memFn' of type 'MemFn'. Call // 'weakMemFn(weakC, args...)'. Check that this operation is a no-op if // 'weakC' has expired, or is identical to 'c.*memFn(args...)' otherwise. @@ -158,12 +158,12 @@ static void test2_weakMemFn_callOperator() // reference; // // Testing: -// 'mwcu::WeakMemFn's call operator +// 'bmqu::WeakMemFn's call operator // ------------------------------------------------------------------------ { - typedef mwcu::WeakMemFn GetFn; - typedef mwcu::WeakMemFn SetFn; - typedef mwcu::WeakMemFn ResetFn; + typedef bmqu::WeakMemFn GetFn; + typedef bmqu::WeakMemFn SetFn; + typedef bmqu::WeakMemFn ResetFn; bslma::TestAllocator alloc; bsl::shared_ptr intPtr = bsl::allocate_shared(&alloc, 10); @@ -201,11 +201,11 @@ static void test3_weakMemFnInstance_resultType() // WEAKMEMFNINSTANCE RESULT TYPE // // Concerns: -// Ensure that the result type of 'mwcu::WeakMemFnInstance' conforms to +// Ensure that the result type of 'bmqu::WeakMemFnInstance' conforms to // the specification. // // Plan: -// Check the result type of the 'mwcu::WeakMemFnInstance' class +// Check the result type of the 'bmqu::WeakMemFnInstance' class // template, given different member function prototypes, including the // ones which return type is: // - 'void'; @@ -213,45 +213,45 @@ static void test3_weakMemFnInstance_resultType() // - a (possibly const / volatile) lvalue. // // Testing: -// mwcu::WeakMemFnInstance::ResultType +// bmqu::WeakMemFnInstance::ResultType // ------------------------------------------------------------------------ { typedef int R; typedef Empty C; - // void -> mwcu::WeakMemFnResult + // void -> bmqu::WeakMemFnResult ASSERT((bsl::is_same< - mwcu::WeakMemFnResult, - mwcu::WeakMemFnInstance::ResultType>::value)); + bmqu::WeakMemFnResult, + bmqu::WeakMemFnInstance::ResultType>::value)); - // R -> mwcu::WeakMemFnResult + // R -> bmqu::WeakMemFnResult ASSERT(( - bsl::is_same, - mwcu::WeakMemFnInstance::ResultType>::value)); + bsl::is_same, + bmqu::WeakMemFnInstance::ResultType>::value)); - // const R -> mwcu::WeakMemFnResult + // const R -> bmqu::WeakMemFnResult ASSERT((bsl::is_same< - mwcu::WeakMemFnResult, - mwcu::WeakMemFnInstance::ResultType>::value)); + bmqu::WeakMemFnResult, + bmqu::WeakMemFnInstance::ResultType>::value)); - // R& -> mwcu::WeakMemFnResult + // R& -> bmqu::WeakMemFnResult ASSERT((bsl::is_same< - mwcu::WeakMemFnResult, - mwcu::WeakMemFnInstance::ResultType>::value)); + bmqu::WeakMemFnResult, + bmqu::WeakMemFnInstance::ResultType>::value)); - // const R& -> mwcu::WeakMemFnResult + // const R& -> bmqu::WeakMemFnResult ASSERT((bsl::is_same< - mwcu::WeakMemFnResult, - mwcu::WeakMemFnInstance::ResultType>::value)); + bmqu::WeakMemFnResult, + bmqu::WeakMemFnInstance::ResultType>::value)); - // volatile R& -> mwcu::WeakMemFnResult - ASSERT((bsl::is_same, - mwcu::WeakMemFnInstance bmqu::WeakMemFnResult + ASSERT((bsl::is_same, + bmqu::WeakMemFnInstance::ResultType>::value)); - // const volatile R& -> mwcu::WeakMemFnResult - ASSERT((bsl::is_same, - mwcu::WeakMemFnInstance bmqu::WeakMemFnResult + ASSERT((bsl::is_same, + bmqu::WeakMemFnInstance::ResultType>::value)); } @@ -261,7 +261,7 @@ static void test4_weakMemFnInstance_callOperator() // // Concerns: // Concerns: -// Ensure proper behavior of the 'mwcu::WeakMemFnInstance's call +// Ensure proper behavior of the 'bmqu::WeakMemFnInstance's call // operator. // // Plan: @@ -274,7 +274,7 @@ static void test4_weakMemFnInstance_callOperator() // 'Args...' - arguments types of 'MemFn' // 'args...' - values of types 'Args...' // -// Construct an instance of 'mwcu::WeakMemFnInstance', +// Construct an instance of 'bmqu::WeakMemFnInstance', // 'weakMemFn', specifing a member function pointer 'memFn' of type // 'MemFn' and a weak object pointer 'weakC' of type 'bsl::weak_ptr'. // Call 'weakMemFn(args...)'. Check that this operation is a no-op if @@ -291,12 +291,12 @@ static void test4_weakMemFnInstance_callOperator() // reference; // // Testing: -// 'mwcu::WeakMemFnInstance's call operator +// 'bmqu::WeakMemFnInstance's call operator // ------------------------------------------------------------------------ { - typedef mwcu::WeakMemFnInstance GetFn; - typedef mwcu::WeakMemFnInstance SetFn; - typedef mwcu::WeakMemFnInstance ResetFn; + typedef bmqu::WeakMemFnInstance GetFn; + typedef bmqu::WeakMemFnInstance SetFn; + typedef bmqu::WeakMemFnInstance ResetFn; bslma::TestAllocator alloc; bsl::shared_ptr intPtr = bsl::allocate_shared(&alloc, 10); @@ -335,7 +335,7 @@ static void test4_weakMemFnInstance_callOperator() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 1: test1_weakMemFn_resultType(); break; @@ -350,5 +350,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwcu/doc/mwcu.txt b/src/groups/bmq/bmqu/doc/bmqu.txt similarity index 60% rename from src/groups/mwc/mwcu/doc/mwcu.txt rename to src/groups/bmq/bmqu/doc/bmqu.txt index 7e65f6480..014520e73 100644 --- a/src/groups/mwc/mwcu/doc/mwcu.txt +++ b/src/groups/bmq/bmqu/doc/bmqu.txt @@ -1,94 +1,94 @@ - mwcu.txt + bmqu.txt @PURPOSE: Provide utility components and mechanisms. -@MNEMONIC: MiddleWare Core Utility (mwcu) +@MNEMONIC: BlazingMQ Utility (bmqu) @DESCRIPTION: This package provides miscellaneous utility components to be reused through various applications. /Hierarchical Synopsis /--------------------- -The 'mwcu' package currently has 19 components having 2 level of physical +The 'bmqu' package currently has 19 components having 2 level of physical dependency. The list below shows the hierarchal ordering of the components. .. - 2. mwcu_blobiterator - mwcu_blobojectproxy - mwcu_operationchain - mwcu_printutil - mwcu_tempdirectory + 2. bmqu_blobiterator + bmqu_blobojectproxy + bmqu_operationchain + bmqu_printutil + bmqu_tempdirectory - 1. mwcu_atomicstate - mwcu_atomicvalidator - mwcu_blob - mwcu_memoutstream - mwcu_objectplaceholder - mwcu_outstreamformatsaver - mwcu_sharedresource - mwcu_samethreadchecker - mwcu_stringutil - mwcu_tempfile - mwcu_temputil - mwcu_throttledaction - mwcu_tlsbool - mwcu_weakmemfn + 1. bmqu_atomicstate + bmqu_atomicvalidator + bmqu_blob + bmqu_memoutstream + bmqu_objectplaceholder + bmqu_outstreamformatsaver + bmqu_sharedresource + bmqu_samethreadchecker + bmqu_stringutil + bmqu_tempfile + bmqu_temputil + bmqu_throttledaction + bmqu_tlsbool + bmqu_weakmemfn .. /Component Synopsis /------------------ -: 'mwcu_atomicstate': +: 'bmqu_atomicstate': : Provide a mechanism to change a state atomically. : -: 'mwcu_atomicvalidator': +: 'bmqu_atomicvalidator': : Provide a mechanism to acquire/release and invalidate a resource. : -: 'mwcu_blob': +: 'bmqu_blob': : Provide blob utilities. : -: 'mwcu_blobiterator': +: 'bmqu_blobiterator': : Provide an iterator over a section of a blob : -: 'mwcu_blobobjectproxy': +: 'bmqu_blobobjectproxy': : Provide a utility for reading/writing structures in 'bdlbb::Blob's : -: 'mwcu_memoutstream': +: 'bmqu_memoutstream': : Provide an 'ostringstream' exposing a StringRef to its internal buffer. : -: 'mwcu_objectplaceholder': +: 'bmqu_objectplaceholder': : Provide a placeholder for any object. : -: 'mwcu_operationchain': +: 'bmqu_operationchain': : Provide a mechanism to serialize execution of async operations. : -: 'mwcu_outstreamformatsaver': +: 'bmqu_outstreamformatsaver': : Provide a scoped guard for an ostream's format state. : -: 'mwcu_printutil': +: 'bmqu_printutil': : Provide utilities for printing things. : -: 'mwcu_samethreadchecker': +: 'bmqu_samethreadchecker': : Provide a mechanism to check if a call is performed in same thread. : -: 'mwcu_sharedresource': +: 'bmqu_sharedresource': : Provide a mechanism to manage the lifetime of a shared resource. : -: 'mwcu_stringutil': +: 'bmqu_stringutil': : Provide utility functions for string manipulation. : -: 'mwcu_tempdirectory': +: 'bmqu_tempdirectory': : Provide a guard for creating a temporary directory. : -: 'mwcu_tempfile': +: 'bmqu_tempfile': : Provide a guard for creating a temporary file. : -: 'mwcu_temputil': +: 'bmqu_temputil': : Provide an utility for resolving the effective temporary directory. : -: 'mwcu_throttledaction': +: 'bmqu_throttledaction': : Provide macros and utilities to throttle an action. : -: 'mwcu_tlsbool': +: 'bmqu_tlsbool': : Provide a VST of bool in 'ThreadLocalStorage'. : -: 'mwcu_weakmemfn': +: 'bmqu_weakmemfn': : Provide a wrapper type for invoking member functions on a weak_ptr. diff --git a/src/groups/bmq/bmqu/package/bmqu.dep b/src/groups/bmq/bmqu/package/bmqu.dep new file mode 100644 index 000000000..85056c20a --- /dev/null +++ b/src/groups/bmq/bmqu/package/bmqu.dep @@ -0,0 +1 @@ +bmqscm diff --git a/src/groups/bmq/bmqu/package/bmqu.mem b/src/groups/bmq/bmqu/package/bmqu.mem new file mode 100644 index 000000000..8e43efc3c --- /dev/null +++ b/src/groups/bmq/bmqu/package/bmqu.mem @@ -0,0 +1,22 @@ +bmqu_alignedprinter +bmqu_atomicstate +bmqu_atomicvalidator +bmqu_blob +bmqu_blobiterator +bmqu_blobobjectproxy +bmqu_memoutstream +bmqu_objectplaceholder +bmqu_objectplaceholder_cpp03 +bmqu_operationchain +bmqu_operationchain_cpp03 +bmqu_outstreamformatsaver +bmqu_printutil +bmqu_samethreadchecker +bmqu_sharedresource +bmqu_stringutil +bmqu_tempdirectory +bmqu_tempfile +bmqu_temputil +bmqu_throttledaction +bmqu_tlsbool +bmqu_weakmemfn diff --git a/src/groups/mwc/mwct/mwct_propertybag.cpp b/src/groups/bmq/bmqvt/bmqvt_propertybag.cpp similarity index 98% rename from src/groups/mwc/mwct/mwct_propertybag.cpp rename to src/groups/bmq/bmqvt/bmqvt_propertybag.cpp index dfd000c6c..2012b4631 100644 --- a/src/groups/mwc/mwct/mwct_propertybag.cpp +++ b/src/groups/bmq/bmqvt/bmqvt_propertybag.cpp @@ -13,17 +13,17 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwct_propertybag.cpp -*-C++-*- -#include +// bmqvt_propertybag.cpp -*-C++-*- +#include -#include +#include // BDE #include #include #include namespace BloombergLP { -namespace mwct { +namespace bmqvt { // ---------------------- // class PropertyBagValue diff --git a/src/groups/mwc/mwct/mwct_propertybag.h b/src/groups/bmq/bmqvt/bmqvt_propertybag.h similarity index 94% rename from src/groups/mwc/mwct/mwct_propertybag.h rename to src/groups/bmq/bmqvt/bmqvt_propertybag.h index c4fd30022..34e7fb2b6 100644 --- a/src/groups/mwc/mwct/mwct_propertybag.h +++ b/src/groups/bmq/bmqvt/bmqvt_propertybag.h @@ -13,18 +13,18 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwct_propertybag.h -*-C++-*- -#ifndef INCLUDED_MWCT_PROPERTYBAG -#define INCLUDED_MWCT_PROPERTYBAG +// bmqvt_propertybag.h -*-C++-*- +#ifndef INCLUDED_BMQT_PROPERTYBAG +#define INCLUDED_BMQT_PROPERTYBAG //@PURPOSE: Provide a bag of named properties. // //@CLASSES: -// mwct::PropertyBag: bag of named properties -// mwct::PropertyBagValue: variant type representing a property +// bmqvt::PropertyBag: bag of named properties +// bmqvt::PropertyBagValue: variant type representing a property // -//@DESCRIPTION: This component defines a mechanism, 'mwct::PropertyBag', for a -// collection of named properties of type 'mwct::PropertyBagValue'. The +//@DESCRIPTION: This component defines a mechanism, 'bmqvt::PropertyBag', for a +// collection of named properties of type 'bmqvt::PropertyBagValue'. The // properties can be updated and accessed in a thread-safe way. A // 'PropertyBagValue' primarily holds two kind of values: either a generic // shared_ptr to arbitrary data, or a datum of any type. Because 'int' and @@ -36,7 +36,7 @@ ///------------- // First, let's create a PropertyBag object, and set a few properties on it: //.. -// mwct::PropertyBag bag(allocator); +// bmqvt::PropertyBag bag(allocator); // bag.set("myIntValue", 5) // .set("myStringValue", "hello world"); //.. @@ -47,8 +47,6 @@ // ASSERT(value == 5); //.. -// MWC - // BDE #include #include @@ -64,7 +62,7 @@ #include namespace BloombergLP { -namespace mwct { +namespace bmqvt { // ====================== // class PropertyBagValue @@ -360,14 +358,14 @@ inline bslma::Allocator* PropertyBag::allocator() const } // close package namespace // FREE OPERATORS -inline bsl::ostream& mwct::operator<<(bsl::ostream& stream, - const mwct::PropertyBagValue& value) +inline bsl::ostream& bmqvt::operator<<(bsl::ostream& stream, + const bmqvt::PropertyBagValue& value) { return value.print(stream, 0, -1); } -inline bsl::ostream& mwct::operator<<(bsl::ostream& stream, - const mwct::PropertyBag& value) +inline bsl::ostream& bmqvt::operator<<(bsl::ostream& stream, + const bmqvt::PropertyBag& value) { return value.print(stream, 0, -1); } diff --git a/src/groups/mwc/mwct/mwct_propertybag.t.cpp b/src/groups/bmq/bmqvt/bmqvt_propertybag.t.cpp similarity index 93% rename from src/groups/mwc/mwct/mwct_propertybag.t.cpp rename to src/groups/bmq/bmqvt/bmqvt_propertybag.t.cpp index 47a643b0d..b85583d38 100644 --- a/src/groups/mwc/mwct/mwct_propertybag.t.cpp +++ b/src/groups/bmq/bmqvt/bmqvt_propertybag.t.cpp @@ -13,8 +13,8 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwct_propertybag.t.cpp -*-C++-*- -#include +// bmqvt_propertybag.t.cpp -*-C++-*- +#include #include #include @@ -22,12 +22,12 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; using namespace bsl; -using namespace mwct; +using namespace bmqvt; // ======================================================================== // HELPERS @@ -84,7 +84,7 @@ static void checkValueSp(int line, static void test1_breathingTest() { - mwctst::TestHelper::printTestName("Breathing Test"); + bmqtst::TestHelper::printTestName("Breathing Test"); const bslstl::StringRef k_strVal("theQuickBrownFoxJumped"); bsl::shared_ptr intSp; @@ -152,7 +152,7 @@ static void test1_breathingTest() static void test2_copyAndAssignment() { - mwctst::TestHelper::printTestName("Copy and Assignment"); + bmqtst::TestHelper::printTestName("Copy and Assignment"); const bslstl::StringRef k_strVal("theQuickBrownFoxJumped"); bsl::shared_ptr intSp; @@ -193,11 +193,11 @@ static void test2_copyAndAssignment() static void test3_print() { s_ignoreCheckDefAlloc = true; - // We can't use 'mwcu::MemOutStream' because mwcu is above mwct, so use + // We can't use 'bmqu::MemOutStream' because bmqu is above bmqvt, so use // a 'ostringstream', which allocates its string using the default // allocator. - mwctst::TestHelper::printTestName("Print"); + bmqtst::TestHelper::printTestName("Print"); const bslstl::StringRef k_strVal("theQuickBrownFox"); @@ -255,7 +255,7 @@ static void test3_print() static void test4_loadAllImport() { - mwctst::TestHelper::printTestName("loadAll/import"); + bmqtst::TestHelper::printTestName("loadAll/import"); PropertyBag obj(s_allocator_p); PropertyBag obj2(s_allocator_p); @@ -283,7 +283,7 @@ static void test4_loadAllImport() static void test5_propertyBagUtil() { - mwctst::TestHelper::printTestName("PropertyBagUtil"); + bmqtst::TestHelper::printTestName("PropertyBagUtil"); bslstl::StringRef longStr( "theQuickBrownFoxALongStringThatWillForceAllocation"); @@ -314,7 +314,7 @@ static void test5_propertyBagUtil() static void test6_valueOverwrite() { - mwctst::TestHelper::printTestName("ValueOverwrite"); + bmqtst::TestHelper::printTestName("ValueOverwrite"); // In this test, we ensure that the underlying container used properly // handles inserting a new value for an existing key (see comment in @@ -346,7 +346,7 @@ static void test6_valueOverwrite() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -362,5 +362,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwct/mwct_rcdescriptionerror.cpp b/src/groups/bmq/bmqvt/bmqvt_rcdescriptionerror.cpp similarity index 89% rename from src/groups/mwc/mwct/mwct_rcdescriptionerror.cpp rename to src/groups/bmq/bmqvt/bmqvt_rcdescriptionerror.cpp index 2409d8597..58dfb9ffe 100644 --- a/src/groups/mwc/mwct/mwct_rcdescriptionerror.cpp +++ b/src/groups/bmq/bmqvt/bmqvt_rcdescriptionerror.cpp @@ -13,15 +13,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwct_rcdescriptionerror.cpp -*-C++-*- -#include +// bmqvt_rcdescriptionerror.cpp -*-C++-*- +#include -#include +#include // BDE #include namespace BloombergLP { -namespace mwct { +namespace bmqvt { // ------------------------ // class RcDescriptionError diff --git a/src/groups/mwc/mwct/mwct_rcdescriptionerror.h b/src/groups/bmq/bmqvt/bmqvt_rcdescriptionerror.h similarity index 94% rename from src/groups/mwc/mwct/mwct_rcdescriptionerror.h rename to src/groups/bmq/bmqvt/bmqvt_rcdescriptionerror.h index d0d962fc3..769934c36 100644 --- a/src/groups/mwc/mwct/mwct_rcdescriptionerror.h +++ b/src/groups/bmq/bmqvt/bmqvt_rcdescriptionerror.h @@ -13,22 +13,20 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwct_rcdescriptionerror.h -*-C++-*- -#ifndef INCLUDED_MWCT_RCDESCRIPTIONERROR -#define INCLUDED_MWCT_RCDESCRIPTIONERROR +// bmqvt_rcdescriptionerror.h -*-C++-*- +#ifndef INCLUDED_BMQT_RCDESCRIPTIONERROR +#define INCLUDED_BMQT_RCDESCRIPTIONERROR //@PURPOSE: Provide a value-semantic class for a typical error. // //@CLASSES: -// mwct::RcDescriptionError: An error type with an 'int' and a 'bsl::string' +// bmqvt::RcDescriptionError: An error type with an 'int' and a 'bsl::string' // -//@DESCRIPTION: The 'mwct::RcDescriptionError' provides a type that represents +//@DESCRIPTION: The 'bmqvt::RcDescriptionError' provides a type that represents // a typical error. It contains the return code (rc) and an error message // (description). // -// MWCSCM - // BDE #include #include @@ -38,7 +36,7 @@ namespace BloombergLP { -namespace mwct { +namespace bmqvt { // ======================== // class RcDescriptionError diff --git a/src/groups/mwc/mwct/mwct_rcdescriptionerror.t.cpp b/src/groups/bmq/bmqvt/bmqvt_rcdescriptionerror.t.cpp similarity index 72% rename from src/groups/mwc/mwct/mwct_rcdescriptionerror.t.cpp rename to src/groups/bmq/bmqvt/bmqvt_rcdescriptionerror.t.cpp index 8484f16a4..b8bd5f350 100644 --- a/src/groups/mwc/mwct/mwct_rcdescriptionerror.t.cpp +++ b/src/groups/bmq/bmqvt/bmqvt_rcdescriptionerror.t.cpp @@ -13,14 +13,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwct_rcdescriptionerror.t.cpp -*-C++-*- -#include +// bmqvt_rcdescriptionerror.t.cpp -*-C++-*- +#include -// MWC -#include +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -40,12 +39,12 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { PV("Default constructor"); - mwct::RcDescriptionError obj(s_allocator_p); + bmqvt::RcDescriptionError obj(s_allocator_p); ASSERT_EQ(obj.rc(), 0); ASSERT_EQ(obj.description(), ""); } @@ -53,7 +52,7 @@ static void test1_breathingTest() { PV("With value constructor"); - mwct::RcDescriptionError obj(123, "abc", s_allocator_p); + bmqvt::RcDescriptionError obj(123, "abc", s_allocator_p); ASSERT_EQ(obj.rc(), 123); ASSERT_EQ(obj.description(), "abc"); } @@ -61,13 +60,13 @@ static void test1_breathingTest() { PV("Copy constructor and assignment operator"); - mwct::RcDescriptionError obj(123, "abc", s_allocator_p); + bmqvt::RcDescriptionError obj(123, "abc", s_allocator_p); - mwct::RcDescriptionError copy(obj, s_allocator_p); + bmqvt::RcDescriptionError copy(obj, s_allocator_p); ASSERT_EQ(copy.rc(), 123); ASSERT_EQ(copy.description(), "abc"); - mwct::RcDescriptionError assignment(987, "zyx", s_allocator_p); + bmqvt::RcDescriptionError assignment(987, "zyx", s_allocator_p); assignment = obj; ASSERT_EQ(assignment.rc(), 123); ASSERT_EQ(assignment.description(), "abc"); @@ -86,7 +85,7 @@ static void test2_equality() // operator!= // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("EQUALITY"); + bmqtst::TestHelper::printTestName("EQUALITY"); struct Test { int d_line; @@ -107,12 +106,12 @@ static void test2_equality() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; - mwct::RcDescriptionError lhs(test.d_lrc, - test.d_ldescription, - s_allocator_p); - mwct::RcDescriptionError rhs(test.d_rrc, - test.d_rdescription, - s_allocator_p); + bmqvt::RcDescriptionError lhs(test.d_lrc, + test.d_ldescription, + s_allocator_p); + bmqvt::RcDescriptionError rhs(test.d_rrc, + test.d_rdescription, + s_allocator_p); ASSERT_EQ_D("line " << test.d_line, test.d_equal, lhs == rhs); ASSERT_NE_D("line " << test.d_line, test.d_equal, lhs != rhs); } @@ -130,22 +129,22 @@ static void test3_print() // operator<< // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); { PV("Explicit print"); - mwct::RcDescriptionError obj(123, "abc", s_allocator_p); - mwcu::MemOutStream os(s_allocator_p); - mwct::RcDescriptionError::print(os, obj, 0, 0); + bmqvt::RcDescriptionError obj(123, "abc", s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); + bmqvt::RcDescriptionError::print(os, obj, 0, 0); ASSERT_EQ(os.str(), "[\nrc = 123\ndescription = \"abc\"\n]\n"); } { PV("operator<<"); - mwct::RcDescriptionError obj(123, "abc", s_allocator_p); - mwcu::MemOutStream os(s_allocator_p); + bmqvt::RcDescriptionError obj(123, "abc", s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); os << obj; ASSERT_EQ(os.str(), "[ rc = 123 description = \"abc\" ]"); @@ -154,11 +153,11 @@ static void test3_print() { PV("Invalid stream ('badbit' set)"); - mwct::RcDescriptionError obj(123, "abc", s_allocator_p); - mwcu::MemOutStream os(s_allocator_p); + bmqvt::RcDescriptionError obj(123, "abc", s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); os.setstate(bsl::ios_base::badbit); - mwct::RcDescriptionError::print(os, obj, 0, 0); + bmqvt::RcDescriptionError::print(os, obj, 0, 0); ASSERT_EQ(os.str(), ""); } @@ -170,7 +169,7 @@ static void test3_print() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -183,5 +182,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwct/mwct_valueorerror.cpp b/src/groups/bmq/bmqvt/bmqvt_valueorerror.cpp similarity index 82% rename from src/groups/mwc/mwct/mwct_valueorerror.cpp rename to src/groups/bmq/bmqvt/bmqvt_valueorerror.cpp index 6568009a7..672f252bc 100644 --- a/src/groups/mwc/mwct/mwct_valueorerror.cpp +++ b/src/groups/bmq/bmqvt/bmqvt_valueorerror.cpp @@ -13,12 +13,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwct_valueorerror.cpp -*-C++-*- -#include +// bmqvt_valueorerror.cpp -*-C++-*- +#include -#include +#include namespace BloombergLP { -namespace mwct { +namespace bmqvt { // NOTHING diff --git a/src/groups/mwc/mwct/mwct_valueorerror.h b/src/groups/bmq/bmqvt/bmqvt_valueorerror.h similarity index 96% rename from src/groups/mwc/mwct/mwct_valueorerror.h rename to src/groups/bmq/bmqvt/bmqvt_valueorerror.h index e802997bf..2afc66aef 100644 --- a/src/groups/mwc/mwct/mwct_valueorerror.h +++ b/src/groups/bmq/bmqvt/bmqvt_valueorerror.h @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwct_valueorerror.h -*-C++-*- -#ifndef INCLUDED_MWCT_VALUEORERROR -#define INCLUDED_MWCT_VALUEORERROR +// bmqvt_valueorerror.h -*-C++-*- +#ifndef INCLUDED_BMQT_VALUEORERROR +#define INCLUDED_BMQT_VALUEORERROR //@PURPOSE: Provide a value-semantic class that may hold a value or an error. // //@CLASSES: -// mwct::ValueOrError: Represents a Value or Error type. +// bmqvt::ValueOrError: Represents a Value or Error type. // -//@DESCRIPTION: The 'mwct::ValueOrError' provides a type that abstracts a wide +//@DESCRIPTION: The 'bmqvt::ValueOrError' provides a type that abstracts a wide // range of function return values in the presence of errors. It might be // uninitialized, initialized with an error or initialized with a value. Both // error and value might be arbitrary types, defined as template arguments @@ -34,7 +34,7 @@ // 'bslma::ConstructionUtil' to do placement new and slightly altered other // functions. // -// 'mwct::ValueOrError' aims to be used in the following way: +// 'bmqvt::ValueOrError' aims to be used in the following way: // //.. // struct ErrorsForFoo { @@ -72,8 +72,6 @@ // // ... do something //.. -// MWCSCM - // BDE #include #include @@ -87,7 +85,7 @@ namespace BloombergLP { -namespace mwct { +namespace bmqvt { // ================== // class ValueOrError @@ -488,8 +486,8 @@ ValueOrError::print(bsl::ostream& stream, template inline bsl::ostream& -mwct::operator<<(bsl::ostream& stream, - const mwct::ValueOrError& value) +bmqvt::operator<<(bsl::ostream& stream, + const bmqvt::ValueOrError& value) { return ValueOrError::print(stream, value, 0, -1); } diff --git a/src/groups/mwc/mwct/mwct_valueorerror.t.cpp b/src/groups/bmq/bmqvt/bmqvt_valueorerror.t.cpp similarity index 88% rename from src/groups/mwc/mwct/mwct_valueorerror.t.cpp rename to src/groups/bmq/bmqvt/bmqvt_valueorerror.t.cpp index 5e71484c0..0445f6398 100644 --- a/src/groups/mwc/mwct/mwct_valueorerror.t.cpp +++ b/src/groups/bmq/bmqvt/bmqvt_valueorerror.t.cpp @@ -13,16 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// mwct_valueorerror.t.cpp -*-C++-*- -#include +// bmqvt_valueorerror.t.cpp -*-C++-*- +#include // BMQ -#include +#include // TEST DRIVER +#include #include #include -#include // CONVENIENCE using namespace BloombergLP; @@ -123,7 +123,7 @@ bool operator==(const CustomAllocValueType& lhs, bsl::string formatError(const int rc) { - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); os << "error: " << rc << "(" << k_LONG_STRING << ")"; return bsl::string(os.str(), s_allocator_p); } @@ -271,7 +271,7 @@ static void test_ops_generic() ASSERT(!value.isValue()); ASSERT(!value.isError()); { - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); os << value; ASSERT_EQ(os.str(), "[ UNDEFINED ]"); } @@ -285,7 +285,7 @@ static void test_ops_generic() ASSERT(value.isValue()); ASSERT(!value.isError()); { - mwcu::MemOutStream expected(s_allocator_p), actual(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p), actual(s_allocator_p); expected << "[ value = " << refValue << " ]"; actual << value; @@ -303,7 +303,7 @@ static void test_ops_generic() ASSERT(!value.isValue()); ASSERT(value.isError()); { - mwcu::MemOutStream expected(s_allocator_p), actual(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p), actual(s_allocator_p); expected << "[ error = " << refError << " ]"; actual << value; @@ -376,9 +376,9 @@ static void test1_ops_on_string_int() // Proper behavior of the 'ValueOrError' class. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ops_on_string_int"); + bmqtst::TestHelper::printTestName("ops_on_string_int"); - test_ops_generic >(); + test_ops_generic >(); } static void test2_ops_on_custom_value_error_types() @@ -397,9 +397,9 @@ static void test2_ops_on_custom_value_error_types() // Proper behavior of the 'ValueOrError' class. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ops_on_custom_value_error_types"); + bmqtst::TestHelper::printTestName("ops_on_custom_value_error_types"); - test_ops_generic >(); + test_ops_generic >(); } static void test3_ops_on_customalloc_value_error_types() @@ -418,10 +418,10 @@ static void test3_ops_on_customalloc_value_error_types() // Proper behavior of the 'ValueOrError' class. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ops_on_customalloc_value_error_types"); + bmqtst::TestHelper::printTestName("ops_on_customalloc_value_error_types"); test_ops_generic< - mwct::ValueOrError >(); + bmqvt::ValueOrError >(); } static void test4_ops_on_custom_value_erroralloc_types() @@ -440,10 +440,10 @@ static void test4_ops_on_custom_value_erroralloc_types() // Proper behavior of the 'ValueOrError' class. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ops_on_custom_value_erroralloc_types"); + bmqtst::TestHelper::printTestName("ops_on_custom_value_erroralloc_types"); test_ops_generic< - mwct::ValueOrError >(); + bmqvt::ValueOrError >(); } static void test5_ops_on_customalloc_value_erroralloc_types() @@ -462,11 +462,11 @@ static void test5_ops_on_customalloc_value_erroralloc_types() // Proper behavior of the 'ValueOrError' class. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "ops_on_customalloc_value_erroralloc_types"); test_ops_generic< - mwct::ValueOrError >(); + bmqvt::ValueOrError >(); } static void test6_converters() @@ -484,12 +484,12 @@ static void test6_converters() // Proper behavior of the 'ValueOrError' class. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("converters"); + bmqtst::TestHelper::printTestName("converters"); // Use 'mapValue()' to transform values (Value case) { - typedef mwct::ValueOrError SourceType; - typedef mwct::ValueOrError TargetType; + typedef bmqvt::ValueOrError SourceType; + typedef bmqvt::ValueOrError TargetType; SourceType st; st.makeValue("12"); @@ -504,8 +504,8 @@ static void test6_converters() // Use 'mapValue()' to transform values (Error case) { - typedef mwct::ValueOrError SourceType; - typedef mwct::ValueOrError TargetType; + typedef bmqvt::ValueOrError SourceType; + typedef bmqvt::ValueOrError TargetType; SourceType st; st.makeError('a'); @@ -520,8 +520,8 @@ static void test6_converters() // Same thing with 'mapError()' for errors (Value case) { - typedef mwct::ValueOrError SourceType; - typedef mwct::ValueOrError TargetType; + typedef bmqvt::ValueOrError SourceType; + typedef bmqvt::ValueOrError TargetType; SourceType st; st.makeValue('a'); @@ -536,8 +536,8 @@ static void test6_converters() // Same thing with 'mapError()' for errors (Error case) { - typedef mwct::ValueOrError SourceType; - typedef mwct::ValueOrError TargetType; + typedef bmqvt::ValueOrError SourceType; + typedef bmqvt::ValueOrError TargetType; SourceType st; st.makeError("12"); @@ -552,8 +552,8 @@ static void test6_converters() // Use map() to transform both. { - typedef mwct::ValueOrError SourceType; - typedef mwct::ValueOrError TargetType; + typedef bmqvt::ValueOrError SourceType; + typedef bmqvt::ValueOrError TargetType; SourceType st1, st2; @@ -587,14 +587,14 @@ static void test7_explicit_print() // Proper behavior of the 'ValueOrError' class. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("explicit_print"); + bmqtst::TestHelper::printTestName("explicit_print"); - typedef mwct::ValueOrError TypeUnderTest; + typedef bmqvt::ValueOrError TypeUnderTest; TypeUnderTest value; value.makeValue(12); - mwcu::MemOutStream os(s_allocator_p); + bmqu::MemOutStream os(s_allocator_p); TypeUnderTest::print(os, value, 0, 0); ASSERT_EQ(os.str(), "[ value = 12 ]\n"); } @@ -605,7 +605,7 @@ static void test7_explicit_print() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -622,5 +622,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mwc/mwct/doc/mwct.txt b/src/groups/bmq/bmqvt/doc/bmqvt.txt similarity index 56% rename from src/groups/mwc/mwct/doc/mwct.txt rename to src/groups/bmq/bmqvt/doc/bmqvt.txt index 09260ecb4..4bd4ae6c9 100644 --- a/src/groups/mwc/mwct/doc/mwct.txt +++ b/src/groups/bmq/bmqvt/doc/bmqvt.txt @@ -1,26 +1,26 @@ -@PURPOSE: Provide value-semantic vocabulary types. +@PURPOSE: Provide internal value-semantic vocabulary types. -@MNEMONIC: MiddleWare Core Types (mwct) +@MNEMONIC: BlazingMQ priVate Types (bmqt) @DESCRIPTION: This package provides value-semantic vocabulary types. /Hierarchical Synopsis /--------------------- -The 'mwct' package currently has 2 component having 1 levels of physical +The 'bmqt' package currently has 18 components having 2 levels of physical dependency. The list below shows the hierarchal ordering of the components. .. - 1. mwct_propertybag - mwct_rcdescriptionerror - mwct_valueorerror + 1. bmqt_propertybag + bmqt_rcdescriptionerror + bmqt_valueorerror .. /Component Synopsis /------------------ -: 'mwct_propertybag': +: 'bmqt_propertybag': : Provide a bag of named properties. : -: 'mwct_rcdescriptionerror': +: 'bmqt_rcdescriptionerror': : Provide a value-semantic class for a typical error. : -: 'mwct_valueorerror': +: 'bmqt_valueorerror': : Provide a value-semantic class that may hold a value or an error. diff --git a/src/groups/bmq/bmqvt/package/bmqvt.dep b/src/groups/bmq/bmqvt/package/bmqvt.dep new file mode 100644 index 000000000..85056c20a --- /dev/null +++ b/src/groups/bmq/bmqvt/package/bmqvt.dep @@ -0,0 +1 @@ +bmqscm diff --git a/src/groups/bmq/bmqvt/package/bmqvt.mem b/src/groups/bmq/bmqvt/package/bmqvt.mem new file mode 100644 index 000000000..958481302 --- /dev/null +++ b/src/groups/bmq/bmqvt/package/bmqvt.mem @@ -0,0 +1,3 @@ +bmqvt_propertybag +bmqvt_rcdescriptionerror +bmqvt_valueorerror diff --git a/src/groups/bmq/doc/bmq.txt b/src/groups/bmq/doc/bmq.txt index abc7e2acd..7cc7f912e 100644 --- a/src/groups/bmq/doc/bmq.txt +++ b/src/groups/bmq/doc/bmq.txt @@ -15,18 +15,34 @@ /Hierarchical Synopsis /--------------------- -The 'bmq' group library currently has 5 packages forming 5 levels of physical +The 'bmq' group library currently has 17 packages forming 8 levels of physical dependency. .. - 5. bmqa + 8. bmqa - 4. bmqimp + 7. bmqimp - 3. bmqp + 6. bmqp - 2. bmqt + 5. bmqio + bmqtsk + bmqpi + + 4. bmqex + bmqt + + 3. bmqeval + bmqc + bmqsys + bmqst + bmqtst + + 2. bmqma + bmqu + bmqvt 1. bmqscm + bmqstm .. /Package Synopsis @@ -34,17 +50,41 @@ dependency. : 'bmqa': : Provide applications public API for the BlazingmQ SDK. : +: 'bmqc': +: [INTERNAL] Provide container vocabulary types. +: +: 'bmqex': +: [INTERNAL] Provide executors and other async programming utilities and mechanisms. +: : 'bmqimp': : [INTERNAL] Provide implementation for the API of the BlazingMQ SDK. : +: 'bmqio': +: [INTERNAL] Provide network related components for input/output. +: +: 'bmqma': +: [INTERNAL] Provide allocators and other memory-management utilities. +: : 'bmqp': : [INTERNAL] Provide BlazingMQ protocol definition, builders and parsers. : : 'bmqscm': -: Provide versioning information for library components in 'bmq'. +: [INTERNAL] Provide versioning information for library components in 'bmq'. +: +: 'bmqsys': +: [INTERNAL] Provide systems utilities and mechanisms. : : 'bmqt': : Provide value-semantic vocabulary types. +: +: 'bmqtst': +: [INTERNAL] Provide macros and utilities to assist writing test drivers. +: +: 'bmqtsk': +: [INTERNAL] Provide application level mechanisms. +: +: 'bmqu': +: [INTERNAL] Provide utility components and mechanisms. /Package Overview /---------------- diff --git a/src/groups/bmq/group/bmq.dep b/src/groups/bmq/group/bmq.dep index 2e372297e..6374cb0d9 100644 --- a/src/groups/bmq/group/bmq.dep +++ b/src/groups/bmq/group/bmq.dep @@ -1,5 +1,5 @@ # Level 4 -mwc +ntc # Level 3 bal diff --git a/src/groups/bmq/group/bmq.mem b/src/groups/bmq/group/bmq.mem index eb59bd4ff..4a91f7818 100644 --- a/src/groups/bmq/group/bmq.mem +++ b/src/groups/bmq/group/bmq.mem @@ -1,9 +1,20 @@ # [OFFLINE ONLY] bmqa +bmqc bmqeval +bmqex bmqimp +bmqio +bmqma bmqp bmqpi -bmqt bmqscm +bmqst +bmqstm +bmqsys +bmqt +bmqtsk +bmqtst +bmqu +bmqvt diff --git a/src/groups/bmq/group/bmq.t.dep b/src/groups/bmq/group/bmq.t.dep index 2f1f34bb8..0ff141920 100644 --- a/src/groups/bmq/group/bmq.t.dep +++ b/src/groups/bmq/group/bmq.t.dep @@ -1,2 +1,2 @@ benchmark -mwc +bmq diff --git a/src/groups/bmq/group/mwc.mem b/src/groups/bmq/group/mwc.mem new file mode 100644 index 000000000..ae7654399 --- /dev/null +++ b/src/groups/bmq/group/mwc.mem @@ -0,0 +1,12 @@ +bmqc +bmqex +bmqio +bmqma +bmqscm +bmqst +bmqstm +bmqsys +bmqt +bmqtsk +bmqtst +bmqu diff --git a/src/groups/mqb/group/mqb.dep b/src/groups/mqb/group/mqb.dep index 5cf00d2e7..bf9bba687 100644 --- a/src/groups/mqb/group/mqb.dep +++ b/src/groups/mqb/group/mqb.dep @@ -1,5 +1,4 @@ bmq -mwc bal bdl bsl diff --git a/src/groups/mqb/group/mqb.t.dep b/src/groups/mqb/group/mqb.t.dep index 2a33d0d06..af38529b2 100644 --- a/src/groups/mqb/group/mqb.t.dep +++ b/src/groups/mqb/group/mqb.t.dep @@ -1,3 +1,3 @@ benchmark mqb -mwc +bmq diff --git a/src/groups/mqb/mqba/mqba_adminsession.cpp b/src/groups/mqb/mqba/mqba_adminsession.cpp index 765072188..85e31ce28 100644 --- a/src/groups/mqb/mqba/mqba_adminsession.cpp +++ b/src/groups/mqb/mqba/mqba_adminsession.cpp @@ -52,11 +52,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -147,28 +146,28 @@ void AdminSession::sendPacket() } // Try to send the data, or drop it if we fail due to high watermark limit. - mwcio::Status status; + bmqio::Status status; d_channel_sp->write(&status, blob); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( - status.category() != mwcio::StatusCategory::e_SUCCESS)) { + status.category() != bmqio::StatusCategory::e_SUCCESS)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - if (status.category() == mwcio::StatusCategory::e_CONNECTION) { + if (status.category() == bmqio::StatusCategory::e_CONNECTION) { // This code relies on the fact that `e_CONNECTION` error cannot be // returned without calling `tearDown`. return; // RETURN } - if (status.category() == mwcio::StatusCategory::e_LIMIT) { + if (status.category() == bmqio::StatusCategory::e_LIMIT) { BALL_LOG_ERROR << "#ADMCLIENT_SEND_FAILURE " << description() << ": Failed to send data [size: " - << mwcu::PrintUtil::prettyNumber(blob.length()) + << bmqu::PrintUtil::prettyNumber(blob.length()) << " bytes] to admin client due to channel watermark limit" << "; dropping."; } else { BALL_LOG_INFO << "#ADMCLIENT_SEND_FAILURE " << description() << ": Failed to send data [size: " - << mwcu::PrintUtil::prettyNumber(blob.length()) + << bmqu::PrintUtil::prettyNumber(blob.length()) << " bytes] to admin client with status: " << status; } } @@ -257,7 +256,7 @@ void AdminSession::enqueueAdminCommand( d_adminCb( d_channel_sp->peerUri(), req.command(), - bdlf::BindUtil::bind(mwcu::WeakMemFnUtil::weakMemFn( + bdlf::BindUtil::bind(bmqu::WeakMemFnUtil::weakMemFn( &AdminSession::onProcessedAdminCommand, d_self.acquireWeak()), adminCommandCtrlMsg, @@ -268,7 +267,7 @@ void AdminSession::enqueueAdminCommand( // CREATORS AdminSession::AdminSession( - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bmqp_ctrlmsg::NegotiationMessage& negotiationMessage, const bsl::string& sessionDescription, mqbi::Dispatcher* dispatcher, @@ -338,7 +337,7 @@ void AdminSession::processEvent( BALL_LOG_ERROR << "#CORRUPTED_EVENT " << description() << ": Received invalid control message from client " << "[reason: 'failed to decode', rc: " << rc << "]:\n" - << mwcu::BlobStartHexDumper(event.blob()); + << bmqu::BlobStartHexDumper(event.blob()); return; // RETURN } diff --git a/src/groups/mqb/mqba/mqba_adminsession.h b/src/groups/mqb/mqba/mqba_adminsession.h index ca85b0b2b..135ed3db0 100644 --- a/src/groups/mqb/mqba/mqba_adminsession.h +++ b/src/groups/mqb/mqba/mqba_adminsession.h @@ -38,9 +38,8 @@ // BMQ #include -// MWC -#include -#include +#include +#include // BDE #include @@ -141,7 +140,7 @@ class AdminSession : public mqbnet::Session, public mqbi::DispatcherClient { private: // DATA - mwcu::SharedResource d_self; + bmqu::SharedResource d_self; // This object is used to avoid // executing a callback if the session // has been destroyed: this is *ONLY* to @@ -165,7 +164,7 @@ class AdminSession : public mqbnet::Session, public mqbi::DispatcherClient { bsl::string d_description; // Short identifier for this session. - bsl::shared_ptr d_channel_sp; + bsl::shared_ptr d_channel_sp; // Channel associated to this session. AdminSessionState d_state; @@ -239,7 +238,7 @@ class AdminSession : public mqbnet::Session, public mqbi::DispatcherClient { /// `allocator`. The specified `adminEnqueueCb` callback is used to /// enqueue admin commands to entity that is responsible for executing /// admin commands. - AdminSession(const bsl::shared_ptr& channel, + AdminSession(const bsl::shared_ptr& channel, const bmqp_ctrlmsg::NegotiationMessage& negotiationMessage, const bsl::string& sessionDescription, mqbi::Dispatcher* dispatcher, @@ -308,7 +307,7 @@ class AdminSession : public mqbnet::Session, public mqbi::DispatcherClient { // (virtual: mqbnet::Session) /// Return the channel associated to this session. - bsl::shared_ptr channel() const BSLS_KEYWORD_OVERRIDE; + bsl::shared_ptr channel() const BSLS_KEYWORD_OVERRIDE; /// Return the clusterNode associated to this session, or 0 if there are /// none. @@ -354,7 +353,7 @@ class AdminSession : public mqbnet::Session, public mqbi::DispatcherClient { // ------------------- // MANIPULATORS -inline bsl::shared_ptr AdminSession::channel() const +inline bsl::shared_ptr AdminSession::channel() const { return d_channel_sp; } diff --git a/src/groups/mqb/mqba/mqba_adminsession.t.cpp b/src/groups/mqb/mqba/mqba_adminsession.t.cpp index 0e9742e6a..4cf5ecfae 100644 --- a/src/groups/mqb/mqba/mqba_adminsession.t.cpp +++ b/src/groups/mqb/mqba/mqba_adminsession.t.cpp @@ -27,12 +27,11 @@ #include #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -46,7 +45,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -142,7 +141,7 @@ class TestBench { // DATA bdlbb::PooledBlobBufferFactory d_bufferFactory; BlobSpPool d_blobSpPool; - bsl::shared_ptr d_channel; + bsl::shared_ptr d_channel; mqbmock::Dispatcher d_mockDispatcher; bdlmt::EventScheduler d_scheduler; TestClock d_testClock; @@ -163,7 +162,7 @@ class TestBench { bdlf::PlaceHolders::_2), // alloc 1024, // blob pool growth strategy allocator) - , d_channel(new mwcio::TestChannel(allocator)) + , d_channel(new bmqio::TestChannel(allocator)) , d_mockDispatcher(allocator) , d_scheduler(bsls::SystemClockType::e_MONOTONIC, allocator) , d_testClock(d_scheduler) @@ -183,8 +182,8 @@ class TestBench { d_mockDispatcher._setInDispatcherThread(true); // Setup test time source - mwcsys::Time::shutdown(); - mwcsys::Time::initialize( + bmqsys::Time::shutdown(); + bmqsys::Time::initialize( bdlf::BindUtil::bind(&TestClock::realtimeClock, &d_testClock), bdlf::BindUtil::bind(&TestClock::monotonicClock, &d_testClock), bdlf::BindUtil::bind(&TestClock::highResTimer, &d_testClock), @@ -225,7 +224,7 @@ static void test1_watermark() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ADMIN SESSION HIGH WATERMARK"); + bmqtst::TestHelper::printTestName("ADMIN SESSION HIGH WATERMARK"); const bsl::string command("sample command", s_allocator_p); const size_t numMessages = 64; @@ -262,8 +261,8 @@ static void test1_watermark() BSLS_ASSERT(adminEvent.isControlEvent()); // Set high watermark status for the test channel - mwcio::Status status; - status.setCategory(mwcio::StatusCategory::e_LIMIT); + bmqio::Status status; + status.setCategory(bmqio::StatusCategory::e_LIMIT); tb.d_channel->setWriteStatus(status); // Send the sample admin event multiple times to the admin session @@ -297,14 +296,14 @@ static void test1_watermark() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); bmqp::Crc32c::initialize(); { bmqp::ProtocolUtil::initialize(s_allocator_p); - mwcsys::Time::initialize(s_allocator_p); + bmqsys::Time::initialize(s_allocator_p); mqbcfg::AppConfig brokerConfig(s_allocator_p); mqbcfg::BrokerConfig::set(brokerConfig); @@ -320,12 +319,12 @@ int main(int argc, char* argv[]) } break; } - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); bmqp::ProtocolUtil::shutdown(); } bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_DEFAULT); + TEST_EPILOG(bmqtst::TestHelper::e_DEFAULT); // Do not check for default/global allocator usage. } diff --git a/src/groups/mqb/mqba/mqba_application.cpp b/src/groups/mqb/mqba/mqba_application.cpp index 055c33d2e..dee58e76e 100644 --- a/src/groups/mqb/mqba/mqba_application.cpp +++ b/src/groups/mqb/mqba/mqba_application.cpp @@ -43,12 +43,11 @@ #include #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -76,8 +75,8 @@ namespace BloombergLP { namespace mqba { namespace { -const int k_BLOBBUFFER_SIZE = 4 * 1024; -const int k_BLOB_POOL_GROWTH_STRATEGY = 1024; +const int k_BLOBBUFFER_SIZE = 4 * 1024; +const int k_BLOB_POOL_GROWTH_STRATEGY = 1024; const bsls::Types::Int64 k_STOP_REQUEST_TIMEOUT_MS = 5000; /// Create a new blob at the specified `arena` address, using the specified @@ -101,7 +100,7 @@ void Application::oneTimeInit() BSLMT_ONCE_DO { // Initialize Time with platform-specific clocks/timers - mwcsys::Time::initialize(); + bmqsys::Time::initialize(); // Initialize pseudo-random number generator. We add some // machine-specific (high resolution timer) and task-specific (pid) @@ -110,7 +109,7 @@ void Application::oneTimeInit() unsigned int seed = bsl::time(NULL) + static_cast(bdls::ProcessUtil::getProcessId()) + - static_cast(mwcsys::Time::highResolutionTimer() & + static_cast(bmqsys::Time::highResolutionTimer() & 0xFFFFFFFF); bsl::srand(seed); @@ -130,22 +129,22 @@ void Application::oneTimeShutdown() { bmqp::ProtocolUtil::shutdown(); bmqt::UriParser::shutdown(); - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); } } // CREATORS Application::Application(bdlmt::EventScheduler* scheduler, - mwcst::StatContext* allocatorsStatContext, + bmqst::StatContext* allocatorsStatContext, bslma::Allocator* allocator) : d_allocators(allocator) , d_scheduler_p(scheduler) -, d_adminExecutionPool(mwcsys::ThreadUtil::defaultAttributes(), +, d_adminExecutionPool(bmqsys::ThreadUtil::defaultAttributes(), 0, 1, bsls::TimeInterval(120).totalMilliseconds(), allocator) -, d_adminRerouteExecutionPool(mwcsys::ThreadUtil::defaultAttributes(), +, d_adminRerouteExecutionPool(bmqsys::ThreadUtil::defaultAttributes(), 0, 1, bsls::TimeInterval(120).totalMilliseconds(), @@ -200,19 +199,17 @@ Application::Application(bdlmt::EventScheduler* scheduler, // Print banner BALL_LOG_INFO - << "Starting" - << "\n ____ __ __ ___ _ _" + << "Starting" << "\n ____ __ __ ___ _ _" << "\n | __ )| \\/ |/ _ \\| |__ _ __ ___ | | _____ _ __" << "\n | _ \\| |\\/| | | | | '_ \\| '__/ _ \\| |/ / _ \\ '__|" << "\n | |_) | | | | |_| | |_) | | | (_) | < __/ |" - << "\n |____/|_| |_|\\__\\_\\_.__/|_| \\___/|_|\\_\\___|_|" - << "\n" + << "\n |____/|_| |_|\\__\\_\\_.__/|_| \\___/|_|\\_\\___|_|" << "\n" << "\n Instance..............: " << brkrCfg.brokerInstanceName() << "\n Version...............: " << brkrCfg.brokerVersion() << "\n Build Type............: " << MQBA_STRINGIFY(BMQ_BUILD_TYPE) << "\n Assert Level..........: " << assertLevel << "\n Config version........: " << brkrCfg.configVersion() - << "\n MWC version...........: " << mwcscm::Version::version() + << "\n BMQ version...........: " << bmqscm::Version::version() << "\n OS name...............: " << osName << "\n OS version............: " << osVersion << "\n OS patch..............: " << osPatch @@ -230,7 +227,7 @@ Application::~Application() } void Application::loadStatContexts( - bsl::unordered_map* contexts) const + bsl::unordered_map* contexts) const { if (!d_statController_mp) { return; // RETURN @@ -357,7 +354,7 @@ int Application::start(bsl::ostream& errorDescription) // sessionNegotiator and cluster catalog, creation and start order is // less than ideal - bsl::unordered_map statContextsMap( + bsl::unordered_map statContextsMap( d_allocator_p); d_statController_mp->loadStatContexts(&statContextsMap); @@ -785,7 +782,7 @@ int Application::executeCommand(const mqbcmd::Command& command, options.setInitialIndentLevel(1); options.setSpacesPerLevel(4); - mwcu::MemOutStream brokerConfigOs; + bmqu::MemOutStream brokerConfigOs; rc = encoder.encode(brokerConfigOs, mqbcfg::BrokerConfig::get(), options); @@ -799,7 +796,7 @@ int Application::executeCommand(const mqbcmd::Command& command, } } else { - mwcu::MemOutStream errorOs; + bmqu::MemOutStream errorOs; errorOs << "Unknown command '" << commandChoice << "'"; cmdResult->makeError().message() = errorOs.str(); } @@ -854,7 +851,7 @@ int Application::processCommand(const bslstl::StringRef& source, bsl::string selfName; if (routeCommandManager.isRoutingNeeded()) { - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; mqbi::Cluster* cluster = getRelevantCluster(errorDescription, command); if (cluster == NULL) { // Error occurred getting cluster @@ -894,7 +891,7 @@ int Application::processCommand(const bslstl::StringRef& source, if (shouldSelfExecute) { // Add self response (executed earlier) - mwcu::MemOutStream cmdOs; + bmqu::MemOutStream cmdOs; mqbcmd::Util::printCommandResult(cmdResult, command.encoding(), cmdOs); mqbcmd::RouteResponse routeResponse; routeResponse.response() = cmdOs.str(); @@ -913,7 +910,7 @@ int Application::processCommandCb( const bsl::function& onProcessedCb, bool fromReroute) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; int rc = processCommand(source, cmd, os, fromReroute); onProcessedCb(rc, os.str()); diff --git a/src/groups/mqb/mqba/mqba_application.h b/src/groups/mqb/mqba/mqba_application.h index f7707aa85..2e490e015 100644 --- a/src/groups/mqb/mqba/mqba_application.h +++ b/src/groups/mqb/mqba/mqba_application.h @@ -32,8 +32,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -70,7 +69,7 @@ class PluginManager; namespace mqbstat { class StatController; } -namespace mwcst { +namespace bmqst { class StatContext; } @@ -111,7 +110,7 @@ class Application { BlobSpPool; // Data members - mwcma::CountingAllocatorStore d_allocators; + bmqma::CountingAllocatorStore d_allocators; // Allocator store to spawn new allocators // for sub-components @@ -138,7 +137,7 @@ class Application { bdlma::ConcurrentPool d_pushElementsPool; - mwcst::StatContext* d_allocatorsStatContext_p; + bmqst::StatContext* d_allocatorsStatContext_p; // Stat context of the counting allocators, // if used @@ -192,7 +191,7 @@ class Application { /// Create a new `Application` object, using the specified `scheduler` /// and the specified `allocatorsStatContext` and `allocator`. Application(bdlmt::EventScheduler* scheduler, - mwcst::StatContext* allocatorsStatContext, + bmqst::StatContext* allocatorsStatContext, bslma::Allocator* allocator); /// Destructor. @@ -203,7 +202,7 @@ class Application { /// Load into the specified `contexts` all root top level stat contexts /// (allocators, systems, domains, clients, ...). void loadStatContexts( - bsl::unordered_map* contexts) const; + bsl::unordered_map* contexts) const; // MANIPULATORS diff --git a/src/groups/mqb/mqba/mqba_application.t.cpp b/src/groups/mqb/mqba/mqba_application.t.cpp index 1b1580a8c..96d99bf1a 100644 --- a/src/groups/mqb/mqba/mqba_application.t.cpp +++ b/src/groups/mqb/mqba/mqba_application.t.cpp @@ -28,7 +28,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -51,7 +51,7 @@ static void test1_breathingTest() // Breathing test of the component // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("breathing test"); + bmqtst::TestHelper::printTestName("breathing test"); // Create a default application, make sure it can start/stop mqbcfg::AppConfig cfg(s_allocator_p); @@ -65,7 +65,7 @@ static void test1_breathingTest() 0, // no allocatorsStatContext s_allocator_p); - // mwcs::MemOutStream error(s_allocator_p); + // bmqs::MemOutStream error(s_allocator_p); // int rc = obj.start(error); // ASSERT_EQ(rc, 0); // obj.stop(); @@ -78,7 +78,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); // Force initialize protocolUtil before any 'mqba::Application' object @@ -99,5 +99,5 @@ int main(int argc, char* argv[]) // Disable default/global allocator check: // - Logger uses the default allocator - TEST_EPILOG(mwctst::TestHelper::e_DEFAULT); + TEST_EPILOG(bmqtst::TestHelper::e_DEFAULT); } diff --git a/src/groups/mqb/mqba/mqba_clientsession.cpp b/src/groups/mqb/mqba/mqba_clientsession.cpp index e630670d1..0d1d5674c 100644 --- a/src/groups/mqb/mqba/mqba_clientsession.cpp +++ b/src/groups/mqb/mqba/mqba_clientsession.cpp @@ -53,7 +53,7 @@ // for remotely activated asynchronous requests (such as 'openQueue' which // could be sending an async request to the cluster, and deliver the response // through the proxyBroker<->clusterBroker IO channel). For those kind of -// requests, the 'mwcu::SharedResource' must be used. All callbacks having the +// requests, the 'bmqu::SharedResource' must be used. All callbacks having the // shared resource bound and which will be invoked through the dispatcher must // do so by using the 'e_DISPATCHER' dispatcher event type, to ensure the // client will not be added to the dispatcher's flush list: the client may @@ -172,13 +172,12 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -228,7 +227,7 @@ void sessionHolderDummy( /// Create the queue stats datum associated with the specified `statContext` /// and having the specified `domain`, `cluster`, and `queueFlags`. -void createQueueStatsDatum(mwcst::StatContext* statContext, +void createQueueStatsDatum(bmqst::StatContext* statContext, const bsl::string& domain, const bsl::string& cluster, bsls::Types::Uint64 queueFlags) @@ -295,7 +294,7 @@ void finalizeClosedHandle(bsl::string description, // ------------------------- ClientSessionState::ClientSessionState( - bslma::ManagedPtr& clientStatContext, + bslma::ManagedPtr& clientStatContext, BlobSpPool* blobSpPool, bdlbb::BlobBufferFactory* bufferFactory, bmqp::EncodingType::Enum encodingType, @@ -434,20 +433,20 @@ void ClientSession::sendPacketDispatched(const bdlbb::Blob& blob, // Try to send the data, if we fail due to high watermark limit, enqueue // the message to the channelBufferQueue, and we'll send it later, once we // get the lowWatermark notification. - mwcio::Status status; + bmqio::Status status; d_channel_sp->write(&status, blob); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( - status.category() != mwcio::StatusCategory::e_SUCCESS)) { + status.category() != bmqio::StatusCategory::e_SUCCESS)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - if (status.category() == mwcio::StatusCategory::e_CONNECTION) { + if (status.category() == bmqio::StatusCategory::e_CONNECTION) { // This code relies on the fact that `e_CONNECTION` error cannot be // returned without calling `tearDown`. return; // RETURN } - if (status.category() == mwcio::StatusCategory::e_LIMIT) { + if (status.category() == bmqio::StatusCategory::e_LIMIT) { BALL_LOG_WARN << "#CLIENT_SEND_FAILURE " << description() << ": Failed to send data [size: " - << mwcu::PrintUtil::prettyNumber(blob.length()) + << bmqu::PrintUtil::prettyNumber(blob.length()) << " bytes] to client due to channel watermark limit" << "; enqueuing to the ChannelBufferQueue."; d_state.d_channelBufferQueue.push_back(blob); @@ -455,7 +454,7 @@ void ClientSession::sendPacketDispatched(const bdlbb::Blob& blob, else { BALL_LOG_INFO << "#CLIENT_SEND_FAILURE " << description() << ": Failed to send data [size: " - << mwcu::PrintUtil::prettyNumber(blob.length()) + << bmqu::PrintUtil::prettyNumber(blob.length()) << " bytes] to client with status: " << status; } } @@ -480,9 +479,9 @@ void ClientSession::flushChannelBufferQueue() while (!d_state.d_channelBufferQueue.empty()) { const bdlbb::Blob& blob = d_state.d_channelBufferQueue.front(); - mwcio::Status status; + bmqio::Status status; d_channel_sp->write(&status, blob); - if (status.category() == mwcio::StatusCategory::e_LIMIT) { + if (status.category() == bmqio::StatusCategory::e_LIMIT) { // We are hitting the limit again, can't continue.. stop sending // and we'll resume with the next lowWatermark notification. BALL_LOG_WARN @@ -923,7 +922,7 @@ void ClientSession::deconfigureAndWait(ShutdownContextSp& context) d_operationState = e_SHUTTING_DOWN; // Fill the first link with handle deconfigure operations - mwcu::OperationChainLink link(d_shutdownChain.allocator()); + bmqu::OperationChainLink link(d_shutdownChain.allocator()); for (QueueStateMapIter it = d_queueSessionManager.queues().begin(); it != d_queueSessionManager.queues().end(); @@ -990,7 +989,7 @@ void ClientSession::checkUnconfirmedDispatched( // expired or the client is disconnected skip checking of the unconfirmed // messages and break the shutdown sequence. const bool isDisconnected = d_operationState != e_SHUTTING_DOWN; - if (mwcsys::Time::nowMonotonicClock() >= shutdownCtx->d_stopTime || + if (bmqsys::Time::nowMonotonicClock() >= shutdownCtx->d_stopTime || isDisconnected) { BALL_LOG_INFO << description() << (isDisconnected ? ": the client is disconnected." @@ -1005,7 +1004,7 @@ void ClientSession::checkUnconfirmedDispatched( shutdownCtx->d_numUnconfirmedTotal = 0; // Add countUnconfirmed operations - mwcu::OperationChainLink link(d_shutdownChain.allocator()); + bmqu::OperationChainLink link(d_shutdownChain.allocator()); for (QueueStateMapIter it = d_queueSessionManager.queues().begin(); it != d_queueSessionManager.queues().end(); @@ -1094,7 +1093,7 @@ void ClientSession::finishCheckUnconfirmedDispatched( bdlb::ScopeExitAny guard(completionCb); const bsls::TimeInterval nextCheckTime = - mwcsys::Time::nowMonotonicClock().addSeconds(1); + bmqsys::Time::nowMonotonicClock().addSeconds(1); // If there are no unconfirmed messages, or if there is no more time to // wait for the confirms, or the client is disconnected then finish the @@ -1120,7 +1119,7 @@ void ClientSession::finishCheckUnconfirmedDispatched( &d_periodicUnconfirmedCheckHandler, nextCheckTime, bdlf::BindUtil::bind( - mwcu::WeakMemFnUtil::weakMemFn(&ClientSession::checkUnconfirmed, + bmqu::WeakMemFnUtil::weakMemFn(&ClientSession::checkUnconfirmed, d_self.acquireWeak()), shutdownCtx, bdlf::noOp)); @@ -1135,27 +1134,27 @@ void ClientSession::closeChannel() BALL_LOG_INFO << description() << ": Closing channel " << channel()->peerUri(); - mwcio::Status status( - mwcio::StatusCategory::e_SUCCESS, + bmqio::Status status( + bmqio::StatusCategory::e_SUCCESS, mqbnet::TCPSessionFactory::k_CHANNEL_STATUS_CLOSE_REASON, true, d_state.d_allocator_p); - // Assume safe to call 'mwcio::Channel::close' on already closed channel. + // Assume safe to call 'bmqio::Channel::close' on already closed channel. channel()->close(status); } -void ClientSession::logOperationTime(mwcu::MemOutStream& opDescription) +void ClientSession::logOperationTime(bmqu::MemOutStream& opDescription) { if (d_beginTimestamp) { BALL_LOG_INFO_BLOCK { const bsls::Types::Int64 elapsed = - mwcsys::Time::highResolutionTimer() - d_beginTimestamp; + bmqsys::Time::highResolutionTimer() - d_beginTimestamp; BALL_LOG_OUTPUT_STREAM << description() << ": " << opDescription.str() - << " took: " << mwcu::PrintUtil::prettyTimeInterval(elapsed) + << " took: " << bmqu::PrintUtil::prettyTimeInterval(elapsed) << " (" << elapsed << " nanoseconds)"; } d_beginTimestamp = 0; @@ -1213,12 +1212,12 @@ void ClientSession::processDisconnectAllQueues( // 'processDisconnectAllQueuesDone' once all queues threads have been // drained. Note, this must be using an 'e_DISPATCHER' dispatcher event // type, refer to top level documention for explanation (paragraph about - // the mwcu::SharedResource). + // the bmqu::SharedResource). dispatcher()->execute( mqbi::Dispatcher::ProcessorFunctor(), // empty mqbi::DispatcherClientType::e_QUEUE, bdlf::BindUtil::bind( - mwcu::WeakMemFnUtil::weakMemFn( + bmqu::WeakMemFnUtil::weakMemFn( &ClientSession::processDisconnectAllQueuesDone, d_self.acquireWeak()), controlMessage)); @@ -1236,7 +1235,7 @@ void ClientSession::processDisconnectAllQueuesDone( dispatcher()->execute( bdlf::BindUtil::bind( - mwcu::WeakMemFnUtil::weakMemFn(&ClientSession::processDisconnect, + bmqu::WeakMemFnUtil::weakMemFn(&ClientSession::processDisconnect, d_self.acquireWeak()), controlMessage), this); @@ -1558,7 +1557,7 @@ void ClientSession::processConfigureStream( handle->configure( req.streamParameters(), bdlf::BindUtil::bind( - mwcu::WeakMemFnUtil::weakMemFn(&ClientSession::onHandleConfigured, + bmqu::WeakMemFnUtil::weakMemFn(&ClientSession::onHandleConfigured, d_self.acquireWeak()), bdlf::PlaceHolders::_1, // status bdlf::PlaceHolders::_2, // streamParams @@ -1602,7 +1601,7 @@ void ClientSession::onAckEvent(const mqbi::DispatcherAckEvent& event) if (cit != d_state.d_unackedMessageInfos.end()) { // Calculate time delta between PUT and ACK const bsls::Types::Int64 timeDelta = - mwcsys::Time::highResolutionTimer() - cit->second.d_timeStamp; + bmqsys::Time::highResolutionTimer() - cit->second.d_timeStamp; queue->stats()->onEvent( mqbstat::QueueStatsDomain::EventType::e_ACK_TIME, timeDelta); @@ -1689,7 +1688,7 @@ void ClientSession::onConfirmEvent(const mqbi::DispatcherConfirmEvent& event) int rc = 0; bdlma::LocalSequentialAllocator<256> localAllocator(d_state.d_allocator_p); - mwcu::MemOutStream errorStream(&localAllocator); + bmqu::MemOutStream errorStream(&localAllocator); while ((rc = confIt.next()) == 1) { const int id = confIt.message().queueId(); @@ -1774,7 +1773,7 @@ void ClientSession::onRejectEvent(const mqbi::DispatcherRejectEvent& event) int rc = 0; bdlma::LocalSequentialAllocator<256> localAllocator(d_state.d_allocator_p); - mwcu::MemOutStream errorStream(&localAllocator); + bmqu::MemOutStream errorStream(&localAllocator); while ((rc = rejectIt.next()) == 1) { const int id = rejectIt.message().queueId(); @@ -1961,7 +1960,7 @@ void ClientSession::onPushEvent(const mqbi::DispatcherPushEvent& event) << it->second.d_handle_p->queue()->uri() << "'" << ", subQueueInfo: " << event.subQueueInfos()[i] << ", GUID: " << event.guid() << "]:\n" - << mwcu::BlobStartHexDumper(blob, k_PAYLOAD_DUMP); + << bmqu::BlobStartHexDumper(blob, k_PAYLOAD_DUMP); } } @@ -2055,7 +2054,7 @@ void ClientSession::onPushEvent(const mqbi::DispatcherPushEvent& event) << citer->second.d_handle_p->queue()->uri() << "', subQueueInfo: " << event.subQueueInfos()[i] << ", GUID: " << event.guid() << "]:\n" - << mwcu::BlobStartHexDumper(blob, k_PAYLOAD_DUMP); + << bmqu::BlobStartHexDumper(blob, k_PAYLOAD_DUMP); invalidQueueStats()->onEvent( mqbstat::QueueStatsClient::EventType::e_PUSH, @@ -2081,7 +2080,7 @@ void ClientSession::onPushEvent(const mqbi::DispatcherPushEvent& event) // REVISIT: An alternative is to send Reject upstream if (dumpRc == 0) { - MWCTSK_ALARMLOG_ALARM("CLIENT_INVALID_PUSH") + BMQTSK_ALARMLOG_ALARM("CLIENT_INVALID_PUSH") << description() << ": error '" << convertingRc << "' converting to old format [queue: '" << citer->second.d_handle_p->queue()->uri() @@ -2089,10 +2088,10 @@ void ClientSession::onPushEvent(const mqbi::DispatcherPushEvent& event) << ", compressionAlgorithmType: " << event.compressionAlgorithmType() << "] Message was dumped in file at location [" << filepath - << "] on this machine." << MWCTSK_ALARMLOG_END; + << "] on this machine." << BMQTSK_ALARMLOG_END; } else { - MWCTSK_ALARMLOG_ALARM("CLIENT_INVALID_PUSH") + BMQTSK_ALARMLOG_ALARM("CLIENT_INVALID_PUSH") << description() << ": error '" << convertingRc << "' converting to old format [queue: '" << citer->second.d_handle_p->queue()->uri() @@ -2100,7 +2099,7 @@ void ClientSession::onPushEvent(const mqbi::DispatcherPushEvent& event) << ", compressionAlgorithmType: " << event.compressionAlgorithmType() << "] Attempt to dump message in a file failed with error " - << dumpRc << MWCTSK_ALARMLOG_END; + << dumpRc << BMQTSK_ALARMLOG_END; } } } @@ -2309,7 +2308,7 @@ void ClientSession::onPutEvent(const mqbi::DispatcherPutEvent& event) bsl::make_pair(putHeader.messageGUID(), ClientSessionState::UnackedMessageInfo( correlationId, - mwcsys::Time::highResolutionTimer()))); + bmqsys::Time::highResolutionTimer()))); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(insertRc.second == false)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; @@ -2347,7 +2346,7 @@ void ClientSession::onPutEvent(const mqbi::DispatcherPutEvent& event) << ", flags: " << putIt.header().flags() << ", message size: " << putIt.applicationDataSize() << "]:\n" - << mwcu::BlobStartHexDumper(appDataSp.get(), 64); + << bmqu::BlobStartHexDumper(appDataSp.get(), 64); queueStatePtr->d_handle_p->postMessage(putIt.header(), appDataSp, @@ -2390,7 +2389,7 @@ mqbstat::QueueStatsClient* ClientSession::invalidQueueStats() // only be done once the stats UI panel has been updated to // support that. - mwcst::StatContext* statContext = + bmqst::StatContext* statContext = d_state.d_invalidQueueStats.value().statContext(); createQueueStatsDatum(statContext, "invalid", "none", 0); } @@ -2587,13 +2586,13 @@ bool ClientSession::validatePutMessage(QueueState** queueState, // CREATORS ClientSession::ClientSession( - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bmqp_ctrlmsg::NegotiationMessage& negotiationMessage, const bsl::string& sessionDescription, mqbi::Dispatcher* dispatcher, mqbblp::ClusterCatalog* clusterCatalog, mqbi::DomainFactory* domainFactory, - bslma::ManagedPtr& clientStatContext, + bslma::ManagedPtr& clientStatContext, ClientSessionState::BlobSpPool* blobSpPool, bdlbb::BlobBufferFactory* bufferFactory, bdlmt::EventScheduler* scheduler, @@ -2688,7 +2687,7 @@ void ClientSession::processEvent( << ": Received invalid control message from client " << "[reason: 'failed to decode', rc: " << rc << "]:\n" - << mwcu::BlobStartHexDumper(event.blob()); + << bmqu::BlobStartHexDumper(event.blob()); return; // RETURN } @@ -2722,7 +2721,7 @@ void ClientSession::processEvent( return; // RETURN } - d_beginTimestamp = mwcsys::Time::highResolutionTimer(); + d_beginTimestamp = bmqsys::Time::highResolutionTimer(); d_isDisconnecting = true; eventCallback = bdlf::BindUtil::bind( @@ -2731,7 +2730,7 @@ void ClientSession::processEvent( controlMessage); } break; case MsgChoice::SELECTION_ID_OPEN_QUEUE: { - d_beginTimestamp = mwcsys::Time::highResolutionTimer(); + d_beginTimestamp = bmqsys::Time::highResolutionTimer(); eventCallback = bdlf::BindUtil::bind( &ClientSession::processOpenQueue, @@ -2739,7 +2738,7 @@ void ClientSession::processEvent( controlMessage); } break; case MsgChoice::SELECTION_ID_CLOSE_QUEUE: { - d_beginTimestamp = mwcsys::Time::highResolutionTimer(); + d_beginTimestamp = bmqsys::Time::highResolutionTimer(); eventCallback = bdlf::BindUtil::bind( &ClientSession::processCloseQueue, @@ -2748,7 +2747,7 @@ void ClientSession::processEvent( } break; case MsgChoice::SELECTION_ID_CONFIGURE_QUEUE_STREAM: case MsgChoice::SELECTION_ID_CONFIGURE_STREAM: { - d_beginTimestamp = mwcsys::Time::highResolutionTimer(); + d_beginTimestamp = bmqsys::Time::highResolutionTimer(); eventCallback = bdlf::BindUtil::bind( &ClientSession::processConfigureStream, @@ -2872,7 +2871,7 @@ void ClientSession::initiateShutdown(const ShutdownCb& callback, { // executed by the *ANY* thread - d_beginTimestamp = mwcsys::Time::highResolutionTimer(); + d_beginTimestamp = bmqsys::Time::highResolutionTimer(); BALL_LOG_INFO << description() << ": initiateShutdown"; @@ -2890,7 +2889,7 @@ void ClientSession::initiateShutdown(const ShutdownCb& callback, // // Choosing 2), assuming that calling the (completion) callback from a // thread other than the *CLIENT* dispatcher thread is ok. The - // 'mwcu::OperationChainLink' expects the completion callback from multiple + // 'bmqu::OperationChainLink' expects the completion callback from multiple // sessions anyway. bsl::shared_ptr ptr = d_self.acquire(); @@ -2926,13 +2925,13 @@ void ClientSession::invalidate() } // MANIPULATORS -void ClientSession::onWatermark(mwcio::ChannelWatermarkType::Enum type) +void ClientSession::onWatermark(bmqio::ChannelWatermarkType::Enum type) { switch (type) { - case mwcio::ChannelWatermarkType::e_LOW_WATERMARK: { + case bmqio::ChannelWatermarkType::e_LOW_WATERMARK: { onLowWatermark(); } break; // BREAK - case mwcio::ChannelWatermarkType::e_HIGH_WATERMARK: { + case bmqio::ChannelWatermarkType::e_HIGH_WATERMARK: { onHighWatermark(); } break; // BREAK default: { @@ -3022,35 +3021,35 @@ void ClientSession::onDispatcherEvent(const mqbi::DispatcherEvent& event) BSLS_ASSERT_OPT(false && "'CONTROL_MSG' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_DISPATCHER: { BSLS_ASSERT_OPT(false && "'DISPATCHER' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_UNDEFINED: { BSLS_ASSERT_OPT(false && "'NONE' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_CLUSTER_STATE: { BSLS_ASSERT_OPT(false && "'CLUSTER_STATE' dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_STORAGE: { BSLS_ASSERT_OPT(false && "'STORAGE' dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_RECOVERY: { BSLS_ASSERT_OPT(false && "'RECOVERY' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_REPLICATION_RECEIPT: { BSLS_ASSERT_OPT( false && "'REPLICATION_RECEIPT' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; default: { BALL_LOG_ERROR << "#CLIENT_UNEXPECTED_EVENT " << description() diff --git a/src/groups/mqb/mqba/mqba_clientsession.h b/src/groups/mqb/mqba/mqba_clientsession.h index ecc803395..47c9e7ada 100644 --- a/src/groups/mqb/mqba/mqba_clientsession.h +++ b/src/groups/mqb/mqba/mqba_clientsession.h @@ -48,12 +48,11 @@ #include #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -91,7 +90,7 @@ class QueueHandle; namespace mqbblp { class ClusterCatalog; } -namespace mwcst { +namespace bmqst { class StatContext; } @@ -149,7 +148,7 @@ struct ClientSessionState { typedef bsl::pair UnackedMessageInfoMapInsertRc; - typedef bslma::ManagedPtr StatContextMp; + typedef bslma::ManagedPtr StatContextMp; public: // PUBLIC DATA @@ -238,7 +237,7 @@ struct ClientSessionState { /// builder will use. Memory allocations are performed using the /// specified `allocator`. ClientSessionState( - bslma::ManagedPtr& clientStatContext, + bslma::ManagedPtr& clientStatContext, BlobSpPool* blobSpPool, bdlbb::BlobBufferFactory* bufferFactory, bmqp::EncodingType::Enum encodingType, @@ -309,7 +308,7 @@ class ClientSession : public mqbnet::Session, private: // DATA - mwcu::SharedResource d_self; + bmqu::SharedResource d_self; // This object is used to avoid // executing a callback if the session // has been destroyed: this is *ONLY* to @@ -363,7 +362,7 @@ class ClientSession : public mqbnet::Session, bsl::string d_description; // Short identifier for this session. - bsl::shared_ptr d_channel_sp; + bsl::shared_ptr d_channel_sp; // Channel associated to this session. ClientSessionState d_state; @@ -387,7 +386,7 @@ class ClientSession : public mqbnet::Session, // the unconfirmed messages during the // session shutdown. - mwcu::OperationChain d_shutdownChain; + bmqu::OperationChain d_shutdownChain; // Mechanism used for the session // graceful shutdown to serialize // execution of the queue handle @@ -400,7 +399,7 @@ class ClientSession : public mqbnet::Session, bsls::Types::Int64 d_beginTimestamp; // HiRes timer value of the begin session/queue operation - mwcu::MemOutStream d_currentOpDescription; + bmqu::MemOutStream d_currentOpDescription; // Stream for constructing current session/queue operation description. private: @@ -625,7 +624,7 @@ class ClientSession : public mqbnet::Session, /// Log session/queue operation time for the specified `opDescription` /// using the stored operation begin timestamp. After logging reset /// `opDescription` and set begin timestamp to 0. - void logOperationTime(mwcu::MemOutStream& opDescription); + void logOperationTime(bmqu::MemOutStream& opDescription); // PRIVATE ACCESSORS @@ -649,13 +648,13 @@ class ClientSession : public mqbnet::Session, /// received from the peer during negotiation, and the specified /// `sessionDescription` is the short form description of the session. /// Memory allocations are performed using the specified `allocator`. - ClientSession(const bsl::shared_ptr& channel, + ClientSession(const bsl::shared_ptr& channel, const bmqp_ctrlmsg::NegotiationMessage& negotiationMessage, const bsl::string& sessionDescription, mqbi::Dispatcher* dispatcher, mqbblp::ClusterCatalog* clusterCatalog, mqbi::DomainFactory* domainFactory, - bslma::ManagedPtr& clientStatContext, + bslma::ManagedPtr& clientStatContext, ClientSessionState::BlobSpPool* blobSpPool, bdlbb::BlobBufferFactory* bufferFactory, bdlmt::EventScheduler* scheduler, @@ -701,7 +700,7 @@ class ClientSession : public mqbnet::Session, void invalidate() BSLS_KEYWORD_OVERRIDE; // MANIPULATORS - void onWatermark(mwcio::ChannelWatermarkType::Enum type); + void onWatermark(bmqio::ChannelWatermarkType::Enum type); void onHighWatermark(); /// Watermark notification methods from observing the specified @@ -727,7 +726,7 @@ class ClientSession : public mqbnet::Session, // (virtual: mqbnet::Session) /// Return the channel associated to this session. - bsl::shared_ptr channel() const BSLS_KEYWORD_OVERRIDE; + bsl::shared_ptr channel() const BSLS_KEYWORD_OVERRIDE; /// Return the clusterNode associated to this session, or 0 if there are /// none. @@ -797,7 +796,7 @@ inline ClientSession::ShutdownContext::ShutdownContext( const ShutdownCb& callback, const bsls::TimeInterval& timeout) : d_callback(callback) -, d_stopTime(mwcsys::Time::nowMonotonicClock()) +, d_stopTime(bmqsys::Time::nowMonotonicClock()) , d_numUnconfirmedTotal(0) { BSLS_ASSERT_SAFE(d_callback); @@ -837,7 +836,7 @@ inline bool ClientSession::isProxy() const bmqp_ctrlmsg::ClientType::E_TCPBROKER; } -inline bsl::shared_ptr ClientSession::channel() const +inline bsl::shared_ptr ClientSession::channel() const { return d_channel_sp; } diff --git a/src/groups/mqb/mqba/mqba_clientsession.t.cpp b/src/groups/mqb/mqba/mqba_clientsession.t.cpp index 557f2c4a4..352ec5103 100644 --- a/src/groups/mqb/mqba/mqba_clientsession.t.cpp +++ b/src/groups/mqb/mqba/mqba_clientsession.t.cpp @@ -40,15 +40,14 @@ #include #include #include -#include +#include -// MWC -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -64,7 +63,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -446,8 +445,8 @@ class MyMockQueueHandle : public mqbmock::QueueHandle { private: // PRIVATE DATA - mwcst::StatContext d_statContext; - // The 'mwcst::StatContext' for this 'QueueHandle'. + bmqst::StatContext d_statContext; + // The 'bmqst::StatContext' for this 'QueueHandle'. bsl::vector d_postedMessages; @@ -472,7 +471,7 @@ class MyMockQueueHandle : public mqbmock::QueueHandle { domainStats, handleParameters, allocator) - , d_statContext(mwcst::StatContextConfiguration("Test Stat Context") + , d_statContext(bmqst::StatContextConfiguration("Test Stat Context") .value("In", 11) .value("Out", 11), allocator) @@ -643,18 +642,18 @@ class TestBench { private: // PRIVATE TYPES typedef mqbmock::Dispatcher::EventGuard EventGuard; - typedef const mwcio::TestChannel::WriteCall ConstWriteCall; + typedef const bmqio::TestChannel::WriteCall ConstWriteCall; public: // DATA bdlbb::PooledBlobBufferFactory d_bufferFactory; BlobSpPool d_blobSpPool; - bsl::shared_ptr d_channel; + bsl::shared_ptr d_channel; mqbmock::Cluster d_cluster; mqbmock::Dispatcher d_mockDispatcher; MyMockDomain d_domain; mqbmock::DomainFactory d_mockDomainFactory; - bslma::ManagedPtr d_clientStatContext_mp; + bslma::ManagedPtr d_clientStatContext_mp; bdlmt::EventScheduler d_scheduler; TestClock d_testClock; mqba::ClientSession d_cs; @@ -676,7 +675,7 @@ class TestBench { bdlf::PlaceHolders::_2), // alloc 1024, // blob pool growth strategy allocator) - , d_channel(new mwcio::TestChannel(allocator)) + , d_channel(new bmqio::TestChannel(allocator)) , d_cluster(&d_bufferFactory, allocator) , d_mockDispatcher(allocator) , d_domain(&d_mockDispatcher, &d_cluster, atMostOnce, allocator) @@ -735,8 +734,8 @@ class TestBench { d_mockDispatcher._setInDispatcherThread(true); // Setup test time source - mwcsys::Time::shutdown(); - mwcsys::Time::initialize( + bmqsys::Time::shutdown(); + bmqsys::Time::initialize( bdlf::BindUtil::bind(&TestClock::realtimeClock, &d_testClock), bdlf::BindUtil::bind(&TestClock::monotonicClock, &d_testClock), bdlf::BindUtil::bind(&TestClock::highResTimer, &d_testClock), @@ -1047,7 +1046,7 @@ class TestBench { bdlbb::Blob payloadBlob(&d_bufferFactory, d_allocator_p); pushIt.loadApplicationData(&payloadBlob); - mwcu::BlobObjectProxy mpsh( + bmqu::BlobObjectProxy mpsh( &payloadBlob, true, // read false); // write @@ -1433,7 +1432,7 @@ static void test1_ackConfigurations() // That acks are propagated as expected. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "TESTS ACK CONFIGURATIONS FOR CLIENT SESSION"); #define SCENARIO_RUN(var, from, to) for (int var = from; var <= to; ++var) { @@ -1477,7 +1476,7 @@ static void test2_invalidPutConfigurations() // That acks are propagated as expected. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "TESTS INVALID PUT CONFIGURATIONS FOR CLIENT SESSION"); #define SCENARIO_RUN(var, from, to) for (int var = from; var <= to; ++var) { @@ -1519,7 +1518,7 @@ static void test3_guidCollisionConfigurations() // That acks are propagated or not as expected. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "TESTS GUID COLLISION CONFIGURATIONS FOR CLIENT SESSION"); #define SCENARIO_RUN(var, from, to) for (int var = from; var <= to; ++var) { @@ -1556,7 +1555,7 @@ static void test4_ackRequestedNullCorrelationId() // That ack is not propagated as expected. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "TESTS ACK REQUESTED NULL CORRELATION ID"); const bsl::string uri("bmq://my.domain/queue-foo-bar", s_allocator_p); @@ -1620,7 +1619,7 @@ static void test5_ackNotRequestedNotNullCorrelationId() // That ack is propagated as expected. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "TESTS ACK NOT REQUESTED NOT NULL CORRELATION ID"); const bsl::string uri("bmq://my.domain/queue-foo-bar", s_allocator_p); @@ -1684,7 +1683,7 @@ static void test6_firstHopUnsetGUID() // That nack is propagated as expected. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("TESTS FIRST HOP UNSET GUID"); + bmqtst::TestHelper::printTestName("TESTS FIRST HOP UNSET GUID"); #define SCENARIO_RUN(var, from, to) for (int var = from; var <= to; ++var) { #define END_SCENARIO } @@ -1714,7 +1713,7 @@ static void test7_oldStylePut() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("TESTS CONVERSION FROM OLD STYLE PUT"); + bmqtst::TestHelper::printTestName("TESTS CONVERSION FROM OLD STYLE PUT"); const bsl::string uri("bmq://my.domain/queue-foo-bar", s_allocator_p); const int queueId = 4; // A queue number @@ -1760,7 +1759,7 @@ static void test7_oldStylePut() int msgPropsAreaSize; bmqp::ProtocolUtil::readPropertiesSize(&msgPropsAreaSize, *payloadBlob, - mwcu::BlobPosition()); + bmqu::BlobPosition()); ASSERT(tb.validateData(*postMessages[0].d_appData, msgPropsAreaSize)); @@ -1787,7 +1786,7 @@ static void test8_oldStyleCompressedPut() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "TESTS OLD STYLE COMPRESSED PUT CONVERSION"); const bsl::string uri("bmq://my.domain/queue-foo-bar", s_allocator_p); @@ -1839,7 +1838,7 @@ static void test8_oldStyleCompressedPut() int msgPropsAreaSize; bmqp::ProtocolUtil::readPropertiesSize(&msgPropsAreaSize, *payloadBlob, - mwcu::BlobPosition()); + bmqu::BlobPosition()); ASSERT(tb.validateData(*postMessages[0].d_appData, msgPropsAreaSize)); @@ -1867,7 +1866,7 @@ static void test9_newStylePush() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "TESTS OLD STYLE COMPRESSED PUT CONVERSION"); const bsl::string uri("bmq://my.domain/queue-foo-bar", s_allocator_p); @@ -1947,7 +1946,7 @@ static void test9_newStylePush() int msgPropsAreaSize; bmqp::ProtocolUtil::readPropertiesSize(&msgPropsAreaSize, *payloadBlob, - mwcu::BlobPosition()); + bmqu::BlobPosition()); ASSERT(tb.validateData(*postMessages[0].d_appData, msgPropsAreaSize, 99)); @@ -1974,7 +1973,7 @@ static void test10_newStyleCompressedPush() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "TESTS OLD STYLE COMPRESSED PUT CONVERSION"); const bsl::string uri("bmq://my.domain/queue-foo-bar", s_allocator_p); @@ -2081,7 +2080,7 @@ static void test11_initiateShutdown() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("TESTS SHUTTING DOWN"); + bmqtst::TestHelper::printTestName("TESTS SHUTTING DOWN"); const bsl::string uri("bmq://my.domain/queue-foo-bar", s_allocator_p); @@ -2361,7 +2360,7 @@ static void testN1_ackConfiguration() // That acks are propagated as expected. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "TESTS ACK CONFIGURATION FOR CLIENT SESSION"); cout << "Please enter the configuration to test followed by\n" @@ -2446,7 +2445,7 @@ static void testN2_invalidPutConfiguration() // That acks are propagated as expected. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "TESTS INVALID PUT CONFIGURATION FOR CLIENT SESSION"); cout << "Please enter the configuration to test followed by\n" @@ -2522,7 +2521,7 @@ static void testN3_guidCollisionConfiguration() // That acks are propagated or not as expected. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "TESTS GUID COLLISION CONFIGURATION FOR CLIENT SESSION"); cout << "Please enter the configuration to test followed by\n" @@ -2577,14 +2576,14 @@ static void testN3_guidCollisionConfiguration() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); bmqp::Crc32c::initialize(); { bmqp::ProtocolUtil::initialize(s_allocator_p); - mwcsys::Time::initialize(s_allocator_p); + bmqsys::Time::initialize(s_allocator_p); mqbcfg::AppConfig brokerConfig(s_allocator_p); brokerConfig.brokerVersion() = 999999; // required for test case 8 @@ -2592,7 +2591,7 @@ int main(int argc, char* argv[]) // from v1 to v2 mqbcfg::BrokerConfig::set(brokerConfig); - bsl::shared_ptr statContext = + bsl::shared_ptr statContext = mqbstat::BrokerStatsUtil::initializeStatContext(30, s_allocator_p); mqbu::MessageGUIDUtil::initialize(); @@ -2619,12 +2618,12 @@ int main(int argc, char* argv[]) } break; } - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); bmqp::ProtocolUtil::shutdown(); } bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_DEFAULT); + TEST_EPILOG(bmqtst::TestHelper::e_DEFAULT); // Do not check for default/global allocator usage. } diff --git a/src/groups/mqb/mqba/mqba_commandrouter.cpp b/src/groups/mqb/mqba/mqba_commandrouter.cpp index 0c9d9abf5..48fa28eb1 100644 --- a/src/groups/mqb/mqba/mqba_commandrouter.cpp +++ b/src/groups/mqb/mqba/mqba_commandrouter.cpp @@ -205,7 +205,7 @@ int CommandRouter::route(bsl::ostream& errorDescription, contextSp->setDestinationNodes(routeTargets.d_nodes); - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Routing command to the following nodes ["; for (NodesVector::const_iterator nit = routeTargets.d_nodes.begin(); nit != routeTargets.d_nodes.end(); @@ -267,7 +267,7 @@ void CommandRouter::onRouteCommandResponse( mqbcmd::Result result; result.makeError().message() = errorMessage; // encode result - mwcu::MemOutStream os; + bmqu::MemOutStream os; bool pretty = d_command.encoding() == mqbcmd::EncodingFormat::JSON_PRETTY ? true diff --git a/src/groups/mqb/mqba/mqba_configprovider.cpp b/src/groups/mqb/mqba/mqba_configprovider.cpp index ccc3fba19..d51f5f348 100644 --- a/src/groups/mqb/mqba/mqba_configprovider.cpp +++ b/src/groups/mqb/mqba/mqba_configprovider.cpp @@ -25,11 +25,10 @@ // BMQ #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -65,7 +64,7 @@ bool ConfigProvider::cacheLookup(mqbconfm::Response* response, } // Check expiration time - if (it->second.d_expireTime < mwcsys::Time::nowMonotonicClock()) { + if (it->second.d_expireTime < bmqsys::Time::nowMonotonicClock()) { // Value has expired, remove from the map d_cache.erase(it); return false; // RETURN @@ -97,7 +96,7 @@ void ConfigProvider::onDomainConfigResponseCb( CacheEntry cacheEntry; cacheEntry.d_data = response; cacheEntry.d_expireTime = - mwcsys::Time::nowMonotonicClock() + + bmqsys::Time::nowMonotonicClock() + bsls::TimeInterval( mqbcfg::BrokerConfig::get().bmqconfConfig().cacheTTLSeconds()); d_cache[response.domainConfig().domainName()] = cacheEntry; @@ -157,7 +156,7 @@ void ConfigProvider::getDomainConfig(const bslstl::StringRef& domainName, if (!bdls::FilesystemUtil::exists(filePath)) { bdlma::LocalSequentialAllocator<1024> localAllocator(d_allocator_p); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "Domain file '" << filePath << "' doesn't exist"; config.assign(os.str().data(), os.str().length()); rc = -1; @@ -167,7 +166,7 @@ void ConfigProvider::getDomainConfig(const bslstl::StringRef& domainName, if (!fileStream) { bdlma::LocalSequentialAllocator<1024> localAllocator( d_allocator_p); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "Unable to open domain file '" << filePath << "'"; config.assign(os.str().data(), os.str().length()); rc = -2; @@ -227,7 +226,7 @@ int ConfigProvider::processCommand( { bslmt::LockGuard guard(&d_mutex); // LOCK if (d_cache.find(domainName) == d_cache.end()) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Domain '" << domainName << "' doesn't exist"; error->message() = os.str(); return -1; // RETURN @@ -238,7 +237,7 @@ int ConfigProvider::processCommand( return 0; // RETURN } } - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Unknown command '" << command << "'"; error->message() = os.str(); return -1; diff --git a/src/groups/mqb/mqba/mqba_dispatcher.cpp b/src/groups/mqb/mqba/mqba_dispatcher.cpp index 3547509f6..4032047ff 100644 --- a/src/groups/mqb/mqba/mqba_dispatcher.cpp +++ b/src/groups/mqb/mqba/mqba_dispatcher.cpp @@ -18,10 +18,9 @@ #include // BMQ -#include +#include -// MWC -#include +#include // BDE #include @@ -87,7 +86,7 @@ void Dispatcher_Executor::post(const bsl::function& f) const BSLS_ASSERT(d_processorPool_p->isStarted()); // create an event containing the function to be invoked on the processor - mwcc::MultiQueueThreadPool::Event* event = + bmqc::MultiQueueThreadPool::Event* event = d_processorPool_p->getUnmanagedEvent(); event->object() @@ -99,7 +98,7 @@ void Dispatcher_Executor::post(const bsl::function& f) const BSLS_ASSERT_OPT(rc == 0); // TODO: We should call 'releaseUnmanagedEvent' on the - // 'mwcc::MultiQueueThreadPool' in case of exception to prevent the + // 'bmqc::MultiQueueThreadPool' in case of exception to prevent the // event from leaking. But somehow this method is declared but not // implemented. } @@ -128,7 +127,7 @@ void Dispatcher_Executor::dispatch(const bsl::function& f) const // ------------------------------- // PRIVATE ACCESSORS -mwcc::MultiQueueThreadPool* +bmqc::MultiQueueThreadPool* Dispatcher_ClientExecutor::processorPool() const BSLS_CPP11_NOEXCEPT { const mqba::Dispatcher* dispatcher = static_cast( @@ -179,7 +178,7 @@ void Dispatcher_ClientExecutor::post(const bsl::function& f) const BSLS_ASSERT(processorPool()->isStarted()); // create an event containing the function to be invoked on the processor - mwcc::MultiQueueThreadPool::Event* event = + bmqc::MultiQueueThreadPool::Event* event = processorPool()->getUnmanagedEvent(); event->object() @@ -192,7 +191,7 @@ void Dispatcher_ClientExecutor::post(const bsl::function& f) const BSLS_ASSERT_OPT(rc == 0); // TODO: We should call 'releaseUnmanagedEvent' on the - // 'mwcc::MultiQueueThreadPool' in case of exception to prevent the + // 'bmqc::MultiQueueThreadPool' in case of exception to prevent the // event from leaking. But somehow this method is declared but not // implemented. } @@ -259,7 +258,7 @@ int Dispatcher::startContext(bsl::ostream& errorDescription, // Create and start the threadPool context->d_threadPool_mp.load( new (*d_allocator_p) - bdlmt::ThreadPool(mwcsys::ThreadUtil::defaultAttributes(), + bdlmt::ThreadPool(bmqsys::ThreadUtil::defaultAttributes(), config.numProcessors(), // min threads config.numProcessors(), // max threads bsl::numeric_limits::max(), // idle time @@ -295,7 +294,7 @@ int Dispatcher::startContext(bsl::ostream& errorDescription, processorPoolConfig.setName(mqbi::DispatcherClientType::toAscii(type)) .setEventScheduler(d_scheduler_p) - .setFinalizeEvents(ProcessorPool::Config::MWCC_FINALIZE_MULTI_QUEUE) + .setFinalizeEvents(ProcessorPool::Config::BMQC_FINALIZE_MULTI_QUEUE) .setMonitorAlarm("ALARM [DISPATCHER_QUEUE_STUCK] ", bsls::TimeInterval(k_QUEUE_STUCK_INTERVAL)); // TBD: .statContext(...) / .createSubcontext(true) @@ -329,7 +328,7 @@ Dispatcher::ProcessorPool::Queue* Dispatcher::queueCreator( int processorId, bslma::Allocator* allocator) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "ProcessorQueue " << processorId << " for '" << type << "'"; bsl::string queueName(os.str().data(), os.str().length()); @@ -339,7 +338,7 @@ Dispatcher::ProcessorPool::Queue* Dispatcher::queueCreator( queue->setWatermarks(config.queueSizeLowWatermark(), config.queueSizeHighWatermark()); queue->setStateCallback( - bdlf::BindUtil::bind(&mwcc::MonitoredQueueUtil::stateLogCallback, + bdlf::BindUtil::bind(&bmqc::MonitoredQueueUtil::stateLogCallback, queueName, "ALARM [DISPATCHER]", // warning string config.queueSizeLowWatermark(), @@ -357,7 +356,7 @@ void Dispatcher::queueEventCb(mqbi::DispatcherClientType::Enum type, const ProcessorPool::Event* event) { switch (event->type()) { - case ProcessorPool::Event::MWCC_USER: { + case ProcessorPool::Event::BMQC_USER: { BALL_LOG_TRACE << "Dispatching Event to queue " << processorId << " of " << type << " dispatcher: " << event->object(); if (event->object().type() == @@ -395,10 +394,10 @@ void Dispatcher::queueEventCb(mqbi::DispatcherClientType::Enum type, } } } break; - case ProcessorPool::Event::MWCC_QUEUE_EMPTY: { + case ProcessorPool::Event::BMQC_QUEUE_EMPTY: { flushClients(type, processorId); } break; - case ProcessorPool::Event::MWCC_FINALIZE_EVENT: { + case ProcessorPool::Event::BMQC_FINALIZE_EVENT: { // We only set finalizeCallback on e_DISPATCHER events if (event->object().type() == mqbi::DispatcherEventType::e_DISPATCHER) { @@ -505,14 +504,14 @@ int Dispatcher::start(bsl::ostream& errorDescription) return rc; // RETURN } - if (mwcsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { - execute(bdlf::BindUtil::bind(&mwcsys::ThreadUtil::setCurrentThreadName, + if (bmqsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { + execute(bdlf::BindUtil::bind(&bmqsys::ThreadUtil::setCurrentThreadName, "bmqDispSession"), mqbi::DispatcherClientType::e_SESSION); - execute(bdlf::BindUtil::bind(&mwcsys::ThreadUtil::setCurrentThreadName, + execute(bdlf::BindUtil::bind(&bmqsys::ThreadUtil::setCurrentThreadName, "bmqDispQueue"), mqbi::DispatcherClientType::e_QUEUE); - execute(bdlf::BindUtil::bind(&mwcsys::ThreadUtil::setCurrentThreadName, + execute(bdlf::BindUtil::bind(&bmqsys::ThreadUtil::setCurrentThreadName, "bmqDispCluster"), mqbi::DispatcherClientType::e_CLUSTER); } @@ -604,7 +603,7 @@ Dispatcher::registerClient(mqbi::DispatcherClient* client, .setDestination(client); // not needed context.d_processorPool_mp->enqueueEvent(event, processor); return processor; // RETURN - } // break; + } // break; case mqbi::DispatcherClientType::e_UNDEFINED: case mqbi::DispatcherClientType::e_ALL: default: { @@ -727,7 +726,7 @@ void Dispatcher::synchronize(mqbi::DispatcherClientType::Enum type, semaphore.wait(); } -mwcex::Executor +bmqex::Executor Dispatcher::executor(const mqbi::DispatcherClient* client) const { // PRECONDITIONS @@ -741,7 +740,7 @@ Dispatcher::executor(const mqbi::DispatcherClient* client) const return Dispatcher_Executor(this, client); } -mwcex::Executor +bmqex::Executor Dispatcher::clientExecutor(const mqbi::DispatcherClient* client) const { // PRECONDITIONS diff --git a/src/groups/mqb/mqba/mqba_dispatcher.h b/src/groups/mqb/mqba/mqba_dispatcher.h index 153c84ac2..23861cc85 100644 --- a/src/groups/mqb/mqba/mqba_dispatcher.h +++ b/src/groups/mqb/mqba/mqba_dispatcher.h @@ -26,7 +26,7 @@ // mqbi::Dispatcher: Protocol implemented by this dispatcher // //@DESCRIPTION: 'mqba::Dispatcher' is an implementation of the -// 'mqbi::Dispatcher' protocol, using the mwcc::MultiQueueThreadPool. This +// 'mqbi::Dispatcher' protocol, using the bmqc::MultiQueueThreadPool. This // dispatcher supports three types of isolated independent pools of threads and // queues: one for the client sessions, one for the queues, and one for // clusters. @@ -54,9 +54,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -91,7 +90,7 @@ class Dispatcher; /// dispatcher's processor. /// /// Note that this class conforms to the Executor concept as defined in -/// the `mwcex` package documentation. +/// the `bmqex` package documentation. /// /// Note also that it is undefined behavior to submit work on this /// executor unless its associated dispatcher is started. @@ -102,7 +101,7 @@ class Dispatcher; class Dispatcher_Executor { private: // PRIVATE DATA - mwcc::MultiQueueThreadPool* d_processorPool_p; + bmqc::MultiQueueThreadPool* d_processorPool_p; mqbi::Dispatcher::ProcessorHandle d_processorHandle; @@ -145,7 +144,7 @@ class Dispatcher_Executor { /// dispatcher's processor to be executed by a dispatcher's client. /// /// Note that this class conforms to the Executor concept as defined in -/// the `mwcex` package documentation. +/// the `bmqex` package documentation. /// /// Note also that it is undefined behavior to submit work on this /// executor unless its associated dispatcher is started and the @@ -160,7 +159,7 @@ class Dispatcher_ClientExecutor { // PRIVATE ACCESSORS /// Return a pointer to the processor pool used to submit work. - mwcc::MultiQueueThreadPool* + bmqc::MultiQueueThreadPool* processorPool() const BSLS_CPP11_NOEXCEPT; /// Return the handle of the associated processor. @@ -206,7 +205,7 @@ class Dispatcher_ClientExecutor { // ================ /// This class provides an implementation of the `mqbi::Dispatcher` -/// protocol, using the mwcc::MultiQueueThreadPool +/// protocol, using the bmqc::MultiQueueThreadPool class Dispatcher BSLS_CPP11_FINAL : public mqbi::Dispatcher { private: // CLASS-SCOPE CATEGORY @@ -214,7 +213,7 @@ class Dispatcher BSLS_CPP11_FINAL : public mqbi::Dispatcher { private: // PRIVATE TYPES - typedef mwcc::MultiQueueThreadPool ProcessorPool; + typedef bmqc::MultiQueueThreadPool ProcessorPool; typedef bslma::ManagedPtr ThreadPoolMp; @@ -478,7 +477,7 @@ class Dispatcher BSLS_CPP11_FINAL : public mqbi::Dispatcher { /// Note also that the returned executor can be used to submit work even /// after the specified `client` has been unregistered from this /// dispatcher. - mwcex::Executor + bmqex::Executor executor(const mqbi::DispatcherClient* client) const BSLS_KEYWORD_OVERRIDE; /// Return an executor object suitable for executing function objects by @@ -490,7 +489,7 @@ class Dispatcher BSLS_CPP11_FINAL : public mqbi::Dispatcher { /// Note that submitting work on the returned executor is undefined /// behavior unless this dispatcher is started or if the specified /// `client` was unregistered from this dispatcher. - mwcex::Executor clientExecutor(const mqbi::DispatcherClient* client) const + bmqex::Executor clientExecutor(const mqbi::DispatcherClient* client) const BSLS_KEYWORD_OVERRIDE; }; @@ -598,22 +597,22 @@ Dispatcher::numProcessors(mqbi::DispatcherClientType::Enum type) const switch (type) { case mqbi::DispatcherClientType::e_SESSION: { return d_config.sessions().numProcessors(); // RETURN - } // break; + } // break; case mqbi::DispatcherClientType::e_QUEUE: { return d_config.queues().numProcessors(); // RETURN - } // break; + } // break; case mqbi::DispatcherClientType::e_CLUSTER: { return d_config.clusters().numProcessors(); // RETURN - } // break; + } // break; case mqbi::DispatcherClientType::e_ALL: { return d_config.sessions().numProcessors() + d_config.queues().numProcessors() + d_config.clusters().numProcessors(); // RETURN - } // break; + } // break; case mqbi::DispatcherClientType::e_UNDEFINED: { BSLS_ASSERT_OPT(false && "Invalid type"); return -1; // RETURN - } // break; + } // break; } return 0; diff --git a/src/groups/mqb/mqba/mqba_dispatcher.t.cpp b/src/groups/mqb/mqba/mqba_dispatcher.t.cpp index 79b827eb2..bc0280b97 100644 --- a/src/groups/mqb/mqba/mqba_dispatcher.t.cpp +++ b/src/groups/mqb/mqba/mqba_dispatcher.t.cpp @@ -20,12 +20,11 @@ #include #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -37,7 +36,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -106,7 +105,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // Create Dispatcher mqbcfg::DispatcherConfig dispatcherConfig; @@ -140,7 +139,7 @@ static void test2_clientTypeEnumValues() // mqbi::DispatcherClientType::Enum // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLIENT TYPE ENUM VALUES"); + bmqtst::TestHelper::printTestName("CLIENT TYPE ENUM VALUES"); ASSERT_EQ(mqbi::DispatcherClientType::e_SESSION, 0); ASSERT_EQ(mqbi::DispatcherClientType::e_QUEUE, 1); @@ -181,7 +180,7 @@ static void test3_executorsSupport() // Executors support // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("EXECUTORS SUPPORT"); + bmqtst::TestHelper::printTestName("EXECUTORS SUPPORT"); // create / start a scheduler bdlmt::EventScheduler eventScheduler(bsls::SystemClockType::e_MONOTONIC, @@ -235,11 +234,11 @@ static void test3_executorsSupport() // test regular executor { // obtain an executor for first client's processor - mwcex::Executor executor1 = dispatcher.executor(&client1); + bmqex::Executor executor1 = dispatcher.executor(&client1); ASSERT(static_cast(executor1)); // obtain executor for second client's processor - mwcex::Executor executor2 = dispatcher.executor(&client2); + bmqex::Executor executor2 = dispatcher.executor(&client2); ASSERT(static_cast(executor2)); // executors for the first and the second client do compare equal as @@ -248,7 +247,7 @@ static void test3_executorsSupport() ASSERT(executor1 == executor2); // obtain executor for third client's processor - mwcex::Executor executor3 = dispatcher.executor(&client3); + bmqex::Executor executor3 = dispatcher.executor(&client3); ASSERT(static_cast(executor3)); // executors for the second and the third clients do not compare equal @@ -276,7 +275,7 @@ static void test3_executorsSupport() // submit two functors to be executed on the same processor using the // executor's 'post' function, and wait for the completion of submitted // functors - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .neverBlocking() .useExecutor(executor1) .useAllocator(s_allocator_p), @@ -284,7 +283,7 @@ static void test3_executorsSupport() &threadId1)) .wait(); - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .neverBlocking() .useExecutor(executor1) .useAllocator(s_allocator_p), @@ -313,7 +312,7 @@ static void test3_executorsSupport() // submit two functors to be executed on the same processor using the // executor's 'dispatch' function, and wait for the completion of // submitted functors - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .possiblyBlocking() .useExecutor(executor2) .useAllocator(s_allocator_p), @@ -321,7 +320,7 @@ static void test3_executorsSupport() &threadId1)) .wait(); - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .possiblyBlocking() .useExecutor(executor2) .useAllocator(s_allocator_p), @@ -341,13 +340,13 @@ static void test3_executorsSupport() // submit a functor that, when invoked, will submit another functor // via the executor's 'dispatch' function and block the calling thread // until the nested functor completes - mwcex::ExecutionUtil::execute( - mwcex::ExecutionPolicyUtil::oneWay() + bmqex::ExecutionUtil::execute( + bmqex::ExecutionPolicyUtil::oneWay() .alwaysBlocking() .useExecutor(executor1) .useAllocator(s_allocator_p), - mwcex::BindUtil::bindExecute( - mwcex::ExecutionPolicyUtil::oneWay() + bmqex::BindUtil::bindExecute( + bmqex::ExecutionPolicyUtil::oneWay() .alwaysBlocking() .useExecutor(executor3) .useAllocator(s_allocator_p), @@ -361,11 +360,11 @@ static void test3_executorsSupport() // test client executor { // obtain executor for first client - mwcex::Executor executor1 = dispatcher.clientExecutor(&client1); + bmqex::Executor executor1 = dispatcher.clientExecutor(&client1); ASSERT(static_cast(executor1)); // obtain executor for second client - mwcex::Executor executor2 = dispatcher.clientExecutor(&client2); + bmqex::Executor executor2 = dispatcher.clientExecutor(&client2); ASSERT(static_cast(executor2)); // executors for the first and the second client do not compare equal @@ -373,7 +372,7 @@ static void test3_executorsSupport() ASSERT(executor1 != executor2); // obtain executor for second client again - mwcex::Executor executor3 = dispatcher.clientExecutor(&client2); + bmqex::Executor executor3 = dispatcher.clientExecutor(&client2); ASSERT(static_cast(executor3)); // executors for the same (second) client do compare equal @@ -399,7 +398,7 @@ static void test3_executorsSupport() // submit two functors to be executed on the same processor and by the // same client using the executor's 'post' function, and wait for the // completion of submitted functors - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .neverBlocking() .useExecutor(executor1) .useAllocator(s_allocator_p), @@ -407,7 +406,7 @@ static void test3_executorsSupport() &threadId1)) .wait(); - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .neverBlocking() .useExecutor(executor1) .useAllocator(s_allocator_p), @@ -436,7 +435,7 @@ static void test3_executorsSupport() // submit two functors to be executed on the same processor and by the // same client using the executor's 'dispatch' function, and wait for // the completion of submitted functors - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .possiblyBlocking() .useExecutor(executor2) .useAllocator(s_allocator_p), @@ -444,7 +443,7 @@ static void test3_executorsSupport() &threadId1)) .wait(); - mwcex::ExecutionUtil::execute(mwcex::ExecutionPolicyUtil::twoWay() + bmqex::ExecutionUtil::execute(bmqex::ExecutionPolicyUtil::twoWay() .possiblyBlocking() .useExecutor(executor2) .useAllocator(s_allocator_p), @@ -460,13 +459,13 @@ static void test3_executorsSupport() // submit a functor that, when invoked, will submit another functor // via the executor's 'dispatch' function and block the calling thread // until the nested functor completes - mwcex::ExecutionUtil::execute( - mwcex::ExecutionPolicyUtil::oneWay() + bmqex::ExecutionUtil::execute( + bmqex::ExecutionPolicyUtil::oneWay() .alwaysBlocking() .useExecutor(executor1) .useAllocator(s_allocator_p), - mwcex::BindUtil::bindExecute( - mwcex::ExecutionPolicyUtil::oneWay() + bmqex::BindUtil::bindExecute( + bmqex::ExecutionPolicyUtil::oneWay() .alwaysBlocking() .useExecutor(executor2) .useAllocator(s_allocator_p), @@ -490,9 +489,9 @@ static void test3_executorsSupport() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); - mwcsys::Time::initialize(); + bmqsys::Time::initialize(); switch (_testCase) { case 0: @@ -505,7 +504,7 @@ int main(int argc, char* argv[]) } break; } - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqba/mqba_domainmanager.cpp b/src/groups/mqb/mqba/mqba_domainmanager.cpp index fb2ff12ef..d5d5ca242 100644 --- a/src/groups/mqb/mqba/mqba_domainmanager.cpp +++ b/src/groups/mqb/mqba/mqba_domainmanager.cpp @@ -31,14 +31,13 @@ // BMQ #include -// MWC -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -249,7 +248,7 @@ void DomainManager::onConfigProviderDomainConfigCb( // This compiles the message that will be sent to the client. This contains // only `d_message` for brevity. - mwcu::MemOutStream err; + bmqu::MemOutStream err; err << "ConfigProvider failed to load domain config " << "[ domain = '" << domain << "'" << " configProviderError = '" << configProviderError.d_status.message() @@ -273,7 +272,7 @@ DomainManager::decodeAndUpsert(DecodeAndUpsertValue* out, const bsl::string& clusterName) { if (status != 0) { - mwcu::MemOutStream err; + bmqu::MemOutStream err; err << "rc = " << status << " message = '" << result << "'"; out->makeError(Error(bmqp_ctrlmsg::StatusCategory::E_REFUSED, mqbi::ClusterErrorCode::e_UNKNOWN, @@ -293,7 +292,7 @@ DomainManager::decodeAndUpsert(DecodeAndUpsertValue* out, int rc = decoder.decode(jsonStream, &domainVariant, options); if (rc != 0) { - mwcu::MemOutStream err; + bmqu::MemOutStream err; err << "rc = " << rc << " error = '" << decoder.loggedMessages() << "'" << " from content = '" << jsonStream.str() << "'"; out->makeError(Error(bmqp_ctrlmsg::StatusCategory::E_REFUSED, @@ -304,7 +303,7 @@ DomainManager::decodeAndUpsert(DecodeAndUpsertValue* out, } if (!domainVariant.isDefinitionValue()) { - mwcu::MemOutStream err; + bmqu::MemOutStream err; err << "invalid domain configuration for domain '" << domain << "' (not a domain definition)"; out->makeError(Error(bmqp_ctrlmsg::StatusCategory::E_REFUSED, @@ -377,7 +376,7 @@ DomainManager::upsertDomain(UpsertDomainValue* out, // cluster description is not backed up and not coming from the // domain configuration, there is no need to try to fall back // if this fails.. - mwcu::MemOutStream err; + bmqu::MemOutStream err; err << "cluster = " << clusterName << " status = " << status; out->makeError(Error(status, err.str(), true)); return *out; // RETURN @@ -390,9 +389,9 @@ DomainManager::upsertDomain(UpsertDomainValue* out, } // Create a dedicated stats subcontext for this domain - mwcst::StatContextConfiguration statContextCfg(domain); + bmqst::StatContextConfiguration statContextCfg(domain); statContextCfg.storeExpiredSubcontextValues(true); - bslma::ManagedPtr queuesStatContext = + bslma::ManagedPtr queuesStatContext = d_queuesStatContext_p->addSubcontext(statContextCfg); bslma::ManagedPtr domainMp( @@ -409,10 +408,10 @@ DomainManager::upsertDomain(UpsertDomainValue* out, // Configure the domain // - - - - - - - - - - - mwcu::MemOutStream configureErrorStream; + bmqu::MemOutStream configureErrorStream; int rc = domainSp->configure(configureErrorStream, definition); if (rc != 0) { - mwcu::MemOutStream err; + bmqu::MemOutStream err; err << "error = '" << configureErrorStream.str() << "'" << " config = '" << definition << "'"; out->makeError( @@ -457,7 +456,7 @@ void DomainManager::invokeCallback( status = response.error().d_status; // Rework the 'message' field of 'status' for improved format. - mwcu::MemOutStream err; + bmqu::MemOutStream err; err << status.message() << ". Details: " << response.error().d_details; status.message().assign(err.str().data(), err.str().length()); callback(status, 0); @@ -480,8 +479,8 @@ DomainManager::DomainManager(ConfigProvider* configProvider, bdlbb::BlobBufferFactory* blobBufferFactory, mqbblp::ClusterCatalog* clusterCatalog, mqbi::Dispatcher* dispatcher, - mwcst::StatContext* domainsStatContext, - mwcst::StatContext* queuesStatContext, + bmqst::StatContext* domainsStatContext, + bmqst::StatContext* queuesStatContext, bslma::Allocator* allocator) : d_configProvider_p(configProvider) , d_blobBufferFactory_p(blobBufferFactory) @@ -545,19 +544,19 @@ void DomainManager::stop() } // Stop all domains (and queues). - mwcu::SharedResource self(this); + bmqu::SharedResource self(this); bslmt::Latch latch(d_domains.size(), bsls::SystemClockType::e_MONOTONIC); for (DomainSpMap::iterator it = d_domains.begin(); it != d_domains.end(); ++it) { it->second->teardown(bdlf::BindUtil::bind( - mwcu::WeakMemFnUtil::weakMemFn(&DomainManager::onDomainClosed, + bmqu::WeakMemFnUtil::weakMemFn(&DomainManager::onDomainClosed, self.acquireWeak()), bdlf::PlaceHolders::_1, // Domain Name &latch)); } - bsls::TimeInterval timeout = mwcsys::Time::nowMonotonicClock().addSeconds( + bsls::TimeInterval timeout = bmqsys::Time::nowMonotonicClock().addSeconds( k_MAX_WAIT_SECONDS_AT_SHUTDOWN); int rc = latch.timedWait(timeout); if (0 != rc) { @@ -648,7 +647,7 @@ int DomainManager::processCommand(mqbcmd::DomainsResult* result, DomainSp domainSp; if (0 != locateOrCreateDomain(&domainSp, name)) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Domain '" << name << "' doesn't exist"; result->makeError().message() = os.str(); return -1; // RETURN @@ -675,7 +674,7 @@ int DomainManager::processCommand(mqbcmd::DomainsResult* result, DomainSp domainSp; if (0 != locateOrCreateDomain(&domainSp, name)) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Domain '" << name << "' doesn't exist"; result->makeError().message() = os.str(); return -1; // RETURN @@ -704,7 +703,7 @@ int DomainManager::processCommand(mqbcmd::DomainsResult* result, } } - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Unknown command '" << command << "'"; result->makeError().message() = os.str(); return -1; diff --git a/src/groups/mqb/mqba/mqba_domainmanager.h b/src/groups/mqb/mqba/mqba_domainmanager.h index bd2984e2f..a48044a82 100644 --- a/src/groups/mqb/mqba/mqba_domainmanager.h +++ b/src/groups/mqb/mqba/mqba_domainmanager.h @@ -38,9 +38,7 @@ // BMQ #include - -// MWC -#include +#include // BDE #include @@ -83,7 +81,7 @@ class Dispatcher; namespace mqbs { class StorageDomain; } -namespace mwcst { +namespace bmqst { class StatContext; } @@ -122,8 +120,8 @@ class DomainManager BSLS_CPP11_FINAL : public mqbi::DomainFactory { mqbi::Dispatcher* dispatcher, const bsl::shared_ptr& cluster, bdlbb::BlobBufferFactory* blobBufferFactory, - mwcst::StatContext* domainsStatContext, - bslma::ManagedPtr& queuesStatContext, + bmqst::StatContext* domainsStatContext, + bslma::ManagedPtr& queuesStatContext, bslma::Allocator* allocator)> FactoryMethod; @@ -150,9 +148,9 @@ class DomainManager BSLS_CPP11_FINAL : public mqbi::DomainFactory { // A type with details on errors for 'upsertDomain()'. /// The return type for `upsertDomain()` might be a value or an error. - typedef mwct::ValueOrError UpsertDomainValue; + typedef bmqvt::ValueOrError UpsertDomainValue; - typedef mwct::ValueOrError DecodeAndUpsertValue; + typedef bmqvt::ValueOrError DecodeAndUpsertValue; // The return type for 'decodeAndUpsert()' might be a value or an error. private: @@ -169,11 +167,11 @@ class DomainManager BSLS_CPP11_FINAL : public mqbi::DomainFactory { mqbblp::ClusterCatalog* d_clusterCatalog_p; // ClusterCatalog to use, held, not owned - mwcst::StatContext* d_domainsStatContext_p; + bmqst::StatContext* d_domainsStatContext_p; // Top-level stat context for all // domains stats - mwcst::StatContext* d_queuesStatContext_p; + bmqst::StatContext* d_queuesStatContext_p; // Top-level stat context for all // domains/queues stats @@ -310,8 +308,8 @@ class DomainManager BSLS_CPP11_FINAL : public mqbi::DomainFactory { bdlbb::BlobBufferFactory* blobBufferFactory, mqbblp::ClusterCatalog* clusterCatalog, mqbi::Dispatcher* dispatcher, - mwcst::StatContext* domainsStatContext, - mwcst::StatContext* queuesstatContext, + bmqst::StatContext* domainsStatContext, + bmqst::StatContext* queuesstatContext, bslma::Allocator* allocator); /// Destructor diff --git a/src/groups/mqb/mqba/mqba_domainresolver.cpp b/src/groups/mqb/mqba/mqba_domainresolver.cpp index 480374865..3d5697dc8 100644 --- a/src/groups/mqb/mqba/mqba_domainresolver.cpp +++ b/src/groups/mqb/mqba/mqba_domainresolver.cpp @@ -22,11 +22,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -63,7 +62,7 @@ void DomainResolver::updateTimestamps() BSLMT_MUTEXASSERT_IS_LOCKED_SAFE(&d_mutex); // mutex LOCKED - const bsls::TimeInterval now = mwcsys::Time::nowRealtimeClock(); + const bsls::TimeInterval now = bmqsys::Time::nowRealtimeClock(); if (now <= d_timestampsValidUntil) { // We last checked recently, don't do anything @@ -152,14 +151,12 @@ int DomainResolver::getOrRead(bsl::ostream& errorDescription, bsl::string filePath = mqbcfg::BrokerConfig::get().etcDir() + "/domains/" + resolvedDomainName + ".json"; - bdlma::LocalSequentialAllocator<1024> localAllocator(d_allocator_p); - // This is copy-pasted from mqba_configprovider.cpp. Maybe we are // going to merge the two? If not, consider factoring this bit. if (!bdls::FilesystemUtil::exists(filePath)) { bdlma::LocalSequentialAllocator<1024> localAllocator( d_allocator_p); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "Domain file '" << filePath << "' doesn't exist"; content.assign(os.str().data(), os.str().length()); rc = rc_READ_ERROR; @@ -169,7 +166,7 @@ int DomainResolver::getOrRead(bsl::ostream& errorDescription, if (!fileStream) { bdlma::LocalSequentialAllocator<1024> localAllocator( d_allocator_p); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "Unable to open domain file '" << filePath << "'"; content.assign(os.str().data(), os.str().length()); rc = rc_READ_ERROR; @@ -192,7 +189,7 @@ int DomainResolver::getOrRead(bsl::ostream& errorDescription, // Remove the trailing '\n' (if any) for cleaner log printing // (avoid extra blank lines added by BALL_LOG). - mwcu::StringUtil::rtrim(&content); + bmqu::StringUtil::rtrim(&content); BALL_LOG_INFO << "Error reading the domain config file " << "[domain: '" << domainName << "'" @@ -302,7 +299,7 @@ DomainResolver::getOrReadDomain(mqbconfm::DomainResolver* out, { // executed by *ANY* thread - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; int rc = getOrRead(errorDescription, out, domainName); @@ -377,7 +374,7 @@ int DomainResolver::processCommand( { bslmt::LockGuard guard(&d_mutex); // LOCK if (d_cache.find(domainName) == d_cache.end()) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Domain '" << domainName << "' doesn't exist"; error->message() = os.str(); return -1; // RETURN @@ -389,7 +386,7 @@ int DomainResolver::processCommand( } } - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Unknown command '" << command << "'"; error->message() = os.str(); return -1; diff --git a/src/groups/mqb/mqba/mqba_sessionnegotiator.cpp b/src/groups/mqb/mqba/mqba_sessionnegotiator.cpp index 0b85b4f95..f6a54203c 100644 --- a/src/groups/mqb/mqba/mqba_sessionnegotiator.cpp +++ b/src/groups/mqb/mqba/mqba_sessionnegotiator.cpp @@ -80,13 +80,12 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -221,9 +220,9 @@ void loadBrokerIdentity(bmqp_ctrlmsg::ClientIdentity* identity, /// not. void loadSessionDescription(bsl::string* out, const bmqp_ctrlmsg::ClientIdentity& identity, - const mwcio::Channel& peerChannel) + const bmqio::Channel& peerChannel) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; // Task Name bsl::string baseName; @@ -251,7 +250,7 @@ void loadSessionDescription(bsl::string* out, ntsa::Ipv4Address ipv4Address(static_cast(peerAddress)); ntsa::IpAddress ipAddress(ipv4Address); - if (!mwcio::ChannelUtil::isLocalHost(ipAddress)) { + if (!bmqio::ChannelUtil::isLocalHost(ipAddress)) { os << "@" << identity.hostName(); } @@ -263,7 +262,7 @@ void loadSessionDescription(bsl::string* out, // class SessionNegotiator // ----------------------- -void SessionNegotiator::readCallback(const mwcio::Status& status, +void SessionNegotiator::readCallback(const bmqio::Status& status, int* numNeeded, bdlbb::Blob* blob, const NegotiationContextSp& context) @@ -285,7 +284,7 @@ void SessionNegotiator::readCallback(const mwcio::Status& status, << context->d_channelSp->peerUri() << "']"; bsl::shared_ptr session; - mwcu::MemOutStream errStream; + bmqu::MemOutStream errStream; if (!status) { errStream << "Read error: " << status; @@ -297,11 +296,11 @@ void SessionNegotiator::readCallback(const mwcio::Status& status, } bdlbb::Blob inBlob; - int rc = mwcio::ChannelUtil::handleRead(&inBlob, numNeeded, blob); + int rc = bmqio::ChannelUtil::handleRead(&inBlob, numNeeded, blob); if (rc != 0) { // This indicates a non recoverable error... errStream << "Unrecoverable read error:\n" - << mwcu::BlobStartHexDumper(blob); + << bmqu::BlobStartHexDumper(blob); bsl::string error(errStream.str().data(), errStream.str().length()); context->d_negotiationCb((rc * 10) + rc_UNRECOVERABLE_READ_ERROR, error, @@ -388,7 +387,7 @@ void SessionNegotiator::readCallback(const mwcio::Status& status, initiateOutboundNegotiation(context); return; // RETURN - } // break; + } // break; default: { errStream << "Invalid negotiation message received (unknown type): " << context->d_negotiationMessage; @@ -426,14 +425,14 @@ int SessionNegotiator::decodeNegotiationMessage( if (!event.isValid()) { errorDescription << "Invalid negotiation message received " << "(packet is not a valid BlazingMQ event):\n" - << mwcu::BlobStartHexDumper(&blob); + << bmqu::BlobStartHexDumper(&blob); return rc_INVALID_MESSAGE; // RETURN } if (!event.isControlEvent()) { errorDescription << "Invalid negotiation message received " << "(packet is not a ControlEvent):\n" - << mwcu::BlobStartHexDumper(&blob); + << bmqu::BlobStartHexDumper(&blob); return rc_NOT_CONTROL_EVENT; // RETURN } @@ -442,7 +441,7 @@ int SessionNegotiator::decodeNegotiationMessage( if (rc != 0) { errorDescription << "Invalid negotiation message received (failed " << "decoding ControlEvent): [rc: " << rc << "]:\n" - << mwcu::BlobStartHexDumper(&blob); + << bmqu::BlobStartHexDumper(&blob); return rc_INVALID_CONTROL_EVENT; // RETURN } @@ -503,7 +502,7 @@ SessionNegotiator::onClientIdentityMessage(bsl::ostream& errorDescription, const int minVersion = mqbu::SDKVersionUtil::minSdkVersionSupported( sdkLanguage); - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Client is using an unsupported version of libbmq " << "(minimum supported version: " << minVersion << ", client version: " << clientVersion << ")."; @@ -632,7 +631,7 @@ SessionNegotiator::onBrokerResponseMessage(bsl::ostream& errorDescription, } // Resolve 'hostName' of the brokerIdentity - mwcio::TCPEndpoint endpoint(context->d_channelSp->peerUri()); + bmqio::TCPEndpoint endpoint(context->d_channelSp->peerUri()); brokerResponse.brokerIdentity().hostName() = endpoint.host(); bsl::string description; @@ -699,7 +698,7 @@ int SessionNegotiator::sendNegotiationMessage( } // Send response event - mwcio::Status status; + bmqio::Status status; context->d_channelSp->write(&status, builder.blob()); if (!status) { errorDescription << "Failed sending NegotiationMessage " @@ -746,9 +745,9 @@ void SessionNegotiator::createSession(bsl::ostream& errorDescription, } else if (context->d_connectionType == ConnectionType::e_CLIENT) { // Create a dedicated stats subcontext for this client - mwcst::StatContextConfiguration statContextCfg(description); + bmqst::StatContextConfiguration statContextCfg(description); statContextCfg.storeExpiredSubcontextValues(true); - bslma::ManagedPtr statContext = + bslma::ManagedPtr statContext = d_statContext_p->addSubcontext(statContextCfg); mqba::ClientSession* session = new (*d_allocator_p) @@ -888,7 +887,7 @@ bool SessionNegotiator::checkIsUnsupportedSdkVersion( // CREATORS SessionNegotiator::SessionNegotiator(bdlbb::BlobBufferFactory* bufferFactory, mqbi::Dispatcher* dispatcher, - mwcst::StatContext* statContext, + bmqst::StatContext* statContext, BlobSpPool* blobSpPool, bdlmt::EventScheduler* scheduler, bslma::Allocator* allocator) @@ -912,7 +911,7 @@ SessionNegotiator::~SessionNegotiator() void SessionNegotiator::scheduleRead(const NegotiationContextSp& context) { // Schedule a TimedRead - mwcio::Status status; + bmqio::Status status; context->d_channelSp->read( &status, bmqp::Protocol::k_PACKET_MIN_SIZE, @@ -927,7 +926,7 @@ void SessionNegotiator::scheduleRead(const NegotiationContextSp& context) // replace it by the channel shared_ptr (inside the context) if (!status) { - mwcu::MemOutStream errStream; + bmqu::MemOutStream errStream; errStream << "Read failed while negotiating: " << status; bsl::string error(errStream.str().data(), errStream.str().length()); context->d_negotiationCb(-1, @@ -954,7 +953,7 @@ void SessionNegotiator::initiateOutboundNegotiation( context->d_clusterName, nodeId); - mwcu::MemOutStream errStream; + bmqu::MemOutStream errStream; int rc = sendNegotiationMessage(errStream, negotiationMessage, context); if (rc != 0) { @@ -971,7 +970,7 @@ void SessionNegotiator::initiateOutboundNegotiation( void SessionNegotiator::negotiate( mqbnet::NegotiatorContext* context, - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const mqbnet::Negotiator::NegotiationCb& negotiationCb) { // Create a NegotiationContext for that connection @@ -1032,7 +1031,7 @@ void SessionNegotiator::negotiate( negotiationContext->d_isReversed = true; negotiationContext->d_connectionType = ConnectionType::e_CLIENT; - mwcu::MemOutStream errStream; + bmqu::MemOutStream errStream; int rc = sendNegotiationMessage(errStream, negotiationMessage, negotiationContext); diff --git a/src/groups/mqb/mqba/mqba_sessionnegotiator.h b/src/groups/mqb/mqba/mqba_sessionnegotiator.h index 8b2347497..b4db32e66 100644 --- a/src/groups/mqb/mqba/mqba_sessionnegotiator.h +++ b/src/groups/mqb/mqba/mqba_sessionnegotiator.h @@ -25,7 +25,7 @@ // //@DESCRIPTION: 'mqba::SessionNegotiator' implements the 'mqbnet::Negotiator' // interface to negotiate a connection with a BlazingMQ client or another -// bmqbrkr. From a 'mwcio::Channel', it will exchange negotiation identity +// bmqbrkr. From a 'bmqio::Channel', it will exchange negotiation identity // message, and create a session associated to the channel on success. // /// Thread Safety @@ -42,9 +42,8 @@ // BMQ #include -// MWC -#include -#include +#include +#include // BDE #include @@ -71,7 +70,7 @@ class Dispatcher; namespace mqbi { class DomainFactory; } -namespace mwcst { +namespace bmqst { class StatContext; } @@ -116,7 +115,7 @@ class SessionNegotiator : public mqbnet::Negotiator { // negotiatorContext, passed in by // the caller - bsl::shared_ptr d_channelSp; + bsl::shared_ptr d_channelSp; // The channel to use for the // negotiation @@ -163,7 +162,7 @@ class SessionNegotiator : public mqbnet::Negotiator { // Domain factory to inject into new client // sessions - mwcst::StatContext* d_statContext_p; + bmqst::StatContext* d_statContext_p; // Top-level stat context for all // clients/queues stats @@ -198,7 +197,7 @@ class SessionNegotiator : public mqbnet::Negotiator { /// `numNeeded` can be used to indicate if more bytes are needed in /// order to get a full message. The specified `context` holds the /// negotiation context associated to this read. - void readCallback(const mwcio::Status& status, + void readCallback(const bmqio::Status& status, int* numNeeded, bdlbb::Blob* blob, const NegotiationContextSp& context); @@ -276,7 +275,7 @@ class SessionNegotiator : public mqbnet::Negotiator { /// specified `allocator` for all memory allocations. SessionNegotiator(bdlbb::BlobBufferFactory* bufferFactory, mqbi::Dispatcher* dispatcher, - mwcst::StatContext* statContext, + bmqst::StatContext* statContext, BlobSpPool* blobSpPool, bdlmt::EventScheduler* scheduler, bslma::Allocator* allocator); @@ -309,7 +308,7 @@ class SessionNegotiator : public mqbnet::Negotiator { /// `negotiationCb` may be invoked directly from inside the call to /// `negotiate`. void negotiate(mqbnet::NegotiatorContext* context, - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const mqbnet::Negotiator::NegotiationCb& negotiationCb) BSLS_KEYWORD_OVERRIDE; }; diff --git a/src/groups/mqb/mqbblp/mqbblp_cluster.cpp b/src/groups/mqb/mqbblp/mqbblp_cluster.cpp index 4b627549f..079db67c4 100644 --- a/src/groups/mqb/mqbblp/mqbblp_cluster.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_cluster.cpp @@ -46,15 +46,14 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -100,7 +99,7 @@ Cluster::ValidationResult::print(bsl::ostream& stream, int level, int spacesPerLevel) { - stream << mwcu::PrintUtil::indent(level, spacesPerLevel) + stream << bmqu::PrintUtil::indent(level, spacesPerLevel) << Cluster::ValidationResult::toAscii(value); if (spacesPerLevel >= 0) { @@ -168,13 +167,17 @@ void Cluster::startDispatched(bsl::ostream* errorDescription, int* rc) // Start a StatMonitorSnapshotRecorder to track system stats during // recovery - mwcsys::StatMonitorSnapshotRecorder statRecorder(description() + ": ", + bmqsys::StatMonitorSnapshotRecorder statRecorder(description() + ": ", d_allocator_p); - // Get named allocator from associated mwcma::CountingAllocatorStore + // Get named allocator from associated bmqma::CountingAllocatorStore bslma::Allocator* storageManagerAllocator = d_allocators.get( "StorageManager"); + // Make a temporal pointer to the dispatcher to avoid a false-positive + // "uninitialized variable" warning + mqbi::Dispatcher* clusterDispatcher = dispatcher(); + // Start the StorageManager d_storageManager_mp.load( isFSMWorkflow() @@ -185,7 +188,7 @@ void Cluster::startDispatched(bsl::ostream* errorDescription, int* rc) &d_clusterData, d_state, d_clusterData.domainFactory(), - dispatcher(), + clusterDispatcher, k_PARTITION_FSM_WATCHDOG_TIMEOUT_DURATION, bdlf::BindUtil::bind(&Cluster::onRecoveryStatus, this, @@ -218,7 +221,7 @@ void Cluster::startDispatched(bsl::ostream* errorDescription, int* rc) bdlf::PlaceHolders::_2, // status bdlf::PlaceHolders::_3), // primary leaseId d_clusterData.domainFactory(), - dispatcher(), + clusterDispatcher, &d_clusterData.miscWorkThreadPool(), storageManagerAllocator)), storageManagerAllocator); @@ -421,7 +424,7 @@ void Cluster::sendAck(bmqt::AckResult::Enum status, } } else if (!isSelfGenerated) { - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedAckMessages, BALL_LOG_WARN << description() @@ -434,16 +437,14 @@ void Cluster::sendAck(bmqt::AckResult::Enum status, // Throttle error log if this is a 'failed Ack': note that we log at // INFO level in order not to overwhelm the dashboard, if a queue is // full, every post will nack, which could be a lot. - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedAckMessages, BALL_LOG_INFO << description() << ": failed Ack " << "[status: " << status << ", source: '" << source - << "'" - << ", correlationId: " << correlationId + << "'" << ", correlationId: " << correlationId << ", GUID: " << messageGUID << ", queue: '" << (found ? uri : "** null **") << "' " - << "(id: " << queueId << ")] " - << "to node " + << "(id: " << queueId << ")] " << "to node " << nodeSession->clusterNode()->nodeDescription();); } @@ -487,12 +488,11 @@ void Cluster::sendAck(bmqt::AckResult::Enum status, // This is non-recoverable, so we drop the ACK msg and log it. - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledDroppedAckMessages, BALL_LOG_ERROR << description() << ": dropping ACK message " << "[status: " << status << ", source: '" << source - << "'" - << ", correlationId: " << correlationId + << "'" << ", correlationId: " << correlationId << ", GUID: " << messageGUID << ", queueId: " << queueId << "] to node " << nodeSession->clusterNode()->nodeDescription() @@ -550,16 +550,16 @@ void Cluster::generateNack(bmqt::AckResult::Enum status, // Report locally generated NACK queue->stats()->onEvent(mqbstat::QueueStatsDomain::EventType::e_NACK, 1); - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << description() << ": Failed to relay PUT message " << "[queueId: " << putHeader.queueId() << ", GUID: " << putHeader.messageGUID() << "]. " << "Reason: " << nackReason; - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedPutMessages, if (raiseAlarm) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") - << os.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_ALARM("CLUSTER") + << os.str() << BMQTSK_ALARMLOG_END; } else { BALL_LOG_WARN << os.str(); }); } @@ -616,7 +616,7 @@ void Cluster::processCommandDispatched(mqbcmd::ClusterResult* result, } bdlma::LocalSequentialAllocator<256> localAllocator(d_allocator_p); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "Unknown command '" << command << "'"; result->makeError().message() = os.str(); } @@ -664,7 +664,7 @@ void Cluster::initiateShutdownDispatched(const VoidFunctor& callback, // // Call 'initiateShutdown' for all client sessions. - mwcu::OperationChainLink link(d_shutdownChain.allocator()); + bmqu::OperationChainLink link(d_shutdownChain.allocator()); bsls::TimeInterval shutdownTimeout; shutdownTimeout.addMilliseconds(d_clusterData.clusterConfig() .queueOperations() @@ -736,7 +736,7 @@ void Cluster::initiateShutdownDispatched(const VoidFunctor& callback, d_shutdownChain.appendInplace( bdlf::BindUtil::bind(&Cluster::continueShutdown, this, - mwcsys::Time::highResolutionTimer(), // startTime + bmqsys::Time::highResolutionTimer(), // startTime bdlf::PlaceHolders::_1), // completionCb callback); @@ -799,11 +799,11 @@ void Cluster::continueShutdownDispatched( BALL_LOG_INFO_BLOCK { - bsls::Types::Int64 now = mwcsys::Time::highResolutionTimer(); + bsls::Types::Int64 now = bmqsys::Time::highResolutionTimer(); BALL_LOG_OUTPUT_STREAM << "Continuing shutting down Cluster: [name: '" << name() << "', elapsed time: " - << mwcu::PrintUtil::prettyTimeInterval(now - startTimeNs) << " (" + << bmqu::PrintUtil::prettyTimeInterval(now - startTimeNs) << " (" << (now - startTimeNs) << " nanoseconds)]"; } @@ -888,7 +888,7 @@ void Cluster::onRelayPutEvent(const mqbi::DispatcherEvent& event) bsls::Types::Uint64 leaseId = d_state.partition(pid).primaryLeaseId(); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(genCount != leaseId)) { - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledSkippedPutMessages, BALL_LOG_WARN << description() << ": skipping relay-PUT message [ queueId: " @@ -907,7 +907,7 @@ void Cluster::onRelayPutEvent(const mqbi::DispatcherEvent& event) BSLS_PERFORMANCEHINT_UNLIKELY_HINT; // Inform event's source of relay-PUT failure - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "invalid partition [" << pid << "]"; generateNack(bmqt::AckResult::e_INVALID_ARGUMENT, os.str(), @@ -933,7 +933,7 @@ void Cluster::onRelayPutEvent(const mqbi::DispatcherEvent& event) BSLS_PERFORMANCEHINT_UNLIKELY_HINT; // Inform event's source of relay-PUT failure - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "self (replica node) not available. Self status: " << selfStatus; generateNack(bmqt::AckResult::e_NOT_READY, os.str(), @@ -955,7 +955,7 @@ void Cluster::onRelayPutEvent(const mqbi::DispatcherEvent& event) bmqp_ctrlmsg::PrimaryStatus::E_ACTIVE != pinfo.primaryStatus())) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "no or non-active primary for partition [" << pid << "]"; generateNack(bmqt::AckResult::e_NOT_READY, os.str(), @@ -975,7 +975,7 @@ void Cluster::onRelayPutEvent(const mqbi::DispatcherEvent& event) BSLS_PERFORMANCEHINT_UNLIKELY_HINT; // This should not occur - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "self is primary for partition [" << pid << "]"; generateNack(bmqt::AckResult::e_UNKNOWN, os.str(), @@ -1000,7 +1000,7 @@ void Cluster::onRelayPutEvent(const mqbi::DispatcherEvent& event) bmqp_ctrlmsg::NodeStatus::E_AVAILABLE != primaryStatus)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "primary not available. Primary status: " << primaryStatus; generateNack(bmqt::AckResult::e_NOT_READY, os.str(), @@ -1024,7 +1024,7 @@ void Cluster::onRelayPutEvent(const mqbi::DispatcherEvent& event) // This is non-recoverable, so we drop the PUT msg and log it. - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledSkippedPutMessages, BALL_LOG_ERROR << description() << ": skipping relay-PUT message [" << "queueId: " << ph.queueId() << ", GUID: " @@ -1065,11 +1065,11 @@ void Cluster::onPutEvent(const mqbi::DispatcherEvent& event) if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!putIt.isValid())) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << description() << ": received an invalid PUT event from node " << source->nodeDescription() << "\n"; putIt.dumpBlob(out); - MWCTSK_ALARMLOG_ALARM("CLUSTER") << out.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_ALARM("CLUSTER") << out.str() << BMQTSK_ALARMLOG_END; BSLS_ASSERT_SAFE(false && "Invalid putMessage"); return; // RETURN } @@ -1108,7 +1108,7 @@ void Cluster::onPutEvent(const mqbi::DispatcherEvent& event) ns->queueHandles().end())) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedPutMessages, BALL_LOG_ERROR << description() << ": PUT message for queue with unknown" @@ -1138,7 +1138,7 @@ void Cluster::onPutEvent(const mqbi::DispatcherEvent& event) queueState.d_handle_p->handleParameters().flags()))) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedPutMessages, BALL_LOG_WARN << description() << ": PUT message for queue [" << queueState.d_handle_p->queue()->uri() @@ -1160,7 +1160,7 @@ void Cluster::onPutEvent(const mqbi::DispatcherEvent& event) queueState.d_isFinalCloseQueueReceived)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedPutMessages, BALL_LOG_WARN << description() << ": rejecting PUT message for queue [" @@ -1185,14 +1185,14 @@ void Cluster::onPutEvent(const mqbi::DispatcherEvent& event) if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(rc != 0)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedPutMessages, - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << description() << ": Failed to load PUT message payload" << " [queue: " << queueState.d_handle_p->queue()->uri() << ", guid: " << putIt.header().messageGUID() << ", from node " << source->nodeDescription() - << ", rc: " << rc << "]" << MWCTSK_ALARMLOG_END;); + << ", rc: " << rc << "]" << BMQTSK_ALARMLOG_END;); sendAck(bmqt::AckResult::e_INVALID_ARGUMENT, bmqp::AckMessage::k_NULL_CORRELATION_ID, @@ -1223,7 +1223,7 @@ void Cluster::onPutEvent(const mqbi::DispatcherEvent& event) << ", GUID: " << putIt.header().messageGUID() << ", message size: " << putIt.applicationDataSize() << "]:\n" - << mwcu::BlobStartHexDumper(appDataSp.get(), 64); + << bmqu::BlobStartHexDumper(appDataSp.get(), 64); // If at-most-once queue and ack is requested, send an ack // immediately regardless of whether this is first hop or not. @@ -1262,7 +1262,7 @@ void Cluster::onPutEvent(const mqbi::DispatcherEvent& event) if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(rc < 0)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedPutMessages, BALL_LOG_ERROR_BLOCK { BALL_LOG_OUTPUT_STREAM << description() @@ -1298,7 +1298,7 @@ void Cluster::onAckEvent(const mqbi::DispatcherEvent& event) bmqp_ctrlmsg::NodeStatus::E_STOPPING != selfStatus)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; // Drop ACK coz self is unavailable - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedAckMessages, BALL_LOG_WARN << "Dropping an ACK for queue [queueId: " << ackMessage.queueId() @@ -1324,7 +1324,7 @@ void Cluster::onAckEvent(const mqbi::DispatcherEvent& event) BSLS_PERFORMANCEHINT_UNLIKELY_HINT; // Drop the ACK because downstream node is either starting, in the // maintenance mode, or shut down. - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedAckMessages, BALL_LOG_WARN << "Dropping an ACK for queue [queueId: " << ackMessage.queueId() @@ -1369,7 +1369,7 @@ void Cluster::onRelayAckEvent(const mqbi::DispatcherEvent& event) BSLS_PERFORMANCEHINT_UNLIKELY_HINT; // Drop ACK messages coz self is down - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedAckMessages, BALL_LOG_WARN << "Dropping relay ACK messages from node " << realEvent->clusterNode()->nodeDescription() @@ -1395,7 +1395,7 @@ void Cluster::onRelayAckEvent(const mqbi::DispatcherEvent& event) // TBD: Logging at INFO level at the moment, until queue close // sequence is properly handled, this is a (non-fatal) // situation which can happen. - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedAckMessages, BALL_LOG_INFO << "[CLUSTER] " << description() << ": Received an ACK for unknown queue " @@ -1434,11 +1434,11 @@ void Cluster::onConfirmEvent(const mqbi::DispatcherEvent& event) BSLS_ASSERT_SAFE(rawEvent.isConfirmEvent()); rawEvent.loadConfirmMessageIterator(&confIt); if (!confIt.isValid()) { - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << description() << ": received invalid CONFIRM event from node " << source->nodeDescription() << "\n"; confIt.dumpBlob(out); - MWCTSK_ALARMLOG_ALARM("CLUSTER") << out.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_ALARM("CLUSTER") << out.str() << BMQTSK_ALARMLOG_END; return; // RETURN } bmqp_ctrlmsg::NodeStatus::Value status = @@ -1446,7 +1446,7 @@ void Cluster::onConfirmEvent(const mqbi::DispatcherEvent& event) if (bmqp_ctrlmsg::NodeStatus::E_AVAILABLE != status && bmqp_ctrlmsg::NodeStatus::E_STOPPING != status) { // This node is going down. - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedConfirmMessages, BALL_LOG_WARN << "Failed to apply CONFIRM event to queue from " << source->nodeDescription() @@ -1484,16 +1484,16 @@ void Cluster::onConfirmEvent(const mqbi::DispatcherEvent& event) queueId.subId()); } else { - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedRejectMessages, - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << ": CONFIRM " << ValidationResult::toAscii(result) << " [queue: '" << (queueHandle ? queueHandle->queue()->uri() : "") << "', queueId: " << queueId << ", GUID: " << confIt.message().messageGUID() << "] from " - << source->nodeDescription() << MWCTSK_ALARMLOG_END;); + << source->nodeDescription() << BMQTSK_ALARMLOG_END;); } } @@ -1532,11 +1532,11 @@ void Cluster::onRejectEvent(const mqbi::DispatcherEvent& event) rawEvent.loadRejectMessageIterator(&rejectIt); if (!rejectIt.isValid()) { - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << description() << ": received invalid REJECT event from node " << source->nodeDescription() << "\n"; rejectIt.dumpBlob(out); - MWCTSK_ALARMLOG_ALARM("CLUSTER") << out.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_ALARM("CLUSTER") << out.str() << BMQTSK_ALARMLOG_END; return; // RETURN } bmqp_ctrlmsg::NodeStatus::Value status = @@ -1544,7 +1544,7 @@ void Cluster::onRejectEvent(const mqbi::DispatcherEvent& event) if (bmqp_ctrlmsg::NodeStatus::E_AVAILABLE != status && bmqp_ctrlmsg::NodeStatus::E_STOPPING != status) { // This node is going down. - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedRejectMessages, BALL_LOG_WARN << "Failed to apply REJECT event to queue from " << source->nodeDescription() @@ -1582,16 +1582,16 @@ void Cluster::onRejectEvent(const mqbi::DispatcherEvent& event) queueId.subId()); } else { - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedRejectMessages, - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << ": REJECT " << ValidationResult::toAscii(result) << " [queue: '" << (queueHandle ? queueHandle->queue()->uri() : "") << "', queueId: " << queueId << ", GUID: " << rejectIt.message().messageGUID() << "] from " - << source->nodeDescription() << MWCTSK_ALARMLOG_END;); + << source->nodeDescription() << BMQTSK_ALARMLOG_END;); } } @@ -1682,7 +1682,7 @@ void Cluster::onRelayRejectEvent(const mqbi::DispatcherEvent& event) mqbc::ClusterNodeSession* ns = 0; bdlma::LocalSequentialAllocator<256> localAllocator(d_allocator_p); - mwcu::MemOutStream errorStream(&localAllocator); + bmqu::MemOutStream errorStream(&localAllocator); bool isValid = validateRelayMessage(&ns, &errorStream, pid); if (isValid) { @@ -1696,7 +1696,7 @@ void Cluster::onRelayRejectEvent(const mqbi::DispatcherEvent& event) BSLS_PERFORMANCEHINT_UNLIKELY_HINT; // This is non-recoverable, so we drop the REJECT msg and log it. - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledDroppedRejectMessages, BALL_LOG_ERROR << description() << ": dropping REJECT message " << "[queueId: " << queueId.id() @@ -1708,7 +1708,7 @@ void Cluster::onRelayRejectEvent(const mqbi::DispatcherEvent& event) } } else { - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedRejectMessages, BALL_LOG_WARN << "Failed to relay REJECT message " << "[queueId: " << queueId.id() @@ -1741,7 +1741,7 @@ void Cluster::onRelayConfirmEvent(const mqbi::DispatcherEvent& event) mqbc::ClusterNodeSession* ns = 0; bdlma::LocalSequentialAllocator<256> localAllocator(d_allocator_p); - mwcu::MemOutStream errorStream(&localAllocator); + bmqu::MemOutStream errorStream(&localAllocator); bool isValid = validateRelayMessage(&ns, &errorStream, pid); if (isValid) { @@ -1755,7 +1755,7 @@ void Cluster::onRelayConfirmEvent(const mqbi::DispatcherEvent& event) BSLS_PERFORMANCEHINT_UNLIKELY_HINT; // This is non-recoverable, so we drop the CONFIRM msg and log it. - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledDroppedConfirmMessages, BALL_LOG_ERROR << description() << ": dropping CONFIRM message" << " [queueId: " << queueId.id() @@ -1767,7 +1767,7 @@ void Cluster::onRelayConfirmEvent(const mqbi::DispatcherEvent& event) } } else { - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedRejectMessages, BALL_LOG_WARN << "Failed to relay CONFIRM message " << "[queueId: " << queueId.id() @@ -1862,7 +1862,7 @@ void Cluster::onPushEvent(const mqbi::DispatcherEvent& event) BSLS_PERFORMANCEHINT_UNLIKELY_HINT; // Drop PUSH coz self is going down - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedPushMessages, BALL_LOG_WARN << "Dropping a PUSH for queue [queueId: " << realEvent->queueId() @@ -1883,7 +1883,7 @@ void Cluster::onPushEvent(const mqbi::DispatcherEvent& event) // Note that this PUSH msg was dispatched by the queue handle // representing the target node, and will be in its 'pending list'. - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedPushMessages, BALL_LOG_WARN << description() << ": Failed to send PUSH message [queueId: " @@ -1899,7 +1899,7 @@ void Cluster::onPushEvent(const mqbi::DispatcherEvent& event) QueueHandleMap& queueHandles = ns->queueHandles(); QueueHandleMapIter queueIt = queueHandles.find(realEvent->queueId()); if (queueIt == queueHandles.end()) { - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedPushMessages, BALL_LOG_WARN << description() << ": PUSH message for queue with unknown queueId [" @@ -1970,7 +1970,7 @@ void Cluster::onPushEvent(const mqbi::DispatcherEvent& event) // This is non-recoverable, so we drop the PUSH msg and log it. - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledDroppedPushMessages, BALL_LOG_ERROR << description() << ": dropping PUSH message " << "[queueId: " << realEvent->queueId() @@ -2003,7 +2003,7 @@ void Cluster::onRelayPushEvent(const mqbi::DispatcherEvent& event) BSLS_PERFORMANCEHINT_UNLIKELY_HINT; // Drop relay-PUSH messages coz self is going down - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedPushMessages, BALL_LOG_WARN << "Dropping relay PUSH messages from node " << realEvent->clusterNode()->nodeDescription() @@ -2028,15 +2028,15 @@ void Cluster::onRelayPushEvent(const mqbi::DispatcherEvent& event) if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(queue == 0)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedPushMessages, - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << description() << ": Received a relay-PUSH for unknown " << "queue [queueId: " << pushHeader.queueId() << ", guid: " << pushHeader.messageGUID() << ", flags: " << pushHeader.flags() << "] from node " << realEvent->clusterNode()->nodeDescription() - << MWCTSK_ALARMLOG_END;); + << BMQTSK_ALARMLOG_END;); continue; // CONTINUE } @@ -2052,9 +2052,9 @@ void Cluster::onRelayPushEvent(const mqbi::DispatcherEvent& event) atMostOnce)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedPushMessages, - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << description() << ": Received relay-PUSH with unexpected flag: " << bsl::boolalpha << implicitPayload @@ -2063,7 +2063,7 @@ void Cluster::onRelayPushEvent(const mqbi::DispatcherEvent& event) << ", guid: " << pushHeader.messageGUID() << ", flags: " << pushHeader.flags() << "] from node " << realEvent->clusterNode()->nodeDescription() - << MWCTSK_ALARMLOG_END;); + << BMQTSK_ALARMLOG_END;); continue; // CONTINUE } @@ -2103,7 +2103,7 @@ void Cluster::onRelayPushEvent(const mqbi::DispatcherEvent& event) void Cluster::onRecoveryStatus( int status, const bsl::vector& primaryLeaseIds, - const mwcsys::StatMonitorSnapshotRecorder& statRecorder) + const bmqsys::StatMonitorSnapshotRecorder& statRecorder) { // exected by *ANY* thread @@ -2120,7 +2120,7 @@ void Cluster::onRecoveryStatus( void Cluster::onRecoveryStatusDispatched( int status, const bsl::vector& primaryLeaseIds, - const mwcsys::StatMonitorSnapshotRecorder& statRecorder) + const bmqsys::StatMonitorSnapshotRecorder& statRecorder) { // executed by the *DISPATCHER* thread @@ -2131,7 +2131,7 @@ void Cluster::onRecoveryStatusDispatched( BALL_LOG_ERROR << description() << ": Stopping cluster as recovery " << "failed with status: " << status; - mwcex::SystemExecutor().post( + bmqex::SystemExecutor().post( bdlf::BindUtil::bind(&Cluster::terminate, this, mqbu::ExitCode::e_RECOVERY_FAILURE)); @@ -2183,16 +2183,16 @@ void Cluster::onRecoveryStatusDispatched( } else if (d_state.partition(pid).primaryLeaseId() < primaryLeaseIds[pid]) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << description() << " Partition [" << pid << "]: self has higher retrieved leaseId (" << primaryLeaseIds[pid] << ") than the one notified by leader (" << d_state.partition(pid).primaryLeaseId() << "). Stopping the node as this node seems to have more " - << "advanced view of the storage." << MWCTSK_ALARMLOG_END; + << "advanced view of the storage." << BMQTSK_ALARMLOG_END; - mwcex::SystemExecutor().post(bdlf::BindUtil::bind( + bmqex::SystemExecutor().post(bdlf::BindUtil::bind( &Cluster::terminate, this, mqbu::ExitCode::e_STORAGE_OUT_OF_SYNC)); @@ -2307,7 +2307,7 @@ void Cluster::logSummaryStateDispatched() const BSLS_ASSERT_SAFE(dispatcher()->inDispatcherThread(this)); bdlma::LocalSequentialAllocator<1024> localAllocator(d_allocator_p); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); // Cluster Name os << description() << " summary: "; @@ -2357,7 +2357,7 @@ void Cluster::logSummaryStateDispatched() const } void Cluster::onProxyConnectionUpDispatched( - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bmqp_ctrlmsg::ClientIdentity& identity, const bsl::string& description) { @@ -2474,7 +2474,7 @@ void Cluster::loadElectorInfo(mqbcmd::ElectorInfo* out) const BSLS_ASSERT_SAFE(!rc && "Unsupported elector state"); if (0 == d_clusterData.electorInfo().leaderNode()) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "[ ** NA **, " << mqbnet::Cluster::k_INVALID_NODE_ID << "]"; out->leaderNode() = os.str(); } @@ -2609,7 +2609,7 @@ Cluster::Cluster(const bslstl::StringRef& name, nodeSessionSp->setNodeStatus(bmqp_ctrlmsg::NodeStatus::E_UNKNOWN); // Create stat context for each cluster node - mwcst::StatContextConfiguration config((*nodeIter)->hostName()); + bmqst::StatContextConfiguration config((*nodeIter)->hostName()); StatContextMp statContextMp = d_clusterData.clusterNodesStatContext()->addSubcontext(config); @@ -2973,9 +2973,9 @@ void Cluster::processControlMessage( } break; case MsgChoice::SELECTION_ID_DISCONNECT: case MsgChoice::SELECTION_ID_DISCONNECT_RESPONSE: { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << description() << ": unexpected clusterMessage:" << message - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } break; // BREAK case MsgChoice::SELECTION_ID_ADMIN_COMMAND: { // Assume this is a rerouted command, so just execute it on the @@ -2998,9 +2998,9 @@ void Cluster::processControlMessage( } break; case MsgChoice::SELECTION_ID_UNDEFINED: default: { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << description() << ": unexpected clusterMessage:" << message - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; BSLS_ASSERT_SAFE(message.choice().selectionId() != MsgChoice::SELECTION_ID_UNDEFINED); // We should never receive an 'UNDEFINED' message, but while @@ -3242,9 +3242,9 @@ void Cluster::processClusterControlMessage( } break; // BREAK case MsgChoice::SELECTION_ID_UNDEFINED: default: { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << description() << ": unexpected clusterMessage:" << message - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } break; // BREAK } } @@ -3280,10 +3280,10 @@ void Cluster::processEvent(const bmqp::Event& event, if (isLocal()) { // We shouldn't be getting any intra-cluster messages if its a // local cluster. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << description() << ": received a 'CONTROL' event from node " << source->nodeDescription() << " in local cluster setup." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -3292,12 +3292,12 @@ void Cluster::processEvent(const bmqp::Event& event, int rc = event.loadControlEvent(&message); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << description() << ": failed to decode 'CLUSTER' message from" << " node " << source->nodeDescription() << ", rc: " << rc << "\n" - << mwcu::BlobStartHexDumper(event.blob()) - << MWCTSK_ALARMLOG_END; + << bmqu::BlobStartHexDumper(event.blob()) + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -3354,11 +3354,11 @@ void Cluster::processEvent(const bmqp::Event& event, if (isLocal()) { // We shouldn't be getting any intra-cluster messages if its a // local cluster. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << description() << ": received a 'CLUSTER_STATE' event from node " << source->nodeDescription() << " in local cluster setup." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -3390,10 +3390,10 @@ void Cluster::processEvent(const bmqp::Event& event, } break; // BREAK case bmqp::EventType::e_UNDEFINED: default: { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << description() << ": Received bmqp event of type '" << event.type() << "' which is currently not handled." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; BSLS_ASSERT_SAFE(event.type() != bmqp::EventType::e_UNDEFINED); // We should never receive an 'UNDEFINED' event, but while // introducing new features, we may receive unknown event types. @@ -3511,7 +3511,7 @@ void Cluster::onNodeStateChange(mqbnet::ClusterNode* node, bool isAvailable) } void Cluster::onProxyConnectionUp( - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bmqp_ctrlmsg::ClientIdentity& identity, const bsl::string& description) { @@ -3538,9 +3538,9 @@ void Cluster::onNodeHighWatermark(mqbnet::ClusterNode* node) // that we don't use a 'channel buffer queue' in this component, unlike // mqba::ClientSession). - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << description() << ": Channel HighWatermark hit for node " - << node->nodeDescription() << MWCTSK_ALARMLOG_END; + << node->nodeDescription() << BMQTSK_ALARMLOG_END; } void Cluster::onNodeLowWatermark( @@ -3606,12 +3606,12 @@ void Cluster::onFailoverThreshold() { const mqbcfg::ClusterMonitorConfig& monitorConfig = d_clusterData.clusterConfig().clusterMonitorConfig(); - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "'" << d_clusterData.identity().name() << "' has not completed the failover process above the threshold " << "amount of " - << mwcu::PrintUtil::prettyTimeInterval( + << bmqu::PrintUtil::prettyTimeInterval( monitorConfig.thresholdFailover() * bdlt::TimeUnitRatio::k_NS_PER_S) << ". There are " @@ -3619,7 +3619,7 @@ void Cluster::onFailoverThreshold() << " pending reopen-queue requests.\n"; // Log only a summary in the alarm printClusterStateSummary(os, 0, 4); - MWCTSK_ALARMLOG_PANIC("CLUSTER") << os.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_PANIC("CLUSTER") << os.str() << BMQTSK_ALARMLOG_END; } void Cluster::onProcessedAdminCommand( @@ -3853,7 +3853,8 @@ void Cluster::getPartitionPrimaryNode(int* rc, d_state.partitions(); // Check boundary conditions for partitionId - if (partitionId < 0 || partitionId >= partitions.size()) { + if (partitionId < 0 || + static_cast(partitions.size()) <= partitionId) { errorDescription << "Invalid partition id: " << partitionId; *rc = rc_ERROR; return; // RETURN diff --git a/src/groups/mqb/mqbblp/mqbblp_cluster.h b/src/groups/mqb/mqbblp/mqbblp_cluster.h index 1609461d1..5c24e5130 100644 --- a/src/groups/mqb/mqbblp/mqbblp_cluster.h +++ b/src/groups/mqb/mqbblp/mqbblp_cluster.h @@ -53,13 +53,12 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -172,9 +171,9 @@ class Cluster : public mqbi::Cluster, typedef bdlmt::EventScheduler::EventHandle SchedulerEventHandle; - typedef bslma::ManagedPtr StatContextMp; + typedef bslma::ManagedPtr StatContextMp; - typedef bsl::shared_ptr StatContextSp; + typedef bsl::shared_ptr StatContextSp; typedef mqbc::ClusterData::RequestManagerType RequestManagerType; @@ -200,7 +199,7 @@ class Cluster : public mqbi::Cluster, typedef bdlmt::EventScheduler::RecurringEventHandle RecurringEventHandle; /// Map of stat context names to StatContext pointers - typedef bsl::unordered_map + typedef bsl::unordered_map StatContextsMap; /// Type of the MultiRequestManager used by the cluster to send @@ -257,7 +256,7 @@ class Cluster : public mqbi::Cluster, bslma::Allocator* d_allocator_p; // Allocator to use - mwcma::CountingAllocatorStore d_allocators; + bmqma::CountingAllocatorStore d_allocators; // Allocator store to spawn new // allocators for sub-components @@ -286,43 +285,43 @@ class Cluster : public mqbi::Cluster, ClusterStateMonitor d_clusterMonitor; // Cluster state monitor - mwcu::ThrottledActionParams d_throttledFailedPutMessages; + bmqu::ThrottledActionParams d_throttledFailedPutMessages; // Throttling parameters for failed PUT // messages. - mwcu::ThrottledActionParams d_throttledSkippedPutMessages; + bmqu::ThrottledActionParams d_throttledSkippedPutMessages; // Throttling parameters for dropped // PUT messages. - mwcu::ThrottledActionParams d_throttledFailedAckMessages; + bmqu::ThrottledActionParams d_throttledFailedAckMessages; // Throttling parameters for failed ACK // messages. - mwcu::ThrottledActionParams d_throttledDroppedAckMessages; + bmqu::ThrottledActionParams d_throttledDroppedAckMessages; // Throttling parameters for dropped // ACK messages. - mwcu::ThrottledActionParams d_throttledFailedConfirmMessages; + bmqu::ThrottledActionParams d_throttledFailedConfirmMessages; // Throttling parameters for failed // CONFIRM messages. - mwcu::ThrottledActionParams d_throttledFailedRejectMessages; + bmqu::ThrottledActionParams d_throttledFailedRejectMessages; // Throttling parameters for failed // REJECT messages. - mwcu::ThrottledActionParams d_throttledDroppedConfirmMessages; + bmqu::ThrottledActionParams d_throttledDroppedConfirmMessages; // Throttling parameters for dropped // CONFIRM messages. - mwcu::ThrottledActionParams d_throttledDroppedRejectMessages; + bmqu::ThrottledActionParams d_throttledDroppedRejectMessages; // Throttling parameters for dropped // REJECT messages. - mwcu::ThrottledActionParams d_throttledFailedPushMessages; + bmqu::ThrottledActionParams d_throttledFailedPushMessages; // Throttling parameters for failed // PUSH messages. - mwcu::ThrottledActionParams d_throttledDroppedPushMessages; + bmqu::ThrottledActionParams d_throttledDroppedPushMessages; // Throttling parameters for dropped // PUSH messages. @@ -336,7 +335,7 @@ class Cluster : public mqbi::Cluster, StopRequestManagerType* d_stopRequestsManager_p; - mwcu::OperationChain d_shutdownChain; + bmqu::OperationChain d_shutdownChain; // Mechanism used for the Cluster // graceful shutdown to serialize // execution of the shutdown callbacks @@ -483,13 +482,13 @@ class Cluster : public mqbi::Cluster, void onRecoveryStatus(int status, const bsl::vector& primaryLeaseIds, - const mwcsys::StatMonitorSnapshotRecorder& statRecorder); + const bmqsys::StatMonitorSnapshotRecorder& statRecorder); /// Executes in cluster's dispatcher thread. void onRecoveryStatusDispatched( int status, const bsl::vector& primaryLeaseIds, - const mwcsys::StatMonitorSnapshotRecorder& statRecorder); + const bmqsys::StatMonitorSnapshotRecorder& statRecorder); /// Executes in the scheduler thread. void gcExpiredQueues(); @@ -503,7 +502,7 @@ class Cluster : public mqbi::Cluster, /// specified `channel` and using the specified `description` if the /// specified `identity` supports broadcastring advisories to proxies. void onProxyConnectionUpDispatched( - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bmqp_ctrlmsg::ClientIdentity& identity, const bsl::string& description); @@ -723,7 +722,7 @@ class Cluster : public mqbi::Cluster, /// specified `channel` and using the specified `description` if the /// specified `identity` supports broadcastring advisories to proxies. void - onProxyConnectionUp(const bsl::shared_ptr& channel, + onProxyConnectionUp(const bsl::shared_ptr& channel, const bmqp_ctrlmsg::ClientIdentity& identity, const bsl::string& description) BSLS_KEYWORD_OVERRIDE; diff --git a/src/groups/mqb/mqbblp/mqbblp_clustercatalog.cpp b/src/groups/mqb/mqbblp/mqbblp_clustercatalog.cpp index a64a2ce98..ac02017f6 100644 --- a/src/groups/mqb/mqbblp/mqbblp_clustercatalog.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_clustercatalog.cpp @@ -26,12 +26,11 @@ #include #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -376,13 +375,14 @@ ClusterCatalog::ClusterCatalog(mqbi::Dispatcher* dispatcher, , d_reversedClusterConnections(d_allocator_p) , d_clusters(d_allocator_p) , d_statContexts(statContexts) +, d_resources(resources) +, d_adminCb() , d_requestManager(bmqp::EventType::e_CONTROL, resources.bufferFactory(), resources.scheduler(), false, // lateResponseMode d_allocator_p) , d_stopRequestsManager(&d_requestManager, d_allocator_p) -, d_resources(resources) { // PRECONDITIONS BSLS_ASSERT_SAFE(d_resources.scheduler()->clockType() == @@ -420,7 +420,7 @@ int ClusterCatalog::loadBrokerClusterConfig(bsl::ostream&) } bsl::ifstream configStream(configFilename.c_str()); - mwcu::MemOutStream configParameters; + bmqu::MemOutStream configParameters; configParameters << configStream.rdbuf(); if (!configStream || !configParameters) { @@ -489,14 +489,14 @@ int ClusterCatalog::loadBrokerClusterConfig(bsl::ostream&) BALL_LOG_OUTPUT_STREAM << " I am *NOT* member of any cluster."; } else { - mwcu::Printer > printer( + bmqu::Printer > printer( &d_myClusters); BALL_LOG_OUTPUT_STREAM << " I am a member of the following clusters: " << printer; } if (!d_myReverseClusters.empty()) { - mwcu::Printer > printer( + bmqu::Printer > printer( &d_myReverseClusters); BALL_LOG_OUTPUT_STREAM << "\n The following clusters will remote connect to me '" @@ -509,7 +509,7 @@ int ClusterCatalog::loadBrokerClusterConfig(bsl::ostream&) for (size_t i = 0; i < d_reversedClusterConnections.size(); ++i) { const mqbcfg::ReversedClusterConnection& clusterConnection = d_reversedClusterConnections[i]; - mwcu::Printer > + bmqu::Printer > printer(&clusterConnection.connections()); BALL_LOG_OUTPUT_STREAM << "\n '" << clusterConnection.name() << "': " << printer; @@ -517,7 +517,7 @@ int ClusterCatalog::loadBrokerClusterConfig(bsl::ostream&) } if (!d_myVirtualClusters.empty()) { - mwcu::Printer > printer( + bmqu::Printer > printer( &d_myVirtualClusters); BALL_LOG_OUTPUT_STREAM << "\n I am a member of the following VIRTUAL clusters: " @@ -644,7 +644,7 @@ ClusterCatalog::getCluster(bsl::shared_ptr* out, } bsl::shared_ptr cluster; - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc = createCluster(errorDesc, &cluster, name); if (rc != 0) { status.category() = bmqp_ctrlmsg::StatusCategory::E_REFUSED; @@ -781,7 +781,7 @@ int ClusterCatalog::processCommand(mqbcmd::ClustersResult* result, connection.connections().push_back(nodeConnection); connectionArray.push_back(connection); - mwcu::MemOutStream os; + bmqu::MemOutStream os; int rc = initiateReversedClusterConnectionsImp(os, connectionArray); if (rc != 0) { result->makeError().message() = os.str() + @@ -802,7 +802,7 @@ int ClusterCatalog::processCommand(mqbcmd::ClustersResult* result, const ClustersMapIter it = d_clusters.find( command.cluster().name()); if (it == d_clusters.end()) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "cluster '" << command.cluster().name() << "' not found !"; result->makeError().message() = os.str(); @@ -832,7 +832,7 @@ int ClusterCatalog::processCommand(mqbcmd::ClustersResult* result, } } - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Unknown command '" << command << "'"; result->makeError().message() = os.str(); return -1; diff --git a/src/groups/mqb/mqbblp/mqbblp_clustercatalog.h b/src/groups/mqb/mqbblp/mqbblp_clustercatalog.h index 90665fd88..863cad568 100644 --- a/src/groups/mqb/mqbblp/mqbblp_clustercatalog.h +++ b/src/groups/mqb/mqbblp/mqbblp_clustercatalog.h @@ -71,8 +71,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -118,7 +117,7 @@ class NegotiatorContext; namespace mqbnet { class TransportManager; } -namespace mwcst { +namespace bmqst { class StatContext; } @@ -200,7 +199,7 @@ class ClusterCatalog { typedef bsl::unordered_map VirtualClustersMap; /// Map of stat context names to StatContext pointers - typedef bsl::unordered_map + typedef bsl::unordered_map StatContextsMap; private: @@ -208,7 +207,7 @@ class ClusterCatalog { bslma::Allocator* d_allocator_p; // Allocator to use - mwcma::CountingAllocatorStore d_allocators; + bmqma::CountingAllocatorStore d_allocators; // Allocator store to spawn new // allocators for sub-components diff --git a/src/groups/mqb/mqbblp/mqbblp_clusterorchestrator.cpp b/src/groups/mqb/mqbblp/mqbblp_clusterorchestrator.cpp index 3def3d866..d368d1027 100644 --- a/src/groups/mqb/mqbblp/mqbblp_clusterorchestrator.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_clusterorchestrator.cpp @@ -29,10 +29,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -373,12 +372,12 @@ void ClusterOrchestrator::onPartitionPrimaryStatusDispatched( // not handled. The leader should assign a new primary if old primary // fails to transition to ACTIVE status in the stipulated time. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " Partition [" << partitionId << "]: primary node (self) failed to sync partition, rc: " << status << ", leaseId: " << primaryLeaseId - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; d_stateManager_mp->setPrimaryStatus( partitionId, @@ -513,7 +512,7 @@ void ClusterOrchestrator::timerCbDispatched() BSLS_ASSERT_SAFE( dispatcher()->inDispatcherThread(&d_clusterData_p->cluster())); - const bsls::Types::Int64 timer = mwcsys::Time::highResolutionTimer(); + const bsls::Types::Int64 timer = bmqsys::Time::highResolutionTimer(); for (size_t partitionId = 0; partitionId < clusterState()->partitions().size(); @@ -937,10 +936,10 @@ void ClusterOrchestrator::processClusterStateFSMMessage( } break; // BREAK case MsgChoice::SELECTION_ID_UNDEFINED: BSLS_ANNOTATION_FALLTHROUGH; default: { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": unexpected clusterMessage:" << message - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } break; // BREAK } } @@ -996,10 +995,10 @@ void ClusterOrchestrator::processPartitionMessage( } break; // BREAK case MsgChoice::SELECTION_ID_UNDEFINED: BSLS_ANNOTATION_FALLTHROUGH; default: { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": unexpected clusterMessage:" << message - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } break; // BREAK } } @@ -1283,11 +1282,11 @@ void ClusterOrchestrator::processElectorEvent(const bmqp::Event& event, if (isLocal()) { // We shouldn't be getting any elector related messages if its a local // cluster. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " received an elector event from node " << source->nodeDescription() << " in local cluster setup." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -1655,17 +1654,32 @@ void ClusterOrchestrator::processPrimaryStatusAdvisory( if (d_clusterConfig.clusterAttributes().isFSMWorkflow()) { if (pinfo.primaryNode() != source || pinfo.primaryLeaseId() != primaryAdv.primaryLeaseId()) { - BALL_LOG_WARN << d_clusterData_p->identity().description() - << ": Partition [" << primaryAdv.partitionId() - << "]: received primary status advisory: " - << primaryAdv - << " from: " << source->nodeDescription() - << ", but self perceived primary and its leaseId are" - << ": [" - << (pinfo.primaryNode() - ? pinfo.primaryNode()->nodeDescription() - : "** null **") - << ", " << pinfo.primaryLeaseId() << "]."; + BALL_LOG_WARN_BLOCK + { + BALL_LOG_OUTPUT_STREAM + << d_clusterData_p->identity().description() + << ": Partition [" << primaryAdv.partitionId() + << "]: received primary status advisory: " << primaryAdv + << " from: " << source->nodeDescription() + << ", but self perceived primary and its leaseId are" + << ": [" + << (pinfo.primaryNode() + ? pinfo.primaryNode()->nodeDescription() + : "** null **") + << ", " << pinfo.primaryLeaseId() << "]."; + if (pinfo.primaryNode()) { + BALL_LOG_OUTPUT_STREAM << " Ignoring advisory."; + } + else { + BALL_LOG_OUTPUT_STREAM << " Since we have not received any" + << " information regarding the true" + << " primary, this advisory could " + << "be from the true one. Will" + << " buffer the advisory for now."; + d_storageManager_p->bufferPrimaryStatusAdvisory(primaryAdv, + source); + } + } return; // RETURN } } @@ -1759,11 +1773,18 @@ void ClusterOrchestrator::processPrimaryStatusAdvisory( // TBD: may need to review the order of invoking these routines. + BALL_LOG_INFO << d_clusterData_p->identity().description() + << " PartitionId [" << primaryAdv.partitionId() + << "]: received primary status advisory: " << primaryAdv + << ", from: " << source->nodeDescription(); + BSLS_ASSERT_SAFE(ns->isPrimaryForPartition(primaryAdv.partitionId())); d_stateManager_mp->setPrimaryStatus(primaryAdv.partitionId(), primaryAdv.status()); - d_storageManager_p->processPrimaryStatusAdvisory(primaryAdv, source); + if (!d_clusterConfig.clusterAttributes().isFSMWorkflow()) { + d_storageManager_p->processPrimaryStatusAdvisory(primaryAdv, source); + } } void ClusterOrchestrator::processStateNotification( @@ -1981,7 +2002,7 @@ int ClusterOrchestrator::processCommand( return rc; // RETURN } - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Unknown command '" << command << "'"; mqbcmd::Error& error = result->makeError(); error.message() = os.str(); diff --git a/src/groups/mqb/mqbblp/mqbblp_clusterorchestrator.h b/src/groups/mqb/mqbblp/mqbblp_clusterorchestrator.h index c649b62a2..9b9fe35e6 100644 --- a/src/groups/mqb/mqbblp/mqbblp_clusterorchestrator.h +++ b/src/groups/mqb/mqbblp/mqbblp_clusterorchestrator.h @@ -42,8 +42,7 @@ #include #include -// MWC -#include +#include // BMQ #include @@ -117,7 +116,7 @@ class ClusterOrchestrator { bslma::Allocator* d_allocator_p; // Allocator to use - mwcma::CountingAllocatorStore d_allocators; + bmqma::CountingAllocatorStore d_allocators; // Allocator store to spawn new // allocators for sub-components diff --git a/src/groups/mqb/mqbblp/mqbblp_clusterproxy.cpp b/src/groups/mqb/mqbblp/mqbblp_clusterproxy.cpp index 066eedfc4..94cca4401 100644 --- a/src/groups/mqb/mqbblp/mqbblp_clusterproxy.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_clusterproxy.cpp @@ -33,11 +33,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -72,7 +71,7 @@ const double k_ACTIVE_NODE_INITIAL_WAIT = 10.0; typedef bsl::function CompletionCallback; -/// Utility function used in `mwcu::OperationChain` as the operation +/// Utility function used in `bmqu::OperationChain` as the operation /// callback which just calls the completion callback. void completeShutDown(const CompletionCallback& callback) { @@ -104,7 +103,7 @@ void ClusterProxy::generateNack(bmqt::AckResult::Enum status, appData, options); - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledSkippedPutMessages, BALL_LOG_ERROR << description() << ": skipping relay-PUT message [" << "queueId: " << putHeader.queueId() << ", GUID: " @@ -147,7 +146,7 @@ void ClusterProxy::startDispatched() // Schedule an event, to ensure we will eventually use a connection - refer // to the ClusterActiveNodeManager documentation for more details. - bsls::TimeInterval interval = mwcsys::Time::nowMonotonicClock() + + bsls::TimeInterval interval = bmqsys::Time::nowMonotonicClock() + bsls::TimeInterval( k_ACTIVE_NODE_INITIAL_WAIT); d_clusterData.scheduler().scheduleEvent( @@ -191,7 +190,7 @@ void ClusterProxy::initiateShutdownDispatched(const VoidFunctor& callback, // V2. // Fill the first link with client session shutdown operations - mwcu::OperationChainLink link(d_shutdownChain.allocator()); + bmqu::OperationChainLink link(d_shutdownChain.allocator()); SessionSpVec sessions; bsls::TimeInterval shutdownTimeout; shutdownTimeout.addMilliseconds( @@ -308,7 +307,7 @@ void ClusterProxy::processCommandDispatched( // be sent to a cluster. bdlma::LocalSequentialAllocator<256> localAllocator(d_allocator_p); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "Unknown command '" << command << "'"; result->makeError().message() = os.str(); } @@ -526,7 +525,7 @@ void ClusterProxy::onAckEvent(const mqbi::DispatcherAckEvent& event) // back the ACK. // TBD: Until closeQueue sequence is revisited to prevent this // situation, log at INFO level. - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedAckMessages, BALL_LOG_INFO << "Received an ACK for unknown queue " << "[queueId: " << ackMessage.queueId() @@ -559,7 +558,7 @@ void ClusterProxy::onRelayPutEvent(const mqbi::DispatcherPutEvent& event, bsls::Types::Uint64 genCount = event.genCount(); bsls::Types::Uint64 term = d_clusterData.electorInfo().electorTerm(); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(genCount != term)) { - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledSkippedPutMessages, BALL_LOG_WARN << description() << ": skipping relay-PUT message [" << "queueId: " << ph.queueId() << ", GUID: " @@ -685,7 +684,7 @@ void ClusterProxy::processEvent(const bmqp::Event& event, << "#CORRUPTED_EVENT " << description() << ": received invalid control message [reason: 'failed to " << "decode', rc: " << rc << "]\n" - << mwcu::BlobStartHexDumper(event.blob()); + << bmqu::BlobStartHexDumper(event.blob()); return; // RETURN } @@ -781,7 +780,7 @@ void ClusterProxy::processEvent(const bmqp::Event& event, << "Received unexpected event: " << event; BSLS_ASSERT_SAFE(false && "Unexpected event received"); return; // RETURN - } // break; + } // break; default: { BALL_LOG_ERROR << "#UNEXPECTED_EVENT " << description() << "Received unknown event: " << event; @@ -925,7 +924,7 @@ void ClusterProxy::updateDatumStats() ? "Active" : ""; - mwcst::StatContext* statContext = (iter->second).get(); + bmqst::StatContext* statContext = (iter->second).get(); bslma::Allocator* alloc = statContext->datumAllocator(); ManagedDatumMp datum = statContext->datum(); @@ -1097,7 +1096,7 @@ ClusterProxy::ClusterProxy( NodeListIter nodeIter = netCluster_p->nodes().begin(); NodeListIter endIter = netCluster_p->nodes().end(); for (; nodeIter != endIter; ++nodeIter) { - mwcst::StatContextConfiguration config((*nodeIter)->hostName()); + bmqst::StatContextConfiguration config((*nodeIter)->hostName()); StatContextMp statContextMp = d_clusterData.clusterNodesStatContext()->addSubcontext(config); @@ -1402,31 +1401,31 @@ void ClusterProxy::onDispatcherEvent(const mqbi::DispatcherEvent& event) BSLS_ASSERT_OPT(false && "'DISPATCHER' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_CLUSTER_STATE: { BSLS_ASSERT_OPT(false && "'CLUSTER_STATE' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_STORAGE: { BSLS_ASSERT_OPT(false && "'STORAGE' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_RECOVERY: { BSLS_ASSERT_OPT(false && "'RECOVERY' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_UNDEFINED: { BSLS_ASSERT_OPT(false && "'UNDEFINED' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_REPLICATION_RECEIPT: { BSLS_ASSERT_OPT( false && "'REPLICATION_RECEIPT' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; default: { BALL_LOG_ERROR << "#UNEXPECTED_EVENT " << description() << ": received unexpected dispatcher event: " << event; @@ -1448,19 +1447,19 @@ void ClusterProxy::onFailoverThreshold() { const mqbcfg::ClusterMonitorConfig& monitorConfig = d_clusterData.clusterConfig().clusterMonitorConfig(); - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "'" << d_clusterData.identity().description() << "'" << " has not completed the failover process above the threshold " << "amount of " - << mwcu::PrintUtil::prettyTimeInterval( + << bmqu::PrintUtil::prettyTimeInterval( monitorConfig.thresholdFailover() * bdlt::TimeUnitRatio::k_NS_PER_S) << ". There are " << d_queueHelper.numPendingReopenQueueRequests() << " pending reopen-queue requests.\n"; // Log only a summary in the alarm printClusterStateSummary(os, 0, 4); - MWCTSK_ALARMLOG_PANIC("CLUSTERPROXY") << os.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_PANIC("CLUSTERPROXY") << os.str() << BMQTSK_ALARMLOG_END; } // MANIPULATORS diff --git a/src/groups/mqb/mqbblp/mqbblp_clusterproxy.h b/src/groups/mqb/mqbblp/mqbblp_clusterproxy.h index 89cf41f20..667a052fe 100644 --- a/src/groups/mqb/mqbblp/mqbblp_clusterproxy.h +++ b/src/groups/mqb/mqbblp/mqbblp_clusterproxy.h @@ -67,11 +67,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -166,9 +165,9 @@ class ClusterProxy : public mqbc::ClusterStateObserver, size_t bytes() const; }; - typedef bslma::ManagedPtr StatContextMp; + typedef bslma::ManagedPtr StatContextMp; - typedef bsl::shared_ptr StatContextSp; + typedef bsl::shared_ptr StatContextSp; typedef bslma::ManagedPtr ManagedDatumMp; @@ -179,7 +178,7 @@ class ClusterProxy : public mqbc::ClusterStateObserver, typedef NodeList::iterator NodeListIter; /// Map of strings to StatContext pointers - typedef bsl::unordered_map + typedef bsl::unordered_map StatContextsMap; /// Type of the MultiRequestManager used by the cluster proxy to send @@ -228,11 +227,11 @@ class ClusterProxy : public mqbc::ClusterStateObserver, // Map of node to associated stat // context. - mwcu::ThrottledActionParams d_throttledFailedAckMessages; + bmqu::ThrottledActionParams d_throttledFailedAckMessages; // Throttling parameters for failed ACK // messages. - mwcu::ThrottledActionParams d_throttledSkippedPutMessages; + bmqu::ThrottledActionParams d_throttledSkippedPutMessages; // Throttling parameters for skipped // PUT messages. @@ -245,7 +244,7 @@ class ClusterProxy : public mqbc::ClusterStateObserver, // 'ClusterActiveNodeManager' // documentation). - mwcu::OperationChain d_shutdownChain; + bmqu::OperationChain d_shutdownChain; // Mechanism used for the ClusterProxy // graceful shutdown to serialize // execution of the shutdown callbacks @@ -717,22 +716,20 @@ inline size_t ClusterProxy::ChannelBuffer::bytes() const // class ClusterProxy // ------------------ -inline void -ClusterProxy::getPrimaryNodes(int* rc, - bsl::ostream& errorDescription, - bsl::vector* nodes, - bool* isSelfPrimary) const +inline void ClusterProxy::getPrimaryNodes(int*, + bsl::ostream&, + bsl::vector*, + bool*) const { // no implementation -- this should not run. BSLS_ASSERT_SAFE(false); } -inline void -ClusterProxy::getPartitionPrimaryNode(int* rc, - bsl::ostream& errorDescription, - mqbnet::ClusterNode** node, - bool* isSelfPrimary, - int partitionId) const +inline void ClusterProxy::getPartitionPrimaryNode(int*, + bsl::ostream&, + mqbnet::ClusterNode**, + bool*, + int) const { // no implementation -- this should not run. BSLS_ASSERT_SAFE(false); diff --git a/src/groups/mqb/mqbblp/mqbblp_clusterqueuehelper.cpp b/src/groups/mqb/mqbblp/mqbblp_clusterqueuehelper.cpp index 761f9d37d..ff24e36a0 100644 --- a/src/groups/mqb/mqbblp/mqbblp_clusterqueuehelper.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_clusterqueuehelper.cpp @@ -54,12 +54,11 @@ #include #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -255,17 +254,17 @@ unsigned int ClusterQueueHelper::getNextQueueId() unsigned int res = d_nextQueueId++; if (d_nextQueueId == bsl::numeric_limits::max() / 2) { - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << d_cluster_p->description() << " nextQueueId for cluster is at 50% capacity, please schedule a" - << " bounce of this broker." << MWCTSK_ALARMLOG_END; + << " bounce of this broker." << BMQTSK_ALARMLOG_END; } else if (d_nextQueueId == bsl::numeric_limits::max() / 10 * 9) { - MWCTSK_ALARMLOG_PANIC("CLUSTER_STATE") + BMQTSK_ALARMLOG_PANIC("CLUSTER_STATE") << d_cluster_p->description() << " nextQueueId for cluster is at 90% capacity, please urgently " - << "schedule a bounce of this broker." << MWCTSK_ALARMLOG_END; + << "schedule a bounce of this broker." << BMQTSK_ALARMLOG_END; } else if (d_nextQueueId == 0 || d_nextQueueId >= bmqp::QueueId::k_RESERVED_QUEUE_ID) { @@ -305,19 +304,19 @@ unsigned int ClusterQueueHelper::getNextSubQueueId(OpenQueueContext* context) if (queueInfo->d_nextSubQueueId == bsl::numeric_limits::max() / 2) { - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << d_cluster_p->description() << " nextSubQueueId for queue " << context->d_queueContext_p->uri() << " in cluster is at 50% capacity, please schedule a bounce of" - << " this broker." << MWCTSK_ALARMLOG_END; + << " this broker." << BMQTSK_ALARMLOG_END; } else if (queueInfo->d_nextSubQueueId == bsl::numeric_limits::max() / 10 * 9) { - MWCTSK_ALARMLOG_PANIC("CLUSTER_STATE") + BMQTSK_ALARMLOG_PANIC("CLUSTER_STATE") << d_cluster_p->description() << " nextSubQueueId for queue " << context->d_queueContext_p->uri() << " in cluster is at 90% capacity, please urgently schedule a" - << " bounce of this broker." << MWCTSK_ALARMLOG_END; + << " bounce of this broker." << BMQTSK_ALARMLOG_END; } else if (queueInfo->d_nextSubQueueId == 0 || (queueInfo->d_nextSubQueueId >= @@ -756,7 +755,7 @@ void ClusterQueueHelper::onQueueContextAssigned( BSLS_ASSERT_SAFE(isQueueAssigned(*(queueContext.get()))); const int pid = queueContext->partitionId(); - mwcu::MemOutStream logMsg(d_allocator_p); + bmqu::MemOutStream logMsg(d_allocator_p); logMsg << d_cluster_p->description() << ": "; if (d_cluster_p->isRemote()) { @@ -1057,7 +1056,7 @@ void ClusterQueueHelper::sendOpenQueueRequest(const OpenQueueContext& context) #define CALLBACK_FAILURE(CAT, RC, MSG) \ do { \ bdlma::LocalSequentialAllocator<128> localAllocator(d_allocator_p); \ - mwcu::MemOutStream os(&localAllocator); \ + bmqu::MemOutStream os(&localAllocator); \ os << MSG; \ \ bmqp_ctrlmsg::Status failure; \ @@ -1460,11 +1459,11 @@ void ClusterQueueHelper::onReopenQueueResponse( // case, alarm, perform any book-keeping and return. This error is // non-recoverable. - MWCTSK_ALARMLOG_ALARM("QUEUE_REOPEN_FAILURE") + BMQTSK_ALARMLOG_ALARM("QUEUE_REOPEN_FAILURE") << d_cluster_p->description() << ": error while reopening queue [" << req << ", response: " << requestContext->response() << "]" - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; // Mark the queue's subStream as 'not opened', so that queue // does not issue further reopen-queue request for it. @@ -1516,7 +1515,7 @@ void ClusterQueueHelper::onReopenQueueResponse( .reopenRetryIntervalMs() << " milliseconds."; - bsls::TimeInterval after(mwcsys::Time::nowMonotonicClock()); + bsls::TimeInterval after(bmqsys::Time::nowMonotonicClock()); after.addMilliseconds(d_clusterData_p->clusterConfig() .queueOperations() .reopenRetryIntervalMs()); @@ -1980,7 +1979,7 @@ bool ClusterQueueHelper::createQueue( << context.d_handleParameters << "]"; mqbi::Cluster::OpenQueueConfirmationCookie confirmationCookie( - new (*d_allocator_p) mqbi::QueueHandle*(0), + new (*d_allocator_p) mqbi::QueueHandle * (0), bdlf::BindUtil::bind( &ClusterQueueHelper::onOpenQueueConfirmationCookieReleased, this, @@ -1989,7 +1988,7 @@ bool ClusterQueueHelper::createQueue( d_allocator_p); bdlma::LocalSequentialAllocator<1024> la(d_allocator_p); - mwcu::MemOutStream errorDescription(&la); + bmqu::MemOutStream errorDescription(&la); bmqp_ctrlmsg::Status status; const bmqp_ctrlmsg::QueueHandleParameters& parameters = openQueueResponse.originalRequest().handleParameters(); @@ -4148,7 +4147,7 @@ void ClusterQueueHelper::onQueueAssigned( // but queueKey specified in the advisory is present in the // 'queueKeys' data structure. - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << d_cluster_p->description() << ": attempting to apply queue assignment for a known but" << " unassigned queue, but queueKey is not unique. " @@ -4156,7 +4155,7 @@ void ClusterQueueHelper::onQueueAssigned( << "], Partition [" << info.partitionId() << "]. Current leader is: '" << leaderDescription << "'. Ignoring this entry in the advisory." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -4179,13 +4178,13 @@ void ClusterQueueHelper::onQueueAssigned( if (false == insertRc.second) { // QueueKey is not unique. - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << d_cluster_p->description() << ": attempting to apply queue assignment for an unknown " << "queue [" << info.uri() << "] assigned to Partition [" << info.partitionId() << "], but queueKey [" << info.key() << "] is not unique. Current leader is: '" << leaderDescription - << "'. Ignoring this assignment." << MWCTSK_ALARMLOG_END; + << "'. Ignoring this assignment." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -4472,8 +4471,8 @@ void ClusterQueueHelper::onQueueUpdated(const bmqt::Uri& uri, } } - mwcu::Printer printer1(&addedAppIds); - mwcu::Printer printer2(&removedAppIds); + bmqu::Printer printer1(&addedAppIds); + bmqu::Printer printer2(&removedAppIds); BALL_LOG_INFO << d_cluster_p->description() << ": Updated queue: " << uri << ", addedAppIds: " << printer1 << ", removedAppIds: " << printer2; @@ -4676,7 +4675,7 @@ void ClusterQueueHelper::openQueue( } const int pid = queueContextIt->second->partitionId(); if (!isSelfAvailablePrimary(pid)) { - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; errorDesc << "Not the primary for partitionId [" << pid << "]"; reason = errorDesc.str(); errorCode = mqbi::ClusterErrorCode::e_NOT_PRIMARY; @@ -4953,11 +4952,11 @@ void ClusterQueueHelper::processPeerOpenQueueRequest( if (bmqp::QueueUtil::isEmpty(handleParams)) { // This code path is not expected to bit hit, so protect against it, // and alarm for investigation. - MWCTSK_ALARMLOG_ALARM("INVALID_OPENQUEUE_REQ") + BMQTSK_ALARMLOG_ALARM("INVALID_OPENQUEUE_REQ") << d_cluster_p->description() << ": Rejecting invalid openQueueRequest from '" << requester->description() << "': " << request - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; bdlma::LocalSequentialAllocator<1024> localAllocator(d_allocator_p); bmqp_ctrlmsg::ControlMessage response(&localAllocator); @@ -6201,7 +6200,7 @@ int ClusterQueueHelper::gcExpiredQueues(bool immediate) } bsls::Types::Int64 currentTimestampMs = - mwcsys::Time::highResolutionTimer() / bdlt::TimeUnitRatio::k_NS_PER_MS; + bmqsys::Time::highResolutionTimer() / bdlt::TimeUnitRatio::k_NS_PER_MS; bdlma::LocalSequentialAllocator<512> vecAlloc(d_allocator_p); bsl::vector queuesToGc(&vecAlloc); @@ -6348,11 +6347,11 @@ int ClusterQueueHelper::gcExpiredQueues(bool immediate) // QueueUnassignedAdvisory. if (!d_primaryNotLeaderAlarmRaised) { - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << d_cluster_p->description() << " Cannot gc " << queuesToGc.size() << " expired queues " << "since primary and leader nodes are different." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; d_primaryNotLeaderAlarmRaised = true; } @@ -6439,7 +6438,7 @@ void ClusterQueueHelper::loadQueuesInfo(mqbcmd::StorageContent* out) const ++it) { queuesInfo.resize(queuesInfo.size() + 1); mqbcmd::StorageQueueInfo& queueInfo = queuesInfo.back(); - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << it->second->key(); queueInfo.queueKey() = os.str(); queueInfo.partitionId() = it->second->partitionId(); @@ -6514,7 +6513,7 @@ void ClusterQueueHelper::loadState( } clusterQueue.partitionId() = pid; - mwcu::MemOutStream os; + bmqu::MemOutStream os; if (pid != mqbs::DataStore::k_INVALID_PARTITION_ID) { mqbnet::ClusterNode* primary = d_clusterState_p->partition(pid).primaryNode(); diff --git a/src/groups/mqb/mqbblp/mqbblp_clusterqueuehelper.h b/src/groups/mqb/mqbblp/mqbblp_clusterqueuehelper.h index bbc42d362..9a60251f2 100644 --- a/src/groups/mqb/mqbblp/mqbblp_clusterqueuehelper.h +++ b/src/groups/mqb/mqbblp/mqbblp_clusterqueuehelper.h @@ -52,8 +52,7 @@ #include #include -// MWC -#include +#include // BDE #include diff --git a/src/groups/mqb/mqbblp/mqbblp_clusterstatemanager.cpp b/src/groups/mqb/mqbblp/mqbblp_clusterstatemanager.cpp index e215d3ac7..a42bbdd30 100644 --- a/src/groups/mqb/mqbblp/mqbblp_clusterstatemanager.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_clusterstatemanager.cpp @@ -32,11 +32,10 @@ // BMQ #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -294,12 +293,12 @@ void ClusterStateManager::onLeaderSyncStateQueryResponse( // Request failed to encode/be sent; process error handling (note that // 'onLeaderSyncDataQueryResponse' won't be invoked in this case) - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": failed to send leader sync data query request to follower " << "node " << maxSeqNode->nodeDescription() << ", rc: " << status << ". Attempting to send leader sync state " - << "query to AVAILABLE followers again." << MWCTSK_ALARMLOG_END; + << "query to AVAILABLE followers again." << BMQTSK_ALARMLOG_END; // Attempt to send leader sync state query to AVAILABLE followers // again (with wait=true flag). @@ -397,7 +396,7 @@ void ClusterStateManager::onLeaderSyncDataQueryResponse( leaderSyncData.sequenceNumber())) { // This should not occur. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Received a smaller or equal leader-msg-sequence number in " << "leader-sync data query response from follower node " @@ -406,7 +405,7 @@ void ClusterStateManager::onLeaderSyncDataQueryResponse( << ", self sequence:" << d_clusterData_p->electorInfo().leaderMessageSequence() << ". Attempting to send leader-sync state query to AVAILABLE " - << "followers again." << MWCTSK_ALARMLOG_END; + << "followers again." << BMQTSK_ALARMLOG_END; initiateLeaderSync(true); return; // RETURN @@ -433,13 +432,13 @@ void ClusterStateManager::onLeaderSyncDataQueryResponse( if (peerPinfo.partitionId() < 0 || peerPinfo.partitionId() >= static_cast(d_state_p->partitions().size())) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Invalid partitionId: " << peerPinfo << " received from follower node " << responder->nodeDescription() << " in leader-sync data query response. " - << "Skipping this partition info." << MWCTSK_ALARMLOG_END; + << "Skipping this partition info." << BMQTSK_ALARMLOG_END; continue; // CONTINUE } @@ -447,24 +446,24 @@ void ClusterStateManager::onLeaderSyncDataQueryResponse( d_clusterData_p->membership().netCluster()->lookupNode( peerPinfo.primaryNodeId()); if (0 == proposedPrimaryNode) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Invalid primaryNodeId: " << peerPinfo << " received from follower node " << responder->nodeDescription() << " in leader-sync data query response. " - << "Skipping this partition info." << MWCTSK_ALARMLOG_END; + << "Skipping this partition info." << BMQTSK_ALARMLOG_END; continue; // CONTINUE } if (0 == peerPinfo.primaryLeaseId()) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Invalid primaryLeaseId: " << peerPinfo << " received from follower node " << responder->nodeDescription() << " in leader-sync data query response. " - << "Skipping this partition info." << MWCTSK_ALARMLOG_END; + << "Skipping this partition info." << BMQTSK_ALARMLOG_END; continue; // CONTINUE } @@ -475,14 +474,14 @@ void ClusterStateManager::onLeaderSyncDataQueryResponse( // message sequence, it should never have a lower primaryLeaseId // for a given partition. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": stale primaryLeaseId: " << peerPinfo << " received from follower node " << responder->nodeDescription() << " in leader-sync data query response. Primary leaseId as " << "perceived by self: " << selfPinfo.primaryLeaseId() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; continue; // CONTINUE } @@ -530,7 +529,7 @@ void ClusterStateManager::onLeaderSyncDataQueryResponse( // network where some nodes cannot see other nodes intermittently. // See 'processPartitionPrimaryAdvisoryRaw' for similar check. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " Partition [" << peerPinfo.partitionId() << "]: self node views self as active/available primary, but a" @@ -538,7 +537,7 @@ void ClusterStateManager::onLeaderSyncDataQueryResponse( << "step: " << peerPinfo << ". This downgrade from primary to replica is currently not " << "supported, and self node will exit." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; mqbu::ExitUtil::terminate(mqbu::ExitCode::e_UNSUPPORTED_SCENARIO); // EXIT @@ -573,24 +572,24 @@ void ClusterStateManager::onLeaderSyncDataQueryResponse( if (queueInfo.partitionId() < 0 || queueInfo.partitionId() >= static_cast(d_state_p->partitions().size())) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Invalid partitionId specified for queueUri [" << queueInfo.uri() << "]: " << queueInfo.partitionId() << " by follower node " << responder->nodeDescription() << " in leader-sync data query response." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; continue; // CONTINUE } if (queueInfo.key().size() != static_cast(k_KEY_LEN)) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Invalid queue key length for queueUri [" << queueInfo.uri() << "]: " << queueInfo.key().size() << " by follower node " << responder->nodeDescription() << " in leader-sync data query response." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; continue; // CONTINUE } @@ -713,7 +712,7 @@ void ClusterStateManager::processPartitionPrimaryAdvisoryRaw( BALL_LOG_INFO << d_clusterData_p->identity().description() << ": processing partition-primary mapping: " - << mwcu::Printer >( + << bmqu::Printer >( &partitions) << " from leader node " << source->nodeDescription(); @@ -725,12 +724,12 @@ void ClusterStateManager::processPartitionPrimaryAdvisoryRaw( if (info.partitionId() >= static_cast(d_state_p->partitions().size())) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Invalid partitionId: " << info << " specified in partition-primary advisory. " << "Ignoring this *ENTIRE* advisory message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -739,11 +738,11 @@ void ClusterStateManager::processPartitionPrimaryAdvisoryRaw( info.primaryNodeId()); if (0 == proposedPrimaryNode) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Invalid primaryNodeId: " << info << " specified in partition-primary advisory." - << " Ignoring this *ENTIRE* advisory." << MWCTSK_ALARMLOG_END; + << " Ignoring this *ENTIRE* advisory." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -758,12 +757,12 @@ void ClusterStateManager::processPartitionPrimaryAdvisoryRaw( // immediately after leader broadcast the advisory. Lower layers // will take care of that scenario. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": proposed primary specified in partition/primary " "mapping: " << info << " is self but self is STARTING. " - << "Ignoring this *ENTIRE* advisory." << MWCTSK_ALARMLOG_END; + << "Ignoring this *ENTIRE* advisory." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -784,14 +783,14 @@ void ClusterStateManager::processPartitionPrimaryAdvisoryRaw( // cannot see other nodes intermittently. See // 'onLeaderSyncDataQueryResponse' for similar check. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " Partition [" << info.partitionId() << "]: self node views self as active/available primary, but a" << " different node is proposed as primary in the " << "partition/primary mapping: " << info << ". This downgrade " << "from primary to replica is currently not supported, and " - << "self node will exit." << MWCTSK_ALARMLOG_END; + << "self node will exit." << BMQTSK_ALARMLOG_END; mqbu::ExitUtil::terminate(mqbu::ExitCode::e_UNSUPPORTED_SCENARIO); // EXIT @@ -813,12 +812,12 @@ void ClusterStateManager::processPartitionPrimaryAdvisoryRaw( // received a primary-status advisory from the primary node. if (info.primaryLeaseId() < pi.primaryLeaseId()) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Stale primaryLeaseId specified in: " << info << ", current primaryLeaseId: " << pi.primaryLeaseId() << ". Ignoring this *ENTIRE* advisory." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } } @@ -847,7 +846,7 @@ void ClusterStateManager::processPartitionPrimaryAdvisoryRaw( BSLS_ASSERT_SAFE(0 != proposedPrimaryNode); if (info.primaryLeaseId() < pi.primaryLeaseId()) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Stale primaryLeaseId specified in: " << info << ", current primaryLeaseId: " << pi.primaryLeaseId() @@ -858,7 +857,7 @@ void ClusterStateManager::processPartitionPrimaryAdvisoryRaw( << ", proposed primary node: " << proposedPrimaryNode->nodeDescription() << ". Ignoring this *ENTIRE* advisory." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } } @@ -867,12 +866,12 @@ void ClusterStateManager::processPartitionPrimaryAdvisoryRaw( // be greater. if (info.primaryLeaseId() <= pi.primaryLeaseId()) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Stale primaryLeaseId specified in: " << info << ", current primaryLeaseId: " << pi.primaryLeaseId() << ". Ignoring this *ENTIRE* advisory." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } } @@ -1347,11 +1346,11 @@ void ClusterStateManager::initiateLeaderSync(bool wait) leaderSyncDelayMs * bdlt::TimeUnitRatio::k_NS_PER_MS; BALL_LOG_INFO << d_clusterData_p->identity().description() << ": none of the followers AVAILABLE. Waiting for " - << mwcu::PrintUtil::prettyTimeInterval( + << bmqu::PrintUtil::prettyTimeInterval( leaderSyncDelayNs) << " before initiating leader sync."; - bsls::TimeInterval after(mwcsys::Time::nowMonotonicClock()); + bsls::TimeInterval after(bmqsys::Time::nowMonotonicClock()); after.addMilliseconds(leaderSyncDelayMs); d_clusterData_p->scheduler().scheduleEvent( d_clusterData_p->electorInfo().leaderSyncEventHandle(), @@ -1544,14 +1543,14 @@ void ClusterStateManager::processQueueAssignmentAdvisory( if (!(d_clusterData_p->electorInfo().leaderMessageSequence() < leaderMsgSeq)) { - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << d_cluster_p->description() << ": got queueAssignmentAdvisory: " << queueAdvisory << " from current leader: " << source->nodeDescription() << ", with smaller/equal leader message sequence: " << leaderMsgSeq << ". Current value: " << d_clusterData_p->electorInfo().leaderMessageSequence() - << ". Ignoring this advisory." << MWCTSK_ALARMLOG_END; + << ". Ignoring this advisory." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -1677,14 +1676,14 @@ void ClusterStateManager::processQueueAssignmentAdvisory( // have queue key. Unfortunately we can't retrieve the // URI of the 'other' queue. - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << d_cluster_p->description() << ": queueKey clash while applying" << (delayed ? " buffered " : " ") << "queue assignment advisory: " << queueInfo << ". QueueKey [" << queueKey << "]. Ignoring this entry in the advisory msg." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; continue; // CONTINUE } @@ -1717,7 +1716,7 @@ void ClusterStateManager::processQueueAssignmentAdvisory( if (false == insertRc.second) { // QueueKey is not unique. - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << d_cluster_p->description() << ": attemping to apply" << (delayed ? " buffered " : " ") << " queueAssignmentAdvisory from leader [" @@ -1725,7 +1724,7 @@ void ClusterStateManager::processQueueAssignmentAdvisory( << uri << "] assigned to Partition [" << queueInfo.partitionId() << "], but queueKey [" << queueKey << "] is not unique. Ignoring this entry in " - << "the advisory." << MWCTSK_ALARMLOG_END; + << "the advisory." << BMQTSK_ALARMLOG_END; continue; // CONTINUE } @@ -1847,13 +1846,13 @@ void ClusterStateManager::processQueueUnAssignmentAdvisory( // Verify 'stale' primary leaseId if (advisory.primaryLeaseId() < pi.primaryLeaseId()) { - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << d_cluster_p->description() << ": got queueUnAssignmentAdvisory: " << advisory << " from current primary: " << source->nodeDescription() << ", with smaller leaseId: " << advisory.primaryLeaseId() << ", current: " << pi.primaryLeaseId() - << ". Ignoring this advisory." << MWCTSK_ALARMLOG_END; + << ". Ignoring this advisory." << BMQTSK_ALARMLOG_END; return; // RETURN } } @@ -2159,14 +2158,14 @@ void ClusterStateManager::processPartitionPrimaryAdvisory( if (!(d_clusterData_p->electorInfo().leaderMessageSequence() < leaderMsgSeq)) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Got partition-primary advisory: " << advisory << " from leader node " << source->nodeDescription() << " with smaller/equal leader message sequence: " << leaderMsgSeq << ". Current value: " << d_clusterData_p->electorInfo().leaderMessageSequence() - << ". Ignoring this advisory." << MWCTSK_ALARMLOG_END; + << ". Ignoring this advisory." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -2221,14 +2220,14 @@ void ClusterStateManager::processLeaderAdvisory( advisory.sequenceNumber(); if (!(d_clusterData_p->electorInfo().leaderMessageSequence() < leaderMsgSeq)) { - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << d_clusterData_p->identity().description() << ": got leader advisory: " << advisory << " from leader node [" << source->nodeDescription() << " with smaller/equal leader message sequence: " << leaderMsgSeq << ". Current value: " << d_clusterData_p->electorInfo().leaderMessageSequence() - << ". Ignoring this advisory." << MWCTSK_ALARMLOG_END; + << ". Ignoring this advisory." << BMQTSK_ALARMLOG_END; return; // RETURN } diff --git a/src/groups/mqb/mqbblp/mqbblp_clusterstatemanager.h b/src/groups/mqb/mqbblp/mqbblp_clusterstatemanager.h index 771a704de..dfd6d38bf 100644 --- a/src/groups/mqb/mqbblp/mqbblp_clusterstatemanager.h +++ b/src/groups/mqb/mqbblp/mqbblp_clusterstatemanager.h @@ -44,8 +44,7 @@ #include #include -// MWC -#include +#include // BMQ #include @@ -126,7 +125,7 @@ class ClusterStateManager : public mqbc::ClusterStateObserver, bslma::Allocator* d_allocator_p; // Allocator to use - mwcma::CountingAllocatorStore d_allocators; + bmqma::CountingAllocatorStore d_allocators; // Allocator store to spawn new // allocators for sub-components diff --git a/src/groups/mqb/mqbblp/mqbblp_clusterstatemonitor.cpp b/src/groups/mqb/mqbblp/mqbblp_clusterstatemonitor.cpp index 5514548c2..49cefb858 100644 --- a/src/groups/mqb/mqbblp/mqbblp_clusterstatemonitor.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_clusterstatemonitor.cpp @@ -22,10 +22,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -118,7 +117,7 @@ void ClusterStateMonitor::notifyObserversIfNeeded() // PRECONDITIONS BSLS_ASSERT_SAFE(dispatcher()->inDispatcherThread(dispatcherClient())); - const bsls::TimeInterval now = mwcsys::Time::nowMonotonicClock(); + const bsls::TimeInterval now = bmqsys::Time::nowMonotonicClock(); // We do 2 things here: // 1. Periodically invoke threshold callbacks (onLeaderPassiveThreshold, @@ -195,11 +194,11 @@ void ClusterStateMonitor::notifyObserversIfNeeded() // [2] Keep alarming that the cluster is still in bad state as long as // applicable if (shouldAlarm) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "'" << d_clusterData_p->identity().name() << "'" << " is still in a bad state."; - MWCTSK_ALARMLOG_PANIC("CLUSTER_STATE_MONITOR") - << os.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_PANIC("CLUSTER_STATE_MONITOR") + << os.str() << BMQTSK_ALARMLOG_END; } } @@ -273,7 +272,7 @@ void ClusterStateMonitor::verifyAllStatesDispatched() // PRECONDITIONS BSLS_ASSERT_SAFE(dispatcher()->inDispatcherThread(dispatcherClient())); - const bsls::TimeInterval now = mwcsys::Time::nowMonotonicClock(); + const bsls::TimeInterval now = bmqsys::Time::nowMonotonicClock(); bool isCurrentlyHealthy = true; bool shouldAlarm = false; @@ -366,7 +365,7 @@ void ClusterStateMonitor::onMonitorStateChange(const StateType& state) switch (state) { case ClusterStateMonitor::e_THRESHOLD: { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "'" << d_clusterData_p->identity().name() << "' has been in " << "invalid state above the threshold amount of time.\n"; // Log only a summary in the alarm @@ -374,7 +373,7 @@ void ClusterStateMonitor::onMonitorStateChange(const StateType& state) BALL_LOG_INFO << os.str(); } break; // BREAK case ClusterStateMonitor::e_ALARMING: { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "'" << d_clusterData_p->identity().name() << "' is in a bad " << "state.\n"; // Log the entire cluster state in the alarm @@ -389,8 +388,8 @@ void ClusterStateMonitor::onMonitorStateChange(const StateType& state) } mqbcmd::HumanPrinter::print(os, result, 0, 4); - MWCTSK_ALARMLOG_PANIC("CLUSTER_STATE_MONITOR") - << os.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_PANIC("CLUSTER_STATE_MONITOR") + << os.str() << BMQTSK_ALARMLOG_END; } break; // BREAK case ClusterStateMonitor::e_VALID: { BALL_LOG_INFO << "'" << d_clusterData_p->identity().name() << "' " @@ -455,7 +454,7 @@ void ClusterStateMonitor::start() // PRECONDITIONS BSLS_ASSERT_SAFE(!d_isStarted && "Already started"); - const bsls::TimeInterval now = mwcsys::Time::nowMonotonicClock(); + const bsls::TimeInterval now = bmqsys::Time::nowMonotonicClock(); const mqbc::ClusterState::PartitionsInfo& partitions = d_clusterState_p->partitions(); diff --git a/src/groups/mqb/mqbblp/mqbblp_clusterstatemonitor.h b/src/groups/mqb/mqbblp/mqbblp_clusterstatemonitor.h index 39d1660b0..5433b3b86 100644 --- a/src/groups/mqb/mqbblp/mqbblp_clusterstatemonitor.h +++ b/src/groups/mqb/mqbblp/mqbblp_clusterstatemonitor.h @@ -32,7 +32,7 @@ //: o primary: each partition must have an active primary //: o node: each node must either be disconnected, or in available status // -// Note that 'mwcsys::TimeUtil::initialize()' must have been called prior to +// Note that 'bmqsys::TimeUtil::initialize()' must have been called prior to // the start of this component // MQB diff --git a/src/groups/mqb/mqbblp/mqbblp_clusterstatemonitor.t.cpp b/src/groups/mqb/mqbblp/mqbblp_clusterstatemonitor.t.cpp index 85c129dea..085999e84 100644 --- a/src/groups/mqb/mqbblp/mqbblp_clusterstatemonitor.t.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_clusterstatemonitor.t.cpp @@ -29,12 +29,11 @@ #include #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -49,8 +48,8 @@ #include // TEST DRIVER -#include -#include +#include +#include // CONVENIENCE using namespace BloombergLP; @@ -131,7 +130,7 @@ struct TestHelper { bsl::vector d_nodes; - mwcu::TempDirectory d_tempDir; + bmqu::TempDirectory d_tempDir; // CREATORS TestHelper() @@ -190,7 +189,7 @@ struct TestHelper { d_tempDir.path()), s_allocator_p); - mwcsys::Time::initialize( + bmqsys::Time::initialize( bdlf::BindUtil::bind(&mqbmock::Cluster::getTime, d_cluster_mp.get()), bdlf::BindUtil::bind(&mqbmock::Cluster::getTime, @@ -206,7 +205,7 @@ struct TestHelper { } } - ~TestHelper() { mwcsys::Time::shutdown(); } + ~TestHelper() { bmqsys::Time::shutdown(); } // MANIPULATORS @@ -271,9 +270,9 @@ static void test1_breathingTest() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); - mwctst::ScopedLogObserver logObserver(ball::Severity::ERROR, + bmqtst::ScopedLogObserver logObserver(ball::Severity::ERROR, s_allocator_p); NotificationEvaluator notifications(s_allocator_p); @@ -292,7 +291,7 @@ static void test1_breathingTest() s_allocator_p); monitor.registerObserver(¬ifications); - mwcu::MemOutStream dummy; + bmqu::MemOutStream dummy; helper.d_cluster_mp->start(dummy); monitor.start(); @@ -334,9 +333,9 @@ static void test2_checkAlarmsWithResetTest() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CHECK ALARMS WITH RESET"); + bmqtst::TestHelper::printTestName("CHECK ALARMS WITH RESET"); - mwctst::ScopedLogObserver logObserver(ball::Severity::ERROR, + bmqtst::ScopedLogObserver logObserver(ball::Severity::ERROR, s_allocator_p); NotificationEvaluator notifications(s_allocator_p); @@ -358,7 +357,7 @@ static void test2_checkAlarmsWithResetTest() s_allocator_p); monitor.registerObserver(¬ifications); - mwcu::MemOutStream dummy; + bmqu::MemOutStream dummy; helper.d_cluster_mp->start(dummy); monitor.start(); @@ -553,9 +552,9 @@ static void test3_alwaysInvalidStateTest() // Edge case. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ALWAYS INVALID STATE"); + bmqtst::TestHelper::printTestName("ALWAYS INVALID STATE"); - mwctst::ScopedLogObserver logObserver(ball::Severity::ERROR, + bmqtst::ScopedLogObserver logObserver(ball::Severity::ERROR, s_allocator_p); NotificationEvaluator notifications(s_allocator_p); @@ -583,7 +582,7 @@ static void test3_alwaysInvalidStateTest() &helper.d_cluster_mp->_state(), s_allocator_p); monitor.registerObserver(¬ifications); - mwcu::MemOutStream dummy; + bmqu::MemOutStream dummy; // No state is ever valid so always not healthy ASSERT_EQ(monitor.isHealthy(), false); @@ -710,7 +709,7 @@ static void test3_alwaysInvalidStateTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); { bmqp::ProtocolUtil::initialize(s_allocator_p); @@ -718,7 +717,7 @@ int main(int argc, char* argv[]) mqbcfg::AppConfig brokerConfig(s_allocator_p); mqbcfg::BrokerConfig::set(brokerConfig); - bsl::shared_ptr statContext = + bsl::shared_ptr statContext = mqbstat::BrokerStatsUtil::initializeStatContext(30, s_allocator_p); switch (_testCase) { @@ -735,7 +734,7 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); } - TEST_EPILOG(mwctst::TestHelper::e_DEFAULT); + TEST_EPILOG(bmqtst::TestHelper::e_DEFAULT); // Can't ensure no global memory is allocated because // 'bslmt::ThreadUtil::create()' uses the global allocator to allocate // memory. diff --git a/src/groups/mqb/mqbblp/mqbblp_domain.cpp b/src/groups/mqb/mqbblp/mqbblp_domain.cpp index 74d0a7f4c..88bfd8d3c 100644 --- a/src/groups/mqb/mqbblp/mqbblp_domain.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_domain.cpp @@ -30,11 +30,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -399,8 +398,8 @@ Domain::Domain(const bsl::string& name, mqbi::Dispatcher* dispatcher, bdlbb::BlobBufferFactory* blobBufferFactory, const bsl::shared_ptr& cluster, - mwcst::StatContext* domainsStatContext, - bslma::ManagedPtr& queuesStatContext, + bmqst::StatContext* domainsStatContext, + bslma::ManagedPtr& queuesStatContext, bslma::Allocator* allocator) : d_allocator_p(allocator) , d_state(e_STOPPED) @@ -454,10 +453,10 @@ int Domain::configure(bsl::ostream& errorDescription, // Certain invalid values might need to be updated in the configuration. mqbconfm::Domain finalConfig(config); { - mwcu::MemOutStream err; + bmqu::MemOutStream err; if (normalizeConfig(&finalConfig, err, *this)) { - MWCTSK_ALARMLOG_ALARM("DOMAIN") - << err.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_ALARM("DOMAIN") + << err.str() << BMQTSK_ALARMLOG_END; } } @@ -703,7 +702,7 @@ int Domain::registerQueue(bsl::ostream& errorDescription, d_queues[queueSp->uri().queue()] = queueSp; } bdlma::LocalSequentialAllocator<1024> localAllocator(d_allocator_p); - mwcu::MemOutStream error(&localAllocator); + bmqu::MemOutStream error(&localAllocator); int rc = queueSp->configure(error, false, // isReconfigure @@ -838,7 +837,7 @@ int Domain::processCommand(mqbcmd::DomainResult* result, baljsn::Encoder encoder; bdlma::LocalSequentialAllocator<1024> localAllocator( d_allocator_p); - mwcu::MemOutStream out(&localAllocator); + bmqu::MemOutStream out(&localAllocator); baljsn::EncoderOptions options; options.setEncodingStyle(baljsn::EncoderOptions::e_PRETTY); @@ -895,7 +894,7 @@ int Domain::processCommand(mqbcmd::DomainResult* result, int rc = uriBuilder.uri(&uri, &uriError); if (rc != 0) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Unable to build queue uri with error '" << uriError << "'"; result->makeError().message() = os.str(); return -1; // RETURN @@ -942,7 +941,7 @@ int Domain::processCommand(mqbcmd::DomainResult* result, rc = lookupQueue(&queue, uri); if (rc != 0) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Queue '" << command.queue().name() << "'" << " was not found on domain '" << name() << "'"; result->makeError().message() = os.str(); @@ -961,7 +960,7 @@ int Domain::processCommand(mqbcmd::DomainResult* result, } bdlma::LocalSequentialAllocator<256> localAllocator(d_allocator_p); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "Unknown command '" << command << "'"; result->makeError().message() = os.str(); return -1; diff --git a/src/groups/mqb/mqbblp/mqbblp_domain.h b/src/groups/mqb/mqbblp/mqbblp_domain.h index 255563656..a8ef7ee14 100644 --- a/src/groups/mqb/mqbblp/mqbblp_domain.h +++ b/src/groups/mqb/mqbblp/mqbblp_domain.h @@ -78,7 +78,7 @@ class QueueHandle; namespace mqbi { class Queue; } -namespace mwcst { +namespace bmqst { class StatContext; } @@ -137,7 +137,7 @@ class Domain : public mqbi::Domain, public mqbc::ClusterStateObserver { bdlbb::BlobBufferFactory* d_blobBufferFactory_p; // Blob buffer factory to use - mwcst::StatContext* d_domainsStatContext_p; + bmqst::StatContext* d_domainsStatContext_p; // Stat context dedicated to this // domain, to use as the parent // stat context for any domain in @@ -146,7 +146,7 @@ class Domain : public mqbi::Domain, public mqbc::ClusterStateObserver { mqbstat::DomainStats d_domainsStats; // Statistics of the domain. - bslma::ManagedPtr d_queuesStatContext_mp; + bslma::ManagedPtr d_queuesStatContext_mp; // Stat context dedicated to this // domain, to use as the parent // stat context for any queue in @@ -250,8 +250,8 @@ class Domain : public mqbi::Domain, public mqbc::ClusterStateObserver { mqbi::Dispatcher* dispatcher, bdlbb::BlobBufferFactory* blobBufferFactory, const bsl::shared_ptr& cluster, - mwcst::StatContext* domainsStatContext, - bslma::ManagedPtr& queuesStatContext, + bmqst::StatContext* domainsStatContext, + bslma::ManagedPtr& queuesStatContext, bslma::Allocator* allocator); /// Destructor @@ -340,7 +340,7 @@ class Domain : public mqbi::Domain, public mqbc::ClusterStateObserver { mqbstat::DomainStats* domainStats() BSLS_KEYWORD_OVERRIDE; /// Return the stat context associated to this Domain. - mwcst::StatContext* queueStatContext() BSLS_KEYWORD_OVERRIDE; + bmqst::StatContext* queueStatContext() BSLS_KEYWORD_OVERRIDE; /// Return the cluster associated to this Domain. mqbi::Cluster* cluster() const BSLS_KEYWORD_OVERRIDE; @@ -387,7 +387,7 @@ inline mqbstat::DomainStats* Domain::domainStats() return &d_domainsStats; } -inline mwcst::StatContext* Domain::queueStatContext() +inline bmqst::StatContext* Domain::queueStatContext() { return d_queuesStatContext_mp.get(); } diff --git a/src/groups/mqb/mqbblp/mqbblp_localqueue.cpp b/src/groups/mqb/mqbblp/mqbblp_localqueue.cpp index 9dc79657d..c300dc02d 100644 --- a/src/groups/mqb/mqbblp/mqbblp_localqueue.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_localqueue.cpp @@ -35,9 +35,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -413,7 +412,7 @@ void LocalQueue::postMessage(const bmqp::PutHeader& putHeader, // Either queue was not opened in the WRITE mode (which should have // been caught in the SDK) or client is posting a message after closing // or reconfiguring the queue (which may not be caught in the SDK). - MWCU_THROTTLEDACTION_THROTTLE( + BMQU_THROTTLEDACTION_THROTTLE( d_throttledFailedPutMessages, BALL_LOG_WARN << "#CLIENT_IMPROPER_BEHAVIOR " @@ -432,7 +431,7 @@ void LocalQueue::postMessage(const bmqp::PutHeader& putHeader, return; // RETURN } - const bsls::Types::Int64 timePoint = mwcsys::Time::highResolutionTimer(); + const bsls::Types::Int64 timePoint = bmqsys::Time::highResolutionTimer(); const bool doAck = bmqp::PutHeaderFlagUtil::isSet( putHeader.flags(), bmqp::PutHeaderFlags::e_ACK_REQUESTED); @@ -483,7 +482,7 @@ void LocalQueue::postMessage(const bmqp::PutHeader& putHeader, if (res != mqbi::StorageResult::e_SUCCESS || haveReceipt) { // Calculate time delta between PUT and ACK const bsls::Types::Int64 timeDelta = - mwcsys::Time::highResolutionTimer() - timePoint; + bmqsys::Time::highResolutionTimer() - timePoint; d_state_p->stats().onEvent( mqbstat::QueueStatsDomain::EventType::e_ACK_TIME, timeDelta); @@ -555,7 +554,7 @@ void LocalQueue::onReceipt(const bmqt::MessageGUID& msgGUID, const bsls::Types::Int64& arrivalTimepoint) { // Calculate time delta between PUT and ACK - const bsls::Types::Int64 timeDelta = mwcsys::Time::highResolutionTimer() - + const bsls::Types::Int64 timeDelta = bmqsys::Time::highResolutionTimer() - arrivalTimepoint; d_state_p->stats().onEvent( diff --git a/src/groups/mqb/mqbblp/mqbblp_localqueue.h b/src/groups/mqb/mqbblp/mqbblp_localqueue.h index 192f55835..21bb29447 100644 --- a/src/groups/mqb/mqbblp/mqbblp_localqueue.h +++ b/src/groups/mqb/mqbblp/mqbblp_localqueue.h @@ -35,8 +35,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -85,7 +84,7 @@ class LocalQueue BSLS_CPP11_FINAL { bslma::Allocator* d_allocator_p; QueueState* d_state_p; bslma::ManagedPtr d_queueEngine_mp; - mwcu::ThrottledActionParams d_throttledFailedPutMessages; + bmqu::ThrottledActionParams d_throttledFailedPutMessages; bool d_hasNewMessages; bdlmt::Throttle d_throttledDuplicateMessages; // Throttler for duplicates. diff --git a/src/groups/mqb/mqbblp/mqbblp_messagegroupidhelper.h b/src/groups/mqb/mqbblp/mqbblp_messagegroupidhelper.h index fa4b6994d..5a211179a 100644 --- a/src/groups/mqb/mqbblp/mqbblp_messagegroupidhelper.h +++ b/src/groups/mqb/mqbblp/mqbblp_messagegroupidhelper.h @@ -34,8 +34,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -129,12 +128,12 @@ inline mqbi::QueueHandle* MessageGroupIdHelper::getHandle(const bmqp::Protocol::MsgGroupId& msgGroupId) { return d_manager.getHandle(msgGroupId, - mwcsys::Time::highResolutionTimer()); + bmqsys::Time::highResolutionTimer()); } inline void MessageGroupIdHelper::addHandle(mqbi::QueueHandle* handle) { - d_manager.addHandle(handle, mwcsys::Time::highResolutionTimer()); + d_manager.addHandle(handle, bmqsys::Time::highResolutionTimer()); } inline void MessageGroupIdHelper::removeHandle(mqbi::QueueHandle* handle) @@ -146,7 +145,7 @@ inline void MessageGroupIdHelper::removeHandle(mqbi::QueueHandle* handle) inline void MessageGroupIdHelper::loadInternals(mqbcmd::MessageGroupIdHelper* out) const { - d_manager.loadInternals(out, mwcsys::Time::highResolutionTimer()); + d_manager.loadInternals(out, bmqsys::Time::highResolutionTimer()); } } // close package namespace diff --git a/src/groups/mqb/mqbblp/mqbblp_messagegroupidmanager.cpp b/src/groups/mqb/mqbblp/mqbblp_messagegroupidmanager.cpp index 079d1fa32..32ef3cbef 100644 --- a/src/groups/mqb/mqbblp/mqbblp_messagegroupidmanager.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_messagegroupidmanager.cpp @@ -81,9 +81,8 @@ // MQB #include -// MWC -#include -#include +#include +#include // BDE #include @@ -624,7 +623,7 @@ MessageGroupIdManager::MessageGroupIdManager(const Time& timeout, , d_timeout(timeout) , d_maxMsgGroupIds(maxMsgGroupIds) , d_rebalance(rebalance) -, d_index(new (*allocator) Index(allocator), allocator) +, d_index(new(*allocator) Index(allocator), allocator) { } diff --git a/src/groups/mqb/mqbblp/mqbblp_messagegroupidmanager.t.cpp b/src/groups/mqb/mqbblp/mqbblp_messagegroupidmanager.t.cpp index 30a3a688f..30aedf449 100644 --- a/src/groups/mqb/mqbblp/mqbblp_messagegroupidmanager.t.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_messagegroupidmanager.t.cpp @@ -25,8 +25,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -37,7 +36,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -72,7 +71,7 @@ Handle _(const int handle) MsgGroupId msgGroupIdFromInt(const int id) { - mwcu::MemOutStream ss(s_allocator_p); + bmqu::MemOutStream ss(s_allocator_p); ss << id; return MsgGroupId(ss.str(), s_allocator_p); } @@ -205,7 +204,7 @@ static void test1_sameGroupIdSameHandleTest() // getHandle // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SAME GROUP ID SAME HANDLE TEST"); + bmqtst::TestHelper::printTestName("SAME GROUP ID SAME HANDLE TEST"); MessageGroupIdManager obj(k_TIMEOUT, k_MAX_NUMBER_OF_MAPPINGS, @@ -240,7 +239,7 @@ static void test2_differentGroupIdsHaveDifferentHandlesTest() // getHandle // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "DIFFERENT GROUP IDS HAVE DIFFERENT HANDLES TEST"); MessageGroupIdManager obj(k_TIMEOUT, @@ -272,7 +271,7 @@ static void test3_timeoutOldMappingsTest() // getHandle // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("TIMEOUT OLD MAPPINGS TEST"); + bmqtst::TestHelper::printTestName("TIMEOUT OLD MAPPINGS TEST"); MessageGroupIdManager obj(k_TIMEOUT, k_MAX_NUMBER_OF_MAPPINGS, @@ -307,7 +306,7 @@ static void test4_groupIdExpiresAfterTtlTest() // getHandle // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GROUP ID EXPIRES AFTER TTL TEST"); + bmqtst::TestHelper::printTestName("GROUP ID EXPIRES AFTER TTL TEST"); MessageGroupIdManager obj(k_TIMEOUT, k_MAX_NUMBER_OF_MAPPINGS, @@ -346,7 +345,7 @@ static void test5_longLivedMoreThanMaxGroupsGcTest() // getHandle // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "LONG LIVED MORE THAN MAX GROUPS GC TEST"); const int k_MY_MAX_NUMBER_OF_MAPPINGS = 2; @@ -386,7 +385,7 @@ static void test6_shortLivedMoreThanMaxGroupsGcTest() // getHandle, exceedsMaxMsgGroupIdsLimit // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "SHORT LIVED MORE THAN MAX GROUPS GC TEST"); const int k_MY_MAX_NUMBER_OF_MAPPINGS = 1; @@ -439,7 +438,7 @@ static void test7_retrievesGroupIdsFromHandlesTest() // idsForHandle // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("RETRIEVES GROUP IDS FROM HANDLES TEST"); + bmqtst::TestHelper::printTestName("RETRIEVES GROUP IDS FROM HANDLES TEST"); MessageGroupIdManager obj(k_TIMEOUT, k_MAX_NUMBER_OF_MAPPINGS, @@ -502,7 +501,7 @@ static void test8_rebalanceWhenAddingHandleTest() // addHandle // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("REBALANCE WHEN ADDING HANDLE TEST"); + bmqtst::TestHelper::printTestName("REBALANCE WHEN ADDING HANDLE TEST"); typedef MessageGroupIdManager::IdsForHandle IdsForHandle; @@ -581,7 +580,7 @@ static void test9_noRebalanceWhenRemovingHandleTest() // removeHandle // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "NO REBALANCE WHEN REMOVING HANDLE TEST"); typedef MessageGroupIdManager::IdsForHandle IdsForHandle; @@ -642,7 +641,7 @@ static void test10_chooseLeastUsedHandleAfterRemoveTest() // getHandle, addHandle, removeHandle // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "CHOOSE LEAST USED HANDLE AFTER REMOVE TEST"); for (int rebalanceMode = 0; rebalanceMode < 2; ++rebalanceMode) { @@ -696,7 +695,7 @@ static void test11_stronglyUnbalancedChainOnRebalanceTest() // getHandle, addHandle // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "STRONGLY UNBALANCED CHAIN ON REBALANCE TEST"); typedef MessageGroupIdManager::IdsForHandle IdsForHandle; @@ -766,7 +765,7 @@ static void test11_stronglyUnbalancedChainOnRebalanceTest() static void test12_printerTest() { - mwctst::TestHelper::printTestName("PRINTER TEST"); + bmqtst::TestHelper::printTestName("PRINTER TEST"); MessageGroupIdManager obj(k_TIMEOUT, k_MAX_NUMBER_OF_MAPPINGS, @@ -814,7 +813,7 @@ static void test12_printerTest() // Dump internals const Time k_at = k_T0 + 5; - mwcu::MemOutStream ss(s_allocator_p); + bmqu::MemOutStream ss(s_allocator_p); mqbcmd::Result result(s_allocator_p); obj.loadInternals(&result.makeMessageGroupIdHelper(), k_at); mqbcmd::HumanPrinter::print(ss, result, 1); @@ -863,7 +862,7 @@ static void test13_largeMessageGroupIdsUseAllocator() // getHandle, addHandle // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LARGE MESSAGE GROUP IDS USE ALLOCATOR"); + bmqtst::TestHelper::printTestName("LARGE MESSAGE GROUP IDS USE ALLOCATOR"); for (int rebalanceMode = 0; rebalanceMode < 2; ++rebalanceMode) { MessageGroupIdManager obj( @@ -876,7 +875,7 @@ static void test13_largeMessageGroupIdsUseAllocator() addHandles(&obj, 3); for (int i = 0; i < 10; ++i) { - mwcu::MemOutStream ss(s_allocator_p); + bmqu::MemOutStream ss(s_allocator_p); ss << "01234567890123456789012345678901234567890123456789" << i; (void)obj.getHandle(bsl::string(ss.str(), s_allocator_p), k_T0); } @@ -893,7 +892,7 @@ static void test13_largeMessageGroupIdsUseAllocator() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); @@ -930,5 +929,5 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbblp/mqbblp_pushstream.cpp b/src/groups/mqb/mqbblp/mqbblp_pushstream.cpp index bf63aabc8..37265b7ba 100644 --- a/src/groups/mqb/mqbblp/mqbblp_pushstream.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_pushstream.cpp @@ -40,12 +40,16 @@ PushStream::PushStream( bslma::Allocator* allocator) : d_stream(allocator) , d_apps(allocator) -, d_pushElementsPool_sp(pushElementsPool.value_or(bsl::nullptr_t()), - noOpDeleter, - allocator) +, d_pushElementsPool_sp() { allocator = bslma::Default::allocator(allocator); + if (pushElementsPool.has_value()) { + d_pushElementsPool_sp.reset(pushElementsPool.value(), + noOpDeleter, + allocator); + } + if (!d_pushElementsPool_sp) { d_pushElementsPool_sp.load( new (*allocator) bdlma::ConcurrentPool(sizeof(Element), allocator), diff --git a/src/groups/mqb/mqbblp/mqbblp_pushstream.h b/src/groups/mqb/mqbblp/mqbblp_pushstream.h index 87bb9378f..9fc594b1e 100644 --- a/src/groups/mqb/mqbblp/mqbblp_pushstream.h +++ b/src/groups/mqb/mqbblp/mqbblp_pushstream.h @@ -54,8 +54,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -110,6 +109,11 @@ struct PushStream { /// Return the first Element in the list Element* front() const; + + /// Return the last Element in the list + Element* back() const; + + /// Return number of Elements in the list unsigned int numElements() const; }; @@ -120,9 +124,10 @@ struct PushStream { App(const bsl::shared_ptr& app); void add(Element* element); void remove(Element* element); + const Element* last() const; }; - typedef mwcc::OrderedHashMap > Stream; @@ -160,7 +165,7 @@ struct PushStream { /// Return true if this Element is associated with the specified /// `iterator` position in the PushStream. - bool isInStream(const PushStream::Stream::iterator& iterator) const; + bool equal(const PushStream::Stream::iterator& iterator) const; /// Return pointer to the next Element associated with the same GUID /// or `0` if this is the last Element. @@ -466,10 +471,10 @@ inline PushStream::App& PushStream::Element::app() const return d_iteratorApp->second; } -inline bool PushStream::Element::isInStream( - const PushStream::Stream::iterator& iterator) const +inline bool +PushStream::Element::equal(const PushStream::Stream::iterator& iterator) const { - return d_iteratorGuid != iterator; + return d_iteratorGuid == iterator; } inline PushStream::Element* PushStream::Element::next() const @@ -579,6 +584,11 @@ inline PushStream::Element* PushStream::Elements::front() const return d_first_p; } +inline PushStream::Element* PushStream::Elements::back() const +{ + return d_last_p; +} + inline unsigned int PushStream::Elements::numElements() const { return d_numElements; @@ -600,6 +610,11 @@ inline void PushStream::App::remove(Element* element) d_elements.remove(element, e_APP); } +inline const PushStream::Element* PushStream::App::last() const +{ + return d_elements.back(); +} + // ------------------ // struct PushStream // ----------------- @@ -639,7 +654,7 @@ inline void PushStream::add(Element* element) { // Add to the GUID BSLS_ASSERT_SAFE(element); - BSLS_ASSERT_SAFE(element->isInStream(d_stream.end())); + BSLS_ASSERT_SAFE(!element->equal(d_stream.end())); element->guid().add(element, e_GUID); @@ -650,7 +665,7 @@ inline void PushStream::add(Element* element) inline unsigned int PushStream::remove(Element* element) { BSLS_ASSERT_SAFE(element); - BSLS_ASSERT_SAFE(element->isInStream(d_stream.end())); + BSLS_ASSERT_SAFE(!element->equal(d_stream.end())); // remove from the App element->app().remove(element); diff --git a/src/groups/mqb/mqbblp/mqbblp_pushstream.t.cpp b/src/groups/mqb/mqbblp/mqbblp_pushstream.t.cpp index 19f09b24f..f6506be07 100644 --- a/src/groups/mqb/mqbblp/mqbblp_pushstream.t.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_pushstream.t.cpp @@ -22,10 +22,10 @@ #include #include -#include +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -37,7 +37,7 @@ using namespace bsl; static void test1_basic() { - mwctst::TestHelper::printTestName("PushStream basic test"); + bmqtst::TestHelper::printTestName("PushStream basic test"); bdlma::ConcurrentPool pushElementsPool(sizeof(mqbblp::PushStream::Element), s_allocator_p); @@ -64,11 +64,12 @@ static void test1_basic() static void test2_iterations() { - mwctst::TestHelper::printTestName("PushStream basic test"); + bmqtst::TestHelper::printTestName("PushStream basic test"); // Imitate {m1, a1}, {m2, a2}, {m1, a2}, {m2, a1} - mqbblp::PushStream ps(bsl::nullptr_t(), s_allocator_p); + mqbblp::PushStream ps(bsl::optional(), + s_allocator_p); unsigned int subQueueId1 = 1; unsigned int subQueueId2 = 2; @@ -132,7 +133,7 @@ static void test2_iterations() limits.messages() = bsl::numeric_limits::max(); limits.bytes() = bsl::numeric_limits::max(); - mwcu::MemOutStream errorDescription(s_allocator_p); + bmqu::MemOutStream errorDescription(s_allocator_p); dummyStorage.configure(errorDescription, config, limits, @@ -194,7 +195,7 @@ static void test2_iterations() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); @@ -210,5 +211,5 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbblp/mqbblp_queue.cpp b/src/groups/mqb/mqbblp/mqbblp_queue.cpp index b544b9a46..3fc107fee 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queue.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_queue.cpp @@ -41,9 +41,8 @@ // BMQ #include -// MWC -#include -#include +#include +#include // BDE #include @@ -159,7 +158,7 @@ void Queue::configureDispatched(int* result, // PRECONDITIONS BSLS_ASSERT_SAFE(dispatcher()->inDispatcherThread(this)); - mwcu::MemOutStream throwaway(d_allocator_p); + bmqu::MemOutStream throwaway(d_allocator_p); bsl::ostream& errStream = (errorDescription ? *errorDescription : throwaway); @@ -335,7 +334,7 @@ void Queue::convertToLocalDispatched() int rc; bdlma::LocalSequentialAllocator<1024> localAllocator(d_allocator_p); - mwcu::MemOutStream errorDescription(&localAllocator); + bmqu::MemOutStream errorDescription(&localAllocator); // Move remoteQueue to a temporary stack based managed pointer, so that // we can bypass all precondition checks (since we are temporarily @@ -875,7 +874,7 @@ int Queue::processCommand(mqbcmd::QueueResult* result, } mqbcmd::Error& error = result->makeError(); - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Unknown command '" << command << "'"; error.message() = os.str(); return -1; diff --git a/src/groups/mqb/mqbblp/mqbblp_queueconsumptionmonitor.cpp b/src/groups/mqb/mqbblp/mqbblp_queueconsumptionmonitor.cpp index 04567bd41..dfa95e75b 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queueconsumptionmonitor.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_queueconsumptionmonitor.cpp @@ -19,22 +19,18 @@ #include // MBQ #include -#include #include #include #include -#include -#include // BMQ #include #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -60,7 +56,7 @@ bsl::ostream& QueueConsumptionMonitor::State::print( int level, int spacesPerLevel) { - stream << mwcu::PrintUtil::indent(level, spacesPerLevel) + stream << bmqu::PrintUtil::indent(level, spacesPerLevel) << QueueConsumptionMonitor::State::toAscii(value); if (spacesPerLevel >= 0) { @@ -95,7 +91,7 @@ bsl::ostream& QueueConsumptionMonitor::Transition::print( int level, int spacesPerLevel) { - stream << mwcu::PrintUtil::indent(level, spacesPerLevel) + stream << bmqu::PrintUtil::indent(level, spacesPerLevel) << QueueConsumptionMonitor::Transition::toAscii(value); if (spacesPerLevel >= 0) { @@ -125,23 +121,12 @@ const char* QueueConsumptionMonitor::Transition::toAscii( // struct QueueConsumptionMonitor::SubStreamInfo // --------------------------------------------- -QueueConsumptionMonitor::SubStreamInfo::SubStreamInfo(const HeadCb& headCb) +QueueConsumptionMonitor::SubStreamInfo::SubStreamInfo() : d_lastKnownGoodTimer(0) , d_messageSent(true) , d_state(State::e_ALIVE) -, d_headCb(headCb) { - BSLS_ASSERT_SAFE(d_headCb); -} - -QueueConsumptionMonitor::SubStreamInfo::SubStreamInfo( - const SubStreamInfo& other) -: d_lastKnownGoodTimer(other.d_lastKnownGoodTimer) -, d_messageSent(other.d_messageSent) -, d_state(other.d_state) -, d_headCb(other.d_headCb) -{ - BSLS_ASSERT_SAFE(d_headCb); + // NOTHING } // ----------------------------- @@ -150,14 +135,17 @@ QueueConsumptionMonitor::SubStreamInfo::SubStreamInfo( // CREATORS QueueConsumptionMonitor::QueueConsumptionMonitor(QueueState* queueState, + const LoggingCb& loggingCb, bslma::Allocator* allocator) : d_queueState_p(queueState) , d_maxIdleTime(0) , d_currentTimer(0) , d_subStreamInfos(allocator) +, d_loggingCb(loggingCb) { // PRECONDITIONS BSLS_ASSERT_SAFE(d_queueState_p); + BSLS_ASSERT_SAFE(d_loggingCb); } // MANIPULATORS @@ -176,14 +164,13 @@ QueueConsumptionMonitor::setMaxIdleTime(bsls::Types::Int64 value) last = d_subStreamInfos.end(); iter != last; ++iter) { - iter->second = SubStreamInfo(iter->second.d_headCb); + iter->second = SubStreamInfo(); } return *this; } -void QueueConsumptionMonitor::registerSubStream(const mqbu::StorageKey& key, - const HeadCb& headCb) +void QueueConsumptionMonitor::registerSubStream(const mqbu::StorageKey& key) { // Should always be called from the queue thread, but will be invoked from // the cluster thread once upon queue creation. @@ -191,12 +178,11 @@ void QueueConsumptionMonitor::registerSubStream(const mqbu::StorageKey& key, // PRECONDITIONS BSLS_ASSERT_SAFE(key != mqbu::StorageKey::k_NULL_KEY || d_subStreamInfos.empty()); - BSLS_ASSERT_SAFE(headCb); BSLS_ASSERT_SAFE(d_subStreamInfos.find(mqbu::StorageKey::k_NULL_KEY) == d_subStreamInfos.end()); BSLS_ASSERT_SAFE(d_subStreamInfos.find(key) == d_subStreamInfos.end()); - d_subStreamInfos.insert(bsl::make_pair(key, SubStreamInfo(headCb))); + d_subStreamInfos.insert(bsl::make_pair(key, SubStreamInfo())); } void QueueConsumptionMonitor::unregisterSubStream(const mqbu::StorageKey& key) @@ -240,37 +226,22 @@ void QueueConsumptionMonitor::onTimer(bsls::Types::Int64 currentTimer) d_currentTimer = currentTimer; - // TBD: 'queue empty' is not the best condition to test. The queue may - // contain messages that have been sent but not yet confirmed. A better - // test would be to check whether the message iterator in the engine points - // to the end of storage, but we don't have access to these. A solution - // would be to have QueueEngine::beforeMessageRemoved notify this monitor, - // via a new method on this component. Not implemented yet because Engines - // are about to undergo overhaul. - for (SubStreamInfoMapIter iter = d_subStreamInfos.begin(), last = d_subStreamInfos.end(); iter != last; ++iter) { - SubStreamInfo& info = iter->second; - BSLS_ASSERT_SAFE(info.d_headCb); - bslma::ManagedPtr head = info.d_headCb(); - if (head) { - if (head->atEnd()) { - head.reset(); - } - } - if (info.d_messageSent || !head) { - // Queue is 'alive' either because at least one message was sent - // since the last 'timer', or the queue is at its head (no more - // messages to deliver to this substream). + SubStreamInfo& info = iter->second; + const mqbu::StorageKey& appKey = iter->first; + if (info.d_messageSent) { + // Queue is 'alive' because at least one message was sent + // since the last 'timer'. info.d_messageSent = false; info.d_lastKnownGoodTimer = d_currentTimer; if (info.d_state == State::e_IDLE) { // object was in idle state - onTransitionToAlive(&(iter->second), iter->first); + onTransitionToAlive(&info, appKey); continue; // CONTINUE } @@ -278,17 +249,29 @@ void QueueConsumptionMonitor::onTimer(bsls::Types::Int64 currentTimer) continue; // CONTINUE } - if (info.d_state == State::e_IDLE) { - // state was already idle, nothing more to do - continue; // CONTINUE - } - - BSLS_ASSERT_SAFE(info.d_state == State::e_ALIVE); - if (d_currentTimer - info.d_lastKnownGoodTimer > d_maxIdleTime) { // No delivered messages in the last 'maxIdleTime'. - onTransitionToIdle(&(iter->second), iter->first, head); - continue; // CONTINUE + + // Call callback to log alarm if there are undelivered messages. + const bool haveUndelivered = d_loggingCb(appKey, + info.d_state == + State::e_ALIVE); + + if (haveUndelivered) { + // There are undelivered messages, transition to idle. + if (info.d_state == State::e_ALIVE) { + info.d_state = State::e_IDLE; + } + } + else { + // The queue is at its head (no more + // messages to deliver to this substream), + // so transition to alive. + if (info.d_state == State::e_IDLE) { + info.d_lastKnownGoodTimer = d_currentTimer; + onTransitionToAlive(&info, appKey); + } + } } } } @@ -321,129 +304,5 @@ void QueueConsumptionMonitor::onTransitionToAlive( BALL_LOG_INFO << "Queue '" << uri << "' no longer appears to be stuck."; } -void QueueConsumptionMonitor::onTransitionToIdle( - SubStreamInfo* subStreamInfo, - const mqbu::StorageKey& appKey, - const bslma::ManagedPtr& head) -{ - // executed by the *QUEUE DISPATCHER* thread - - // PRECONDITIONS - BSLS_ASSERT_SAFE(d_queueState_p->queue()->dispatcher()->inDispatcherThread( - d_queueState_p->queue())); - - subStreamInfo->d_state = State::e_IDLE; - - bdlma::LocalSequentialAllocator<2048> localAllocator(0); - bsl::vector handles(&localAllocator); - d_queueState_p->handleCatalog().loadHandles(&handles); - - bmqt::UriBuilder uriBuilder(d_queueState_p->uri(), &localAllocator); - bsl::string appId; - - if (appKey.isNull()) { - appId = bmqp::ProtocolUtil::k_DEFAULT_APP_ID; - } - else if (d_queueState_p->storage()->hasVirtualStorage(appKey, &appId)) { - uriBuilder.setId(appId); - } - - bmqt::Uri uri(&localAllocator); - uriBuilder.uri(&uri); - - mwcu::MemOutStream ss(&localAllocator); - - int idx = 1; - int numConsumers = 0; - - const bool isFanoutValue = - d_queueState_p->queue()->hasMultipleSubStreams(); - - for (bsl::vector::const_iterator it = handles.begin(), - last = handles.end(); - it != last; - ++it) { - const mqbi::QueueHandle::SubStreams& subStreamInfos = - (*it)->subStreamInfos(); - - for (mqbi::QueueHandle::SubStreams::const_iterator infoCiter = - subStreamInfos.begin(); - infoCiter != subStreamInfos.end(); - ++infoCiter) { - const bsl::string& itemAppId = infoCiter->first; - - bool isReader = !isFanoutValue && - bmqt::QueueFlagsUtil::isReader( - (*it)->handleParameters().flags()); - // Non-fanout mode consumer in the default subStream ? - isReader |= isFanoutValue && !itemAppId.empty(); - - if (!isReader) { - continue; // CONTINUE - } - - if (itemAppId != appId) { - continue; // CONTINUE - } - - numConsumers += infoCiter->second.d_counts.d_readCount; - - const int level = 2, spacesPerLevel = 2; - - ss << "\n " << idx++ << ". " << (*it)->client()->description() - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) - << "Handle Parameters .....: " << (*it)->handleParameters() - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) - << "UnconfirmedMonitors ....:"; - - const bsl::vector monitors = - (*it)->unconfirmedMonitors(appId); - for (size_t i = 0; i < monitors.size(); ++i) { - ss << "\n " << monitors[i]; - } - } - } - - mwcu::MemOutStream out; - out << "Queue '" << uri << "' "; - d_queueState_p->storage()->capacityMeter()->printShortSummary(out); - out << ", max idle time " - << mwcu::PrintUtil::prettyTimeInterval(d_maxIdleTime) - << " appears to be stuck. It currently has " << numConsumers - << " consumers." << ss.str() << "\n"; - - // Print the 10 oldest messages in the queue - static const int k_NUM_MSGS = 10; - const int level = 0, spacesPerLevel = 2; - - out << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) - << k_NUM_MSGS << " oldest messages in the queue:\n"; - - mqbcmd::Result result; - mqbs::StoragePrintUtil::listMessages(&result.makeQueueContents(), - appId, - 0, - k_NUM_MSGS, - d_queueState_p->storage()); - mqbcmd::HumanPrinter::print(out, result); - - if (!head) { - return; // RETURN - } - - // Print the current head of the queue - mqbi::Storage* const storage = d_queueState_p->storage(); - out << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) - << "Current head of the queue:\n"; - - mqbs::StoragePrintUtil::listMessage(&result.makeMessage(), storage, *head); - - mqbcmd::HumanPrinter::print(out, result); - out << "\n"; - - MWCTSK_ALARMLOG_ALARM("QUEUE_CONSUMER_MONITOR") - << out.str() << MWCTSK_ALARMLOG_END; -} - } // close package namespace } // close enterprise namespace diff --git a/src/groups/mqb/mqbblp/mqbblp_queueconsumptionmonitor.h b/src/groups/mqb/mqbblp/mqbblp_queueconsumptionmonitor.h index 0779ea601..0d570e64d 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queueconsumptionmonitor.h +++ b/src/groups/mqb/mqbblp/mqbblp_queueconsumptionmonitor.h @@ -210,8 +210,12 @@ class QueueConsumptionMonitor { static const char* toAscii(Transition::Enum value); }; - typedef bsl::function(void)> - HeadCb; + /// Callback function to log alarm info when queue state transitions to + /// idle. First argument is the app key, second argument is a boolean flag + /// to enable logging. If `enableLog` is `false`, logging is skipped. + /// Return `true` if there are un-delivered messages and `false` otherwise. + typedef bsl::function + LoggingCb; private: // PRIVATE TYPES @@ -220,8 +224,7 @@ class QueueConsumptionMonitor { struct SubStreamInfo { // CREATORS - SubStreamInfo(const HeadCb& headCb); - SubStreamInfo(const SubStreamInfo& other); + SubStreamInfo(); // PUBLIC DATA bsls::Types::Int64 d_lastKnownGoodTimer; @@ -234,12 +237,6 @@ class QueueConsumptionMonitor { // the last time slice State::Enum d_state; // The current state. - - HeadCb d_headCb; - // Returns storage iterator to the 1st - // un-delivered message including - // 'put-aside' messages (those without - // matching Subscriptions). }; typedef bsl::unordered_map& head); + /// `appKey`, and write log, upon transition to alive state. + void onTransitionToAlive(SubStreamInfo* subStreamInfo, + const mqbu::StorageKey& appKey); public: // TRAITS @@ -302,10 +296,12 @@ class QueueConsumptionMonitor { // CREATORS /// Create a `QueueConsumptionMonitor` object that monitors the queue - /// specified by `queueState`. Use the optionally specified - /// `basicAllocator` to supply memory. If `basicAllocator` is 0, the - /// currently installed default allocator is used. + /// specified by `queueState`. Use the specified `loggingCb` callback for + /// logging alarm data. Use the optionally specified `allocator` to supply + /// memory. If `allocator` is 0, the currently installed default allocator + /// is used. QueueConsumptionMonitor(QueueState* queueState, + const LoggingCb& loggingCb, bslma::Allocator* allocator); // MANIPULATORS @@ -321,12 +317,11 @@ class QueueConsumptionMonitor { /// this object. QueueConsumptionMonitor& setMaxIdleTime(bsls::Types::Int64 value); - /// Register the substream identified by the specified `key` and - /// consuming from the specified `storageIter` for monitoring. `key` - /// may be `StorageKey::k_NULL_KEY`, in which case no other key may be - /// registered via this function. It is illegal to register the same + /// Register the substream identified by the specified `key`. + /// `key` may be `StorageKey::k_NULL_KEY`, in which case no other key may + /// be registered via this function. It is illegal to register the same /// substream more than once. - void registerSubStream(const mqbu::StorageKey& key, const HeadCb& headCb); + void registerSubStream(const mqbu::StorageKey& key); /// Stop monitoring the substream identified by the specified `key`. /// `key` must have been previously registered via `registerSubStream`. diff --git a/src/groups/mqb/mqbblp/mqbblp_queueconsumptionmonitor.t.cpp b/src/groups/mqb/mqbblp/mqbblp_queueconsumptionmonitor.t.cpp index 6ecaed15e..421ee6bed 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queueconsumptionmonitor.t.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_queueconsumptionmonitor.t.cpp @@ -17,31 +17,25 @@ #include // MBQ -#include #include #include -#include -#include #include -#include #include #include #include #include #include #include -#include #include // BMQ #include #include #include - -// MWC -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -51,6 +45,7 @@ #include #include #include +#include using namespace BloombergLP; using namespace bsl; @@ -68,109 +63,62 @@ static mqbconfm::Domain getDomainConfig() return domainCfg; } -struct ClientContext { - // PUBLIC DATA - mqbmock::DispatcherClient d_dispatcherClient; - const bsl::shared_ptr - d_requesterContext_sp; - - // CREATORS - ClientContext(); - virtual ~ClientContext(); -}; - -ClientContext::ClientContext() -: d_dispatcherClient(s_allocator_p) -, d_requesterContext_sp(new (*s_allocator_p) - mqbi::QueueHandleRequesterContext(s_allocator_p), - s_allocator_p) -{ - d_requesterContext_sp->setClient(&d_dispatcherClient); -} - -ClientContext::~ClientContext() -{ - // NOTHING -} - -struct Test : mwctst::Test { - typedef bsl::vector< - bsl::pair > - TestQueueHandleSeq; - +struct Test : bmqtst::Test { // PUBLIC DATA - bmqt::Uri d_uri; - unsigned int d_id; - mqbu::StorageKey d_storageKey; - int d_partitionId; - mqbmock::Dispatcher d_dispatcher; - bdlbb::PooledBlobBufferFactory d_bufferFactory; - mqbmock::Cluster d_cluster; - mqbmock::Domain d_domain; - mqbmock::Queue d_queue; - QueueState d_queueState; - QueueConsumptionMonitor d_monitor; - mqbs::InMemoryStorage d_storage; - bdlbb::Blob d_dataBlob, d_optionBlob; - bsl::unordered_map d_advance; - unsigned int d_clientId; - ClientContext d_consumer1; - ClientContext d_consumer2; - ClientContext d_producer; - TestQueueHandleSeq d_testQueueHandles; + mqbu::StorageKey d_storageKey; + mqbmock::Dispatcher d_dispatcher; + bdlbb::PooledBlobBufferFactory d_bufferFactory; + mqbmock::Cluster d_cluster; + mqbmock::Domain d_domain; + mqbmock::Queue d_queue; + QueueState d_queueState; + QueueConsumptionMonitor d_monitor; + mqbs::InMemoryStorage d_storage; + bsl::set d_haveUndelivered; // CREATORS Test(); ~Test() BSLS_KEYWORD_OVERRIDE; // MANIPULATORS - void putMessage(); - mqbi::QueueHandle* createClient( - const ClientContext& clientContext, - bmqt::QueueFlags::Enum role, - const bsl::string& appId = bmqp::ProtocolUtil::k_DEFAULT_APP_ID, - unsigned int subQueueId = bmqp::QueueId::k_DEFAULT_SUBQUEUE_ID); - - bslma::ManagedPtr head(const mqbu::StorageKey& key); - void advance(const mqbu::StorageKey& key); + void putMessage(mqbu::StorageKey key = mqbu::StorageKey::k_NULL_KEY); + bool loggingCb(const mqbu::StorageKey& appKey, bool enableLog); }; Test::Test() -: d_uri("bmq://bmq.test.local/test_queue") -, d_id(802701) -, d_storageKey(mqbu::StorageKey::k_NULL_KEY) -, d_partitionId(1) +: d_storageKey(mqbu::StorageKey::k_NULL_KEY) , d_dispatcher(s_allocator_p) , d_bufferFactory(1024, s_allocator_p) , d_cluster(&d_bufferFactory, s_allocator_p) , d_domain(&d_cluster, s_allocator_p) , d_queue(&d_domain, s_allocator_p) , d_queueState(&d_queue, - d_uri, - d_id, + bmqt::Uri("bmq://bmq.test.local/test_queue"), + 802701, d_storageKey, - d_partitionId, + 1, &d_domain, d_cluster._resources(), s_allocator_p) -, d_monitor(&d_queueState, s_allocator_p) +, d_monitor(&d_queueState, + bdlf::BindUtil::bind(&Test::loggingCb, + this, + bdlf::PlaceHolders::_1, // appKey + bdlf::PlaceHolders::_2), // enableLog + + s_allocator_p) , d_storage(d_queue.uri(), - mqbu::StorageKey::k_NULL_KEY, + d_storageKey, mqbs::DataStore::k_INVALID_PARTITION_ID, getDomainConfig(), d_domain.capacityMeter(), s_allocator_p) -, d_advance(s_allocator_p) -, d_clientId(0) -, d_consumer1() -, d_consumer2() -, d_producer() -, d_testQueueHandles(s_allocator_p) +, d_haveUndelivered(s_allocator_p) { d_dispatcher._setInDispatcherThread(true); d_queue._setDispatcher(&d_dispatcher); - mwcu::MemOutStream errorDescription(s_allocator_p); + bmqu::MemOutStream errorDescription(s_allocator_p); bslma::ManagedPtr queueMp(&d_queue, 0, @@ -198,95 +146,31 @@ Test::Test() d_queueState.setStorage(storageMp); d_domain.queueStatContext()->snapshot(); - - d_consumer1.d_dispatcherClient._setDescription("test consumer 1"); - d_consumer2.d_dispatcherClient._setDescription("test consumer 2"); - d_producer.d_dispatcherClient._setDescription("test producer"); } Test::~Test() { - for (TestQueueHandleSeq::reverse_iterator - iter = d_testQueueHandles.rbegin(), - last = d_testQueueHandles.rend(); - iter != last; - ++iter) { - bsl::shared_ptr handleSp; - bsls::Types::Uint64 lostFlags; - d_queueState.handleCatalog().releaseHandleHelper(&handleSp, - &lostFlags, - iter->first, - iter->second, - true); - } - d_domain.unregisterQueue(&d_queue); } -void Test::putMessage() +void Test::putMessage(mqbu::StorageKey key) { - bmqt::MessageGUID messageGUID; - mqbu::MessageGUIDUtil::generateGUID(&messageGUID); - - mqbi::StorageMessageAttributes messageAttributes; - bslma::ManagedPtr appData(&d_dataBlob, - 0, - bslma::ManagedPtrUtil::noOpDeleter); - bslma::ManagedPtr options(&d_dataBlob, - 0, - bslma::ManagedPtrUtil::noOpDeleter); - - ASSERT_EQ(d_storage.put(&messageAttributes, messageGUID, appData, options), - mqbi::StorageResult::e_SUCCESS); + d_monitor.onMessageSent(key); + d_haveUndelivered.insert(key); } -mqbi::QueueHandle* Test::createClient(const ClientContext& clientContext, - bmqt::QueueFlags::Enum role, - const bsl::string& appId, - unsigned int subQueueId) +bool Test::loggingCb(const mqbu::StorageKey& appKey, const bool enableLog) { - bmqp_ctrlmsg::QueueHandleParameters handleParams(s_allocator_p); - handleParams.uri() = d_uri.asString(); - handleParams.qId() = ++d_clientId; - handleParams.readCount() = role == bmqt::QueueFlags::e_READ ? 1 : 0; - handleParams.writeCount() = role == bmqt::QueueFlags::e_WRITE ? 1 : 0; - handleParams.adminCount() = 0; - handleParams.flags() = role; - - mqbi::QueueHandle* queueHandle = d_queueState.handleCatalog().createHandle( - clientContext.d_requesterContext_sp, - handleParams, - &d_queueState.stats()); - d_testQueueHandles.push_back(bsl::make_pair(queueHandle, handleParams)); - - // Update the current handle parameters. - d_queueState.add(handleParams); - - bmqp_ctrlmsg::SubQueueIdInfo subStreamInfo; - subStreamInfo.appId() = appId; - queueHandle->registerSubStream(subStreamInfo, - subQueueId, - mqbi::QueueCounts(1, 0)); - - return queueHandle; -} + BALL_LOG_SET_CATEGORY("MQBBLP.QUEUECONSUMPTIONMONITORTEST"); -bslma::ManagedPtr -Test::head(const mqbu::StorageKey& key) -{ - bslma::ManagedPtr out; - out = d_storage.getIterator(key); - for (int i = 0; i < d_advance[key]; ++i) { - if (!out->atEnd()) { - out->advance(); - } + bool haveUndelivered = d_haveUndelivered.contains(appKey); + + if (enableLog && haveUndelivered) { + BMQTSK_ALARMLOG_ALARM("QUEUE_STUCK") + << "Test Alarm" << BMQTSK_ALARMLOG_END; } - return out; -} -void Test::advance(const mqbu::StorageKey& key) -{ - ++d_advance[key]; + return haveUndelivered; } // ============================================================================ @@ -304,20 +188,18 @@ TEST_F(Test, doNotMonitor) { putMessage(); - mwctst::ScopedLogObserver observer(ball::Severity::INFO, s_allocator_p); + bmqtst::ScopedLogObserver observer(ball::Severity::INFO, s_allocator_p); - d_monitor.registerSubStream( - mqbu::StorageKey::k_NULL_KEY, - bdlf::BindUtil::bind(&Test::head, this, mqbu::StorageKey::k_NULL_KEY)); + d_monitor.registerSubStream(d_storageKey); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); d_monitor.onTimer(0); d_monitor.onTimer(1000000); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); ASSERT_EQ(observer.records().size(), 0U); @@ -331,65 +213,26 @@ TEST_F(Test, emptyQueue) // Plan: Start monitoring, make time pass, state should remain ALIVE. // ------------------------------------------------------------------------ { - mwctst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); + bmqtst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); size_t expectedLogRecords = 0U; const bsls::Types::Int64 k_MAX_IDLE_TIME = 10; d_monitor.setMaxIdleTime(k_MAX_IDLE_TIME); - d_monitor.registerSubStream( - mqbu::StorageKey::k_NULL_KEY, - bdlf::BindUtil::bind(&Test::head, this, mqbu::StorageKey::k_NULL_KEY)); + d_monitor.registerSubStream(d_storageKey); d_monitor.onTimer(k_MAX_IDLE_TIME); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); ASSERT_EQ(logObserver.records().size(), expectedLogRecords); d_monitor.onTimer(k_MAX_IDLE_TIME + 1); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); ASSERT_EQ(logObserver.records().size(), expectedLogRecords); } -TEST_F(Test, logFormat) -// ------------------------------------------------------------------------ -// Concerns: State becomes IDLE after set period then returns to normal -// when message is processed - this is a typical, full scenario. -// -// Plan: Instantiate component, put message in queue, make time pass and -// check that state flips to IDLE according to specs, check logs, make more -// time pass and check that state remains 'idle', signal component that a -// message was consumed, check that state flips to 'alive', make more time -// pass, check that state remains 'alive'. -// ------------------------------------------------------------------------ -{ - mwctst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); - - const bsls::Types::Int64 k_MAX_IDLE_TIME = 10; - - d_monitor.setMaxIdleTime(k_MAX_IDLE_TIME); - - d_monitor.registerSubStream( - mqbu::StorageKey::k_NULL_KEY, - bdlf::BindUtil::bind(&Test::head, this, mqbu::StorageKey::k_NULL_KEY)); - - putMessage(); - - d_monitor.onTimer(k_MAX_IDLE_TIME); - d_monitor.onTimer(2 * k_MAX_IDLE_TIME + 1); - ASSERT_EQ(logObserver.records().size(), 1u); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( - logObserver.records().back(), - "ALARM \\[QUEUE_CONSUMER_MONITOR\\]", - s_allocator_p)); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( - logObserver.records().back(), - "Queue '.*'", - s_allocator_p)); -} - TEST_F(Test, putAliveIdleSendAlive) // ------------------------------------------------------------------------ // Concerns: State becomes IDLE after set period then returns to normal @@ -402,117 +245,58 @@ TEST_F(Test, putAliveIdleSendAlive) // pass, check that state remains 'alive'. // ------------------------------------------------------------------------ { - mwctst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); + bmqtst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); size_t expectedLogRecords = 0U; const bsls::Types::Int64 k_MAX_IDLE_TIME = 10; d_monitor.setMaxIdleTime(k_MAX_IDLE_TIME); - d_monitor.registerSubStream( - mqbu::StorageKey::k_NULL_KEY, - bdlf::BindUtil::bind(&Test::head, this, mqbu::StorageKey::k_NULL_KEY)); + d_monitor.registerSubStream(d_storageKey); putMessage(); d_monitor.onTimer(k_MAX_IDLE_TIME); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); ASSERT_EQ(logObserver.records().size(), expectedLogRecords); d_monitor.onTimer(2 * k_MAX_IDLE_TIME - 1); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); ASSERT_EQ(logObserver.records().size(), expectedLogRecords); d_monitor.onTimer(2 * k_MAX_IDLE_TIME); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); ASSERT_EQ(logObserver.records().size(), expectedLogRecords); d_monitor.onTimer(2 * k_MAX_IDLE_TIME + 1); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_IDLE); ASSERT_EQ(logObserver.records().size(), ++expectedLogRecords); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( - logObserver.records().back(), - "ALARM \\[QUEUE_CONSUMER_MONITOR\\]", - s_allocator_p)); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( logObserver.records().back(), - "0 consumers", + "ALARM \\[QUEUE_STUCK\\]", s_allocator_p)); d_monitor.onTimer(2 * k_MAX_IDLE_TIME + 2); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_IDLE); - d_monitor.onMessageSent(mqbu::StorageKey::k_NULL_KEY); - advance(mqbu::StorageKey::k_NULL_KEY); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + d_monitor.onMessageSent(d_storageKey); + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_IDLE); ASSERT_EQ(logObserver.records().size(), expectedLogRecords); d_monitor.onTimer(3 * k_MAX_IDLE_TIME + 2); ASSERT_EQ(logObserver.records().size(), ++expectedLogRecords); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( logObserver.records().back(), "no longer appears to be stuck", s_allocator_p)); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), - QueueConsumptionMonitor::State::e_ALIVE); -} - -TEST_F(Test, putAliveIdleWithConsumer) -{ - // ------------------------------------------------------------------------ - // Concerns: Same as above, but with two read and one write clients. - // - // Plan: Start monitoring, create three clients (2 read and 1 write), put - // message in queue, create an 'idle' condition, check that the two read - // clients (but not the write client) are reported in the log. - // ------------------------------------------------------------------------ - mwctst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); - size_t expectedLogRecords = 3U; - - const bsls::Types::Int64 k_MAX_IDLE_TIME = 10; - d_monitor.setMaxIdleTime(k_MAX_IDLE_TIME); - - d_monitor.registerSubStream( - mqbu::StorageKey::k_NULL_KEY, - bdlf::BindUtil::bind(&Test::head, this, mqbu::StorageKey::k_NULL_KEY)); - - createClient(d_consumer1, bmqt::QueueFlags::e_READ); - createClient(d_consumer2, bmqt::QueueFlags::e_READ); - createClient(d_producer, bmqt::QueueFlags::e_WRITE); - - putMessage(); - - d_monitor.onTimer(k_MAX_IDLE_TIME); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); - ASSERT_EQ(logObserver.records().size(), expectedLogRecords); - - d_monitor.onTimer(2 * k_MAX_IDLE_TIME + 1); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), - QueueConsumptionMonitor::State::e_IDLE); - ASSERT_EQ(logObserver.records().size(), ++expectedLogRecords); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( - logObserver.records().back(), - "ALARM \\[QUEUE_CONSUMER_MONITOR\\].*It currently has 2 consumers", - s_allocator_p)); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( - logObserver.records().back(), - "test consumer 1", - s_allocator_p)); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( - logObserver.records().back(), - "test consumer 2", - s_allocator_p)); - ASSERT(!mwctst::ScopedLogObserverUtil::recordMessageMatch( - logObserver.records().back(), - "test producer", - s_allocator_p)); } TEST_F(Test, putAliveIdleEmptyAlive) @@ -528,23 +312,22 @@ TEST_F(Test, putAliveIdleEmptyAlive) d_monitor.setMaxIdleTime(k_MAX_IDLE_TIME); - d_monitor.registerSubStream( - mqbu::StorageKey::k_NULL_KEY, - bdlf::BindUtil::bind(&Test::head, this, mqbu::StorageKey::k_NULL_KEY)); + d_monitor.registerSubStream(d_storageKey); + putMessage(); d_monitor.onTimer(k_MAX_IDLE_TIME); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); d_monitor.onTimer(2 * k_MAX_IDLE_TIME + 1); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_IDLE); - d_storage.removeAll(d_storageKey); + d_haveUndelivered.erase(d_storageKey); d_monitor.onTimer(2 * k_MAX_IDLE_TIME + 1); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); } @@ -562,37 +345,35 @@ TEST_F(Test, changeMaxIdleTime) d_monitor.setMaxIdleTime(k_MAX_IDLE_TIME); - d_monitor.registerSubStream( - mqbu::StorageKey::k_NULL_KEY, - bdlf::BindUtil::bind(&Test::head, this, mqbu::StorageKey::k_NULL_KEY)); + d_monitor.registerSubStream(d_storageKey); putMessage(); d_monitor.onTimer(0); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); d_monitor.onTimer(k_MAX_IDLE_TIME + 1); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_IDLE); - mwctst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); + bmqtst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); d_monitor.setMaxIdleTime(k_MAX_IDLE_TIME * 2); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); ASSERT_EQ(logObserver.records().size(), 0u); d_monitor.onTimer(k_MAX_IDLE_TIME * 2); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); d_monitor.onTimer(k_MAX_IDLE_TIME * 2 + k_MAX_IDLE_TIME * 2); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); d_monitor.onTimer(k_MAX_IDLE_TIME * 2 + k_MAX_IDLE_TIME * 2 + 1); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_IDLE); } @@ -609,17 +390,15 @@ TEST_F(Test, reset) d_monitor.setMaxIdleTime(k_MAX_IDLE_TIME); - d_monitor.registerSubStream( - mqbu::StorageKey::k_NULL_KEY, - bdlf::BindUtil::bind(&Test::head, this, mqbu::StorageKey::k_NULL_KEY)); + d_monitor.registerSubStream(d_storageKey); putMessage(); d_monitor.onTimer(0); - ASSERT_EQ(d_monitor.state(mqbu::StorageKey::k_NULL_KEY), + ASSERT_EQ(d_monitor.state(d_storageKey), QueueConsumptionMonitor::State::e_ALIVE); - mwctst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); + bmqtst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); d_monitor.reset(); d_monitor.onTimer(k_MAX_IDLE_TIME + 1); @@ -638,7 +417,7 @@ TEST_F(Test, putAliveIdleSendAliveTwoSubstreams) // pass, check that state remains 'alive'. // ------------------------------------------------------------------------ { - mwctst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); + bmqtst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); size_t expectedLogRecords = 0U; const bsls::Types::Int64 k_MAX_IDLE_TIME = 10; @@ -649,17 +428,15 @@ TEST_F(Test, putAliveIdleSendAliveTwoSubstreams) d_monitor.setMaxIdleTime(k_MAX_IDLE_TIME); - mwcu::MemOutStream errorDescription(s_allocator_p); + bmqu::MemOutStream errorDescription(s_allocator_p); d_storage.addVirtualStorage(errorDescription, "app1", key1); d_storage.addVirtualStorage(errorDescription, "app2", key2); - d_monitor.registerSubStream(key1, - bdlf::BindUtil::bind(&Test::head, this, key1)); - - d_monitor.registerSubStream(key2, - bdlf::BindUtil::bind(&Test::head, this, key2)); + d_monitor.registerSubStream(key1); + d_monitor.registerSubStream(key2); - putMessage(); + putMessage(key1); + putMessage(key2); d_monitor.onTimer(k_MAX_IDLE_TIME); ASSERT_EQ(d_monitor.state(key1), QueueConsumptionMonitor::State::e_ALIVE); @@ -683,13 +460,9 @@ TEST_F(Test, putAliveIdleSendAliveTwoSubstreams) ASSERT_EQ(logObserver.records().size(), expectedLogRecords += 2); for (int i = 0; i < 2; ++i) { - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( logObserver.records().rbegin()[i], - "ALARM \\[QUEUE_CONSUMER_MONITOR\\]", - s_allocator_p)); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( - logObserver.records().rbegin()[i], - "0 consumers", + "ALARM \\[QUEUE_STUCK\\]", s_allocator_p)); } @@ -698,14 +471,13 @@ TEST_F(Test, putAliveIdleSendAliveTwoSubstreams) ASSERT_EQ(d_monitor.state(key2), QueueConsumptionMonitor::State::e_IDLE); d_monitor.onMessageSent(key1); - advance(key1); ASSERT_EQ(d_monitor.state(key1), QueueConsumptionMonitor::State::e_IDLE); ASSERT_EQ(d_monitor.state(key2), QueueConsumptionMonitor::State::e_IDLE); ASSERT_EQ(logObserver.records().size(), expectedLogRecords); d_monitor.onTimer(3 * k_MAX_IDLE_TIME + 2); ASSERT_EQ(logObserver.records().size(), expectedLogRecords += 1); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( logObserver.records().back(), "Queue 'bmq://bmq.test.local/test_queue\\?id=app1' no longer appears " "to be stuck.", @@ -715,10 +487,9 @@ TEST_F(Test, putAliveIdleSendAliveTwoSubstreams) ASSERT_EQ(d_monitor.state(key2), QueueConsumptionMonitor::State::e_IDLE); d_monitor.onMessageSent(key2); - advance(key2); d_monitor.onTimer(3 * k_MAX_IDLE_TIME + 3); ASSERT_EQ(logObserver.records().size(), expectedLogRecords += 1); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( logObserver.records().back(), "Queue 'bmq://bmq.test.local/test_queue\\?id=app2' no longer appears " "to be stuck.", @@ -727,122 +498,6 @@ TEST_F(Test, putAliveIdleSendAliveTwoSubstreams) ASSERT_EQ(d_monitor.state(key2), QueueConsumptionMonitor::State::e_ALIVE); } -TEST_F(Test, putAliveIdleSendAliveTwoSubstreamsTwoConsumers) -// ------------------------------------------------------------------------ -// Concerns: State becomes IDLE after set period then returns to normal -// when message is processed - this is a typical, full scenario. -// -// Plan: Instantiate component, put message in queue, make time pass and -// check that state flips to IDLE according to specs, check logs, make more -// time pass and check that state remains 'idle', signal component that a -// message was consumed, check that state flips to 'alive', make more time -// pass, check that state remains 'alive'. -// ------------------------------------------------------------------------ -{ - mwctst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); - size_t expectedLogRecords = 3U; - - const bsls::Types::Int64 k_MAX_IDLE_TIME = 10; - - mqbu::StorageKey key1, key2; - key1.fromHex("ABCDEF1234"); - key2.fromHex("1234ABCDEF"); - - d_monitor.setMaxIdleTime(k_MAX_IDLE_TIME); - - mwcu::MemOutStream errorDescription(s_allocator_p); - d_storage.addVirtualStorage(errorDescription, "app1", key1); - d_storage.addVirtualStorage(errorDescription, "app2", key2); - - d_monitor.registerSubStream(key1, - bdlf::BindUtil::bind(&Test::head, this, key1)); - - d_monitor.registerSubStream(key2, - bdlf::BindUtil::bind(&Test::head, this, key2)); - - createClient(d_consumer1, bmqt::QueueFlags::e_READ, "app1"); - createClient(d_consumer2, bmqt::QueueFlags::e_READ, "app2"); - createClient(d_producer, bmqt::QueueFlags::e_WRITE); - - putMessage(); - - d_monitor.onTimer(k_MAX_IDLE_TIME); - ASSERT_EQ(d_monitor.state(key1), QueueConsumptionMonitor::State::e_ALIVE); - ASSERT_EQ(d_monitor.state(key2), QueueConsumptionMonitor::State::e_ALIVE); - ASSERT_EQ(logObserver.records().size(), expectedLogRecords); - - d_monitor.onTimer(2 * k_MAX_IDLE_TIME - 1); - ASSERT_EQ(d_monitor.state(key1), QueueConsumptionMonitor::State::e_ALIVE); - ASSERT_EQ(d_monitor.state(key2), QueueConsumptionMonitor::State::e_ALIVE); - ASSERT_EQ(logObserver.records().size(), expectedLogRecords); - - d_monitor.onTimer(2 * k_MAX_IDLE_TIME); - ASSERT_EQ(d_monitor.state(key1), QueueConsumptionMonitor::State::e_ALIVE); - ASSERT_EQ(d_monitor.state(key2), QueueConsumptionMonitor::State::e_ALIVE); - ASSERT_EQ(logObserver.records().size(), expectedLogRecords); - - d_monitor.onTimer(2 * k_MAX_IDLE_TIME + 1); - ASSERT_EQ(d_monitor.state(key1), QueueConsumptionMonitor::State::e_IDLE); - ASSERT_EQ(d_monitor.state(key2), QueueConsumptionMonitor::State::e_IDLE); - - ASSERT_EQ(logObserver.records().size(), expectedLogRecords += 2); - - for (bsl::vector::const_iterator iter = - logObserver.records().end() - 2; - iter != logObserver.records().end(); - ++iter) { - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( - *iter, - "ALARM \\[QUEUE_CONSUMER_MONITOR\\] Queue " - "'bmq://bmq.test.local/test_queue\\?id=app\\d'", - s_allocator_p)); - ASSERT( - mwctst::ScopedLogObserverUtil::recordMessageMatch(*iter, - "1 consumers", - s_allocator_p)); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( - *iter, - "test consumer \\d", - s_allocator_p)); - ASSERT( - !mwctst::ScopedLogObserverUtil::recordMessageMatch(*iter, - "test producer", - s_allocator_p)); - } - - d_monitor.onTimer(2 * k_MAX_IDLE_TIME + 2); - ASSERT_EQ(d_monitor.state(key1), QueueConsumptionMonitor::State::e_IDLE); - ASSERT_EQ(d_monitor.state(key2), QueueConsumptionMonitor::State::e_IDLE); - - d_monitor.onMessageSent(key1); - advance(key1); - ASSERT_EQ(d_monitor.state(key1), QueueConsumptionMonitor::State::e_IDLE); - ASSERT_EQ(d_monitor.state(key2), QueueConsumptionMonitor::State::e_IDLE); - ASSERT_EQ(logObserver.records().size(), expectedLogRecords); - - d_monitor.onTimer(3 * k_MAX_IDLE_TIME + 2); - ASSERT_EQ(logObserver.records().size(), expectedLogRecords += 1); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( - logObserver.records().back(), - "Queue 'bmq://bmq.test.local/test_queue\\?id=app1' no longer appears " - "to be stuck", - s_allocator_p)); - ASSERT_EQ(d_monitor.state(key1), QueueConsumptionMonitor::State::e_ALIVE); - ASSERT_EQ(d_monitor.state(key2), QueueConsumptionMonitor::State::e_IDLE); - - d_monitor.onMessageSent(key2); - advance(key2); - d_monitor.onTimer(3 * k_MAX_IDLE_TIME + 3); - ASSERT_EQ(logObserver.records().size(), expectedLogRecords += 1); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( - logObserver.records().back(), - "Queue 'bmq://bmq.test.local/test_queue\\?id=app2' no longer appears " - "to be stuck", - s_allocator_p)); - ASSERT_EQ(d_monitor.state(key1), QueueConsumptionMonitor::State::e_ALIVE); - ASSERT_EQ(d_monitor.state(key2), QueueConsumptionMonitor::State::e_ALIVE); -} - TEST_F(Test, usage) // ------------------------------------------------------------------------- // Concerns: Make sure the usage example is correct. @@ -853,13 +508,11 @@ TEST_F(Test, usage) { #define monitor d_monitor - mwctst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); + bmqtst::ScopedLogObserver logObserver(ball::Severity::INFO, s_allocator_p); monitor.setMaxIdleTime(20); - d_monitor.registerSubStream( - mqbu::StorageKey::k_NULL_KEY, - bdlf::BindUtil::bind(&Test::head, this, mqbu::StorageKey::k_NULL_KEY)); + d_monitor.registerSubStream(d_storageKey); putMessage(); putMessage(); @@ -878,8 +531,7 @@ TEST_F(Test, usage) monitor.onTimer(T += 15); // nothing is logged ASSERT_EQ(logObserver.records().size(), 1u); // 15 seconds later - T + 60s - consume first message, inform monitor: - monitor.onMessageSent(mqbu::StorageKey::k_NULL_KEY); - advance(mqbu::StorageKey::k_NULL_KEY); + monitor.onMessageSent(d_storageKey); // 15 seconds later - T + 75s monitor.onTimer(T += 15); // log INFO: back to active @@ -891,7 +543,7 @@ TEST_F(Test, usage) monitor.onTimer(T += 15); // log ALARM ASSERT_EQ(logObserver.records().size(), 3u); // 15 seconds later - T + 120s - d_storage.removeAll(d_storageKey); + d_haveUndelivered.erase(d_storageKey); monitor.onTimer(T += 15); // log INFO: back to active ASSERT_EQ(logObserver.records().size(), 4u); @@ -907,7 +559,7 @@ int main(int argc, char* argv[]) { BALL_LOG_SET_CATEGORY("MAIN"); - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); @@ -920,13 +572,13 @@ int main(int argc, char* argv[]) mqbcfg::AppConfig brokerConfig(s_allocator_p); mqbcfg::BrokerConfig::set(brokerConfig); - bsl::shared_ptr statContext = + bsl::shared_ptr statContext = mqbstat::BrokerStatsUtil::initializeStatContext(30, s_allocator_p); - mwctst::runTest(_testCase); + bmqtst::runTest(_testCase); } bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbblp/mqbblp_queueenginetester.cpp b/src/groups/mqb/mqbblp/mqbblp_queueenginetester.cpp index afbff91de..4cae090d1 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queueenginetester.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_queueenginetester.cpp @@ -36,9 +36,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -410,7 +409,7 @@ void QueueEngineTester::oneTimeInit() { BSLMT_ONCE_DO { - mwcsys::Time::initialize(); + bmqsys::Time::initialize(); // Make MessageGUID generation thread-safe by calling initialize mqbu::MessageGUIDUtil::initialize(); } @@ -419,7 +418,7 @@ void QueueEngineTester::oneTimeInit() void QueueEngineTester::init(const mqbconfm::Domain& domainConfig, bool startScheduler) { - mwcu::MemOutStream errorDescription(d_allocator_p); + bmqu::MemOutStream errorDescription(d_allocator_p); int rc = 0; // Dispatcher @@ -602,7 +601,7 @@ void QueueEngineTester::oneTimeShutdown() { BSLMT_ONCE_DO { - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); } } @@ -740,7 +739,7 @@ QueueEngineTester::getHandle(const bsl::string& clientText) handleParams.uri() = uri.asString(); // 2. Get the handle - mwcu::MemOutStream errorDescription(d_allocator_p); + bmqu::MemOutStream errorDescription(d_allocator_p); mqbi::QueueHandle* handle = 0; HandleMap::iterator handleIter = d_handles.find(clientKey); if (handleIter != d_handles.end()) { diff --git a/src/groups/mqb/mqbblp/mqbblp_queueenginetester.h b/src/groups/mqb/mqbblp/mqbblp_queueenginetester.h index 0f2296c92..519fd1802 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queueenginetester.h +++ b/src/groups/mqb/mqbblp/mqbblp_queueenginetester.h @@ -107,8 +107,7 @@ #include #include -// MWC -#include +#include // BMQ #include @@ -165,7 +164,7 @@ class QueueEngineTester { /// Must be a container in which iteration order is same as insertion /// order because in `afterNewMessage`, we need to invoke the engine for /// newly posted messages in the order that they were posted. - typedef mwcc::OrderedHashMap MessagesMap; + typedef bmqc::OrderedHashMap MessagesMap; typedef bsl::shared_ptr QueueHandleSp; @@ -593,8 +592,8 @@ class TimeControlledQueueEngineTester : public mqbblp::QueueEngineTester { : mqbblp::QueueEngineTester(domainConfig, true, allocator) , d_testClock(d_mockCluster_mp->_timeSource()) { - mwcsys::Time::shutdown(); - mwcsys::Time::initialize( + bmqsys::Time::shutdown(); + bmqsys::Time::initialize( bdlf::BindUtil::bind(&TestClock::realtimeClock, &d_testClock), bdlf::BindUtil::bind(&TestClock::monotonicClock, &d_testClock), bdlf::BindUtil::bind(&TestClock::highResTimer, &d_testClock)); @@ -623,7 +622,7 @@ QueueEngineTester::createQueueEngineHelper(mqbi::QueueEngine* engine) BSLS_ASSERT_OPT(engine); BSLS_ASSERT_OPT(d_mockQueue_sp); - mwcu::MemOutStream errorDescription(d_allocator_p); + bmqu::MemOutStream errorDescription(d_allocator_p); int rc = engine->configure(errorDescription); BSLS_ASSERT_OPT(rc == 0); diff --git a/src/groups/mqb/mqbblp/mqbblp_queueengineutil.cpp b/src/groups/mqb/mqbblp/mqbblp_queueengineutil.cpp index 41465337b..0dd4e3cb2 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queueengineutil.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_queueengineutil.cpp @@ -39,12 +39,11 @@ #include #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -278,7 +277,7 @@ int QueueEngineUtil::dumpMessageInTempfile( rc_FILE_OPEN_FAILURE = -2 }; - const bsl::string prefix = mwcu::TempUtil::tempDir(); + const bsl::string prefix = bmqu::TempUtil::tempDir(); bdls::FilesystemUtil::FileDescriptor fileDescriptor = bdls::FilesystemUtil::createTemporaryFile(filepath, prefix); if (fileDescriptor == bdls::FilesystemUtil::k_INVALID_FD) { @@ -337,7 +336,7 @@ void QueueEngineUtil::logRejectMessage( *appData, appData->length(), true, - mwcu::BlobPosition(), + bmqu::BlobPosition(), attributes.messagePropertiesInfo().isPresent(), attributes.messagePropertiesInfo().isExtended(), attributes.compressionAlgorithmType(), @@ -353,15 +352,15 @@ void QueueEngineUtil::logRejectMessage( bsl::string filepath; if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("POISON_PILL") + BMQTSK_ALARMLOG_ALARM("POISON_PILL") << "A poison pill message was detected and purged from the queue " << queueState->uri() << " [GUID: " << msgGUID << ", appId: " << appId << ", subQueueId: " << subQueueId - << "]. Message was " - << "transmitted a total of " << attemptedDeliveries + << "]. Message was " << "transmitted a total of " + << attemptedDeliveries << " times to consumer(s). BlazingMQ failed to load message " << "properties with internal error code " << rc - << "Dumping raw message." << MWCTSK_ALARMLOG_END; + << "Dumping raw message." << BMQTSK_ALARMLOG_END; rc = dumpMessageInTempfile(&filepath, *appData, 0, @@ -376,37 +375,37 @@ void QueueEngineUtil::logRejectMessage( } if (rc == -1) { - MWCTSK_ALARMLOG_ALARM("POISON_PILL") + BMQTSK_ALARMLOG_ALARM("POISON_PILL") << "A poison pill message was detected and purged from the queue " << queueState->uri() << " [GUID: " << msgGUID << ", appId: " << appId << ", subQueueId: " << subQueueId << "]. Message was transmitted a total of " << attemptedDeliveries << " times to consumer(s). Attempt to dump message in a file " << "failed because file could not be created." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } if (rc == -2) { - MWCTSK_ALARMLOG_ALARM("POISON_PILL") + BMQTSK_ALARMLOG_ALARM("POISON_PILL") << "A poison pill message was detected and purged from the queue " << queueState->uri() << " [GUID: " << msgGUID << ", appId: " << appId << ", subQueueId: " << subQueueId << "]. Message was transmitted a total of " << attemptedDeliveries << " times to consumer(s). Attempt to dump message in a file " << "failed because file could not be opened." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } - MWCTSK_ALARMLOG_ALARM("POISON_PILL") + BMQTSK_ALARMLOG_ALARM("POISON_PILL") << "A poison pill message was detected and purged from the queue " << queueState->uri() << " [GUID: " << msgGUID << ", appId: " << appId << ", subQueueId: " << subQueueId << "]. Message was transmitted a total of " << attemptedDeliveries << " times to consumer(s). Message was dumped in file at location [" << filepath << "] on this machine. Please copy file before it gets " - << "deleted." << MWCTSK_ALARMLOG_END; + << "deleted." << BMQTSK_ALARMLOG_END; } // ------------------------------------------- @@ -994,7 +993,7 @@ Routers::Result QueueEngineUtil_AppState::tryDeliverOneMessage( // 'delay' and return false. bsls::TimeInterval messageDelay; - bsls::TimeInterval now = mwcsys::Time::nowMonotonicClock(); + bsls::TimeInterval now = bmqsys::Time::nowMonotonicClock(); Visitor visitor; Routers::Result result = Routers::e_SUCCESS; diff --git a/src/groups/mqb/mqbblp/mqbblp_queueengineutil.h b/src/groups/mqb/mqbblp/mqbblp_queueengineutil.h index 377688654..7496a9a37 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queueengineutil.h +++ b/src/groups/mqb/mqbblp/mqbblp_queueengineutil.h @@ -258,7 +258,7 @@ class RedeliveryList { Item(); }; - typedef mwcc::OrderedHashMap > Map; @@ -364,8 +364,8 @@ struct QueueEngineUtil_AppState { bdlmt::EventSchedulerEventHandle d_throttleEventHandle; // EventHandle for poison pill message // throttling. - mqbu::StorageKey d_appKey; - const bsl::string d_appId; + mqbu::StorageKey d_appKey; + const bsl::string d_appId; unsigned int d_upstreamSubQueueId; @@ -550,6 +550,10 @@ struct QueueEngineUtil_AppState { /// the queue iterator: empty PutAside List and no resume point. bool isAtEndOfStorage() const; + size_t putAsideListSize() const; + + size_t redeliveryListSize() const; + Routers::Consumer* findQueueHandleContext(mqbi::QueueHandle* handle); unsigned int upstreamSubQueueId() const; @@ -784,6 +788,16 @@ QueueEngineUtil_AppState::putForRedelivery(const bmqt::MessageGUID& guid) d_redeliveryList.add(guid); } +inline size_t QueueEngineUtil_AppState::putAsideListSize() const +{ + return d_putAsideList.size(); +} + +inline size_t QueueEngineUtil_AppState::redeliveryListSize() const +{ + return d_redeliveryList.size(); +} + inline Routers::Consumer* QueueEngineUtil_AppState::findQueueHandleContext(mqbi::QueueHandle* handle) { diff --git a/src/groups/mqb/mqbblp/mqbblp_queuehandle.cpp b/src/groups/mqb/mqbblp/mqbblp_queuehandle.cpp index ffcbeda0a..42ffca0c7 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queuehandle.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_queuehandle.cpp @@ -31,12 +31,11 @@ #include #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -75,7 +74,7 @@ const bsls::Types::Int64 k_NS_PER_MESSAGE = typedef bsl::function CompletionCallback; -/// Utility function used in `mwcu::OperationChain` as the operation +/// Utility function used in `bmqu::OperationChain` as the operation /// callback which just calls the completion callback. void allSubstreamsDeconfigured(const CompletionCallback& callback) { @@ -378,7 +377,7 @@ mqbu::ResourceUsageMonitorStateTransition::Enum QueueHandle::updateMonitor( // overflow and the update actually increments by a very large // value - const bsls::Types::Int64 timeDelta = mwcsys::Time::highResolutionTimer() - + const bsls::Types::Int64 timeDelta = bmqsys::Time::highResolutionTimer() - it->second.d_timeStamp; BSLS_ASSERT_SAFE(timeDelta >= 0); @@ -826,7 +825,7 @@ void QueueHandle::deliverMessage( const int msgSize = message->length(); bmqp::Protocol::SubQueueInfosArray targetSubscriptions; - bsls::Types::Int64 now = mwcsys::Time::highResolutionTimer(); + bsls::Types::Int64 now = bmqsys::Time::highResolutionTimer(); for (size_t i = 0; i < subscriptions.size(); ++i) { unsigned int subscriptionId = subscriptions[i].id(); const SubscriptionSp& subscription = d_subscriptions[subscriptionId]; @@ -900,16 +899,16 @@ void QueueHandle::deliverMessage( << " of client '" << d_clientContext_sp->client()->description() << "' has too many outstanding data [" - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( subscription->d_unconfirmedMonitor.messages()) << " msgs (max: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( subscription->d_unconfirmedMonitor.messageCapacity()) << "), " - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( subscription->d_unconfirmedMonitor.bytes()) << " (max: " - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( subscription->d_unconfirmedMonitor.byteCapacity()) << ")], I'm taking a break!"; } @@ -1018,7 +1017,7 @@ void QueueHandle::deconfigureDispatched( BSLS_ASSERT_SAFE(d_clientContext_sp); // Fill the first link with deconfigure operations - mwcu::OperationChainLink link(d_deconfigureChain.allocator()); + bmqu::OperationChainLink link(d_deconfigureChain.allocator()); mqbi::QueueHandle::SubStreams::const_iterator citer = d_subStreamInfos.begin(); @@ -1285,7 +1284,7 @@ void QueueHandle::loadInternals(mqbcmd::QueueHandle* out) const BSLS_ASSERT_SAFE( d_queue_sp->dispatcher()->inDispatcherThread(d_queue_sp.get())); - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << d_handleParameters; out->parametersJson() = os.str(); out->isClientClusterMember() = d_isClientClusterMember; diff --git a/src/groups/mqb/mqbblp/mqbblp_queuehandle.h b/src/groups/mqb/mqbblp/mqbblp_queuehandle.h index 25360cf0f..78b75d4e8 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queuehandle.h +++ b/src/groups/mqb/mqbblp/mqbblp_queuehandle.h @@ -35,8 +35,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -126,7 +125,7 @@ class QueueHandle : public mqbi::QueueHandle { static unsigned int nextStamp(); }; typedef bsl::shared_ptr SubscriptionSp; - typedef mwcc::Array, + typedef bmqc::Array, bmqp::Protocol::k_SUBID_ARRAY_STATIC_LEN> Downstreams; @@ -196,7 +195,7 @@ class QueueHandle : public mqbi::QueueHandle { bdlmt::Throttle d_throttledDroppedPutMessages; - mwcu::OperationChain d_deconfigureChain; + bmqu::OperationChain d_deconfigureChain; // Mechanism to serialize execution of // the substream deconfigure callbacks // and the caller callback invoked when @@ -665,7 +664,7 @@ inline QueueHandle::Downstream::Downstream(const bsl::string& appId, bslma::Allocator* allocator_p) : d_appId(appId) , d_upstreamSubQueueId(upstreamSubQueueId) -, d_data(new (*allocator_p) +, d_data(new(*allocator_p) mqbi::QueueHandle::UnconfirmedMessageInfoMap(allocator_p), allocator_p) { diff --git a/src/groups/mqb/mqbblp/mqbblp_queuehandlecatalog.cpp b/src/groups/mqb/mqbblp/mqbblp_queuehandlecatalog.cpp index 43b2ff6ee..8d30ab34b 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queuehandlecatalog.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_queuehandlecatalog.cpp @@ -28,8 +28,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -357,7 +356,7 @@ void QueueHandleCatalog::loadInternals( ++it) { out->resize(out->size() + 1); mqbi::QueueHandle* handle = it->key1(); - mwcu::MemOutStream description; + bmqu::MemOutStream description; description << handle << " ~ " << handle->client()->description(); out->back().clientDescription() = description.str(); handle->loadInternals(&out->back()); diff --git a/src/groups/mqb/mqbblp/mqbblp_queuehandlecatalog.h b/src/groups/mqb/mqbblp/mqbblp_queuehandlecatalog.h index 47dad6cd5..86a81787f 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queuehandlecatalog.h +++ b/src/groups/mqb/mqbblp/mqbblp_queuehandlecatalog.h @@ -38,8 +38,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -127,7 +126,7 @@ class QueueHandleCatalog { RequesterKey; /// (queueHandlePtr, requester) -> queueHandleSp - typedef mwcc::TwoKeyHashMap > HandleMap; diff --git a/src/groups/mqb/mqbblp/mqbblp_queuesessionmanager.cpp b/src/groups/mqb/mqbblp/mqbblp_queuesessionmanager.cpp index 946e2e030..b2f383420 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queuesessionmanager.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_queuesessionmanager.cpp @@ -50,7 +50,7 @@ namespace { /// Create the queue stats datum associated with the specified `statContext` /// and having the specified `domain`, `cluster`, and `queueFlags`. -void createQueueStatsDatum(mwcst::StatContext* statContext, +void createQueueStatsDatum(bmqst::StatContext* statContext, const bsl::string& domain, const bsl::string& cluster, bsls::Types::Uint64 queueFlags) @@ -92,11 +92,11 @@ void QueueSessionManager::onDomainQualifiedCb( const ErrorCallback& errorCallback, const bmqt::Uri& uri, const bmqp_ctrlmsg::ControlMessage& request, - const mwcu::AtomicValidatorSp& validator) + const bmqu::AtomicValidatorSp& validator) { // executed by the *CLIENT* dispatcher thread (TBD: for now) - mwcu::AtomicValidatorGuard guard(validator.get()); + bmqu::AtomicValidatorGuard guard(validator.get()); if (!guard.isValid()) { // The session was destroyed before we received the response (see // implementation notes at top of this file for explanation). @@ -171,14 +171,14 @@ void QueueSessionManager::onDomainOpenCb( const ErrorCallback& errorCallback, const bmqt::Uri& uri, const bmqp_ctrlmsg::ControlMessage& request, - const mwcu::AtomicValidatorSp& validator) + const bmqu::AtomicValidatorSp& validator) { // executed by the *ANY* thread (TBD: for now) // Preconditions BSLS_ASSERT_SAFE(request.choice().isOpenQueueValue()); - mwcu::AtomicValidatorGuard guard(validator.get()); + bmqu::AtomicValidatorGuard guard(validator.get()); if (!guard.isValid()) { // The session was destroyed before we received the response (see // implementation notes at top of this file for explanation). @@ -228,7 +228,7 @@ void QueueSessionManager::onQueueOpenCb( const mqbi::Domain::OpenQueueConfirmationCookie& confirmationCookie, const GetHandleCallback& responseCallback, const bmqp_ctrlmsg::ControlMessage& request, - const mwcu::AtomicValidatorSp& validator) + const bmqu::AtomicValidatorSp& validator) { // executed by *ANY* thread @@ -241,7 +241,7 @@ void QueueSessionManager::onQueueOpenCb( *confirmationCookie = queueHandle; } - mwcu::AtomicValidatorGuard guard(validator.get()); + bmqu::AtomicValidatorGuard guard(validator.get()); if (!guard.isValid()) { // The session was destroyed before we received the response (see // implementation notes at top of this file for explanation). @@ -322,7 +322,7 @@ void QueueSessionManager::onQueueOpenCbDispatched( QueueState::StreamsMap::iterator subQueueInfo = qs.d_subQueueInfosMap.insert(apppId, queueId.subId(), queueId); - mwcst::StatContext* statContext = + bmqst::StatContext* statContext = subQueueInfo->value().d_stats->statContext(); if (!statContext) { @@ -356,11 +356,11 @@ void QueueSessionManager::onHandleReleased( const CloseHandleCallback& successCallback, const ErrorCallback& errorCallback, const bmqp_ctrlmsg::ControlMessage& request, - const mwcu::AtomicValidatorSp& validator) + const bmqu::AtomicValidatorSp& validator) { // executed by the *QUEUE* dispatcher thread - mwcu::AtomicValidatorGuard guard(validator.get()); + bmqu::AtomicValidatorGuard guard(validator.get()); if (!guard.isValid()) { // The session was destroyed before we received the response (see // implementation notes at top of this file for explanation). @@ -518,7 +518,7 @@ void QueueSessionManager::dispatchErrorCallback( QueueSessionManager::QueueSessionManager( mqbi::DispatcherClient* dispatcherClient, const bmqp_ctrlmsg::ClientIdentity& clientIdentity, - mwcst::StatContext* statContext, + bmqst::StatContext* statContext, mqbi::DomainFactory* domainFactory, bslma::Allocator* allocator) : d_dispatcherClient_p(dispatcherClient) @@ -526,8 +526,8 @@ QueueSessionManager::QueueSessionManager( , d_domainFactory_p(domainFactory) , d_allocator_p(allocator) , d_shutdownInProgress(false) -, d_validator_sp(new (*allocator) mwcu::AtomicValidator(), allocator) -, d_requesterContext_sp(new (*allocator) +, d_validator_sp(new(*allocator) bmqu::AtomicValidator(), allocator) +, d_requesterContext_sp(new(*allocator) mqbi::QueueHandleRequesterContext(allocator), allocator) { diff --git a/src/groups/mqb/mqbblp/mqbblp_queuesessionmanager.h b/src/groups/mqb/mqbblp/mqbblp_queuesessionmanager.h index 223b9029b..a4dbb6fd5 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queuesessionmanager.h +++ b/src/groups/mqb/mqbblp/mqbblp_queuesessionmanager.h @@ -35,8 +35,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -63,7 +62,7 @@ class DispatcherClient; namespace mqbstat { class QueueStatsClient; } -namespace mwcst { +namespace bmqst { class StatContext; } @@ -165,7 +164,7 @@ class QueueSessionManager { // Dispatcher client to use, held not // owned - mwcst::StatContext* d_statContext_p; + bmqst::StatContext* d_statContext_p; // StatContext to use, held not owned mqbi::DomainFactory* d_domainFactory_p; @@ -183,7 +182,7 @@ class QueueSessionManager { // sort should be delivered to the // client. - mwcu::AtomicValidatorSp d_validator_sp; + bmqu::AtomicValidatorSp d_validator_sp; // Object validator used in callbacks, // to avoid executing a callback if the // session has been destroyed: this is @@ -239,7 +238,7 @@ class QueueSessionManager { const ErrorCallback& errorCallback, const bmqt::Uri& uri, const bmqp_ctrlmsg::ControlMessage& request, - const mwcu::AtomicValidatorSp& validator); + const bmqu::AtomicValidatorSp& validator); /// Callback invoked in response to an open domain request (in the /// specified `controlMessage`) made to the domain manager, for the @@ -255,7 +254,7 @@ class QueueSessionManager { const ErrorCallback& errorCallback, const bmqt::Uri& uri, const bmqp_ctrlmsg::ControlMessage& request, - const mwcu::AtomicValidatorSp& validator); + const bmqu::AtomicValidatorSp& validator); void onQueueOpenCb( const bmqp_ctrlmsg::Status& status, @@ -264,7 +263,7 @@ class QueueSessionManager { const mqbi::Domain::OpenQueueConfirmationCookie& confirmationCookie, const GetHandleCallback& responseCallback, const bmqp_ctrlmsg::ControlMessage& request, - const mwcu::AtomicValidatorSp& validator); + const bmqu::AtomicValidatorSp& validator); /// Callback invoked in response to an open queue request (in the /// specified `controlMessage`). If the specified `status` is SUCCESS, @@ -288,7 +287,7 @@ class QueueSessionManager { const CloseHandleCallback& successCallback, const ErrorCallback& errorCallback, const bmqp_ctrlmsg::ControlMessage& request, - const mwcu::AtomicValidatorSp& validator); + const bmqu::AtomicValidatorSp& validator); /// Callback invoked by the queue engine in response to a /// `QueueHandle::release` call for the specified `handle`. If the @@ -322,7 +321,7 @@ class QueueSessionManager { /// Create a `QueueSessionManager` object. QueueSessionManager(mqbi::DispatcherClient* dispatcherClient, const bmqp_ctrlmsg::ClientIdentity& clientIdentity, - mwcst::StatContext* statContext, + bmqst::StatContext* statContext, mqbi::DomainFactory* domainFactory, bslma::Allocator* allocator); diff --git a/src/groups/mqb/mqbblp/mqbblp_queuestate.cpp b/src/groups/mqb/mqbblp/mqbblp_queuestate.cpp index 864c090fb..e262b6f28 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queuestate.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_queuestate.cpp @@ -29,9 +29,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -204,7 +203,7 @@ void QueueState::loadInternals(mqbcmd::QueueState* out) const // PRECONDITIONS BSLS_ASSERT_SAFE(d_queue_p->dispatcher()->inDispatcherThread(d_queue_p)); - mwcu::MemOutStream os; + bmqu::MemOutStream os; out->uri() = d_uri.asString(); os << d_handleParameters; diff --git a/src/groups/mqb/mqbblp/mqbblp_queuestate.h b/src/groups/mqb/mqbblp/mqbblp_queuestate.h index 131ae6927..1d2468d4c 100644 --- a/src/groups/mqb/mqbblp/mqbblp_queuestate.h +++ b/src/groups/mqb/mqbblp/mqbblp_queuestate.h @@ -102,7 +102,7 @@ class QueueState { bmqp_ctrlmsg::QueueHandleParameters> SubQueuesHandleParameters; - typedef mwcc::Array, + typedef bmqc::Array, bmqp::Protocol::k_SUBID_ARRAY_STATIC_LEN> SubQueues; diff --git a/src/groups/mqb/mqbblp/mqbblp_recoverymanager.cpp b/src/groups/mqb/mqbblp/mqbblp_recoverymanager.cpp index f6c0842a3..9aa99c4c2 100644 --- a/src/groups/mqb/mqbblp/mqbblp_recoverymanager.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_recoverymanager.cpp @@ -39,13 +39,12 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -561,7 +560,7 @@ void RecoveryManager::recoveryStatusDispatched(int partitionId) return; // RETURN } - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], recovery not completed " << "after maximum stipulated time of " @@ -573,7 +572,7 @@ void RecoveryManager::recoveryStatusDispatched(int partitionId) ? recoveryCtx.recoveryPeer()->nodeDescription() : "** none **") << ". It was attempt #" << recoveryCtx.numAttempts() << "." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; // TBD: cancel the recovery. @@ -613,7 +612,7 @@ void RecoveryManager::primarySyncStatusDispatched(int partitionId) return; // RETURN } - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], primary sync not " << "completed after maximum stipulated time of " @@ -621,7 +620,7 @@ void RecoveryManager::primarySyncStatusDispatched(int partitionId) .syncConfig() .masterSyncMaxDurationMs() << " milliseconds. Cancelling on-going primary sync." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; // TBD: cancel primary sync @@ -770,12 +769,12 @@ void RecoveryManager::sendStorageSyncRequesterHelper(RecoveryContext* context, // Request failed to encode/be sent; process error handling (note that // 'onStorageSyncResponse' won't be invoked in this case). - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], failed to send " << "storage sync request to node " << context->recoveryPeer()->nodeDescription() << ", rc: " << status - << ". No retry attempt will be made." << MWCTSK_ALARMLOG_END; + << ". No retry attempt will be made." << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -790,7 +789,7 @@ void RecoveryManager::sendStorageSyncRequesterHelper(RecoveryContext* context, // an event to check recovery status. if (1 == context->numAttempts()) { - bsls::TimeInterval after(mwcsys::Time::nowMonotonicClock()); + bsls::TimeInterval after(bmqsys::Time::nowMonotonicClock()); after.addMilliseconds(d_clusterConfig.partitionConfig() .syncConfig() .startupRecoveryMaxDurationMs()); @@ -902,7 +901,7 @@ void RecoveryManager::onStorageSyncResponseDispatched( .syncConfig() .maxAttemptsStorageSync(); if (maxAttempts == recoveryCtx.numAttempts()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], received storage sync failure response: " @@ -910,7 +909,7 @@ void RecoveryManager::onStorageSyncResponseDispatched( << " from node: " << responder->nodeDescription() << " for request: " << req << ". Exhausted max attempts for " << "storage sync: " << maxAttempts - << ". No retry attempt will be made." << MWCTSK_ALARMLOG_END; + << ". No retry attempt will be made." << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -967,14 +966,14 @@ void RecoveryManager::onStorageSyncResponseDispatched( .storageSyncResponse(); if (response.partitionId() != partitionId) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], invalid partitionId" << " specified in storage sync response: " << response << " from node: " << responder->nodeDescription() << " for storage sync request: " << req << ". No retry attempt will be made. It was attempt #" - << recoveryCtx.numAttempts() << "." << MWCTSK_ALARMLOG_END; + << recoveryCtx.numAttempts() << "." << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -985,14 +984,14 @@ void RecoveryManager::onStorageSyncResponseDispatched( if (response.storageSyncResponseType() == bmqp_ctrlmsg::StorageSyncResponseType::E_UNDEFINED) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], invalid " << "storage-sync response type specified: " << response << " from node: " << responder->nodeDescription() << " for storage sync request: " << req << ". No retry attempt will be made. It was attempt #" - << recoveryCtx.numAttempts() << "." << MWCTSK_ALARMLOG_END; + << recoveryCtx.numAttempts() << "." << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -1035,12 +1034,12 @@ void RecoveryManager::onStorageSyncResponseDispatched( const bmqp_ctrlmsg::SyncPoint& endSp = response.endSyncPoint(); if (endSp <= beginSp) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], received incorrect sync points in storage sync response" << " type: " << rtype << ". Begin sync point: " << beginSp - << ", end sync point: " << endSp << MWCTSK_ALARMLOG_END; + << ", end sync point: " << endSp << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -1051,13 +1050,13 @@ void RecoveryManager::onStorageSyncResponseDispatched( if ((0 != recoveryCtx.newSyncPointOffset() && endSp < recoveryCtx.newSyncPoint())) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], received " << "incorrect end sync point in storage sync response type: " << rtype << ". End sync point: " << endSp << ", 'B' sync point: " << recoveryCtx.newSyncPoint() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -1067,13 +1066,13 @@ void RecoveryManager::onStorageSyncResponseDispatched( } if (endSp < recoveryCtx.oldSyncPoint()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], received " << "incorrect end sync point in storage sync response type: " << rtype << ". End sync point: " << endSp << ", 'A' sync point: " << recoveryCtx.oldSyncPoint() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -1178,7 +1177,7 @@ void RecoveryManager::onStorageSyncResponseDispatched( .setQlistFile(qlistFileName) .setQlistFileSize(d_dataStoreConfig.maxQlistFileSize()); - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; rc = mqbs::FileStoreUtil::openFileSetWriteMode( errorDesc, fileSet, @@ -1189,12 +1188,12 @@ void RecoveryManager::onStorageSyncResponseDispatched( &recoveryCtx.qlistFd(), d_dataStoreConfig.hasPrefaultPages()); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], " << "failed to create file set: " << fileSet << ", rc: " << rc << ", reason: " << errorDesc.str() << ", during recovery." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); return; // RETURN @@ -1220,12 +1219,12 @@ void RecoveryManager::onStorageSyncResponseDispatched( const bmqp_ctrlmsg::SyncPoint& endSp = response.endSyncPoint(); if (endSp <= beginSp) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], received " << "incorrect sync points in storage sync response type: " << rtype << ". Begin sync point: " << beginSp - << ", end sync point: " << endSp << MWCTSK_ALARMLOG_END; + << ", end sync point: " << endSp << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -1235,13 +1234,13 @@ void RecoveryManager::onStorageSyncResponseDispatched( } if (beginSp != recoveryCtx.oldSyncPoint()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], received " << "incorrect sync points in storage sync response type: " << rtype << ". Begin sync point: " << beginSp << ", 'A' sync point: " << recoveryCtx.oldSyncPoint() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); return; // RETURN @@ -1249,13 +1248,13 @@ void RecoveryManager::onStorageSyncResponseDispatched( if (0 != recoveryCtx.newSyncPointOffset() && (recoveryCtx.newSyncPoint() != endSp)) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], received " << "incorrect sync points in storage sync response type: " << rtype << ". End sync point: " << endSp << ", 'B' sync point: " << recoveryCtx.newSyncPoint() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -1288,7 +1287,7 @@ void RecoveryManager::onStorageSyncResponseDispatched( } } - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; recoveryCtx.fileSet() .setJournalFileSize(d_dataStoreConfig.maxJournalFileSize()) .setDataFileSize(d_dataStoreConfig.maxDataFileSize()) @@ -1304,12 +1303,12 @@ void RecoveryManager::onStorageSyncResponseDispatched( &recoveryCtx.qlistFd(), d_dataStoreConfig.hasPrefaultPages()); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], failed to open file set: " << recoveryCtx.fileSet() << ", rc: " << rc << ", reason: " << errorDesc.str() - << ", during recovery." << MWCTSK_ALARMLOG_END; + << ", during recovery." << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); return; // RETURN @@ -1353,18 +1352,18 @@ void RecoveryManager::onPartitionRecoveryStatus(int partitionId, int status) << d_clusterData_p->identity().description() << " Partition [" << partitionId << "]: truncating & closing partition with sizes: " << "journal: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( recoveryCtx.journalFileOffset())) << ", data: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( recoveryCtx.dataFileOffset())) << ", qlist: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( recoveryCtx.qlistFileOffset())); // Truncate the files to correct size (recall that they were opened // with max configured size). - mwcu::MemOutStream dummy; + bmqu::MemOutStream dummy; mqbs::FileSystemUtil::truncate(&recoveryCtx.journalFd(), recoveryCtx.journalFileOffset(), dummy); @@ -1855,7 +1854,7 @@ void RecoveryManager::syncPeerPartitions(PrimarySyncContext* primarySyncCtx) FileTransferInfo& fti = primarySyncCtx->fileTransferInfo(); BSLS_ASSERT_SAFE(false == fti.areFilesMapped()); - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc = mqbs::FileStoreUtil::openFileSetReadMode(errorDesc, fileSet, &fti.journalFd(), @@ -1863,12 +1862,12 @@ void RecoveryManager::syncPeerPartitions(PrimarySyncContext* primarySyncCtx) &fti.qlistFd()); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData_p->identity().description() << " Partition [" << pid << "]: Failed to open JOURNAL/QLIST/DATA file, rc: " << rc << ", reason [" << errorDesc.str() << "] while new primary (self)" << " is initiating partition-sync with peers." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -1907,12 +1906,12 @@ void RecoveryManager::syncPeerPartitions(PrimarySyncContext* primarySyncCtx) << pps.peer()->nodeDescription(); } else { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " Partition [" << pid << "]: new primary (self) failed to sync partition with peer: " << pps.peer()->nodeDescription() << ", rc: " << rc << "." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } } } @@ -2049,14 +2048,14 @@ int RecoveryManager::syncPeerPartition(PrimarySyncContext* primarySyncCtx, if (fti.journalFd().fileSize() < minJournalSize) { // Yikes, this is bad. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " Partition [" << pid << "] Encountered invalid sync point JOURNAL offset: " << journalSpOffset << ", JOURNAL size: " << fti.journalFd().fileSize() << ", sync point: " << spOffsetPair.syncPoint() << ", when " << "new primary (self) is initiating partition-sync with peer:" - << ppState.peer()->nodeDescription() << MWCTSK_ALARMLOG_END; + << ppState.peer()->nodeDescription() << BMQTSK_ALARMLOG_END; return rc_INVALID_JOURNAL_OFFSET; // RETURN } @@ -2083,13 +2082,13 @@ int RecoveryManager::syncPeerPartition(PrimarySyncContext* primarySyncCtx, if (fti.qlistFd().fileSize() < qlistMapOffset) { // Yikes, this is bad. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " Partition [" << pid << "]: Invalid QLIST offset in sync point: " << spOffsetPair.syncPoint() << ". Current QLIST file size: " << fti.qlistFd().fileSize() << ", while syncing peer: " << ppState.peer()->nodeDescription() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_QLIST_OFFSET; // RETURN } @@ -2101,13 +2100,13 @@ int RecoveryManager::syncPeerPartition(PrimarySyncContext* primarySyncCtx, if (fti.dataFd().fileSize() < dataMapOffset) { // Yikes, this is bad. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " Partition [" << pid << "]: Invalid DATA offset in sync point: " << spOffsetPair.syncPoint() << ". Current DATA file size: " << fti.dataFd().fileSize() << ", while syncing peer: " << ppState.peer()->nodeDescription() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_DATA_OFFSET; // RETURN } @@ -2119,12 +2118,12 @@ int RecoveryManager::syncPeerPartition(PrimarySyncContext* primarySyncCtx, selfSequenceNum, journalSpOffset); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " Partition [" << pid << "]: New primary (self) failed to " << "replay partition while syncing partition in peer: " << ppState.peer()->nodeDescription() << ", rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_REPLAY_FAILURE * 10 + rc; // RETURN } @@ -2133,7 +2132,7 @@ int RecoveryManager::syncPeerPartition(PrimarySyncContext* primarySyncCtx, bool RecoveryManager::hasSyncPoint(bmqp_ctrlmsg::SyncPoint* syncPoint, mqbs::RecordHeader* syncPointRecHeader, - mwcu::BlobPosition* syncPointHeaderPosition, + bmqu::BlobPosition* syncPointHeaderPosition, int* messageNumber, bsls::Types::Uint64* journalOffset, int partitionId, @@ -2171,34 +2170,34 @@ bool RecoveryManager::hasSyncPoint(bmqp_ctrlmsg::SyncPoint* syncPoint, // sub-type, it can be either. // Load the position of journal record. - mwcu::BlobPosition syncPointPosition; + bmqu::BlobPosition syncPointPosition; int rc = iter.loadDataPosition(&syncPointPosition); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "]" << ", failed to load JOURNAL_OP record position in storage " << "message from " << source->nodeDescription() << ", rc: " << rc << ". Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; continue; // CONTINUE } // Load the JOURNAL_OP record. - mwcu::BlobObjectProxy journalOpRec( + bmqu::BlobObjectProxy journalOpRec( blob.get(), syncPointPosition, true, // read false); // write if (!journalOpRec.isSet()) { // Should never happen. - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "]" << ", failed to load JournalOp record in storage message from " << source->nodeDescription() << ". Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; continue; // CONTINUE } @@ -2224,7 +2223,7 @@ bool RecoveryManager::hasSyncPoint(bmqp_ctrlmsg::SyncPoint* syncPoint, // This should not occur. Per BlazingMQ replication algo, only a // JournalOp record of type SYNCPOINT should be encountered. - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "]" << ", received a JOURNAL_OP record of type " @@ -2233,13 +2232,13 @@ bool RecoveryManager::hasSyncPoint(bmqp_ctrlmsg::SyncPoint* syncPoint, << "sequence number (" << syncPointRecHeader->primaryLeaseId() << ", " << syncPointRecHeader->sequenceNumber() << "), from " << source->nodeDescription() << ". Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; continue; // CONTINUE } if (mqbs::SyncPointType::e_UNDEFINED == journalOpRec->syncPointType()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For partition [" << partitionId << "]" << ", received a syncPoint record of UNDEFINED type (expected " @@ -2247,7 +2246,7 @@ bool RecoveryManager::hasSyncPoint(bmqp_ctrlmsg::SyncPoint* syncPoint, << "number (" << syncPointRecHeader->primaryLeaseId() << ", " << syncPointRecHeader->sequenceNumber() << "), from " << source->nodeDescription() << ". Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; continue; // CONTINUE } @@ -2287,10 +2286,10 @@ bool RecoveryManager::hasSyncPoint(bmqp_ctrlmsg::SyncPoint* syncPoint, // look at the above comment or see // 'FileStore::writeJournalRecord'. - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() - << " Partition [" << partitionId << "]: " - << "received a SyncPt record with mismatched " + << " Partition [" << partitionId + << "]: " << "received a SyncPt record with mismatched " << "sequence numbers. Sequence number in RecordHeader (" << syncPointRecHeader->primaryLeaseId() << ", " << syncPointRecHeader->sequenceNumber() @@ -2298,7 +2297,7 @@ bool RecoveryManager::hasSyncPoint(bmqp_ctrlmsg::SyncPoint* syncPoint, << journalOpRec->primaryLeaseId() << ", " << journalOpRec->sequenceNum() << "). Source: " << source->nodeDescription() - << ". Ignoring this message." << MWCTSK_ALARMLOG_END; + << ". Ignoring this message." << BMQTSK_ALARMLOG_END; continue; // CONTINUE } } @@ -2355,7 +2354,7 @@ bool RecoveryManager::hasSyncPoint(bmqp_ctrlmsg::SyncPoint* syncPoint, bmqp::Protocol::k_WORD_SIZE; return true; // RETURN - } // end 'while' loop + } // end 'while' loop return false; } @@ -2621,12 +2620,12 @@ void RecoveryManager::onPartitionSyncStateQueryResponseDispatched( // Request failed to encode/be sent; process error handling (note that // 'onPartitionSyncDataQueryResponse' won't be invoked in this case). - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], failed to send " << "partition sync data query to node " << maxSeqNode->nodeDescription() << ", rc: " << status - << ". No retry attempt will be made." << MWCTSK_ALARMLOG_END; + << ". No retry attempt will be made." << BMQTSK_ALARMLOG_END; onPartitionPrimarySyncStatus(partitionId, -1 /* status */); @@ -2688,14 +2687,14 @@ void RecoveryManager::onPartitionSyncDataQueryResponseDispatched( .partitionSyncDataQuery(); if (context->response().choice().isStatusValue()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << " Partition [" << partitionId << "]: " << "received partition sync data query failure response: " << context->response().choice().status() << " from node: " << responder->nodeDescription() << " for request: " << req << ". No retry attempt will be made." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; onPartitionPrimarySyncStatus(partitionId, -1 /* status */); @@ -2719,13 +2718,13 @@ void RecoveryManager::onPartitionSyncDataQueryResponseDispatched( .partitionSyncDataQueryResponse(); if (response.partitionId() != partitionId) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << " Partition [" << partitionId << "]: " << "invalid partitionId specified in response: " << response << " from node: " << responder->nodeDescription() << " for partition sync data request: " << req - << ". No retry attempt will be made." << MWCTSK_ALARMLOG_END; + << ". No retry attempt will be made." << BMQTSK_ALARMLOG_END; onPartitionPrimarySyncStatus(partitionId, -1 /* status */); @@ -2766,7 +2765,7 @@ void RecoveryManager::onPartitionSyncDataQueryResponseDispatched( peerPartitionSeqNum.sequenceNumber() = response.endSequenceNum(); if (peerPartitionSeqNum <= primarySyncCtx.selfPartitionSequenceNum()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << " Partition [" << partitionId << "]: " << "invalid partition sequenceNum specified in response: " @@ -2774,7 +2773,7 @@ void RecoveryManager::onPartitionSyncDataQueryResponseDispatched( << " for partition sync data request: " << req << ". Self partition seqNum: " << primarySyncCtx.selfPartitionSequenceNum() - << "No retry attempt will be made." << MWCTSK_ALARMLOG_END; + << "No retry attempt will be made." << BMQTSK_ALARMLOG_END; onPartitionPrimarySyncStatus(partitionId, -1 /* status */); // TBD: reschedule partition sync. @@ -2953,7 +2952,7 @@ void RecoveryManager::startRecovery( << "], will check after " << startupWaitMs << " millisec " << "if any sync point has been received by then."; - bsls::TimeInterval after(mwcsys::Time::nowMonotonicClock()); + bsls::TimeInterval after(bmqsys::Time::nowMonotonicClock()); after.addMilliseconds(startupWaitMs); d_clusterData_p->scheduler().scheduleEvent( &recoveryCtx.recoveryStartupWaitHandle(), @@ -2967,7 +2966,7 @@ void RecoveryManager::startRecovery( const int k_MAX_NUM_FILE_SETS_TO_CHECK = 2; int rc = 0; - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; bsls::Types::Uint64 journalFilePos; bsls::Types::Uint64 dataFilePos; @@ -2985,13 +2984,13 @@ void RecoveryManager::startRecovery( &recoveryCtx.qlistFd()); if ((rc != 0) && (rc != 1)) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], failed to find or " << "open a recoverable file set, rc: " << rc << ", reason: " << errorDesc.str() << ". Recovery will proceed as if this node had no local " - << "recoverable files for this partition." << MWCTSK_ALARMLOG_END; + << "recoverable files for this partition." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -3036,13 +3035,13 @@ void RecoveryManager::startRecovery( << "], rc: " << rc; } - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], " << "failed to load iterator(s) for recoverable file set, " << "rc: " << rc << ", reason: " << errorDesc.str() << ". Recovery will proceed as if this node had no local " - << "recoverable files for this partition." << MWCTSK_ALARMLOG_END; + << "recoverable files for this partition." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -3064,7 +3063,7 @@ void RecoveryManager::startRecovery( BALL_LOG_INFO << d_clusterData_p->identity().description() << " Partition [" << partitionId << "]: Potential last sync point offset retrieved at: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(lastSyncPointOffset)); // Check for the validity of the retrieved old sync point. @@ -3073,13 +3072,13 @@ void RecoveryManager::startRecovery( BSLS_ASSERT_SAFE(mqbs::JournalOpType::e_SYNCPOINT == journalOpRec.type()); if (mqbs::SyncPointType::e_UNDEFINED == journalOpRec.syncPointType()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], last sync point has" << " invalid SyncPt sub-type: " << journalOpRec.syncPointType() << ". Ignoring this sync point. Recovery will proceed as if this " << "node had no local recoverable files for this partition." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -3101,7 +3100,7 @@ void RecoveryManager::startRecovery( if (0 == journalOpRec.primaryLeaseId() || 0 == journalOpRec.sequenceNum()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], " << "last sync point has invalid primaryLeaseId: " @@ -3109,7 +3108,7 @@ void RecoveryManager::startRecovery( << " or sequenceNum: " << journalOpRec.sequenceNum() << ". Ignoring this sync point. Recovery will proceed as if this " << "node had no local recoverable files for this partition." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -3119,7 +3118,7 @@ void RecoveryManager::startRecovery( if (bdls::FilesystemUtil::getFileSize(recoveryCtx.fileSet().dataFile()) < static_cast(dataFileOffset)) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], data file size is " << "smaller than data file offset present in last sync point [" @@ -3127,7 +3126,7 @@ void RecoveryManager::startRecovery( recoveryCtx.fileSet().dataFile()) << " < " << dataFileOffset << "]. Ignoring this sync point. " << "Recovery will proceed as if this node had no local recoverable" - << " files for this partition." << MWCTSK_ALARMLOG_END; + << " files for this partition." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -3137,7 +3136,7 @@ void RecoveryManager::startRecovery( if (bdls::FilesystemUtil::getFileSize(recoveryCtx.fileSet().qlistFile()) < static_cast(qlistFileOffset)) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], QLIST file size is " << "smaller than QLIST file offset present in last sync point [" @@ -3145,7 +3144,7 @@ void RecoveryManager::startRecovery( recoveryCtx.fileSet().qlistFile()) << " < " << qlistFileOffset << "]. Ignoring this sync point. " << "Recovery will proceed as if this node had no local recoverable" - << " files for this partition." << MWCTSK_ALARMLOG_END; + << " files for this partition." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -3166,7 +3165,7 @@ void RecoveryManager::startRecovery( BALL_LOG_INFO << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], retrieved " << "old SyncPt at journal offset: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(lastSyncPointOffset)) << ". SyncPt details: " << syncPoint << ". Sequence number is SyncPt's RecordHeader (" @@ -3227,7 +3226,7 @@ void RecoveryManager::processStorageEvent( // 'blob' to see if there is a sync point. bmqp_ctrlmsg::SyncPoint syncPoint; - mwcu::BlobPosition syncPointHeaderPosition; + bmqu::BlobPosition syncPointHeaderPosition; int msgNumber = 0; bsls::Types::Uint64 primaryJournalOffset = 0; mqbs::RecordHeader syncPointRecHeader; @@ -3282,14 +3281,14 @@ void RecoveryManager::processStorageEvent( iter.header().messageWords() * bmqp::Protocol::k_WORD_SIZE); if (bmqt::EventBuilderResult::e_SUCCESS != buildRc) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], " << "failed to build first buffered storage event after " << "encountering sync point: " << syncPoint << " from node: " << source->nodeDescription() << ", rc: " << buildRc << ". Ignoring sync point." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } } @@ -3335,7 +3334,7 @@ void RecoveryManager::processRecoveryEvent( RecoveryContext& recoveryCtx = d_recoveryContexts[partitionId]; if (source != recoveryCtx.recoveryPeer()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], received recovery event from node " << source->nodeDescription() @@ -3343,7 +3342,7 @@ void RecoveryManager::processRecoveryEvent( << (recoveryCtx.recoveryPeer() ? recoveryCtx.recoveryPeer()->nodeDescription() : "** null **") - << ". Ignoring this event." << MWCTSK_ALARMLOG_END; + << ". Ignoring this event." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -3381,14 +3380,14 @@ void RecoveryManager::processRecoveryEvent( (void)isJournal; // Compiler happiness if (header.fileChunkType() != recoveryCtx.expectedChunkFileType()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], received incorrect file chunk type: " << header.fileChunkType() << ", expected: " << recoveryCtx.expectedChunkFileType() << ", from: " << source->nodeDescription() - << ". Stopping recovery." << MWCTSK_ALARMLOG_END; + << ". Stopping recovery." << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -3404,14 +3403,14 @@ void RecoveryManager::processRecoveryEvent( 1; if (header.chunkSequenceNumber() != expectedSeqNum) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], received incorrect chunk sequence " << "number: " << header.chunkSequenceNumber() << ", expected: " << expectedSeqNum << ", from: " << source->nodeDescription() - << ". Stopping recovery." << MWCTSK_ALARMLOG_END; + << ". Stopping recovery." << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -3423,18 +3422,18 @@ void RecoveryManager::processRecoveryEvent( return; // RETURN } - mwcu::BlobPosition chunkPosition; + bmqu::BlobPosition chunkPosition; int rc = iter.loadChunkPosition(&chunkPosition); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "]," << " failed to load chunk position, rc: " << rc << ". Chunk type: " << header.fileChunkType() << ", chunk sequence number: " << header.chunkSequenceNumber() << ", from: " << source->nodeDescription() - << ". Stopping recovery." << MWCTSK_ALARMLOG_END; + << ". Stopping recovery." << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -3463,7 +3462,7 @@ void RecoveryManager::processRecoveryEvent( chunkPosition, chunkSize); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], " << "failed to calculate MD5 digest, " << "rc: " << rc @@ -3471,7 +3470,7 @@ void RecoveryManager::processRecoveryEvent( << ", chunk sequence number: " << header.chunkSequenceNumber() << ", from: " << source->nodeDescription() - << ". Stopping recovery." << MWCTSK_ALARMLOG_END; + << ". Stopping recovery." << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -3487,7 +3486,7 @@ void RecoveryManager::processRecoveryEvent( if (0 != bsl::memcmp(md5Digest.buffer(), header.md5Digest(), bmqp::RecoveryHeader::k_MD5_DIGEST_LEN)) { - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << d_clusterData_p->identity().description() << ": For Partition [" << partitionId << "], chunk MD5 digest mismatch. Calculated: "; @@ -3510,8 +3509,8 @@ void RecoveryManager::processRecoveryEvent( << ", from: " << source->nodeDescription() << ". Stopping recovery."; - MWCTSK_ALARMLOG_ALARM("RECOVERY") - << out.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_ALARM("RECOVERY") + << out.str() << BMQTSK_ALARMLOG_END; onPartitionRecoveryStatus(partitionId, -1 /* status */); @@ -3548,7 +3547,7 @@ void RecoveryManager::processRecoveryEvent( BSLS_ASSERT_SAFE(mfd); if (0 != chunkSize) { - mwcu::BlobUtil::copyToRawBufferFromIndex(mfd->block().base() + + bmqu::BlobUtil::copyToRawBufferFromIndex(mfd->block().base() + offset, *blob, chunkPosition.buffer(), @@ -3863,13 +3862,13 @@ void RecoveryManager::processStorageSyncRequest( if (ysp < bsp) { // Error, peer is behind. - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": Received newer sync point from " << source->nodeDescription() << " in its storage sync request. Self's newest sync point: " << ysp << ". This implies this node is behind despite being AVAILABLE." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; bmqp_ctrlmsg::Status& status = controlMsg.choice().makeStatus(); status.category() = bmqp_ctrlmsg::StatusCategory::E_UNKNOWN; @@ -3885,7 +3884,7 @@ void RecoveryManager::processStorageSyncRequest( // data, qlist and journal files from the file store and map them. mqbs::FileStoreSet fileSet; - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; fs->loadCurrentFiles(&fileSet); int rc = mqbs::FileStoreUtil::openFileSetReadMode(errorDesc, @@ -3895,12 +3894,12 @@ void RecoveryManager::processStorageSyncRequest( &fti.qlistFd()); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData_p->identity().description() << ": Failed to open one of JOURNAL/QLIST/DATA file, rc: " << rc << ", reason [" << errorDesc.str() << "] while serving storage sync request from: " - << source->nodeDescription() << MWCTSK_ALARMLOG_END; + << source->nodeDescription() << BMQTSK_ALARMLOG_END; bmqp_ctrlmsg::Status& status = controlMsg.choice().makeStatus(); status.category() = bmqp_ctrlmsg::StatusCategory::E_UNKNOWN; @@ -4004,12 +4003,12 @@ void RecoveryManager::processStorageSyncRequest( bsp, SyncPointOffsetPairComparator()); if (retB.first == retB.second) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": End sync point (B) not found: " << bsp << ", while serving storage sync request: " << req << ", from: " << source->nodeDescription() - << ". Sending error." << MWCTSK_ALARMLOG_END; + << ". Sending error." << BMQTSK_ALARMLOG_END; bmqp_ctrlmsg::Status& status = controlMsg.choice().makeStatus(); status.category() = bmqp_ctrlmsg::StatusCategory::E_UNKNOWN; @@ -4099,12 +4098,12 @@ void RecoveryManager::processStorageSyncRequest( << "]: done with search."; if (rcPair.first == rcPair.second) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": End sync point (max(X, B)) not found: " << endSpOffset << ", while serving storage sync request: " << req << ", from: " << source->nodeDescription() - << ". Sending error." << MWCTSK_ALARMLOG_END; + << ". Sending error." << BMQTSK_ALARMLOG_END; bmqp_ctrlmsg::Status& status = controlMsg.choice().makeStatus(); status.category() = bmqp_ctrlmsg::StatusCategory::E_UNKNOWN; @@ -4162,7 +4161,7 @@ void RecoveryManager::processStorageSyncRequest( BALL_LOG_INFO << d_clusterData_p->identity().description() << " Partition [" << req.partitionId() << "]: sending DATA patch/file of size: " - << mwcu::PrintUtil::prettyNumber(dataFileSize) << " bytes."; + << bmqu::PrintUtil::prettyNumber(dataFileSize) << " bytes."; const int fileChunkSize = d_clusterConfig.partitionConfig().syncConfig().fileChunkSize(); @@ -4172,14 +4171,13 @@ void RecoveryManager::processStorageSyncRequest( fileChunkSize, bmqp::RecoveryFileChunkType::e_DATA); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": Failed to send DATA file/patch to " << source->nodeDescription() << ", while serving storage sync request: " << req << ", from: " << source->nodeDescription() << ". [rc: " << rc - << "]. " - << "Sending error." << MWCTSK_ALARMLOG_END; + << "]. " << "Sending error." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -4190,7 +4188,7 @@ void RecoveryManager::processStorageSyncRequest( BALL_LOG_INFO << d_clusterData_p->identity().description() << " Partition [" << req.partitionId() << "]: sending QLIST file/patch of size: " - << mwcu::PrintUtil::prettyNumber(qlistFileSize) << " bytes."; + << bmqu::PrintUtil::prettyNumber(qlistFileSize) << " bytes."; rc = sendFile(&requestCtx, qlistFileBeginOffset, @@ -4198,14 +4196,13 @@ void RecoveryManager::processStorageSyncRequest( fileChunkSize, bmqp::RecoveryFileChunkType::e_QLIST); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": Failed to send QLIST file/patch to " << source->nodeDescription() << ", while serving storage sync request: " << req << ", from: " << source->nodeDescription() << ". [rc: " << rc - << "]. " - << "Sending error." << MWCTSK_ALARMLOG_END; + << "]. " << "Sending error." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -4216,7 +4213,7 @@ void RecoveryManager::processStorageSyncRequest( BALL_LOG_INFO << d_clusterData_p->identity().description() << " Partition [" << req.partitionId() << "]: sending JOURNAL file/patch of size: " - << mwcu::PrintUtil::prettyNumber(journalFileSize) + << bmqu::PrintUtil::prettyNumber(journalFileSize) << " bytes."; rc = sendFile(&requestCtx, @@ -4225,14 +4222,13 @@ void RecoveryManager::processStorageSyncRequest( fileChunkSize, bmqp::RecoveryFileChunkType::e_JOURNAL); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": Failed to send JOURNAL file/patch to " << source->nodeDescription() << ", while serving storage sync request: " << req << ", from: " << source->nodeDescription() << ". [rc: " << rc - << "]. " - << "Sending error." << MWCTSK_ALARMLOG_END; + << "]. " << "Sending error." << BMQTSK_ALARMLOG_END; return; // RETURN } } @@ -4262,13 +4258,13 @@ void RecoveryManager::startPartitionPrimarySync( // sync as well. So we call 'partitionPrimarySyncCb' directly. TBD: // this case needs to be handled in a higher component. - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << " Partition [" << pid << "]: " << "primary sync is already under progress with " << (primarySyncCtx.syncPeer() ? primarySyncCtx.syncPeer()->nodeDescription() : "** null **") - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; partitionPrimarySyncCb(pid, -1 /* status */); } @@ -4311,7 +4307,7 @@ void RecoveryManager::startPartitionPrimarySync( // Currently, this routine doesn't return error, so we schedule an event // right away to fire 2 minute from now to check recovery status. - bsls::TimeInterval after(mwcsys::Time::nowMonotonicClock()); + bsls::TimeInterval after(bmqsys::Time::nowMonotonicClock()); after.addMilliseconds(d_clusterConfig.partitionConfig() .syncConfig() .masterSyncMaxDurationMs()); @@ -4646,7 +4642,7 @@ void RecoveryManager::processPartitionSyncDataRequest( minJournalSize) { // Yikes, this is bad. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " Partition [" << req.partitionId() << "]: Encountered invalid sync point JOURNAL offset: " @@ -4654,7 +4650,7 @@ void RecoveryManager::processPartitionSyncDataRequest( << ", JOURNAL size: " << fileSet.journalFileSize() << ", sync point: " << lastSpoPair.syncPoint() << ", while processing partition-sync" << " data request: " << req - << ", from: " << source->nodeDescription() << MWCTSK_ALARMLOG_END; + << ", from: " << source->nodeDescription() << BMQTSK_ALARMLOG_END; bmqp_ctrlmsg::Status& status = controlMsg.choice().makeStatus(); status.category() = bmqp_ctrlmsg::StatusCategory::E_REFUSED; @@ -4668,21 +4664,21 @@ void RecoveryManager::processPartitionSyncDataRequest( // Map JOURNAL file at appropriate offset. - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc = mqbs::FileStoreUtil::openFileSetReadMode(errorDesc, fileSet, &fti.journalFd(), &fti.dataFd(), &fti.qlistFd()); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData_p->identity().description() << " Partition [" << req.partitionId() << "]: Failed to open one of JOURNAL/QLIST/DATA file, rc: " << rc << ", reason [" << errorDesc.str() << "] while serving partition-sync data request: " << req << ", from node: " << source->nodeDescription() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; bmqp_ctrlmsg::Status& status = controlMsg.choice().makeStatus(); status.category() = bmqp_ctrlmsg::StatusCategory::E_UNKNOWN; @@ -4717,13 +4713,13 @@ void RecoveryManager::processPartitionSyncDataRequest( qlistMapOffset) { // Yikes, this is bad. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " Partition [" << req.partitionId() << "]: Invalid QLIST [" << fileSet.qlistFile() << "] offset in sync point: " << lastSpoPair.syncPoint() << ". Current QLIST file size: " << fileSet.qlistFileSize() << ". Error encountered while serving partition-sync data request " - << "from: " << source->nodeDescription() << MWCTSK_ALARMLOG_END; + << "from: " << source->nodeDescription() << BMQTSK_ALARMLOG_END; bmqp_ctrlmsg::Status& status = controlMsg.choice().makeStatus(); status.category() = bmqp_ctrlmsg::StatusCategory::E_REFUSED; @@ -4742,13 +4738,13 @@ void RecoveryManager::processPartitionSyncDataRequest( dataMapOffset) { // Yikes, this is bad. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " Partition [" << req.partitionId() << "]: Invalid DATA [" << fileSet.dataFile() << "] offset in sync point: " << lastSpoPair.syncPoint() << ". Current DATA file size: " << fileSet.dataFileSize() << ". Error encountered while serving partition-sync data request " - << "from: " << source->nodeDescription() << MWCTSK_ALARMLOG_END; + << "from: " << source->nodeDescription() << BMQTSK_ALARMLOG_END; bmqp_ctrlmsg::Status& status = controlMsg.choice().makeStatus(); status.category() = bmqp_ctrlmsg::StatusCategory::E_REFUSED; @@ -4794,13 +4790,13 @@ void RecoveryManager::processPartitionSyncDataRequest( requesterUptoSeqNum, journalSpOffset); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " Partition [" << req.partitionId() << "]: Failed to replay partition while serving partition sync " << "request: " << req << ", from node: " << source->nodeDescription() << ", rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } // Send final notification indicating end of partition-sync-data query @@ -4879,11 +4875,11 @@ void RecoveryManager::processPartitionSyncDataRequestStatus( const bmqp_ctrlmsg::Status& status = queryStatus.status(); if (status.category() != bmqp_ctrlmsg::StatusCategory::E_SUCCESS) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << " Partition [" << queryStatus.partitionId() << "]: partition-sync with peer: " << source->nodeDescription() - << " failed with status: " << status << MWCTSK_ALARMLOG_END; + << " failed with status: " << status << BMQTSK_ALARMLOG_END; onPartitionPrimarySyncStatus(queryStatus.partitionId(), -1 /* status */); return; // RETURN diff --git a/src/groups/mqb/mqbblp/mqbblp_recoverymanager.h b/src/groups/mqb/mqbblp/mqbblp_recoverymanager.h index ef4994044..02120360c 100644 --- a/src/groups/mqb/mqbblp/mqbblp_recoverymanager.h +++ b/src/groups/mqb/mqbblp/mqbblp_recoverymanager.h @@ -43,8 +43,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -999,7 +998,7 @@ class RecoveryManager : public mqbnet::ClusterObserver { bool hasSyncPoint(bmqp_ctrlmsg::SyncPoint* syncPoint, mqbs::RecordHeader* syncPointRecHeader, - mwcu::BlobPosition* syncPointHeaderPosition, + bmqu::BlobPosition* syncPointHeaderPosition, int* messageNumber, bsls::Types::Uint64* journalOffset, int partitionId, diff --git a/src/groups/mqb/mqbblp/mqbblp_relayqueueengine.cpp b/src/groups/mqb/mqbblp/mqbblp_relayqueueengine.cpp index 8f3dd58d1..3b5ec9e8f 100644 --- a/src/groups/mqb/mqbblp/mqbblp_relayqueueengine.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_relayqueueengine.cpp @@ -37,11 +37,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -91,7 +90,7 @@ class LimitedPrinter { private: // DATA const bsl::size_t d_maxPrintBytes; - mwcu::MemOutStream d_out; + bmqu::MemOutStream d_out; // FRIENDS friend bsl::ostream& operator<<(bsl::ostream& stream, @@ -362,7 +361,7 @@ void RelayQueueEngine::onHandleReleased( const bsl::shared_ptr& proctor) { d_queueState_p->queue()->dispatcher()->execute( - bdlf::BindUtil::bind(mwcu::WeakMemFnUtil::weakMemFn( + bdlf::BindUtil::bind(bmqu::WeakMemFnUtil::weakMemFn( &RelayQueueEngine::onHandleReleasedDispatched, d_self.acquireWeak()), status, @@ -662,7 +661,7 @@ void RelayQueueEngine::processAppRedelivery(unsigned int upstreamSubQueueId, if (delay != bsls::TimeInterval()) { app->scheduleThrottle( - mwcsys::Time::nowMonotonicClock() + delay, + bmqsys::Time::nowMonotonicClock() + delay, bdlf::BindUtil::bind(&RelayQueueEngine::processAppRedelivery, this, upstreamSubQueueId, @@ -797,7 +796,7 @@ void RelayQueueEngine::rebuildUpstreamState(Routers::AppContext* context, ++iter) { const bmqp_ctrlmsg::StreamParameters& streamParameters = iter->second.d_streamParameters; - mwcu::MemOutStream errorStream(d_allocator_p); + bmqu::MemOutStream errorStream(d_allocator_p); context->load(iter->first, &errorStream, iter->second.d_downstreamSubQueueId, @@ -1179,8 +1178,8 @@ void RelayQueueEngine::configureHandle( return; // RETURN } - unsigned int upstreamSubQueueId = it->second.d_upstreamSubQueueId; - App_State* app = findApp(upstreamSubQueueId); + unsigned int upstreamSubQueueId = it->second.d_upstreamSubQueueId; + App_State* app = findApp(upstreamSubQueueId); BSLS_ASSERT_SAFE(app); context->initializeRouting(d_queueState_p->routingContext()); @@ -1234,8 +1233,8 @@ void RelayQueueEngine::releaseHandleImpl( handle->subStreamInfos().find(appId); BSLS_ASSERT_SAFE(it != handle->subStreamInfos().end()); - unsigned int upstreamSubQueueId = it->second.d_upstreamSubQueueId; - App_State* app = findApp(upstreamSubQueueId); + unsigned int upstreamSubQueueId = it->second.d_upstreamSubQueueId; + App_State* app = findApp(upstreamSubQueueId); BSLS_ASSERT_SAFE(app); App_State::CachedParametersMap::iterator itHandle = app->d_cache.find( @@ -1305,7 +1304,7 @@ void RelayQueueEngine::releaseHandleImpl( effectiveHandleParam, upstreamSubQueueId, bdlf::BindUtil::bind( - mwcu::WeakMemFnUtil::weakMemFn(&RelayQueueEngine::onHandleReleased, + bmqu::WeakMemFnUtil::weakMemFn(&RelayQueueEngine::onHandleReleased, d_self.acquireWeak()), bdlf::PlaceHolders::_1, // Status handle, @@ -1608,9 +1607,9 @@ void RelayQueueEngine::loadInternals(mqbcmd::QueueEngine* out) const subStreams.resize(subStreams.size() + 1); mqbcmd::RelayQueueEngineSubStream& subStream = subStreams.back(); subStream.appId() = p.first; - mwcu::MemOutStream appKey; + bmqu::MemOutStream appKey; appKey << p.second; - subStream.appKey() = appKey.str(); + subStream.appKey() = appKey.str(); subStream.numMessages() = d_queueState_p->storage()->numMessages( p.second); } @@ -1795,9 +1794,9 @@ RelayQueueEngine::push(mqbi::StorageMessageAttributes* attributes, PushStream::Apps::iterator itApp = d_pushStream.d_apps.find( subQueueId); if (itApp == d_pushStream.d_apps.end()) { - AppsMap::const_iterator cit = d_apps.find(subQueueId); + AppsMap::const_iterator app_cit = d_apps.find(subQueueId); - if (cit == d_apps.end()) { + if (app_cit == d_apps.end()) { BMQ_LOGTHROTTLE_ERROR() << "#QUEUE_UNKNOWN_SUBSCRIPTION_ID " << "Remote queue: " << d_queueState_p->uri() @@ -1807,10 +1806,25 @@ RelayQueueEngine::push(mqbi::StorageMessageAttributes* attributes, continue; // CONTINUE } - itApp = d_pushStream.d_apps.emplace(subQueueId, cit->second).first; + itApp = + d_pushStream.d_apps.emplace(subQueueId, app_cit->second).first; } - else if (!checkForDuplicate(itApp->second.d_app.get(), msgGUID)) { - continue; // CONTINUE + else { + const PushStream::App& app = itApp->second; + + if (app.last() && app.last()->equal(itGuid)) { + BMQ_LOGTHROTTLE_INFO() + << "Remote queue: " << d_queueState_p->uri() + << " (id: " << d_queueState_p->id() << ", App '" + << itApp->second.d_app->appId() + << "') discarding a duplicate PUSH for guid " << msgGUID; + + continue; // CONTINUE + } + + if (!checkForDuplicate(app.d_app.get(), msgGUID)) { + continue; // CONTINUE + } } PushStream::Element* element = d_pushStream.create(subscription, @@ -1875,12 +1889,11 @@ void RelayQueueEngine::storePush(mqbi::StorageMessageAttributes* attributes, // in 'options' is subQueueInfos, and we won't store the specified // 'options' in the storage. - mqbi::StorageResult::Enum result = mqbi::StorageResult::e_SUCCESS; - result = storage()->put(attributes, - msgGUID, - appData, - bsl::shared_ptr() // No options - ); + mqbi::StorageResult::Enum result = storage()->put( + attributes, + msgGUID, + appData, + bsl::shared_ptr()); // No options if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( result != mqbi::StorageResult::e_SUCCESS)) { diff --git a/src/groups/mqb/mqbblp/mqbblp_relayqueueengine.h b/src/groups/mqb/mqbblp/mqbblp_relayqueueengine.h index 1515c3ecf..dcb06963b 100644 --- a/src/groups/mqb/mqbblp/mqbblp_relayqueueengine.h +++ b/src/groups/mqb/mqbblp/mqbblp_relayqueueengine.h @@ -52,9 +52,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -222,7 +221,7 @@ class RelayQueueEngine : public mqbi::QueueEngine { AppIds d_appIds; // (appId) -> App_State map - mwcu::SharedResource d_self; + bmqu::SharedResource d_self; // Used to avoid executing a callback if // the engine has been destroyed. For // example, upon queue converting to local. diff --git a/src/groups/mqb/mqbblp/mqbblp_relayqueueengine.t.cpp b/src/groups/mqb/mqbblp/mqbblp_relayqueueengine.t.cpp index 49dcb33db..a73db2885 100644 --- a/src/groups/mqb/mqbblp/mqbblp_relayqueueengine.t.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_relayqueueengine.t.cpp @@ -25,8 +25,7 @@ #include #include -// MWC -#include +#include // BMQ #include @@ -38,7 +37,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -87,7 +86,7 @@ static void test1_breathingTest() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); mqbconfm::Domain domainConfig; domainConfig.mode().makePriority(); @@ -168,7 +167,7 @@ static void test2_aggregateDownstream() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("AGGREGATE DOWNSTREAM"); + bmqtst::TestHelper::printTestName("AGGREGATE DOWNSTREAM"); mqbconfm::Domain domainConfig; domainConfig.mode().makePriority(); @@ -339,7 +338,7 @@ static void test3_reconfigure() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks // from 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("RECONFIGURE"); + bmqtst::TestHelper::printTestName("RECONFIGURE"); mqbconfm::Domain domainConfig; domainConfig.mode().makePriority(); @@ -478,7 +477,7 @@ static void test4_cannotDeliver() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("CANNOT CONSUMERS"); + bmqtst::TestHelper::printTestName("CANNOT CONSUMERS"); mqbconfm::Domain domainConfig; domainConfig.mode().makePriority(); @@ -593,7 +592,7 @@ static void test5_localRedelivery() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("REDELIVERY TO OTHER CONSUMERS"); + bmqtst::TestHelper::printTestName("REDELIVERY TO OTHER CONSUMERS"); mqbconfm::Domain domainConfig; domainConfig.mode().makePriority(); @@ -673,7 +672,7 @@ static void test6_clearDeliveryStateWhenLostReaders() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("REDELIVERY TO FIRST CONSUMER UP"); + bmqtst::TestHelper::printTestName("REDELIVERY TO FIRST CONSUMER UP"); mqbconfm::Domain domainConfig; domainConfig.mode().makePriority(); @@ -743,7 +742,7 @@ static void test7_broadcastMode() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("BROADCAST MODE"); + bmqtst::TestHelper::printTestName("BROADCAST MODE"); mqbconfm::Domain domainConfig(s_allocator_p); domainConfig.mode().makeBroadcast(); @@ -835,7 +834,7 @@ static void test8_priority_beforeMessageRemoved_garbageCollection() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("BEFORE MESSAGE REMOVED - GARBAGE " + bmqtst::TestHelper::printTestName("BEFORE MESSAGE REMOVED - GARBAGE " "COLLECTION"); mqbconfm::Domain domainConfig(s_allocator_p); @@ -911,7 +910,7 @@ static void test9_releaseHandle_isDeletedFlag() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("RELEASE HANDLE - IS-DELETED FLAG"); + bmqtst::TestHelper::printTestName("RELEASE HANDLE - IS-DELETED FLAG"); mqbconfm::Domain domainConfig(s_allocator_p); domainConfig.mode().makePriority(); @@ -974,7 +973,7 @@ static void test10_configureFanoutAppIds() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "CONFIGURING DIFFERENT APPIDs FOR UPSTREAM"); mqbblp::QueueEngineTester tester(fanoutConfig(), false, s_allocator_p); @@ -1060,7 +1059,7 @@ static void test11_roundRobinAndRedelivery() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("ROUND-ROBIN AND REDELIVERY"); + bmqtst::TestHelper::printTestName("ROUND-ROBIN AND REDELIVERY"); mqbconfm::Domain config = fanoutConfig(); bsl::vector& appIDs = config.mode().fanout().appIDs(); @@ -1164,7 +1163,7 @@ static void test12_redeliverAfterGc() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("REDELIVERY AFTER GC"); + bmqtst::TestHelper::printTestName("REDELIVERY AFTER GC"); mqbconfm::Domain domainConfig(s_allocator_p); domainConfig.mode().makePriority(); @@ -1234,7 +1233,7 @@ static void test13_deconfigureWhenOpen() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "DECONFIGURE IN BETWEEN OPEN AND CONFIGURE"); mqbblp::QueueEngineTester tester(fanoutConfig(), false, s_allocator_p); @@ -1252,7 +1251,7 @@ static void test13_deconfigureWhenOpen() ASSERT_NE(C2, k_nullHandle_p); // 4. Deconfigure 1st consumer. - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "C1@a consumerPriority=" << bmqp::Protocol::k_CONSUMER_PRIORITY_INVALID; @@ -1289,7 +1288,7 @@ static void test14_throttleRedeliveryPriority() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("THROTTLED REDELIVERY PRIORITY"); + bmqtst::TestHelper::printTestName("THROTTLED REDELIVERY PRIORITY"); mqbconfm::Domain config; config.mode().makePriority(); @@ -1384,7 +1383,7 @@ static void test15_throttleRedeliveryFanout() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("THROTTLED REDELIVERY FANOUT"); + bmqtst::TestHelper::printTestName("THROTTLED REDELIVERY FANOUT"); mqbconfm::Domain config = fanoutConfig(); bsl::vector& appIDs = config.mode().fanout().appIDs(); @@ -1527,7 +1526,7 @@ static void test16_throttleRedeliveryCancelledDelay() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("THROTTLED REDELIVERY CANCELLED DELAY"); + bmqtst::TestHelper::printTestName("THROTTLED REDELIVERY CANCELLED DELAY"); mqbconfm::Domain config; config.mode().makePriority(); @@ -1620,7 +1619,7 @@ static void test17_throttleRedeliveryNewHandle() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("THROTTLED REDELIVERY NEW HANDLE"); + bmqtst::TestHelper::printTestName("THROTTLED REDELIVERY NEW HANDLE"); mqbconfm::Domain config; config.mode().makePriority(); @@ -1682,7 +1681,7 @@ static void test18_throttleRedeliveryNoMoreHandles() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("THROTTLED REDELIVERY NO MORE HANDLES"); + bmqtst::TestHelper::printTestName("THROTTLED REDELIVERY NO MORE HANDLES"); mqbconfm::Domain config; config.mode().makePriority(); @@ -1745,7 +1744,7 @@ static void test18_throttleRedeliveryNoMoreHandles() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); { bmqt::UriParser::initialize(s_allocator_p); @@ -1754,7 +1753,7 @@ int main(int argc, char* argv[]) mqbcfg::AppConfig brokerConfig(s_allocator_p); mqbcfg::BrokerConfig::set(brokerConfig); - bsl::shared_ptr statContext = + bsl::shared_ptr statContext = mqbstat::BrokerStatsUtil::initializeStatContext(30, s_allocator_p); switch (_testCase) { @@ -1787,5 +1786,5 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbblp/mqbblp_remotequeue.cpp b/src/groups/mqb/mqbblp/mqbblp_remotequeue.cpp index bbd579fa8..c7849c837 100644 --- a/src/groups/mqb/mqbblp/mqbblp_remotequeue.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_remotequeue.cpp @@ -38,12 +38,11 @@ #include #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -186,7 +185,7 @@ int RemoteQueue::configureAsClusterMember(bsl::ostream& errorDescription, // previously created storage. bslma::ManagedPtr storageMp; bdlma::LocalSequentialAllocator<1024> localAllocator(d_allocator_p); - mwcu::MemOutStream errorDesc(&localAllocator); + bmqu::MemOutStream errorDesc(&localAllocator); rc = d_state_p->storageManager()->makeStorage( errorDesc, &storageMp, @@ -200,13 +199,13 @@ int RemoteQueue::configureAsClusterMember(bsl::ostream& errorDescription, // This most likely means that this queue's partition at this // replica is out of sync. - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << d_state_p->domain()->cluster()->name() << ": Partition [" << d_state_p->partitionId() << "]: failed to retrieve storage for remote queue [" << d_state_p->uri() << "], queueKey [" << d_state_p->key() << "], rc: " << rc << ", reason [" << errorDesc.str() << "]." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return 10 * rc + rc_QUEUE_CONFIGURE_FAILURE; // RETURN } @@ -216,12 +215,12 @@ int RemoteQueue::configureAsClusterMember(bsl::ostream& errorDescription, } if (!d_state_p->isStorageCompatible(storageMp)) { - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << d_state_p->domain()->cluster()->name() << ": Partition [" << d_state_p->partitionId() << "]: incompatible storage type for remote queue [" << d_state_p->uri() << "], queueKey [" << d_state_p->key() - << "]" << MWCTSK_ALARMLOG_END; + << "]" << BMQTSK_ALARMLOG_END; return 10 * rc + rc_QUEUE_CONFIGURE_FAILURE; // RETURN } @@ -246,16 +245,16 @@ int RemoteQueue::configureAsClusterMember(bsl::ostream& errorDescription, } bdlma::LocalSequentialAllocator<1024> localAllocator(d_allocator_p); - mwcu::MemOutStream errorDesc(&localAllocator); + bmqu::MemOutStream errorDesc(&localAllocator); rc = d_queueEngine_mp->configure(errorDesc); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << d_state_p->domain()->cluster()->name() << ": Partition [" << d_state_p->partitionId() << "]: failed to configure queue engine for remote queue [" << d_state_p->uri() << "], queueKey [" << d_state_p->key() << "], rc: " << rc << ", reason [" << errorDesc.str() << "]." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return 10 * rc + rc_ENGINE_CONFIGURE_FAILURE; // RETURN } @@ -291,7 +290,7 @@ bool RemoteQueue::loadSubQueueInfos( // Load 'SubQueueIdsOption' from 'options'. int rc = d_optionsView.reset(&options, - mwcu::BlobPosition(), + bmqu::BlobPosition(), options.length()); if (rc) { BALL_LOG_ERROR @@ -480,7 +479,7 @@ RemoteQueue::RemoteQueue(QueueState* state, // Description, to identify a 'remote' queue, prefix its URI with an '@'. bdlma::LocalSequentialAllocator<1024> localAllocator(d_allocator_p); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << '@' << d_state_p->uri().asString(); d_state_p->setDescription(os.str()); @@ -777,39 +776,39 @@ void RemoteQueue::onDispatcherEvent(const mqbi::DispatcherEvent& event) case mqbi::DispatcherEventType::e_CONFIRM: { BSLS_ASSERT_OPT(false && "'CONFIRM' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_REJECT: { BSLS_ASSERT_OPT(false && "'REJECT' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_DISPATCHER: { BSLS_ASSERT_OPT(false && "'DISPATCHER' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_CLUSTER_STATE: { BSLS_ASSERT_OPT(false && "'CLUSTER_STATE' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_STORAGE: { BSLS_ASSERT_OPT(false && "'STORAGE' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_RECOVERY: { BSLS_ASSERT_OPT(false && "'RECOVERY' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_REPLICATION_RECEIPT: { BSLS_ASSERT_OPT( false && "'REPLICATION_RECEIPT' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; case mqbi::DispatcherEventType::e_UNDEFINED: { BSLS_ASSERT_OPT(false && "'NONE' type dispatcher event unexpected"); return; // RETURN - } // break; + } // break; default: { BALL_LOG_ERROR << "#QUEUE_UNEXPECTED_EVENT " << d_state_p->description() @@ -913,7 +912,7 @@ void RemoteQueue::postMessage(const bmqp::PutHeader& putHeaderIn, // - if this is broadcast PUT, just GUID unless there is no upstream // - else, also keep 'appData' and 'options' - bsl::shared_ptr state = d_statePool_p->getObject(); + bsl::shared_ptr state = d_statePool_p->getObject(); bsls::Types::Int64 now = 0; if (d_state_p->isAtMostOnce()) { @@ -940,7 +939,7 @@ void RemoteQueue::postMessage(const bmqp::PutHeader& putHeaderIn, // an ACK for 'd_ackWindowSize' PUTs. } else { - now = mwcsys::Time::highResolutionTimer(); + now = bmqsys::Time::highResolutionTimer(); if (!d_pendingMessagesTimerEventHandle) { bsls::TimeInterval time; @@ -1284,7 +1283,7 @@ void RemoteQueue::expirePendingMessagesDispatched() BSLS_ASSERT_SAFE(d_state_p->queue()->dispatcher()->inDispatcherThread( d_state_p->queue())); - bsls::Types::Int64 now = mwcsys::Time::highResolutionTimer(); + bsls::Types::Int64 now = bmqsys::Time::highResolutionTimer(); bsls::Types::Int64 nextTime = 0; bsls::Types::Int64 numExpired = 0; bsls::Types::Int64 numMessages = d_pendingMessages.size(); @@ -1315,9 +1314,9 @@ void RemoteQueue::expirePendingMessagesDispatched() if (numExpired) { if (d_throttledFailedPutMessages.requestPermission()) { BALL_LOG_INFO << "[THROTTLED] " << d_state_p->uri() << ": expired " - << mwcu::PrintUtil::prettyNumber(numExpired) + << bmqu::PrintUtil::prettyNumber(numExpired) << " pending PUT messages (" - << mwcu::PrintUtil::prettyNumber(numMessages - + << bmqu::PrintUtil::prettyNumber(numMessages - numExpired) << " remaining messages)."; } @@ -1336,8 +1335,8 @@ void RemoteQueue::expirePendingMessagesDispatched() BALL_LOG_DEBUG << d_state_p->uri() << ": will check again to expire" << " pending PUSH messages in " - << mwcu::PrintUtil::prettyTimeInterval( - nextTime - mwcsys::Time::highResolutionTimer()); + << bmqu::PrintUtil::prettyTimeInterval( + nextTime - bmqsys::Time::highResolutionTimer()); } else { d_pendingMessagesTimerEventHandle.release(); @@ -1488,7 +1487,7 @@ void RemoteQueue::sendPutMessage( const bmqp::PutHeader& putHeader, const bsl::shared_ptr& appData, const bsl::shared_ptr& options, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bsls::Types::Uint64 genCount) { mqbi::Cluster* cluster = d_state_p->domain()->cluster(); diff --git a/src/groups/mqb/mqbblp/mqbblp_remotequeue.h b/src/groups/mqb/mqbblp/mqbblp_remotequeue.h index 2b063cfe4..0a8b36cc4 100644 --- a/src/groups/mqb/mqbblp/mqbblp_remotequeue.h +++ b/src/groups/mqb/mqbblp/mqbblp_remotequeue.h @@ -38,14 +38,13 @@ #include #include -#include +#include // BMQ #include #include #include -// MWC -#include +#include // BDE #include @@ -95,9 +94,9 @@ class RemoteQueue { ConfirmsVisitor; typedef bdlcc::SharedObjectPool< - mwcu::AtomicState, + bmqu::AtomicState, bdlcc::ObjectPoolFunctors::DefaultCreator, - bdlcc::ObjectPoolFunctors::Reset > + bdlcc::ObjectPoolFunctors::Reset > StateSpPool; private: @@ -115,14 +114,14 @@ class RemoteQueue { // Insertion time. Do not // retransmit past 'deduplication' // timeout. - bsl::shared_ptr d_state_sp; + bsl::shared_ptr d_state_sp; PutMessage(mqbi::QueueHandle* handle, const bmqp::PutHeader& header, const bsl::shared_ptr& appData, const bsl::shared_ptr& options, bsls::Types::Int64 time, - bsl::shared_ptr& state); + bsl::shared_ptr& state); ~PutMessage(); }; @@ -160,7 +159,7 @@ class RemoteQueue { /// Must be a container in which iteration order is same as insertion /// order. - typedef mwcc::OrderedHashMap > Puts; @@ -173,7 +172,7 @@ class RemoteQueue { /// 1. Opened and with an available upstream. Send. /// 2. Opened and without an available upstream. Buffer. /// 3. Not opened. Drop. - typedef mwcc::Array SubQueueIds; @@ -302,7 +301,7 @@ class RemoteQueue { void sendPutMessage(const bmqp::PutHeader& putHeader, const bsl::shared_ptr& appData, const bsl::shared_ptr& options, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bsls::Types::Uint64 genCount); void sendConfirmMessage(const bmqt::MessageGUID& msgGUID, @@ -475,7 +474,7 @@ class RemoteQueue { /// Load into the specified `out` object the internal details about this /// queue. - void loadInternals(mqbcmd::RemoteQueue* out) const; + void loadInternals(mqbcmd::RemoteQueue* out) const; const bmqt::MessageGUID& resumePoint() const; }; @@ -519,7 +518,7 @@ inline RemoteQueue::PutMessage::PutMessage( const bsl::shared_ptr& appData, const bsl::shared_ptr& options, bsls::Types::Int64 time, - bsl::shared_ptr& state) + bsl::shared_ptr& state) : d_handle(handle) , d_header(header) , d_appData(appData) diff --git a/src/groups/mqb/mqbblp/mqbblp_remotequeue.t.cpp b/src/groups/mqb/mqbblp/mqbblp_remotequeue.t.cpp index 6e6e9b475..439d4ef11 100644 --- a/src/groups/mqb/mqbblp/mqbblp_remotequeue.t.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_remotequeue.t.cpp @@ -32,9 +32,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -44,7 +43,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -185,12 +184,12 @@ TestBench::TestBench(bslma::Allocator* allocator_p) this, bdlf::PlaceHolders::_1)); - mwcsys::Time::initialize( + bmqsys::Time::initialize( bdlf::BindUtil::bind(&TestClock::realtimeClock, &d_testClock), bdlf::BindUtil::bind(&TestClock::monotonicClock, &d_testClock), bdlf::BindUtil::bind(&TestClock::highResTimer, &d_testClock)); - mwcu::MemOutStream errorDescription(allocator_p); + bmqu::MemOutStream errorDescription(allocator_p); d_cluster.start(errorDescription); } @@ -203,7 +202,7 @@ TestBench::~TestBench() d_event.reset(); - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); } bsl::shared_ptr TestBench::getQueue() @@ -467,11 +466,11 @@ static void test1_fanoutBasic() // 6. Run timer which shoudl not rechedule because there are no pending. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("basic tests using fanout"); + bmqtst::TestHelper::printTestName("basic tests using fanout"); bmqt::UriParser::initialize(s_allocator_p); - bsl::shared_ptr statContext = + bsl::shared_ptr statContext = mqbstat::BrokerStatsUtil::initializeStatContext(30, s_allocator_p); TestBench theBench(s_allocator_p); @@ -609,11 +608,11 @@ static void test2_broadcastBasic() // 6. Force close the queue. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("basic tests using broadcast"); + bmqtst::TestHelper::printTestName("basic tests using broadcast"); bmqt::UriParser::initialize(s_allocator_p); - bsl::shared_ptr statContext = + bsl::shared_ptr statContext = mqbstat::BrokerStatsUtil::initializeStatContext(30, s_allocator_p); TestBench theBench(s_allocator_p); @@ -897,11 +896,11 @@ static void test3_close() // Producers should not receive any NACKs. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("close queue with pending messages"); + bmqtst::TestHelper::printTestName("close queue with pending messages"); bmqt::UriParser::initialize(s_allocator_p); - bsl::shared_ptr statContext = + bsl::shared_ptr statContext = mqbstat::BrokerStatsUtil::initializeStatContext(30, s_allocator_p); TestBench theBench(s_allocator_p); @@ -952,11 +951,11 @@ static void test4_buffering() // onUnavailableUpstreamDispatched // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("buffering"); + bmqtst::TestHelper::printTestName("buffering"); bmqt::UriParser::initialize(s_allocator_p); - bsl::shared_ptr statContext = + bsl::shared_ptr statContext = mqbstat::BrokerStatsUtil::initializeStatContext(30, s_allocator_p); TestBench theBench(s_allocator_p); @@ -1049,11 +1048,11 @@ static void test5_reopen_failure() // onReopenFailure // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("buffering"); + bmqtst::TestHelper::printTestName("buffering"); bmqt::UriParser::initialize(s_allocator_p); - bsl::shared_ptr statContext = + bsl::shared_ptr statContext = mqbstat::BrokerStatsUtil::initializeStatContext(30, s_allocator_p); TestBench theBench(s_allocator_p); @@ -1126,7 +1125,7 @@ static void test5_reopen_failure() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -1141,5 +1140,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbblp/mqbblp_rootqueueengine.cpp b/src/groups/mqb/mqbblp/mqbblp_rootqueueengine.cpp index 80cb2fce9..fc531542f 100644 --- a/src/groups/mqb/mqbblp/mqbblp_rootqueueengine.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_rootqueueengine.cpp @@ -23,12 +23,15 @@ #include #include #include +#include #include #include #include #include #include #include +#include +#include // BMQ #include @@ -39,11 +42,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -129,7 +131,7 @@ void RootQueueEngine::deliverMessages(AppState* app) if (delay != bsls::TimeInterval()) { app->scheduleThrottle( - mwcsys::Time::nowMonotonicClock() + delay, + bmqsys::Time::nowMonotonicClock() + delay, bdlf::BindUtil::bind(&RootQueueEngine::deliverMessages, this, app)); @@ -258,7 +260,13 @@ RootQueueEngine::RootQueueEngine(QueueState* queueState, const mqbconfm::Domain& domainConfig, bslma::Allocator* allocator) : d_queueState_p(queueState) -, d_consumptionMonitor(queueState, allocator) +, d_consumptionMonitor( + queueState, + bdlf::BindUtil::bind(&RootQueueEngine::logAlarmCb, + this, + bdlf::PlaceHolders::_1, // appKey + bdlf::PlaceHolders::_2), // enableLog + allocator) , d_apps(allocator) , d_nullKeyCount(0) , d_hasAutoSubscriptions(false) @@ -406,7 +414,12 @@ int RootQueueEngine::initializeAppId(const bsl::string& appId, bsl::ostream& errorDescription, unsigned int upstreamSubQueueId) { - if (d_apps.findByKey1(appId) != d_apps.end()) { + Apps::iterator iter = d_apps.findByKey1(appId); + + if (iter != d_apps.end()) { + mqbconfm::Expression empty(d_allocator_p); + iter->value()->setSubscription(empty); + // Don't reconfigure an AppId that is already registered. return 0; // RETURN } @@ -430,15 +443,11 @@ int RootQueueEngine::initializeAppId(const bsl::string& appId, } BSLS_ASSERT_SAFE(!appKey.isNull()); - Apps::iterator iter = makeSubStream(appId, - AppKeyCount(appKey, 0), - upstreamSubQueueId); + iter = makeSubStream(appId, AppKeyCount(appKey, 0), upstreamSubQueueId); iter->value()->authorize(appKey, ordinal); - d_consumptionMonitor.registerSubStream( - appKey, - bdlf::BindUtil::bind(&RootQueueEngine::head, this, iter->value())); + d_consumptionMonitor.registerSubStream(appKey); BALL_LOG_INFO << "Found virtual storage for appId [" << appId << "], queue [" << d_queueState_p->uri() << "], appKey [" @@ -482,7 +491,7 @@ void RootQueueEngine::rebuildSelectedApp( BSLS_ASSERT_SAFE(app->routing()); - mwcu::MemOutStream errorStream(d_allocator_p); + bmqu::MemOutStream errorStream(d_allocator_p); app->routing()->loadApp(itApp->key1().c_str(), handle, @@ -562,8 +571,8 @@ int RootQueueEngine::rebuildInternalState(bsl::ostream& errorDescription) bmqp::QueueId::k_UNASSIGNED_SUBQUEUE_ID); } - AppStateSp& app = itApp->value(); - app->routing() = previous->routing(); + AppStateSp& app = itApp->value(); + app->routing() = previous->routing(); app->setUpstreamSubQueueId(upstreamSubQueueId); // Do not copy resumePoint. New RootQueueEngine redelivers everything @@ -629,7 +638,7 @@ mqbi::QueueHandle* RootQueueEngine::getHandle( // race during failover scenarios, these max producer/consumer config // fields should be used with caution (perhaps as a hint or soft-limit // instead of a hard limit). - mwcu::MemOutStream errorDescription(d_allocator_p); + bmqu::MemOutStream errorDescription(d_allocator_p); if (!QueueEngineUtil::consumerAndProducerLimitsAreValid( d_queueState_p, errorDescription, @@ -766,12 +775,12 @@ mqbi::QueueHandle* RootQueueEngine::getHandle( Apps::iterator iter = d_apps.findByKey1(appId); if (iter == d_apps.end()) { - MWCTSK_ALARMLOG_ALARM("FANOUT_UNREGISTERED_APPID") + BMQTSK_ALARMLOG_ALARM("FANOUT_UNREGISTERED_APPID") << "AppId '" << appId << "' is not authorized for queue '" << d_queueState_p->uri() << "' - please contact BlazingMQ team to request configuration" " of this AppId" - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; AppKeyCount key2; if (d_queueState_p->isCSLModeEnabled()) { @@ -801,10 +810,7 @@ mqbi::QueueHandle* RootQueueEngine::getHandle( if (!iter->value()->isAuthorized()) { if (iter->value()->authorize()) { d_consumptionMonitor.registerSubStream( - iter->value()->appKey(), - bdlf::BindUtil::bind(&RootQueueEngine::head, - this, - iter->value())); + iter->value()->appKey()); } } } @@ -1173,7 +1179,7 @@ void RootQueueEngine::releaseHandle( d_allocator_p), d_allocator_p); - mwcu::MemOutStream errorStream(d_allocator_p); + bmqu::MemOutStream errorStream(d_allocator_p); app->rebuildConsumers(currSubStreamInfo.appId().c_str(), &errorStream, d_queueState_p, @@ -1228,7 +1234,7 @@ void RootQueueEngine::releaseHandle( // the set of consumers for the given appId BSLS_ASSERT_SAFE(!hasHandle(subStreamInfo.appId(), handle)); } // else there are app consumers on this handle - } // else producer + } // else producer // Register/unregister both consumers and producers handle->unregisterSubStream( @@ -1469,7 +1475,7 @@ int RootQueueEngine::onRejectMessage(mqbi::QueueHandle* handle, // primary, if a new consumer connects to the replica/proxy. const int maxDeliveryAttempts = d_queueState_p->domain()->config().maxDeliveryAttempts(); - const bool domainIsUnlimited = (maxDeliveryAttempts == 0); + const bool domainIsUnlimited = (maxDeliveryAttempts == 0); bmqp::RdaInfo& rda = message->appMessageState(app.ordinal()).d_rdaInfo; if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(domainIsUnlimited != @@ -1613,6 +1619,256 @@ void RootQueueEngine::onTimer(bsls::Types::Int64 currentTimer) d_consumptionMonitor.onTimer(currentTimer); } +bsl::ostream& +RootQueueEngine::logAppSubscriptionInfo(bsl::ostream& stream, + const mqbu::StorageKey& appKey) const +{ + // executed by the *QUEUE DISPATCHER* thread + + // PRECONDITIONS + BSLS_ASSERT_SAFE(d_queueState_p->queue()->dispatcher()->inDispatcherThread( + d_queueState_p->queue())); + + // Get AppState by appKey. + Apps::const_iterator cItApp = d_apps.findByKey2(AppKeyCount(appKey, 0)); + if (cItApp == d_apps.end()) { + BALL_LOG_WARN << "No app found for appKey: " << appKey; + stream << "\nSubscription info: no app found for appKey: " << appKey; + return stream; // RETURN + } + + const AppStateSp& app = cItApp->value(); + return logAppSubscriptionInfo(stream, app); +} + +bsl::ostream& +RootQueueEngine::logAppSubscriptionInfo(bsl::ostream& stream, + const AppStateSp& appState) const +{ + mqbi::Storage* const storage = d_queueState_p->storage(); + + // Log un-delivered messages info + stream << "\nFor appId: " << appState->appId() << "\n\n"; + stream << "Put aside list size: " + << bmqu::PrintUtil::prettyNumber(static_cast( + appState->putAsideListSize())) + << '\n'; + stream << "Redelivery list size: " + << bmqu::PrintUtil::prettyNumber(static_cast( + appState->redeliveryListSize())) + << '\n'; + stream << "Number of messages: " + << bmqu::PrintUtil::prettyNumber( + storage->numMessages(appState->appKey())) + << '\n'; + stream << "Number of bytes: " + << bmqu::PrintUtil::prettyBytes( + storage->numBytes(appState->appKey())) + << "\n\n"; + + // Log consumer subscriptions + mqbblp::Routers::QueueRoutingContext& routingContext = + appState->routing()->d_queue; + mqbcmd::Routing routing; + routingContext.loadInternals(&routing); + const bsl::vector& subscrGroups = + routing.subscriptionGroups(); + + // Limit to log only k_EXPR_NUM_LIMIT expressions + static const size_t k_EXPR_NUM_LIMIT = 50; + bmqu::MemOutStream ss(d_allocator_p); + + size_t exprNum = 0; + for (bsl::vector::const_iterator cIt = + subscrGroups.begin(); + cIt != subscrGroups.end() && exprNum < k_EXPR_NUM_LIMIT; + ++cIt) { + if (!cIt->expression().empty()) { + ss << cIt->expression() << '\n'; + ++exprNum; + } + } + if (exprNum) { + if (exprNum == k_EXPR_NUM_LIMIT) { + stream << "First " << k_EXPR_NUM_LIMIT + << " of consumer subscription expressions: "; + } + else { + stream << "Consumer subscription expressions: "; + } + stream << '\n' << ss.str() << '\n'; + } + + // Log the first (oldest) message in a put aside list and its properties + if (!appState->putAsideList().empty()) { + bslma::ManagedPtr storageIt_mp; + mqbi::StorageResult::Enum rc = storage->getIterator( + &storageIt_mp, + appState->appKey(), + appState->putAsideList().first()); + if (rc == mqbi::StorageResult::e_SUCCESS) { + // Log timestamp + stream << "Oldest message in the 'Put aside' list:\n"; + mqbcmd::Result result; + mqbs::StoragePrintUtil::listMessage(&result.makeMessage(), + storage, + *storageIt_mp); + mqbcmd::HumanPrinter::print(stream, result); + stream << '\n'; + // Log message properties + const bsl::shared_ptr& appData = + storageIt_mp->appData(); + const bmqp::MessagePropertiesInfo& logic = + storageIt_mp->attributes().messagePropertiesInfo(); + bmqp::MessageProperties properties; + int ret = properties.streamIn(*appData, logic.isExtended()); + if (!ret) { + stream << "Message Properties: " << properties << '\n'; + } + else { + BALL_LOG_WARN << "Failed to streamIn MessageProperties, rc = " + << rc; + stream << "Message Properties: Failed to acquire [rc: " << rc + << "]\n"; + } + } + else { + BALL_LOG_WARN << "Failed to get storage iterator for GUID: " + << appState->putAsideList().first() + << ", rc = " << rc; + stream << "'Put aside' list: Failed to acquire [rc: " << rc + << "]\n"; + } + } + + return stream; +} + +bool RootQueueEngine::logAlarmCb(const mqbu::StorageKey& appKey, + bool enableLog) const +{ + // executed by the *QUEUE DISPATCHER* thread + + // PRECONDITIONS + BSLS_ASSERT_SAFE(d_queueState_p->queue()->dispatcher()->inDispatcherThread( + d_queueState_p->queue())); + + // Get AppState by appKey. + Apps::const_iterator cItApp = d_apps.findByKey2(AppKeyCount(appKey, 0)); + if (cItApp == d_apps.end()) { + BALL_LOG_WARN << "No app found for appKey: " << appKey; + return false; // RETURN + } + const AppStateSp& app = cItApp->value(); + + // Check if there are un-delivered messages + bslma::ManagedPtr headIt = head(app); + + if (!headIt) { + // No un-delivered messages, do nothing. + return false; // RETURN + } + if (!enableLog) { + // There are un-delivered messages, but log is disabled. + return true; // RETURN + } + + // Logging alarm info + bdlma::LocalSequentialAllocator<4096> localAllocator(d_allocator_p); + + bmqu::MemOutStream ss(&localAllocator); + + // Log app consumers queue handles info + int idx = 1; + int numConsumers = 0; + + const QueueEngineUtil_AppState::Consumers& consumers = app->consumers(); + for (QueueEngineUtil_AppState::Consumers::const_iterator citConsumer = + consumers.begin(); + citConsumer != consumers.end(); + ++citConsumer) { + mqbi::QueueHandle* const queueHandle_p = citConsumer->first; + + const mqbi::QueueHandle::SubStreams& subStreamInfos = + queueHandle_p->subStreamInfos(); + + for (mqbi::QueueHandle::SubStreams::const_iterator citSubStreams = + subStreamInfos.begin(); + citSubStreams != subStreamInfos.end(); + ++citSubStreams) { + numConsumers += citSubStreams->second.d_counts.d_readCount; + + const int level = 2, spacesPerLevel = 2; + + ss << "\n " << idx++ << ". " + << queueHandle_p->client()->description() + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << "Handle Parameters .....: " + << queueHandle_p->handleParameters() + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << "Number of unconfirmed messages .....: " + << queueHandle_p->countUnconfirmed() + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << "UnconfirmedMonitors ....:"; + + const bsl::vector monitors = + queueHandle_p->unconfirmedMonitors(app->appId()); + for (size_t i = 0; i < monitors.size(); ++i) { + ss << "\n " << *monitors[i]; + } + } + } + + bmqu::MemOutStream out(&localAllocator); + mqbi::Storage* const storage = d_queueState_p->storage(); + + out << "Queue '" << d_queueState_p->uri(); + if (app->appId() != bmqp::ProtocolUtil::k_DEFAULT_APP_ID) { + out << "?id=" << app->appId(); + } + out << "' "; + storage->capacityMeter()->printShortSummary(out); + out << ", max idle time " + << bmqu::PrintUtil::prettyTimeInterval( + d_queueState_p->queue()->domain()->config().maxIdleTime() * + bdlt::TimeUnitRatio::k_NANOSECONDS_PER_SECOND) + << " appears to be stuck. It currently has " << numConsumers + << " consumers." << ss.str() << '\n'; + + // Log un-delivered messages info + logAppSubscriptionInfo(out, app); + + // Print the 10 oldest messages in the queue + static const int k_NUM_MSGS = 10; + const int level = 0, spacesPerLevel = 2; + + out << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << k_NUM_MSGS << " oldest messages in the queue:\n"; + + mqbcmd::Result result; + mqbs::StoragePrintUtil::listMessages(&result.makeQueueContents(), + app->appId(), + 0, + k_NUM_MSGS, + storage); + mqbcmd::HumanPrinter::print(out, result); + + // Print the current head of the queue + out << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << "Current head of the queue:\n"; + + mqbs::StoragePrintUtil::listMessage(&result.makeMessage(), + storage, + *headIt); + + mqbcmd::HumanPrinter::print(out, result); + out << "\n"; + + BMQTSK_ALARMLOG_ALARM("QUEUE_STUCK") << out.str() << BMQTSK_ALARMLOG_END; + + return true; +} + void RootQueueEngine::afterAppIdRegistered( const mqbi::Storage::AppIdKeyPair& appIdKeyPair) { @@ -1708,7 +1964,7 @@ void RootQueueEngine::afterAppIdRegistered( BSLS_ASSERT_SAFE(!key.isNull()); - d_queueState_p->storageManager()->updateQueue( + d_queueState_p->storageManager()->updateQueuePrimary( d_queueState_p->uri(), d_queueState_p->key(), d_queueState_p->partitionId(), @@ -1761,7 +2017,7 @@ void RootQueueEngine::afterAppIdUnregistered( } } - d_queueState_p->storageManager()->updateQueue( + d_queueState_p->storageManager()->updateQueuePrimary( d_queueState_p->uri(), d_queueState_p->key(), d_queueState_p->partitionId(), @@ -1769,8 +2025,8 @@ void RootQueueEngine::afterAppIdUnregistered( mqbi::Storage::AppIdKeyPairs(1, mqbi::Storage::AppIdKeyPair(appId, appKey))); - // No need to log in case of failure because 'updateQueue' does it (even in - // case of success FTM). + // No need to log in case of failure because 'updateQueuePrimary' does it + // (even in case of success FTM). d_consumptionMonitor.unregisterSubStream(appKey); } @@ -1796,9 +2052,7 @@ void RootQueueEngine::registerStorage(const bsl::string& appId, iter->value()->authorize(appKey, appOrdinal); - d_consumptionMonitor.registerSubStream( - appKey, - bdlf::BindUtil::bind(&RootQueueEngine::head, this, iter->value())); + d_consumptionMonitor.registerSubStream(appKey); } void RootQueueEngine::unregisterStorage(const bsl::string& appId, diff --git a/src/groups/mqb/mqbblp/mqbblp_rootqueueengine.h b/src/groups/mqb/mqbblp/mqbblp_rootqueueengine.h index d4c369110..ecb0c92fc 100644 --- a/src/groups/mqb/mqbblp/mqbblp_rootqueueengine.h +++ b/src/groups/mqb/mqbblp/mqbblp_rootqueueengine.h @@ -41,8 +41,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -96,8 +95,7 @@ class RootQueueEngine BSLS_KEYWORD_FINAL : public mqbi::QueueEngine { typedef bsl::pair AppKeyCount; /// (appId, appKeyCount) -> AppStateSp - typedef mwcc::TwoKeyHashMap Apps; - typedef bslma::ManagedPtr StorageIteratorMp; + typedef bmqc::TwoKeyHashMap Apps; private: // DATA @@ -118,7 +116,7 @@ class RootQueueEngine BSLS_KEYWORD_FINAL : public mqbi::QueueEngine { // resulting in multiple instances of // nullKeys. We need to differentiate // them to use them as keys in - // mwcc::TwoKeyHashMap. + // bmqc::TwoKeyHashMap. bool d_hasAutoSubscriptions; // Does this queue engine have any auto subscriptions configured @@ -207,6 +205,17 @@ class RootQueueEngine BSLS_KEYWORD_FINAL : public mqbi::QueueEngine { const AppStateSp& subQueue(unsigned int upstreamSubQueueId) const; + /// Callback called by `d_consumptionMonitor` when alarm condition is met. + /// If there are un-delivered messages for the specified `appKey` and + /// `enableLog` is `true` it logs alarm data. Return `true` if there are + /// un-delivered messages and `false` otherwise. + bool logAlarmCb(const mqbu::StorageKey& appKey, bool enableLog) const; + + /// Log appllication subscription info for the specified `appKey` into the + /// specified `stream`. + bsl::ostream& logAppSubscriptionInfo(bsl::ostream& stream, + const AppStateSp& appState) const; + public: // TRAITS BSLMF_NESTED_TRAIT_DECLARATION(RootQueueEngine, bslma::UsesBslmaAllocator) @@ -454,6 +463,15 @@ class RootQueueEngine BSLS_KEYWORD_FINAL : public mqbi::QueueEngine { /// THREAD: This method is called from the Queue's dispatcher thread. virtual void loadInternals(mqbcmd::QueueEngine* out) const BSLS_KEYWORD_OVERRIDE; + + /// Log appllication subscription info for the specified `appKey` into the + /// specified `stream`. + /// + /// THREAD: This method is called from the Queue's + /// dispatcher thread. + virtual bsl::ostream& logAppSubscriptionInfo( + bsl::ostream& stream, + const mqbu::StorageKey& appKey) const BSLS_KEYWORD_OVERRIDE; }; } // close package namespace diff --git a/src/groups/mqb/mqbblp/mqbblp_rootqueueengine.t.cpp b/src/groups/mqb/mqbblp/mqbblp_rootqueueengine.t.cpp index ffcf4cc8b..99eeedb10 100644 --- a/src/groups/mqb/mqbblp/mqbblp_rootqueueengine.t.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_rootqueueengine.t.cpp @@ -46,12 +46,11 @@ #include #include -// MWC -#include -#include +#include +#include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -189,7 +188,7 @@ MaybeError checkInvariants(const Invariants& invariants, ++i) { const MaybeError rv = i->d_clause(model, tester); if (!rv.isNull()) { - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << "invariant \"" << i->d_name << "\" failed after operation \"" << op << "\", " << rv.value(); @@ -293,14 +292,14 @@ struct Subscribe : public ClientOperation { // Applies the actual operation using the specified 'model' and // 'tester'. { - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << d_client << " readCount=" << d_readCount; ConsumerStatus& status = (*model)[d_client]; status.handle = tester->getHandle(out.str()); status.priority = d_consumerPriority; } { - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << d_client << " consumerPriority=" << d_consumerPriority << " consumerPriorityCount=" << d_consumerPriorityCount; tester->configureHandle(out.str()); @@ -436,7 +435,7 @@ struct Post : public Operation { // 'tester'. // Does post and wait. - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << d_value; tester->post(out.str()); tester->afterNewMessage(1); @@ -491,7 +490,7 @@ MaybeError checkReceivedForConsumers( mqbmock::QueueHandle* handle = status.handle; ASSERT(handle); if (handle->_numMessages() != status.expectedCount) { - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << "actual messages (" << handle->_numMessages() << ") != expected messages(" << status.expectedCount << ")" << " for client \"" << iter->first << "\""; @@ -563,7 +562,7 @@ void regress(Operations* operations, // information. if (!rv.isNull()) { PVV(L_ << ": Failed on sequence: " - << mwcu::PrintUtil::printer(*operations) << " " + << bmqu::PrintUtil::printer(*operations) << " " << rv.value()); ASSERT(false); return; // RETURN @@ -656,7 +655,7 @@ static void test1_broadcastBreathingTest() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); mqbblp::QueueEngineTester tester(broadcastConfig(), false, // start scheduler @@ -721,7 +720,7 @@ static void test2_broadcastConfirmAssertFails() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("CONFIRM ASSERT FAILS TEST"); + bmqtst::TestHelper::printTestName("CONFIRM ASSERT FAILS TEST"); mqbblp::QueueEngineTester tester(broadcastConfig(), false, // start scheduler @@ -776,7 +775,7 @@ static void test3_broadcastCannotDeliver() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("CANNOT CONSUMERS"); + bmqtst::TestHelper::printTestName("CANNOT CONSUMERS"); mqbblp::QueueEngineTester tester(broadcastConfig(), false, // start scheduler @@ -885,7 +884,7 @@ static void test4_broadcastPostAfterResubscribe() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("POST AFTER RESUBSCRIBE"); + bmqtst::TestHelper::printTestName("POST AFTER RESUBSCRIBE"); mqbblp::QueueEngineTester tester(broadcastConfig(), false, // start scheduler @@ -954,7 +953,7 @@ static void test5_broadcastReleaseHandle_isDeletedFlag() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("RELEASE HANDLE - IS-DELETED FLAG"); + bmqtst::TestHelper::printTestName("RELEASE HANDLE - IS-DELETED FLAG"); mqbconfm::Domain domainConfig(s_allocator_p); @@ -1021,7 +1020,7 @@ static void test6_broadcastDynamicPriorities() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("DYNAMIC PRIORITIES"); + bmqtst::TestHelper::printTestName("DYNAMIC PRIORITIES"); mqbblp::QueueEngineTester tester(broadcastConfig(), false, // start scheduler @@ -1122,7 +1121,7 @@ static void test7_broadcastPriorityFailover() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("PRIORITY FAILOVER"); + bmqtst::TestHelper::printTestName("PRIORITY FAILOVER"); mqbblp::QueueEngineTester tester(broadcastConfig(), false, // start scheduler @@ -1212,7 +1211,7 @@ static void testN1_broadcastExhaustiveSubscriptions() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("EXHAUSTIVE SUBSCRIPTIONS TEST"); + bmqtst::TestHelper::printTestName("EXHAUSTIVE SUBSCRIPTIONS TEST"); Operations operations; @@ -1254,7 +1253,7 @@ static void testN2_broadcastExhaustiveCanDeliver() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("EXHAUSTIVE CAN DELIVER TEST"); + bmqtst::TestHelper::printTestName("EXHAUSTIVE CAN DELIVER TEST"); Operations operations; @@ -1301,7 +1300,7 @@ static void testN3_broadcastExhaustiveConsumerPriority() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("EXHAUSTIVE CONSUMER PRIORITY TEST"); + bmqtst::TestHelper::printTestName("EXHAUSTIVE CONSUMER PRIORITY TEST"); Operations operations; @@ -1353,7 +1352,7 @@ static void test8_priorityBreathingTest() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); mqbblp::QueueEngineTester tester(priorityDomainConfig(), false, // start scheduler @@ -1423,7 +1422,7 @@ static void test9_priorityCreateAndConfigure() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("CREATE AND CONFIGURE"); + bmqtst::TestHelper::printTestName("CREATE AND CONFIGURE"); class PriorityQueueEngineTester : public mqbblp::QueueEngineTester { public: @@ -1462,7 +1461,7 @@ static void test9_priorityCreateAndConfigure() // 2. Verify that the created PriorityQueueEngine is functional by // configuring it successfully - mwcu::MemOutStream errorDescription(s_allocator_p); + bmqu::MemOutStream errorDescription(s_allocator_p); errorDescription.reset(); int rc = queueEngineMp->configure(errorDescription); @@ -1503,7 +1502,7 @@ static void test10_priorityAggregateDownstream() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("AGGREGATE DOWNSTREAM"); + bmqtst::TestHelper::printTestName("AGGREGATE DOWNSTREAM"); mqbblp::QueueEngineTester tester(priorityDomainConfig(), false, // start scheduler @@ -1671,7 +1670,7 @@ static void test11_priorityReconfigure() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks // from 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("RECONFIGURE"); + bmqtst::TestHelper::printTestName("RECONFIGURE"); mqbblp::QueueEngineTester tester(priorityDomainConfig(), false, // start scheduler @@ -1807,7 +1806,7 @@ static void test12_priorityCannotDeliver() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("CANNOT CONSUMERS"); + bmqtst::TestHelper::printTestName("CANNOT CONSUMERS"); mqbblp::QueueEngineTester tester(priorityDomainConfig(), false, // start scheduler @@ -1921,7 +1920,7 @@ static void test13_priorityRedeliverToFirstConsumerUp() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("REDELIVERY TO FIRST CONSUMER UP"); + bmqtst::TestHelper::printTestName("REDELIVERY TO FIRST CONSUMER UP"); mqbblp::QueueEngineTester tester(priorityDomainConfig(), false, // start scheduler @@ -1987,7 +1986,7 @@ static void test14_priorityRedeliverToOtherConsumers() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("REDELIVERY TO OTHER CONSUMERS"); + bmqtst::TestHelper::printTestName("REDELIVERY TO OTHER CONSUMERS"); mqbblp::QueueEngineTester tester(priorityDomainConfig(), false, // start scheduler @@ -2067,10 +2066,10 @@ static void test15_priorityReleaseActiveConsumerWithoutNullReconfigure() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("RELEASE ACTIVE CONSUMER WITHOUT NULL" + bmqtst::TestHelper::printTestName("RELEASE ACTIVE CONSUMER WITHOUT NULL" " RECONFIGURE"); - mwctst::ScopedLogObserver logObserver(ball::Severity::ERROR, + bmqtst::ScopedLogObserver logObserver(ball::Severity::ERROR, s_allocator_p); mqbblp::QueueEngineTester tester(priorityDomainConfig(), false, // start scheduler @@ -2165,10 +2164,10 @@ static void test16_priorityReleaseDormantConsumerWithoutNullReconfigure() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("RELEASE DORMANT CONSUMER WITHOUT NULL" + bmqtst::TestHelper::printTestName("RELEASE DORMANT CONSUMER WITHOUT NULL" " RECONFIGURE"); - mwctst::ScopedLogObserver logObserver(ball::Severity::ERROR, + bmqtst::ScopedLogObserver logObserver(ball::Severity::ERROR, s_allocator_p); mqbblp::QueueEngineTester tester(priorityDomainConfig(), false, // start scheduler @@ -2265,7 +2264,7 @@ static void test17_priorityBeforeMessageRemoved_garbageCollection() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("BEFORE MESSAGE REMOVED - GARBAGE " + bmqtst::TestHelper::printTestName("BEFORE MESSAGE REMOVED - GARBAGE " "COLLECTION"); mqbblp::QueueEngineTester tester(priorityDomainConfig(), @@ -2333,7 +2332,7 @@ static void test18_priorityAfterQueuePurged_queueStreamResets() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("AFTER QUEUE PURGED - QUEUE STREAM" + bmqtst::TestHelper::printTestName("AFTER QUEUE PURGED - QUEUE STREAM" " RESETS"); mqbblp::QueueEngineTester tester(priorityDomainConfig(), @@ -2442,7 +2441,7 @@ static void test19_priorityReleaseHandle_isDeletedFlag() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("RELEASE HANDLE - IS-DELETED FLAG"); + bmqtst::TestHelper::printTestName("RELEASE HANDLE - IS-DELETED FLAG"); mqbconfm::Domain domainConfig(s_allocator_p); @@ -2510,7 +2509,7 @@ static void test20_priorityRedeliverAfterGc() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("REDELIVERY AFTER GC"); + bmqtst::TestHelper::printTestName("REDELIVERY AFTER GC"); mqbblp::QueueEngineTester tester(priorityDomainConfig(), false, // start scheduler @@ -2584,7 +2583,7 @@ static void test21_breathingTest() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c"), false, // start scheduler @@ -2742,7 +2741,7 @@ static void test22_createAndConfigure() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("CREATE AND CONFIGURE"); + bmqtst::TestHelper::printTestName("CREATE AND CONFIGURE"); class FanoutQueueEngineTester : public mqbblp::QueueEngineTester { public: @@ -2778,7 +2777,7 @@ static void test22_createAndConfigure() // 2. Verify that the created FanoutQueueEngine is functional by // configuring it successfully - mwcu::MemOutStream errorDescription(s_allocator_p); + bmqu::MemOutStream errorDescription(s_allocator_p); errorDescription.reset(); int rc = queueEngineMp->configure(errorDescription); @@ -2806,7 +2805,7 @@ static void test23_loadRoutingConfiguration() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("ROUTING CONFIGURATION"); + bmqtst::TestHelper::printTestName("ROUTING CONFIGURATION"); mqbblp::QueueEngineTester tester(fanoutConfig("a"), false, // start scheduler @@ -2868,7 +2867,7 @@ static void test24_getHandleDuplicateAppId() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("GET HANDLE - DUPLICATE APP ID"); + bmqtst::TestHelper::printTestName("GET HANDLE - DUPLICATE APP ID"); mqbblp::QueueEngineTester tester(fanoutConfig("a"), false, // start scheduler @@ -2914,7 +2913,7 @@ static void test25_getHandleSameHandleMultipleAppIds() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("GET HANDLE - MULTIPLE APP IDS"); + bmqtst::TestHelper::printTestName("GET HANDLE - MULTIPLE APP IDS"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c"), false, // start scheduler @@ -2959,7 +2958,7 @@ static void test26_getHandleUnauthorizedAppId() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("GET HANDLE - UNAUTHORIZED APP ID"); + bmqtst::TestHelper::printTestName("GET HANDLE - UNAUTHORIZED APP ID"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c"), false, // start scheduler @@ -3009,7 +3008,7 @@ static void test27_configureHandleMultipleAppIds() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("CONFIGURE HANDLE - MULTIPLE APP IDS"); + bmqtst::TestHelper::printTestName("CONFIGURE HANDLE - MULTIPLE APP IDS"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c"), false, // start scheduler @@ -3103,7 +3102,7 @@ static void test28_releaseHandle() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("RELEASE HANDLE"); + bmqtst::TestHelper::printTestName("RELEASE HANDLE"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c"), false, // start scheduler @@ -3188,7 +3187,7 @@ static void test29_releaseHandleMultipleProducers() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("RELEASE HANDLE - MULTIPLE PRODUCERS"); + bmqtst::TestHelper::printTestName("RELEASE HANDLE - MULTIPLE PRODUCERS"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c"), false, // start scheduler @@ -3257,7 +3256,7 @@ static void test30_releaseHandle_isDeletedFlag() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("RELEASE HANDLE - IS-DELETED FLAG"); + bmqtst::TestHelper::printTestName("RELEASE HANDLE - IS-DELETED FLAG"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c,d"), false, // start scheduler @@ -3359,7 +3358,7 @@ static void test31_afterNewMessageDeliverToAllActiveConsumers() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "AFTER NEW MESSAGE - DELIVER TO ALL ACTIVE CONSUMERS"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c,d,e"), @@ -3505,7 +3504,7 @@ static void test32_afterNewMessageRespectsFlowControl() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "AFTER NEW MESSAGE - RESPECT FLOW CONTROL"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c,d,e"), @@ -3805,7 +3804,7 @@ static void test33_consumerUpAfterMessagePosted() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "HANDLE CONSUMER SUBSCRIPTION AFTER POST"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c,d,e"), @@ -3945,7 +3944,7 @@ static void test34_beforeMessageRemoved_deadConsumers() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("BEFORE MESSAGE REMOVED - DEAD" + bmqtst::TestHelper::printTestName("BEFORE MESSAGE REMOVED - DEAD" " CONSUMERS"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c"), @@ -4030,7 +4029,7 @@ static void test35_beforeMessageRemoved_withActiveConsumers() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("BEFORE MESSAGE REMOVED - WITH ALIVE" + bmqtst::TestHelper::printTestName("BEFORE MESSAGE REMOVED - WITH ALIVE" " CONSUMERS"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c"), @@ -4120,7 +4119,7 @@ static void test36_afterQueuePurged_queueStreamResets() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("BEFORE MESSAGE REMOVED - WITH ALIVE" + bmqtst::TestHelper::printTestName("BEFORE MESSAGE REMOVED - WITH ALIVE" " CONSUMERS"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c"), @@ -4285,7 +4284,7 @@ static void test37_afterQueuePurged_specificSubStreamResets() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("BEFORE MESSAGE REMOVED - WITH ALIVE" + bmqtst::TestHelper::printTestName("BEFORE MESSAGE REMOVED - WITH ALIVE" " CONSUMERS"); mqbblp::QueueEngineTester tester(fanoutConfig("a,b,c"), @@ -4436,7 +4435,7 @@ static void test38_unauthorizedAppIds() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("UNAUTHORIZED APP IDS - DELIVER ONLY TO " + bmqtst::TestHelper::printTestName("UNAUTHORIZED APP IDS - DELIVER ONLY TO " "CONSUMERS USING AUTHORIZED APPID"); mqbblp::QueueEngineTester tester(fanoutConfig("a"), @@ -4515,7 +4514,7 @@ static void test39_maxConsumersProducers() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("CONSUMERS/PRODUCERS LIMITS PER APP"); + bmqtst::TestHelper::printTestName("CONSUMERS/PRODUCERS LIMITS PER APP"); // 1. Set maxConsumers and maxProducers limits to the value (2) less than // number of applications (3). @@ -4578,7 +4577,7 @@ static void test40_roundRobinAndRedelivery() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("ROUND-ROBIN AND REDELIVERY"); + bmqtst::TestHelper::printTestName("ROUND-ROBIN AND REDELIVERY"); mqbconfm::Domain config = fanoutConfig("a,b,c"); @@ -4679,7 +4678,7 @@ static void test41_redeliverAfterGc() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("REDELIVERY AFTER GC"); + bmqtst::TestHelper::printTestName("REDELIVERY AFTER GC"); mqbconfm::Domain config = fanoutConfig("a"); @@ -4758,7 +4757,7 @@ static void test42_throttleRedeliveryPriority() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("THROTTLED REDELIVERY PRIORITY"); + bmqtst::TestHelper::printTestName("THROTTLED REDELIVERY PRIORITY"); mqbconfm::Domain config = priorityDomainConfig(); config.maxDeliveryAttempts() = 5; @@ -4850,7 +4849,7 @@ static void test43_throttleRedeliveryFanout() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("THROTTLED REDELIVERY FANOUT"); + bmqtst::TestHelper::printTestName("THROTTLED REDELIVERY FANOUT"); mqbconfm::Domain config = fanoutConfig("a,b,c"); config.maxDeliveryAttempts() = 5; @@ -4987,7 +4986,7 @@ static void test44_throttleRedeliveryCancelledDelay() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("THROTTLED REDELIVERY CANCELLED DELAY"); + bmqtst::TestHelper::printTestName("THROTTLED REDELIVERY CANCELLED DELAY"); mqbconfm::Domain config = priorityDomainConfig(); config.maxDeliveryAttempts() = 5; @@ -5078,7 +5077,7 @@ static void test45_throttleRedeliveryNewHandle() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("THROTTLED REDELIVERY NEW HANDLE"); + bmqtst::TestHelper::printTestName("THROTTLED REDELIVERY NEW HANDLE"); mqbconfm::Domain config = priorityDomainConfig(); config.maxDeliveryAttempts() = 5; @@ -5139,7 +5138,7 @@ static void test46_throttleRedeliveryNoMoreHandles() // Can't check the default allocator: 'mqbblp::QueueEngine' and mocks from // 'mqbi' methods print with ball, which allocates. - mwctst::TestHelper::printTestName("THROTTLED REDELIVERY NO MORE HANDLES"); + bmqtst::TestHelper::printTestName("THROTTLED REDELIVERY NO MORE HANDLES"); mqbconfm::Domain config = priorityDomainConfig(); config.maxDeliveryAttempts() = 5; @@ -5208,7 +5207,7 @@ static void test46_throttleRedeliveryNoMoreHandles() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); bmqp::ProtocolUtil::initialize(s_allocator_p); @@ -5217,7 +5216,7 @@ int main(int argc, char* argv[]) mqbcfg::BrokerConfig::set(brokerConfig); { - bsl::shared_ptr statContext = + bsl::shared_ptr statContext = mqbstat::BrokerStatsUtil::initializeStatContext(30, s_allocator_p); switch (_testCase) { @@ -5287,5 +5286,5 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbblp/mqbblp_routers.cpp b/src/groups/mqb/mqbblp/mqbblp_routers.cpp index 079a2c8ef..f31647ea8 100644 --- a/src/groups/mqb/mqbblp/mqbblp_routers.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_routers.cpp @@ -28,10 +28,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -829,8 +828,8 @@ void Routers::RoundRobin::print(bsl::ostream& os, int level, int spacesPerLevel) const { - os << mwcu::PrintUtil::indent(level, spacesPerLevel) << "Consumers: " - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "Consumers: " + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "-----------------"; for (Priorities::const_iterator itPriority = d_priorities.begin(); @@ -852,22 +851,22 @@ void Routers::RoundRobin::print(bsl::ostream& os, ++it) { const Subscription& subscription = *it; - os << mwcu::PrintUtil::newlineAndIndent(level + 1, + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "priority .........: " << subscription.d_ci.consumerPriorityCount() - << mwcu::PrintUtil::newlineAndIndent(level + 1, + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "count ............: " << subscription.d_ci.consumerPriorityCount() - << mwcu::PrintUtil::newlineAndIndent(level + 1, + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "expression .......:" << subscription.d_itGroup->value() .d_itId->value() .d_itExpression->key() .text() - << mwcu::PrintUtil::newlineAndIndent(level + 1, + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "client---- .......:" << subscriber.d_itConsumer->key()->client()->description(); diff --git a/src/groups/mqb/mqbblp/mqbblp_routers.t.cpp b/src/groups/mqb/mqbblp/mqbblp_routers.t.cpp index 9fb123d04..8b4351851 100644 --- a/src/groups/mqb/mqbblp/mqbblp_routers.t.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_routers.t.cpp @@ -40,7 +40,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -280,7 +280,7 @@ static void test3_parse() { mqbblp::Routers::AppContext appContext(queueContext, s_allocator_p); - mwcu::MemOutStream errorStream(s_allocator_p); + bmqu::MemOutStream errorStream(s_allocator_p); appContext.load(&handle1, &errorStream, subStreamInfo1.subId(), @@ -315,7 +315,7 @@ static void test3_parse() { mqbblp::Routers::AppContext appContext(queueContext, s_allocator_p); - mwcu::MemOutStream errorStream(s_allocator_p); + bmqu::MemOutStream errorStream(s_allocator_p); appContext.load(&handle1, &errorStream, @@ -355,7 +355,7 @@ static void test3_parse() { mqbblp::Routers::AppContext appContext(queueContext, s_allocator_p); - mwcu::MemOutStream errorStream(s_allocator_p); + bmqu::MemOutStream errorStream(s_allocator_p); mqbblp::Routers::RoundRobin router(appContext.d_priorities); @@ -443,7 +443,7 @@ static void test4_generate() s_allocator_p); unsigned int upstreamSubQueueId = 1; mqbblp::Routers::AppContext appContext(queueContext, s_allocator_p); - mwcu::MemOutStream errorStream(s_allocator_p); + bmqu::MemOutStream errorStream(s_allocator_p); bsl::string appId("foo", s_allocator_p); int priorityCount = 2; @@ -514,7 +514,7 @@ int main(int argc, char* argv[]) // Initialize Crc32c bmqp::Crc32c::initialize(); - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); bmqt::UriParser::initialize(s_allocator_p); @@ -537,5 +537,5 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbblp/mqbblp_storagemanager.cpp b/src/groups/mqb/mqbblp/mqbblp_storagemanager.cpp index 7d74f968b..c573e12f2 100644 --- a/src/groups/mqb/mqbblp/mqbblp_storagemanager.cpp +++ b/src/groups/mqb/mqbblp/mqbblp_storagemanager.cpp @@ -36,14 +36,13 @@ #include #include #include -#include +#include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -160,7 +159,7 @@ void StorageManager::startRecoveryCb(int partitionId) bdlf::PlaceHolders::_2, // status bdlf::PlaceHolders::_3, // events bdlf::PlaceHolders::_4, // peer - mwcsys::Time::highResolutionTimer())); + bmqsys::Time::highResolutionTimer())); } void StorageManager::onPartitionRecovery( @@ -215,13 +214,13 @@ void StorageManager::onPartitionRecovery( } if (0 != status) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": Partition [" << partitionId << "] failed to recover with peer " << (recoveryPeer ? recoveryPeer->nodeDescription() : "**NA**") << " with status: " << status << ". This node will not be started now (even if other partitions " - << "recover successfully)." << MWCTSK_ALARMLOG_END; + << "recover successfully)." << BMQTSK_ALARMLOG_END; } else { // Recovery was successful & there is no need to schedule another one. @@ -235,11 +234,11 @@ void StorageManager::onPartitionRecovery( int rc = fs->open(); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData_p->identity().description() << ": Failed to open Partition [" << partitionId << "] after recovery was finished, rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } else { // Apply 'recoveryEvents' to the file store. @@ -253,12 +252,12 @@ void StorageManager::onPartitionRecovery( for (size_t i = 0; i < recoveryEvents.size(); ++i) { rc = fs->processRecoveryEvent(recoveryEvents[i]); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << ": Partition [" << partitionId << "] failed to apply buffered storage event, rc: " << rc << ". Closing the partition." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; fs->close(); break; // BREAK } @@ -284,7 +283,7 @@ void StorageManager::onPartitionRecovery( // Print a summary of the recovered storages if the partition opened // successfully. - mwcu::MemOutStream out; + bmqu::MemOutStream out; if (fs->isOpen()) { mqbs::StoragePrintUtil::printRecoveredStorages( out, @@ -549,7 +548,7 @@ void StorageManager::setPrimaryForPartitionDispatched( << ", leaseId: " << pinfo.primaryLeaseId(); if (primaryLeaseId < pinfo.primaryLeaseId()) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << d_clusterData_p->identity().description() << " Partition [" << partitionId << "]: Smaller new primaryLeaseId specified: " << primaryLeaseId @@ -558,7 +557,7 @@ void StorageManager::setPrimaryForPartitionDispatched( << primaryNode->nodeDescription() << ", current primary node: " << (pinfo.primary() ? pinfo.primary()->nodeDescription() : "** null **") - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -592,14 +591,14 @@ void StorageManager::setPrimaryForPartitionDispatched( if (0 != pinfo.primary()) { // Same leaseId, different node. This is an error. - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << d_clusterData_p->identity().description() << " Partition [" << partitionId << "]: Same primaryLeaseId specified [" << primaryLeaseId << "] with a different primary node. Current primary: " << pinfo.primary()->nodeDescription() << ", specified primary: " << primaryNode->nodeDescription() - << ". Ignoring this request." << MWCTSK_ALARMLOG_END; + << ". Ignoring this request." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -736,12 +735,12 @@ void StorageManager::processPartitionSyncEvent( // Ensure that 'pid' is valid. if (pid >= d_clusterState.partitions().size()) { - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << d_cluster_p->description() << ": Received partition-sync event from node " << source->nodeDescription() << " with invalid" << " partitionId: " << pid << ". Ignoring entire event." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -1110,11 +1109,11 @@ void StorageManager::unregisterQueue(const bmqt::Uri& uri, int partitionId) d_fileStores[partitionId]->dispatchEvent(queueEvent); } -int StorageManager::updateQueue(const bmqt::Uri& uri, - const mqbu::StorageKey& queueKey, - int partitionId, - const AppIdKeyPairs& addedIdKeyPairs, - const AppIdKeyPairs& removedIdKeyPairs) +int StorageManager::updateQueuePrimary(const bmqt::Uri& uri, + const mqbu::StorageKey& queueKey, + int partitionId, + const AppIdKeyPairs& addedIdKeyPairs, + const AppIdKeyPairs& removedIdKeyPairs) { // executed by *QUEUE_DISPATCHER* thread with the specified 'partitionId' @@ -1123,7 +1122,7 @@ int StorageManager::updateQueue(const bmqt::Uri& uri, partitionId < static_cast(d_fileStores.size())); BSLS_ASSERT_SAFE(d_fileStores[partitionId]->inDispatcherThread()); - return mqbc::StorageUtil::updateQueue( + return mqbc::StorageUtil::updateQueuePrimary( &d_storages[partitionId], &d_storagesLock, d_fileStores[partitionId].get(), @@ -1443,7 +1442,7 @@ int StorageManager::start(bsl::ostream& errorDescription) .setMaxQlistFileSize(partitionCfg.maxQlistFileSize()); // Only relevant fields of data store config are set. - // Get named allocator from associated mwcma::CountingAllocatorStore + // Get named allocator from associated bmqma::CountingAllocatorStore bslma::Allocator* recoveryManagerAllocator = d_allocators.get( "RecoveryManager"); @@ -1702,11 +1701,11 @@ void StorageManager::processStorageEvent( // Ensure that 'pid' is valid. if (pid >= d_clusterState.partitions().size()) { - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << d_cluster_p->description() << ": Received storage event " << "from node " << source->nodeDescription() << " with " << "invalid Partition [" << pid << "]. Ignoring entire " - << "storage event." << MWCTSK_ALARMLOG_END; + << "storage event." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -1726,8 +1725,8 @@ void StorageManager::processStorageEvent( pinfo.primaryStatus(), d_clusterData_p->identity().description(), skipAlarm, - false)) { // isFSMWorkflow - return; // RETURN + false)) { // isFSMWorkflow + return; // RETURN } mqbs::FileStore* fs = d_fileStores[pid].get(); @@ -1949,12 +1948,12 @@ void StorageManager::processRecoveryEvent( // Ensure that 'pid' is valid. if (pid >= d_clusterState.partitions().size()) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_cluster_p->description() << ": Received recovery event from node " << source->nodeDescription() << " with invalid partitionId: " << pid - << ". Ignoring entire recovery event." << MWCTSK_ALARMLOG_END; + << ". Ignoring entire recovery event." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -1968,13 +1967,13 @@ void StorageManager::processRecoveryEvent( // implementation of recovery, and thus, if it occurs, we reject // the *entire* recovery event. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_cluster_p->description() << ": Received recovery event from node " << source->nodeDescription() << " with different partitionIds: " << pid << " vs " << header.partitionId() << ". Ignoring entire recovery event." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } } @@ -1995,14 +1994,14 @@ void StorageManager::processReceiptEvent(const bmqp::Event& event, { // executed by *IO* thread - mwcu::BlobPosition position; - BSLA_MAYBE_UNUSED const int rc = mwcu::BlobUtil::findOffsetSafe( + bmqu::BlobPosition position; + BSLA_MAYBE_UNUSED const int rc = bmqu::BlobUtil::findOffsetSafe( &position, *event.blob(), sizeof(bmqp::EventHeader)); BSLS_ASSERT_SAFE(rc == 0); - mwcu::BlobObjectProxy receipt( + bmqu::BlobObjectProxy receipt( event.blob(), position, true, // read mode @@ -2025,6 +2024,15 @@ void StorageManager::processReceiptEvent(const bmqp::Event& event, source)); } +void StorageManager::bufferPrimaryStatusAdvisory( + BSLS_ANNOTATION_UNUSED const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, + BSLS_ANNOTATION_UNUSED mqbnet::ClusterNode* source) +{ + // executed by *ANY* thread + + BSLS_ASSERT_OPT(false && "This method should only be invoked in FSM mode"); +} + void StorageManager::processPrimaryStatusAdvisory( const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, mqbnet::ClusterNode* source) diff --git a/src/groups/mqb/mqbblp/mqbblp_storagemanager.h b/src/groups/mqb/mqbblp/mqbblp_storagemanager.h index 2d0144fe5..86ceb2fff 100644 --- a/src/groups/mqb/mqbblp/mqbblp_storagemanager.h +++ b/src/groups/mqb/mqbblp/mqbblp_storagemanager.h @@ -47,8 +47,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -191,7 +190,7 @@ class StorageManager : public mqbi::StorageManager { bslma::Allocator* d_allocator_p; // Allocator to use - mwcma::CountingAllocatorStore d_allocators; + bmqma::CountingAllocatorStore d_allocators; // Allocator store to spawn new // allocators for sub-components @@ -540,12 +539,12 @@ class StorageManager : public mqbi::StorageManager { /// queue is configured in fanout mode. /// /// THREAD: Executed by the Queue's dispatcher thread. - virtual int - updateQueue(const bmqt::Uri& uri, - const mqbu::StorageKey& queueKey, - int partitionId, - const AppIdKeyPairs& addedIdKeyPairs, - const AppIdKeyPairs& removedIdKeyPairs) BSLS_KEYWORD_OVERRIDE; + virtual int updateQueuePrimary(const bmqt::Uri& uri, + const mqbu::StorageKey& queueKey, + int partitionId, + const AppIdKeyPairs& addedIdKeyPairs, + const AppIdKeyPairs& removedIdKeyPairs) + BSLS_KEYWORD_OVERRIDE; virtual void registerQueueReplica(int partitionId, @@ -676,6 +675,11 @@ class StorageManager : public mqbi::StorageManager { processReceiptEvent(const bmqp::Event& event, mqbnet::ClusterNode* source) BSLS_KEYWORD_OVERRIDE; + /// Executed by any thread. + virtual void bufferPrimaryStatusAdvisory( + const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, + mqbnet::ClusterNode* source) BSLS_KEYWORD_OVERRIDE; + /// Executed by any thread. virtual void processPrimaryStatusAdvisory( const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, diff --git a/src/groups/mqb/mqbc/mqbc_clusterdata.cpp b/src/groups/mqb/mqbc/mqbc_clusterdata.cpp index b19e97a56..0b8c36956 100644 --- a/src/groups/mqb/mqbc/mqbc_clusterdata.cpp +++ b/src/groups/mqb/mqbc/mqbc_clusterdata.cpp @@ -26,8 +26,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -72,7 +71,7 @@ mqbc::ClusterDataIdentity clusterIdentity(const bslstl::StringRef& name, // Create and set description bdlma::LocalSequentialAllocator<256> localAllocator; - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); if (isRemote) { os << "ClusterProxy (" << name << ")"; } @@ -102,7 +101,7 @@ ClusterData::ClusterData( mqbi::Cluster* cluster, mqbi::DomainFactory* domainFactory, mqbnet::TransportManager* transportManager, - mwcst::StatContext* clustersStatContext, + bmqst::StatContext* clustersStatContext, const StatContextsMap& statContexts, bslma::Allocator* allocator) : d_allocator_p(allocator) @@ -134,11 +133,11 @@ ClusterData::ClusterData( , d_clusterNodesStatContext_mp( statContexts.find("clusterNodes") ->second->addSubcontext( - mwcst::StatContextConfiguration(d_identity.name(), + bmqst::StatContextConfiguration(d_identity.name(), d_allocator_p))) , d_stateSpPool(8192, allocator) , d_miscWorkThreadPool( - mwcsys::ThreadUtil::defaultAttributes().setThreadName("bmqMiscWorkTP"), + bmqsys::ThreadUtil::defaultAttributes().setThreadName("bmqMiscWorkTP"), 3, // numThreads 10000, // maxNumPendingJobs allocator) diff --git a/src/groups/mqb/mqbc/mqbc_clusterdata.h b/src/groups/mqb/mqbc/mqbc_clusterdata.h index 8b7e2565c..6d7a07571 100644 --- a/src/groups/mqb/mqbc/mqbc_clusterdata.h +++ b/src/groups/mqb/mqbc/mqbc_clusterdata.h @@ -45,10 +45,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -126,9 +125,9 @@ class ClusterData { BlobSpPool; typedef bdlcc::SharedObjectPool< - mwcu::AtomicState, + bmqu::AtomicState, bdlcc::ObjectPoolFunctors::DefaultCreator, - bdlcc::ObjectPoolFunctors::Reset > + bdlcc::ObjectPoolFunctors::Reset > StateSpPool; /// Type of the RequestManager used by the cluster. @@ -141,10 +140,10 @@ class ClusterData { bmqp_ctrlmsg::ControlMessage> MultiRequestManagerType; - typedef bslma::ManagedPtr StatContextMp; + typedef bslma::ManagedPtr StatContextMp; /// Map of stat context names to StatContext pointers - typedef bsl::unordered_map + typedef bsl::unordered_map StatContextsMap; private: @@ -229,7 +228,7 @@ class ClusterData { mqbi::Cluster* cluster, mqbi::DomainFactory* domainFactory, mqbnet::TransportManager* transportManager, - mwcst::StatContext* clustersStatContext, + bmqst::StatContext* clustersStatContext, const StatContextsMap& statContexts, bslma::Allocator* allocator); diff --git a/src/groups/mqb/mqbc/mqbc_clusternodesession.cpp b/src/groups/mqb/mqbc/mqbc_clusternodesession.cpp index 86217e9b4..3b139f86d 100644 --- a/src/groups/mqb/mqbc/mqbc_clusternodesession.cpp +++ b/src/groups/mqb/mqbc/mqbc_clusternodesession.cpp @@ -17,8 +17,8 @@ #include #include -// MWC -#include + +#include // BDE #include @@ -42,7 +42,7 @@ ClusterNodeSession::ClusterNodeSession( , d_clusterNode_p(netNode) , d_peerInstanceId(0) // There is no invalid value for this field , d_queueHandleRequesterContext_sp( - new (*allocator) mqbi::QueueHandleRequesterContext(allocator), + new(*allocator) mqbi::QueueHandleRequesterContext(allocator), allocator) , d_nodeStatus(bmqp_ctrlmsg::NodeStatus::E_UNAVAILABLE) // See note in ctor , d_statContext_sp() diff --git a/src/groups/mqb/mqbc/mqbc_clusternodesession.h b/src/groups/mqb/mqbc/mqbc_clusternodesession.h index b0447844d..2658e96a9 100644 --- a/src/groups/mqb/mqbc/mqbc_clusternodesession.h +++ b/src/groups/mqb/mqbc/mqbc_clusternodesession.h @@ -37,8 +37,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -139,7 +138,7 @@ class ClusterNodeSession : public mqbi::DispatcherClient, typedef QueueHandleMap::const_iterator QueueHandleMapConstIter; - typedef bsl::shared_ptr StatContextSp; + typedef bsl::shared_ptr StatContextSp; typedef QueueState::StreamsMap StreamsMap; diff --git a/src/groups/mqb/mqbc/mqbc_clusterstate.cpp b/src/groups/mqb/mqbc/mqbc_clusterstate.cpp index 23dee1d41..8bf7084f7 100644 --- a/src/groups/mqb/mqbc/mqbc_clusterstate.cpp +++ b/src/groups/mqb/mqbc/mqbc_clusterstate.cpp @@ -21,8 +21,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -361,7 +360,7 @@ bool ClusterState::assignQueue(const bmqt::Uri& uri, updatePartitionQueueMapped(partitionId, 1); - mwcu::Printer printer(&appIdInfos); + bmqu::Printer printer(&appIdInfos); BALL_LOG_INFO << "Cluster [" << d_cluster_p->name() << "]: " << "Assigning queue [" << uri << "], queueKey: [" << key << "] to Partition [" << partitionId @@ -504,8 +503,8 @@ int ClusterState::updateQueue(const bmqt::Uri& uri, appIdInfos.erase(appIdInfoCIter); } - mwcu::Printer printer1(&addedAppIds); - mwcu::Printer printer2(&removedAppIds); + bmqu::Printer printer1(&addedAppIds); + bmqu::Printer printer2(&removedAppIds); BALL_LOG_INFO << "Cluster [" << d_cluster_p->name() << "]: " << "Updating queue [" << uri << "], queueKey: [" << iter->second->key() << "], partitionId: [" @@ -516,8 +515,8 @@ int ClusterState::updateQueue(const bmqt::Uri& uri, else { // This update is for an entire domain, instead of any individual // queue. - mwcu::Printer printer1(&addedAppIds); - mwcu::Printer printer2(&removedAppIds); + bmqu::Printer printer1(&addedAppIds); + bmqu::Printer printer2(&removedAppIds); BALL_LOG_INFO << "Cluster [" << d_cluster_p->name() << "]: " << "Updating domain: [" << domain << "], addedAppIds: " << printer1 diff --git a/src/groups/mqb/mqbc/mqbc_clusterstateledger.t.cpp b/src/groups/mqb/mqbc/mqbc_clusterstateledger.t.cpp index 04d61cbb0..a41e442dd 100644 --- a/src/groups/mqb/mqbc/mqbc_clusterstateledger.t.cpp +++ b/src/groups/mqb/mqbc/mqbc_clusterstateledger.t.cpp @@ -19,8 +19,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -32,7 +31,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -171,7 +170,7 @@ static void test1_clusterStateLedger_protocol() // PROTOCOL TEST // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE LEDGER - PROTOCOL TEST"); + bmqtst::TestHelper::printTestName("CLUSTER STATE LEDGER - PROTOCOL TEST"); PV("Creating a test object"); bsls::ProtocolTest testObj(s_verbosityLevel > @@ -235,7 +234,7 @@ static void test2_commitStatus_fromAscii() // 'ClusterStateLedgerCommitStatus::fromAscii' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("COMMIT STATUS - FROM ASCII"); + bmqtst::TestHelper::printTestName("COMMIT STATUS - FROM ASCII"); struct Test { int d_line; @@ -285,7 +284,7 @@ static void test3_commitStatus_toAscii() // 'ClusterStateLedgerCommitStatus::toAscii' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("COMMIT STATUS - TO ASCII"); + bmqtst::TestHelper::printTestName("COMMIT STATUS - TO ASCII"); struct Test { int d_line; @@ -333,7 +332,7 @@ static void test4_commitStatus_print() // 'ClusterStateLedgerCommitStatus::print' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("COMMIT STATUS - PRINT"); + bmqtst::TestHelper::printTestName("COMMIT STATUS - PRINT"); // 1. struct Test { @@ -354,7 +353,7 @@ static void test4_commitStatus_print() << ") == " << test.d_expected); // 1. - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); mqbc::ClusterStateLedgerCommitStatus::Enum obj( static_cast( test.d_value)); @@ -400,7 +399,7 @@ static void test5_clusterStateLedgerConsistency_fromAscii() // 'ClusterStateLedgerConsistency::fromAscii' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE LEDGER CONSISTENCY -" + bmqtst::TestHelper::printTestName("CLUSTER STATE LEDGER CONSISTENCY -" " FROM ASCII"); struct Test { @@ -453,7 +452,7 @@ static void test6_clusterStateLedgerConsistency_toAscii() // 'ClusterStateLedgerConsistency::toAscii' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE LEDGER CONSISTENCY -" + bmqtst::TestHelper::printTestName("CLUSTER STATE LEDGER CONSISTENCY -" " TO ASCII"); struct Test { @@ -502,7 +501,7 @@ static void test7_clusterStateLedgerConsistency_print() // 'ClusterStateLedgerConsistency::print' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE LEDGER CONSISTENCY -" + bmqtst::TestHelper::printTestName("CLUSTER STATE LEDGER CONSISTENCY -" " PRINT"); // 1. @@ -524,7 +523,7 @@ static void test7_clusterStateLedgerConsistency_print() << ") == " << test.d_expected); // 1. - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); mqbc::ClusterStateLedgerConsistency::Enum obj( static_cast( test.d_value)); @@ -560,7 +559,7 @@ static void test7_clusterStateLedgerConsistency_print() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -577,5 +576,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbc/mqbc_clusterstateledgeriterator.t.cpp b/src/groups/mqb/mqbc/mqbc_clusterstateledgeriterator.t.cpp index d7f8dfe92..07487d3b8 100644 --- a/src/groups/mqb/mqbc/mqbc_clusterstateledgeriterator.t.cpp +++ b/src/groups/mqb/mqbc/mqbc_clusterstateledgeriterator.t.cpp @@ -23,15 +23,14 @@ // BMQ #include -// MWC -#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -143,7 +142,7 @@ static void test1_clusterStateLedgerIterator_protocol() // PROTOCOL TEST // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE LEDGER ITERATOR - " + bmqtst::TestHelper::printTestName("CLUSTER STATE LEDGER ITERATOR - " "PROTOCOL TEST"); PV("Creating a test object"); @@ -166,7 +165,7 @@ static void test1_clusterStateLedgerIterator_protocol() s_allocator_p); mqbmock::ClusterStateLedgerIterator cslIter(records); bmqp_ctrlmsg::ClusterMessage clusterMessage; - mwcu::MemOutStream os; + bmqu::MemOutStream os; BSLS_PROTOCOLTEST_ASSERT(testObj, copy(cslIter)); BSLS_PROTOCOLTEST_ASSERT(testObj, clone(0)); BSLS_PROTOCOLTEST_ASSERT(testObj, next()); @@ -183,7 +182,7 @@ static void test1_clusterStateLedgerIterator_protocol() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -194,5 +193,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbc/mqbc_clusterstateledgerprotocol.t.cpp b/src/groups/mqb/mqbc/mqbc_clusterstateledgerprotocol.t.cpp index cdb3d851b..e22e757d0 100644 --- a/src/groups/mqb/mqbc/mqbc_clusterstateledgerprotocol.t.cpp +++ b/src/groups/mqb/mqbc/mqbc_clusterstateledgerprotocol.t.cpp @@ -16,15 +16,14 @@ // mqbc_clusterstateledgerprotocol.t.cpp -*-C++-*- #include -// MWC -#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -63,7 +62,7 @@ static void test1_breathingTest() // Basic functionality // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); using namespace mqbc; @@ -135,8 +134,8 @@ static void printEnumHelper(ARRAY (&data)[SIZE]) PVVV("Line [" << test.d_line << "]"); - mwcu::MemOutStream out(s_allocator_p); - mwcu::MemOutStream expected(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream expected(s_allocator_p); typedef typename ENUM_TYPE::Enum T; @@ -181,7 +180,7 @@ static void test2_enumPrint() // ClusterStateRecordType::print // operator<<(bsl::ostream&, ClusterStateRecordType::Enum) // -------------------------------------------------------------------- - mwctst::TestHelper::printTestName("ENUM LAYOUT"); + bmqtst::TestHelper::printTestName("ENUM LAYOUT"); PV("Test mqbc::ClusterStateRecordType printing"); { @@ -209,7 +208,7 @@ static void test2_enumPrint() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -221,5 +220,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbc/mqbc_clusterstateledgerutil.cpp b/src/groups/mqb/mqbc/mqbc_clusterstateledgerutil.cpp index b0ef644e2..ddd934b8f 100644 --- a/src/groups/mqb/mqbc/mqbc_clusterstateledgerutil.cpp +++ b/src/groups/mqb/mqbc/mqbc_clusterstateledgerutil.cpp @@ -22,11 +22,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -300,7 +299,7 @@ int ClusterStateLedgerUtil::validateLog(mqbsi::Log::Offset* offset, bdlb::BigEndianUint32 crc32cComputed; crc32cComputed = bmqp::Crc32c::calculate(blob); if (crc32cComputed != crc32cExpected) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << "CSL Recovery: CRC mismatch for record with sequenceNumber " << "[" << recHeader->sequenceNumber() << "] in file '" << log->logConfig().location() << "' with fileKey [" @@ -315,7 +314,7 @@ int ClusterStateLedgerUtil::validateLog(mqbsi::Log::Offset* offset, << ", electorTerm: " << recHeader->electorTerm() << ", sequenceNumber: " << recHeader->sequenceNumber() << ", timestamp: " << recHeader->timestamp() << "]" - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return ClusterStateLedgerUtilRc::e_INVALID_CHECKSUM; // RETURN } @@ -378,7 +377,7 @@ int ClusterStateLedgerUtil::appendRecord( .setTimestamp(timestamp); // Encode and append 'advisory' to the blob - mwcu::MemOutStream os; + bmqu::MemOutStream os; int rc = bmqp::ProtocolUtil::encodeMessage(os, blob, clusterMessage, @@ -434,7 +433,7 @@ int ClusterStateLedgerUtil::loadClusterMessage( // RETURN } - mwcu::MemOutStream os; + bmqu::MemOutStream os; rc = bmqp::ProtocolUtil::decodeMessage(os, message, entry, @@ -486,7 +485,7 @@ int ClusterStateLedgerUtil::loadClusterMessage( const int recordHeaderSize = recordHeader.headerWords() * bmqp::Protocol::k_WORD_SIZE; - mwcu::MemOutStream os; + bmqu::MemOutStream os; int rc = bmqp::ProtocolUtil::decodeMessage(os, message, record, @@ -505,14 +504,14 @@ int ClusterStateLedgerUtil::loadClusterMessage( const bdlbb::Blob& record, int offset) { - mwcu::BlobPosition headerPosition; - int rc = mwcu::BlobUtil::findOffsetSafe(&headerPosition, record, offset); + bmqu::BlobPosition headerPosition; + int rc = bmqu::BlobUtil::findOffsetSafe(&headerPosition, record, offset); if (rc != 0) { return rc * 100 + ClusterStateLedgerUtilRc::e_MISSING_HEADER; // RETURN } - mwcu::BlobObjectProxy header( + bmqu::BlobObjectProxy header( &record, headerPosition, -ClusterStateRecordHeader::k_MIN_HEADER_SIZE, diff --git a/src/groups/mqb/mqbc/mqbc_clusterstateledgerutil.t.cpp b/src/groups/mqb/mqbc/mqbc_clusterstateledgerutil.t.cpp index b38b0d206..1881ce711 100644 --- a/src/groups/mqb/mqbc/mqbc_clusterstateledgerutil.t.cpp +++ b/src/groups/mqb/mqbc/mqbc_clusterstateledgerutil.t.cpp @@ -30,9 +30,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -48,7 +47,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -94,7 +93,7 @@ struct Tester { // DATA mqbsi::LedgerConfig d_config; bslma::ManagedPtr d_ledger_mp; - mwcu::TempDirectory d_tempDir; + bmqu::TempDirectory d_tempDir; bdlbb::PooledBlobBufferFactory d_bufferFactory; public: @@ -211,7 +210,7 @@ static void test1_validateFileHeader() // validateFileHeader(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("VALIDATE FILE HEADER"); + bmqtst::TestHelper::printTestName("VALIDATE FILE HEADER"); mqbc::ClusterStateFileHeader header; mqbu::StorageKey key(mqbu::StorageKey::BinaryRepresentation(), "12345"); @@ -261,7 +260,7 @@ static void test2_validateRecordHeader() // validateRecordHeader(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("VALIDATE RECORD HEADER"); + bmqtst::TestHelper::printTestName("VALIDATE RECORD HEADER"); mqbc::ClusterStateRecordHeader header; header.setHeaderWords(mqbc::ClusterStateRecordHeader::k_HEADER_NUM_WORDS) @@ -303,7 +302,7 @@ static void test3_extractLogId() // extractLogId(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("EXTRACT LOG ID"); + bmqtst::TestHelper::printTestName("EXTRACT LOG ID"); Tester tester; mqbsi::Ledger* ledger = tester.ledger(); @@ -332,7 +331,7 @@ static void test4_validateLog() // validateLog(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("VALIDATE LOG"); + bmqtst::TestHelper::printTestName("VALIDATE LOG"); Tester tester; mqbsi::Ledger* ledger = tester.ledger(); @@ -367,7 +366,7 @@ static void test4_validateLog() mqbsi::LedgerRecordId recordId1; rc = ledger->writeRecord(&recordId1, record1, - mwcu::BlobPosition(), + bmqu::BlobPosition(), record1.length()); BSLS_ASSERT_OPT(rc == 0); @@ -393,7 +392,7 @@ static void test4_validateLog() mqbsi::LedgerRecordId recordId2; rc = ledger->writeRecord(&recordId2, record2, - mwcu::BlobPosition(), + bmqu::BlobPosition(), record2.length()); BSLS_ASSERT_OPT(rc == 0); @@ -417,7 +416,7 @@ static void test4_validateLog() mqbsi::LedgerRecordId recordId3; rc = ledger->writeRecord(&recordId3, record3, - mwcu::BlobPosition(), + bmqu::BlobPosition(), record3.length()); BSLS_ASSERT_OPT(rc == 0); @@ -442,7 +441,7 @@ static void test4_validateLog() mqbsi::LedgerRecordId recordId4; rc = ledger->writeRecord(&recordId4, record4, - mwcu::BlobPosition(), + bmqu::BlobPosition(), record4.length()); BSLS_ASSERT_OPT(rc == 0); @@ -465,7 +464,7 @@ static void test5_validateLog_invalidCrc32c() // validateLog(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("VALIDATE LOG - INVALID CRC32-C"); + bmqtst::TestHelper::printTestName("VALIDATE LOG - INVALID CRC32-C"); Tester tester; mqbsi::Ledger* ledger = tester.ledger(); @@ -499,7 +498,7 @@ static void test5_validateLog_invalidCrc32c() mqbsi::LedgerRecordId recordId1; rc = ledger->writeRecord(&recordId1, record1, - mwcu::BlobPosition(), + bmqu::BlobPosition(), record1.length()); BSLS_ASSERT_OPT(rc == 0); @@ -539,7 +538,7 @@ static void test5_validateLog_invalidCrc32c() mqbsi::LedgerRecordId recordId2; rc = ledger->writeRecord(&recordId2, record2, - mwcu::BlobPosition(), + bmqu::BlobPosition(), record2.length()); BSLS_ASSERT_OPT(rc == 0); @@ -561,7 +560,7 @@ static void test6_writeFileHeader() // writeFileHeader(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRTIE FILE HEADER"); + bmqtst::TestHelper::printTestName("WRTIE FILE HEADER"); Tester tester; mqbsi::Ledger* ledger = tester.ledger(); @@ -599,7 +598,7 @@ static void test7_appendRecord() // appendRecord(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("APPEND RECORD"); + bmqtst::TestHelper::printTestName("APPEND RECORD"); Tester tester; @@ -664,7 +663,7 @@ static void test8_loadClusterMessageLedger() // const mqbsi::LedgerRecordId& recordId) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LOAD CLUSTER MESSAGE LEDGER"); + bmqtst::TestHelper::printTestName("LOAD CLUSTER MESSAGE LEDGER"); Tester tester; mqbsi::Ledger* ledger = tester.ledger(); @@ -690,7 +689,7 @@ static void test8_loadClusterMessageLedger() mqbsi::LedgerRecordId recordId; rc = ledger->writeRecord(&recordId, record, - mwcu::BlobPosition(), + bmqu::BlobPosition(), record.length()); BSLS_ASSERT_OPT(rc == 0); @@ -740,7 +739,7 @@ static void test9_loadClusterMessageBlob() // int offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LOAD CLUSTER MESSAGE BLOB"); + bmqtst::TestHelper::printTestName("LOAD CLUSTER MESSAGE BLOB"); Tester tester; @@ -808,7 +807,7 @@ static void test10_recordSize() // recordSize(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("RECORD SIZE"); + bmqtst::TestHelper::printTestName("RECORD SIZE"); mqbc::ClusterStateRecordHeader header; header.setHeaderWords(mqbc::ClusterStateRecordHeader::k_HEADER_NUM_WORDS) @@ -831,9 +830,9 @@ static void test10_recordSize() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); - mwcsys::Time::initialize(s_allocator_p); + bmqsys::Time::initialize(s_allocator_p); bmqp::ProtocolUtil::initialize(s_allocator_p); bmqp::Crc32c::initialize(); @@ -856,7 +855,7 @@ int main(int argc, char* argv[]) } bmqp::ProtocolUtil::shutdown(); - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbc/mqbc_clusterstatemanager.h b/src/groups/mqb/mqbc/mqbc_clusterstatemanager.h index 4ab48ddd7..b2a8c2670 100644 --- a/src/groups/mqb/mqbc/mqbc_clusterstatemanager.h +++ b/src/groups/mqb/mqbc/mqbc_clusterstatemanager.h @@ -45,8 +45,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -126,7 +125,7 @@ class ClusterStateManager bslma::Allocator* d_allocator_p; // Allocator for memory allocations - mwcma::CountingAllocatorStore d_allocators; + bmqma::CountingAllocatorStore d_allocators; // Allocator store to spawn new // allocators for sub-components diff --git a/src/groups/mqb/mqbc/mqbc_clusterstatemanager.t.cpp b/src/groups/mqb/mqbc/mqbc_clusterstatemanager.t.cpp index adecd84df..e8258298b 100644 --- a/src/groups/mqb/mqbc/mqbc_clusterstatemanager.t.cpp +++ b/src/groups/mqb/mqbc/mqbc_clusterstatemanager.t.cpp @@ -35,10 +35,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -50,7 +49,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -88,7 +87,7 @@ struct Tester { public: // PUBLIC DATA bdlbb::PooledBlobBufferFactory d_bufferFactory; - mwcu::TempDirectory d_tempDir; + bmqu::TempDirectory d_tempDir; bslma::ManagedPtr d_cluster_mp; mqbmock::ClusterStateLedger* d_clusterStateLedger_p; bslma::ManagedPtr d_clusterStateManager_mp; @@ -150,7 +149,7 @@ struct Tester { d_cluster_mp->_clusterData()->stats().setIsMember(true); BSLS_ASSERT_OPT(d_cluster_mp->_channels().size() > 0); - mwcsys::Time::initialize( + bmqsys::Time::initialize( &bsls::SystemTime::nowRealtimeClock, bdlf::BindUtil::bind(&Tester::nowMonotonicClock, this), bdlf::BindUtil::bind(&Tester::highResolutionTimer, this), @@ -179,7 +178,7 @@ struct Tester { d_clusterStateManager_mp->setStorageManager(&d_storageManager); // Start the cluster and the cluster state manager - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; int rc = d_cluster_mp->start(errorDescription); BSLS_ASSERT_OPT(rc == 0); rc = d_clusterStateManager_mp->start(errorDescription); @@ -198,7 +197,7 @@ struct Tester { d_clusterStateManager_mp->stop(); d_cluster_mp->stop(); - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); } // MANIPULATORS @@ -562,7 +561,7 @@ static void test1_breathingTestLeader() // Basic functionality as new leader // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "BREATHING TEST LEADER"); Tester tester(true); // isLeader @@ -605,7 +604,7 @@ static void test2_breathingTestFollower() // Basic functionality as new follower // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "BREATHING TEST FOLLOWER"); Tester tester(false); // isLeader @@ -639,7 +638,7 @@ static void test3_invalidMessagesUnknownState() // Invalid message handling when in Unknown state // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "INVALID MESSAGES UNKNOWN STATE"); Tester tester(false); // isLeader @@ -679,7 +678,7 @@ static void test4_invalidMessagesLeader() // Invalid message handling when in any leader state // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "INVALID MESSAGES LEADER"); Tester tester(true); // isLeader @@ -761,7 +760,7 @@ static void test5_followerLSNRequestHandlingFollower() // Follower response to follower LSN request // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "CLUSTER STATE MANAGER - " "FOLLOWER LSN REQUEST HANDLING FOLLOWER"); @@ -813,7 +812,7 @@ static void test6_registrationRequestHandlingLeader() // Leader response to registration request // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "REGISTRATION REQUEST HANDLING LEADER"); Tester tester(true); // isLeader @@ -872,7 +871,7 @@ static void test7_followerLSNResponseQuorum() // Leader transition upon follower LSN response quorum // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "FOLLOWER LSN RESPONSE QUORUM"); Tester tester(true); // isLeader @@ -945,7 +944,7 @@ static void test8_registrationRequestQuorum() // Leader transition upon registration request quorum // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "REGISTRATION REQUEST QUORUM"); Tester tester(true); // isLeader @@ -1022,7 +1021,7 @@ static void test9_followerLSNNoQuorum() // Leader transition upon follower LSN no quorum // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "FOLLOWER LSN NO QUORUM"); Tester tester(true); // isLeader @@ -1093,7 +1092,7 @@ static void test10_followerClusterStateRequestHandlingFollower() // Follower response to follower cluster state request // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "CLUSTER STATE MANAGER - " "FOLLOWER CLUSTER STATE REQUEST HANDLING FOLLOWER"); @@ -1150,7 +1149,7 @@ static void test11_leaderHighestLeaderHealed() // Leader transition to healed upon successful CSL commit callback // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "LEADER HIGHEST LEADER HEALED"); Tester tester(true); // isLeader @@ -1243,7 +1242,7 @@ static void test12_followerHighestLeaderHealed() // successful CSL commit callback // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "FOLLOWER HIGHEST LEADER HEALED"); Tester tester(true); // isLeader @@ -1365,7 +1364,7 @@ static void test13_followerHealed() // Follower transition to healed upon successful CSL commit callback // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "FOLLOWER HEALED"); Tester tester(false); // isLeader @@ -1406,7 +1405,7 @@ static void test14_leaderCSLCommitFailure() // Leader upon CSL commit callback failure // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "LEADER CSL COMMIT FAILURE"); Tester tester(true); // isLeader @@ -1474,7 +1473,7 @@ static void test15_followerCSLCommitFailure() // Follower upon CSL commit callback failure // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "FOLLOWER CSL COMMIT FAILURE"); Tester tester(false); // isLeader @@ -1517,7 +1516,7 @@ static void test16_followerClusterStateRespFailureLeaderNext() // healed upon successful CSL commit callback // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "CLUSTER STATE MANAGER - " "FOLLOWER CLUSTER STATE RESP FAILURE LEADER NEXT"); @@ -1636,7 +1635,7 @@ static void test17_followerClusterStateRespFailureFollowerNext() // callback // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "CLUSTER STATE MANAGER - " "FOLLOWER CLUSTER STATE RESP FAILURE FOLLOWER NEXT"); @@ -1783,7 +1782,7 @@ static void test18_followerClusterStateRespFailureLostQuorum() // After losing quorum, leader transition back to healing stage 1 // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "CLUSTER STATE MANAGER - " "FOLLOWER CLUSTER STATE RESP FAILURE LOST QUORUM"); @@ -1883,7 +1882,7 @@ static void test19_stopNode() // Self transition to STOPPING state // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - STOP NODE"); + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - STOP NODE"); // 1.) Stopping from Unknown state Tester tester1(true); // isLeader @@ -2030,7 +2029,7 @@ static void test20_resetUnknownLeader() // Upon RST_UNKNOWN event, the leader goes back to UNKNOWN state // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "RESET UNKNOWN LEADER"); Tester tester(true); // isLeader @@ -2159,7 +2158,7 @@ static void test21_resetUnknownFollower() // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "RESET UNKNOWN FOLLOWER"); Tester tester(false); // isLeader @@ -2219,7 +2218,7 @@ static void test22_selectFollowerFromLeader() // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "SELECT FOLLOWER FROM LEADER"); bmqp_ctrlmsg::LeaderMessageSequence selfLSN; @@ -2355,7 +2354,7 @@ static void test23_selectLeaderFromFollower() // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "SELECT LEADER FROM FOLLOWER"); bmqp_ctrlmsg::LeaderMessageSequence selfLSN; @@ -2429,7 +2428,7 @@ static void test24_watchDogLeader() // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "WATCH DOG LEADER"); Tester tester(true); // isLeader @@ -2535,7 +2534,7 @@ static void test25_watchDogFollower() // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CLUSTER STATE MANAGER - " + bmqtst::TestHelper::printTestName("CLUSTER STATE MANAGER - " "WATCH DOG FOLLOWER"); Tester tester(false); // isLeader @@ -2590,7 +2589,7 @@ static void test25_watchDogFollower() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); bmqp::Crc32c::initialize(); @@ -2630,7 +2629,7 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); // Can't ensure no default memory is allocated because // 'bdlmt::EventSchedulerTestTimeSource' inside 'mqbmock::Cluster' uses // the default allocator in its constructor. diff --git a/src/groups/mqb/mqbc/mqbc_clusterutil.cpp b/src/groups/mqb/mqbc/mqbc_clusterutil.cpp index cdf19c625..98be24bbe 100644 --- a/src/groups/mqb/mqbc/mqbc_clusterutil.cpp +++ b/src/groups/mqb/mqbc/mqbc_clusterutil.cpp @@ -37,12 +37,11 @@ #include #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -171,11 +170,11 @@ void applyQueueUpdate(mqbc::ClusterState* clusterState, if (domCiter == clusterState->domainStates().end()) { // First time hearing about this domain and queue - should not // occur for an update advisory - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << clusterData.identity().description() << ": Received QueueUpdateAdvisory for a domain and queue " << "that were not found: " << queueUpdate << "]" - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -184,32 +183,32 @@ void applyQueueUpdate(mqbc::ClusterState* clusterState, if (cit == domCiter->second->queuesInfo().end()) { // First time hearing about this queue - should not occur for // an update advisory - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << clusterData.identity().description() << ": Received QueueUpdateAdvisory for a queue that was " << "not found: " << queueUpdate << "]" - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } if (cit->second->partitionId() != partitionId) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << clusterData.identity().description() << ": Received QueueUpdateAdvisory for known queue [uri: " << uri << "] with a mismatched partitionId " << "[expected: " << cit->second->partitionId() << ", received: " << partitionId << "]: " << queueUpdate - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } if (cit->second->key() != queueKey) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << clusterData.identity().description() << ": Received QueueUpdateAdvisory for known queue [uri: " << uri << "] with a mismatched queueKey " << "[expected: " << queueKey << ", received: " << queueKey - << "]: " << queueUpdate << MWCTSK_ALARMLOG_END; + << "]: " << queueUpdate << BMQTSK_ALARMLOG_END; return; // RETURN } } @@ -303,12 +302,12 @@ void getNextPrimarys(NumNewPartitionsMap* numNewPartitions, // primary nodes for a given partition. However, this mode is not // supported right now. default: { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << clusterData.identity().description() << ": Unknown cluster masterAssignmentAlgorithm '" << assignmentAlgo << "', defaulting to 'leaderIsMasterAll' algorithm." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; mqbnet::ClusterNode* selfNode = clusterData.membership().selfNode(); numNewPartitions->insert(bsl::make_pair( @@ -384,7 +383,7 @@ void ClusterUtil::extractMessage(bmqp_ctrlmsg::ControlMessage* message, bslma::Allocator* allocator) { // Extract event header - mwcu::BlobObjectProxy eventHeader( + bmqu::BlobObjectProxy eventHeader( &eventBlob, -bmqp::EventHeader::k_MIN_HEADER_SIZE, true, // read @@ -400,7 +399,7 @@ void ClusterUtil::extractMessage(bmqp_ctrlmsg::ControlMessage* message, BSLS_ASSERT_OPT(eventHeader->type() == bmqp::EventType::e_CONTROL); // Decode message - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; int rc = bmqp::ProtocolUtil::decodeMessage(errorDescription, message, eventBlob, @@ -934,21 +933,21 @@ ClusterUtil::assignQueue(ClusterState* clusterState, struct local { static void panic(mqbi::Domain* domain) { - MWCTSK_ALARMLOG_PANIC("DOMAIN_QUEUE_LIMIT_FULL") + BMQTSK_ALARMLOG_PANIC("DOMAIN_QUEUE_LIMIT_FULL") << "domain '" << domain->name() << "' has reached the maximum number of queues (limit: " - << domain->config().maxQueues() << ")." << MWCTSK_ALARMLOG_END; + << domain->config().maxQueues() << ")." << BMQTSK_ALARMLOG_END; } static void alarm(mqbi::Domain* domain, int queues) { - MWCTSK_ALARMLOG_ALARM("DOMAIN_QUEUE_LIMIT_HIGH_WATERMARK") + BMQTSK_ALARMLOG_ALARM("DOMAIN_QUEUE_LIMIT_HIGH_WATERMARK") << "domain '" << domain->name() << "' has reached the " << (k_MAX_QUEUES_HIGH_WATERMARK * 100) << "% watermark limit for the number of queues " "(current: " << queues << ", limit: " << domain->config().maxQueues() - << ")." << MWCTSK_ALARMLOG_END; + << ")." << BMQTSK_ALARMLOG_END; } }; @@ -1102,12 +1101,12 @@ void ClusterUtil::registerQueueInfo(ClusterState* clusterState, return; // RETURN } - mwcu::Printer stateAppIdInfos(&qs->appIdInfos()); - mwcu::Printer storageAppIdInfos(&appIdInfos); + bmqu::Printer stateAppIdInfos(&qs->appIdInfos()); + bmqu::Printer storageAppIdInfos(&appIdInfos); // PartitionId and/or QueueKey and/or AppIdInfos mismatch. if (!forceUpdate) { - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << cluster->description() << ": For queue [ " << uri << "], different partitionId/queueKey/appIdInfos in " << "cluster state and storage. " @@ -1116,7 +1115,7 @@ void ClusterUtil::registerQueueInfo(ClusterState* clusterState, << stateAppIdInfos << "]. PartitionId/QueueKey/AppIdInfos in storage [" << partitionId << "], [" << queueKey << "], [" - << storageAppIdInfos << "]." << MWCTSK_ALARMLOG_END; + << storageAppIdInfos << "]." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -1140,13 +1139,13 @@ void ClusterUtil::registerQueueInfo(ClusterState* clusterState, ClusterState::QueueKeysInsertRc insertRc = clusterState->queueKeys().insert(queueKey); if (false == insertRc.second) { - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << cluster->description() << ": re-registering a known queue with a stale view, " << "but queueKey is not unique. " << "QueueKey [" << queueKey << "], URI [" << uri << "], Partition [" << partitionId << "], AppIdInfos [" - << storageAppIdInfos << "]." << MWCTSK_ALARMLOG_END; + << storageAppIdInfos << "]." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -1164,7 +1163,7 @@ void ClusterUtil::registerQueueInfo(ClusterState* clusterState, // Queue is not known, so add it. clusterState->assignQueue(uri, queueKey, partitionId, appIdInfos); - mwcu::Printer printer(&appIdInfos); + bmqu::Printer printer(&appIdInfos); BALL_LOG_INFO << cluster->description() << ": Queue assigned: " << "[uri: " << uri << ", queueKey: " << queueKey << ", partitionId: " << partitionId @@ -1175,12 +1174,12 @@ void ClusterUtil::registerQueueInfo(ClusterState* clusterState, clusterState->queueKeys().insert(queueKey); if (false == insertRc.second) { // Duplicate queue key. - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << cluster->description() << ": registering a queue for an unknown queue, but " << "queueKey is not unique. QueueKey [" << queueKey << "], URI [" << uri << "], Partition [" << partitionId << "]." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -1637,7 +1636,7 @@ void ClusterUtil::appendClusterNode(bsl::vector* out, // PRECONDITIONS BSLS_ASSERT_SAFE(out); - mwcu::MemOutStream endpoint(allocator); + bmqu::MemOutStream endpoint(allocator); endpoint << "tcp://localhost:" << port; out->emplace_back(); @@ -1687,10 +1686,10 @@ void ClusterUtil::apply(mqbc::ClusterState* clusterState, } break; // BREAK case MsgChoice::SELECTION_ID_UNDEFINED: default: { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << clusterData.identity().description() << ": Unexpected clusterMessage: " << clusterMessage - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } break; // BREAK } } @@ -1708,7 +1707,7 @@ int ClusterUtil::validateState(bsl::ostream& errorDescription, bool seenMissingQueue = false; bool seenExtraQueue = false; - mwcu::MemOutStream out; + bmqu::MemOutStream out; const int level = 0; // Check incorrect partition information @@ -1967,7 +1966,7 @@ void ClusterUtil::validateClusterStateLedger(mqbi::Cluster* cluster, return; // RETURN } - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; rc = validateState(errorDescription, tempState, clusterState); if (rc != 0) { BALL_LOG_WARN_BLOCK @@ -2153,10 +2152,10 @@ int ClusterUtil::load(ClusterState* state, } break; // BREAK case MsgChoice::SELECTION_ID_UNDEFINED: default: { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << clusterData.identity().description() << ": Unexpected clusterMessage: " << clusterMessage - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } break; // BREAK } } while ((rc = latestIter->next()) == 0); diff --git a/src/groups/mqb/mqbc/mqbc_controlmessagetransmitter.cpp b/src/groups/mqb/mqbc/mqbc_controlmessagetransmitter.cpp index 30722e1f1..26c96b5f4 100644 --- a/src/groups/mqb/mqbc/mqbc_controlmessagetransmitter.cpp +++ b/src/groups/mqb/mqbc/mqbc_controlmessagetransmitter.cpp @@ -22,8 +22,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -114,9 +113,9 @@ void ControlMessageTransmitter::broadcastMessageHelper( bmqp::HighAvailabilityFeatures::k_FIELD_NAME, bmqp::HighAvailabilityFeatures::k_BROADCAST_TO_PROXIES, negoMsg.clientIdentity().features())) { - mwcio::Status status; + bmqio::Status status; sessionSp->channel()->write(&status, schemaBuilder->blob()); - if (status.category() == mwcio::StatusCategory::e_SUCCESS) { + if (status.category() == bmqio::StatusCategory::e_SUCCESS) { BALL_LOG_INFO << "Sent message '" << message << "' to proxy " << sessionSp->description(); } @@ -169,7 +168,7 @@ void ControlMessageTransmitter::sendMessage( void ControlMessageTransmitter::sendMessage( const bmqp_ctrlmsg::ControlMessage& message, - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bsl::string& description) { // executed by the cluster *DISPATCHER* thread @@ -189,9 +188,9 @@ void ControlMessageTransmitter::sendMessage( return; // RETURN } - mwcio::Status status; + bmqio::Status status; channel->write(&status, d_schemaBuilder.blob()); - if (status.category() != mwcio::StatusCategory::e_SUCCESS) { + if (status.category() != bmqio::StatusCategory::e_SUCCESS) { BALL_LOG_ERROR << "#CLUSTER_SEND_FAILURE " << "Failed to write schema message: " << message << " to session " << description diff --git a/src/groups/mqb/mqbc/mqbc_controlmessagetransmitter.h b/src/groups/mqb/mqbc/mqbc_controlmessagetransmitter.h index 66d83cc9e..69a15c091 100644 --- a/src/groups/mqb/mqbc/mqbc_controlmessagetransmitter.h +++ b/src/groups/mqb/mqbc/mqbc_controlmessagetransmitter.h @@ -39,8 +39,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -148,7 +147,7 @@ class ControlMessageTransmitter { void sendMessage(const bmqp_ctrlmsg::ControlMessage& message, mqbnet::ClusterNode* destination); void sendMessage(const bmqp_ctrlmsg::ControlMessage& message, - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bsl::string& description); /// Encode and send the specified schema `message` to the specified diff --git a/src/groups/mqb/mqbc/mqbc_incoreclusterstateledger.cpp b/src/groups/mqb/mqbc/mqbc_incoreclusterstateledger.cpp index 8b597cb1d..834982b4f 100644 --- a/src/groups/mqb/mqbc/mqbc_incoreclusterstateledger.cpp +++ b/src/groups/mqb/mqbc/mqbc_incoreclusterstateledger.cpp @@ -39,12 +39,11 @@ // BMQ #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -285,7 +284,7 @@ int IncoreClusterStateLedger::onLogRolloverCb(const mqbu::StorageKey& oldLogId, rc = d_ledger_mp->writeRecord(&(info.d_recordId), record, - mwcu::BlobPosition(), + bmqu::BlobPosition(), record.length()); if (rc != 0) { return 10 * rc + rc_WRITE_RECORD_FAILURE; // RETURN @@ -357,7 +356,7 @@ int IncoreClusterStateLedger::onLogRolloverCb(const mqbu::StorageKey& oldLogId, rc = d_ledger_mp->writeRecord(&(info.d_recordId), record, - mwcu::BlobPosition(), + bmqu::BlobPosition(), record.length()); if (rc != 0) { return 10 * rc + rc_WRITE_RECORD_FAILURE; // RETURN @@ -441,7 +440,7 @@ int IncoreClusterStateLedger::applyAdvisoryInternal( int IncoreClusterStateLedger::applyRecordInternal( const bdlbb::Blob& record, int recordOffset, - const mwcu::BlobPosition& recordPosition, + const bmqu::BlobPosition& recordPosition, const bmqp_ctrlmsg::ClusterMessage& clusterMessage, const bmqp_ctrlmsg::LeaderMessageSequence& sequenceNumber, ClusterStateRecordType::Enum recordType) @@ -735,9 +734,9 @@ int IncoreClusterStateLedger::applyRecordInternal( const bmqp_ctrlmsg::LeaderMessageSequence& sequenceNumber, ClusterStateRecordType::Enum recordType) { - mwcu::BlobPosition recordPosition; + bmqu::BlobPosition recordPosition; BSLA_MAYBE_UNUSED const int rc = - mwcu::BlobUtil::findOffsetSafe(&recordPosition, record, recordOffset); + bmqu::BlobUtil::findOffsetSafe(&recordPosition, record, recordOffset); BSLS_ASSERT_SAFE(rc == 0); return applyRecordInternal(record, @@ -750,13 +749,13 @@ int IncoreClusterStateLedger::applyRecordInternal( int IncoreClusterStateLedger::applyRecordInternal( const bdlbb::Blob& record, - const mwcu::BlobPosition& recordPosition, + const bmqu::BlobPosition& recordPosition, const bmqp_ctrlmsg::ClusterMessage& clusterMessage, const bmqp_ctrlmsg::LeaderMessageSequence& sequenceNumber, ClusterStateRecordType::Enum recordType) { int recordOffset = 0; - BSLA_MAYBE_UNUSED const int rc = mwcu::BlobUtil::positionToOffsetSafe( + BSLA_MAYBE_UNUSED const int rc = bmqu::BlobUtil::positionToOffsetSafe( &recordOffset, record, recordPosition); @@ -835,7 +834,7 @@ int IncoreClusterStateLedger::applyImpl(const bdlbb::Blob& event, << source->nodeDescription() << "'"; // Sanity check on record - mwcu::BlobObjectProxy eventHeader( + bmqu::BlobObjectProxy eventHeader( &event, -bmqp::EventHeader::k_MIN_HEADER_SIZE, true, // read @@ -856,15 +855,15 @@ int IncoreClusterStateLedger::applyImpl(const bdlbb::Blob& event, BSLS_ASSERT_SAFE(eventHeader->length() == event.length()); BSLS_ASSERT_SAFE(eventHeader->type() == bmqp::EventType::e_CLUSTER_STATE); - mwcu::BlobPosition recordHeaderPosition; - int rc = mwcu::BlobUtil::findOffsetSafe(&recordHeaderPosition, + bmqu::BlobPosition recordHeaderPosition; + int rc = bmqu::BlobUtil::findOffsetSafe(&recordHeaderPosition, event, eventHeaderSize); if (rc != 0) { return rc_MISSING_HEADER; // RETURN } - mwcu::BlobObjectProxy recordHeader( + bmqu::BlobObjectProxy recordHeader( &event, recordHeaderPosition, -ClusterStateRecordHeader::k_HEADER_NUM_WORDS, @@ -992,12 +991,12 @@ int IncoreClusterStateLedger::applyImpl(const bdlbb::Blob& event, const bmqp_ctrlmsg::PartitionPrimaryInfo& info = partitions[i]; if (info.partitionId() >= static_cast(d_clusterState_p->partitions().size())) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Invalid partitionId: " << info << " specified in partition-primary advisory. " << "Ignoring this *ENTIRE* advisory message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_ADVISORY_INVALID; // RETURN } @@ -1005,12 +1004,12 @@ int IncoreClusterStateLedger::applyImpl(const bdlbb::Blob& event, d_clusterData_p->membership().netCluster()->lookupNode( info.primaryNodeId()); if (proposedPrimaryNode == 0) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Invalid primaryNodeId: " << info << " specified in partition-primary advisory." << " Ignoring this *ENTIRE* advisory." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_ADVISORY_INVALID; // RETURN } @@ -1026,12 +1025,12 @@ int IncoreClusterStateLedger::applyImpl(const bdlbb::Blob& event, // other state immediately after leader broadcast the advisory. // Lower layers will take care of that scenario. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": proposed primary specified in partition/primary : " << info << " is self but self is STARTING. " << "Ignoring this *ENTIRE* advisory." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_ADVISORY_INVALID; // RETURN } @@ -1051,7 +1050,7 @@ int IncoreClusterStateLedger::applyImpl(const bdlbb::Blob& event, // this scnenario can be witnessed in a bad network where some // nodes cannot see other nodes intermittently. See // 'onLeaderSyncDataQueryResponseDispatched' for similar check. - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Partition [" << info.partitionId() << "]: self node views self as active/available primary, " @@ -1059,7 +1058,7 @@ int IncoreClusterStateLedger::applyImpl(const bdlbb::Blob& event, << "partition/primary mapping: " << info << ". This " << "downgrade from primary to replica is currently not " << "supported, and self node will exit." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; mqbu::ExitUtil::terminate( mqbu::ExitCode::e_UNSUPPORTED_SCENARIO); @@ -1083,12 +1082,12 @@ int IncoreClusterStateLedger::applyImpl(const bdlbb::Blob& event, // the primary node. if (info.primaryLeaseId() < pi.primaryLeaseId()) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Stale primaryLeaseId specified in: " << info << ", current primaryLeaseId: " << pi.primaryLeaseId() << ". Ignoring this *ENTIRE* advisory." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_ADVISORY_INVALID; // RETURN } } @@ -1115,7 +1114,7 @@ int IncoreClusterStateLedger::applyImpl(const bdlbb::Blob& event, // from leader even once. if (info.primaryLeaseId() < pi.primaryLeaseId()) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Stale primaryLeaseId specified " << "in: " << info << ", current primaryLeaseId: " @@ -1127,7 +1126,7 @@ int IncoreClusterStateLedger::applyImpl(const bdlbb::Blob& event, << ", proposed primary node: " << proposedPrimaryNode->nodeDescription() << ". Ignoring this *ENTIRE* advisory." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_ADVISORY_INVALID; // RETURN } } @@ -1136,13 +1135,13 @@ int IncoreClusterStateLedger::applyImpl(const bdlbb::Blob& event, // must be greater. if (info.primaryLeaseId() <= pi.primaryLeaseId()) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": Stale primaryLeaseId specified in: " << info << ", current primaryLeaseId: " << pi.primaryLeaseId() << ". Ignoring this *ENTIRE* advisory." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_ADVISORY_INVALID; // RETURN } } @@ -1200,7 +1199,7 @@ IncoreClusterStateLedger::IncoreClusterStateLedger( BSLS_ASSERT_SAFE(clusterState); // Create description - mwcu::MemOutStream osstr; + bmqu::MemOutStream osstr; osstr << "IncoreClusterStateLedger (cluster: " << d_clusterData_p->identity().name() << ") : "; d_description.assign(osstr.str().data(), osstr.str().length()); diff --git a/src/groups/mqb/mqbc/mqbc_incoreclusterstateledger.h b/src/groups/mqb/mqbc/mqbc_incoreclusterstateledger.h index cc1227b29..0550a8c24 100644 --- a/src/groups/mqb/mqbc/mqbc_incoreclusterstateledger.h +++ b/src/groups/mqb/mqbc/mqbc_incoreclusterstateledger.h @@ -57,9 +57,8 @@ // BMQ #include -// MWC -#include -#include +#include +#include // BDE #include @@ -141,7 +140,7 @@ class IncoreClusterStateLedger BSLS_KEYWORD_FINAL : public ClusterStateLedger { /// associated information. /// /// sequenceNumber -> {clusterMessage, recordId, ackCount} - typedef mwcc::OrderedHashMap AdvisoriesMap; typedef AdvisoriesMap::iterator AdvisoriesMapIter; @@ -244,7 +243,7 @@ class IncoreClusterStateLedger BSLS_KEYWORD_FINAL : public ClusterStateLedger { int applyRecordInternal( const bdlbb::Blob& record, int recordOffset, - const mwcu::BlobPosition& recordPosition, + const bmqu::BlobPosition& recordPosition, const bmqp_ctrlmsg::ClusterMessage& clusterMessage, const bmqp_ctrlmsg::LeaderMessageSequence& sequenceNumber, ClusterStateRecordType::Enum recordType); @@ -256,7 +255,7 @@ class IncoreClusterStateLedger BSLS_KEYWORD_FINAL : public ClusterStateLedger { ClusterStateRecordType::Enum recordType); int applyRecordInternal( const bdlbb::Blob& record, - const mwcu::BlobPosition& recordPosition, + const bmqu::BlobPosition& recordPosition, const bmqp_ctrlmsg::ClusterMessage& clusterMessage, const bmqp_ctrlmsg::LeaderMessageSequence& sequenceNumber, ClusterStateRecordType::Enum recordType); diff --git a/src/groups/mqb/mqbc/mqbc_incoreclusterstateledger.t.cpp b/src/groups/mqb/mqbc/mqbc_incoreclusterstateledger.t.cpp index efaeab448..13700f07d 100644 --- a/src/groups/mqb/mqbc/mqbc_incoreclusterstateledger.t.cpp +++ b/src/groups/mqb/mqbc/mqbc_incoreclusterstateledger.t.cpp @@ -39,10 +39,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -66,8 +65,8 @@ #include // TEST DRIVER -#include -#include +#include +#include // CONVENIENCE using namespace BloombergLP; @@ -195,7 +194,7 @@ struct Tester { // PUBLIC DATA bdlbb::PooledBlobBufferFactory d_bufferFactory; mqbc::ClusterStateLedgerConsistency::Enum d_consistencyLevel; - mwcu::TempDirectory d_tempDir; + bmqu::TempDirectory d_tempDir; bsl::string d_location; bslma::ManagedPtr d_cluster_mp; bslma::ManagedPtr d_clusterStateLedger_mp; @@ -487,7 +486,7 @@ static void test1_breathingTest() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("INCORE CLUSTER STATE LEDGER" + bmqtst::TestHelper::printTestName("INCORE CLUSTER STATE LEDGER" " - BREATHING TEST"); Tester tester; @@ -514,7 +513,7 @@ static void test2_apply_PartitionPrimaryAdvisory() // int apply(const bmqp_ctrlmsg::PartitionPrimaryAdvisory& advisory); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("APPLY - PARTITION PRIMARY ADVISORY"); + bmqtst::TestHelper::printTestName("APPLY - PARTITION PRIMARY ADVISORY"); Tester tester; mqbc::IncoreClusterStateLedger* obj = tester.d_clusterStateLedger_mp.get(); @@ -560,7 +559,7 @@ static void test3_apply_QueueAssignmentAdvisory() // int apply(const bmqp_ctrlmsg::QueueAssignmentAdvisory& advisory); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("APPLY - QUEUE ASSIGNMENT ADVISORY"); + bmqtst::TestHelper::printTestName("APPLY - QUEUE ASSIGNMENT ADVISORY"); Tester tester; mqbc::IncoreClusterStateLedger* obj = tester.d_clusterStateLedger_mp.get(); @@ -609,7 +608,7 @@ static void test4_apply_QueueUnassignedAdvisory() // int apply(const bmqp_ctrlmsg::QueueUnassignedAdvisory& advisory); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("APPLY - QUEUE UNASSIGNED ADVISORY"); + bmqtst::TestHelper::printTestName("APPLY - QUEUE UNASSIGNED ADVISORY"); Tester tester; mqbc::IncoreClusterStateLedger* obj = tester.d_clusterStateLedger_mp.get(); @@ -654,7 +653,7 @@ static void test5_apply_QueueUpdateAdvisory() // int apply(const bmqp_ctrlmsg::QueueUpdateAdvisory& advisory); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("APPLY - QUEUE UPDATE ADVISORY"); + bmqtst::TestHelper::printTestName("APPLY - QUEUE UPDATE ADVISORY"); Tester tester; mqbc::IncoreClusterStateLedger* obj = tester.d_clusterStateLedger_mp.get(); @@ -716,7 +715,7 @@ static void test6_apply_LeaderAdvisory() // int apply(const bmqp_ctrlmsg::LeaderAdvisory& advisory); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("APPLY - LEADER ADVISORY"); + bmqtst::TestHelper::printTestName("APPLY - LEADER ADVISORY"); Tester tester; mqbc::IncoreClusterStateLedger* obj = tester.d_clusterStateLedger_mp.get(); @@ -770,7 +769,7 @@ static void test7_apply_ClusterStateRecord() // // 'e_SNAPSHOT' or 'e_UPDATE' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("APPLY - CLUSTER STATE RECORD"); + bmqtst::TestHelper::printTestName("APPLY - CLUSTER STATE RECORD"); Tester tester(false); // isLeader mqbc::IncoreClusterStateLedger* obj = tester.d_clusterStateLedger_mp.get(); @@ -886,7 +885,7 @@ static void test8_apply_ClusterStateRecordAck() // int apply(const bdlbb::Blob& record) // for 'record' of type 'e_ACK' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("APPLY - CLUSTER STATE RECORD ACK"); + bmqtst::TestHelper::printTestName("APPLY - CLUSTER STATE RECORD ACK"); Tester tester; mqbc::IncoreClusterStateLedger* obj = tester.d_clusterStateLedger_mp.get(); @@ -952,7 +951,7 @@ static void test9_apply_ClusterStateRecordCommit() // // 'e_COMMIT' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("APPLY - CLUSTER STATE RECORD COMMIT"); + bmqtst::TestHelper::printTestName("APPLY - CLUSTER STATE RECORD COMMIT"); Tester tester(false); // isLeader mqbc::IncoreClusterStateLedger* obj = tester.d_clusterStateLedger_mp.get(); @@ -1049,7 +1048,7 @@ static void test10_persistanceLeader() // Persistence of the logs at the leader node. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PERSISTENCE LEADER"); + bmqtst::TestHelper::printTestName("PERSISTENCE LEADER"); Tester tester; mqbc::IncoreClusterStateLedger* obj = tester.d_clusterStateLedger_mp.get(); @@ -1276,7 +1275,7 @@ static void test11_persistanceFollower() // Persistence of the logs at the follower node. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PERSISTENCE FOLLOWER"); + bmqtst::TestHelper::printTestName("PERSISTENCE FOLLOWER"); Tester tester(false); // isLeader mqbc::IncoreClusterStateLedger* obj = tester.d_clusterStateLedger_mp.get(); @@ -1570,7 +1569,7 @@ static void test12_persistanceAcrossRollover() // Rollover and persistence. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PERSISTENCE ACROSS ROLLOVER"); + bmqtst::TestHelper::printTestName("PERSISTENCE ACROSS ROLLOVER"); Tester tester; mqbc::IncoreClusterStateLedger* obj = tester.d_clusterStateLedger_mp.get(); @@ -1582,7 +1581,7 @@ static void test12_persistanceAcrossRollover() // Build 'QueueAssignmentAdvisory' bmqp_ctrlmsg::QueueAssignmentAdvisory qadvisory; for (size_t i = 0; i < 50; ++i) { - mwcu::MemOutStream uriStream(s_allocator_p); + bmqu::MemOutStream uriStream(s_allocator_p); uriStream << "bmq://bmq.test.mmap.priority/q" << i; bmqp_ctrlmsg::QueueInfo qinfo; @@ -1821,7 +1820,7 @@ static void test13_rolloverUncommittedAdvisories() // Rollover uncommitted advisories. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ROLLOVER UNCOMMITTED ADVISORIES"); + bmqtst::TestHelper::printTestName("ROLLOVER UNCOMMITTED ADVISORIES"); Tester tester(false); // Leader mqbc::IncoreClusterStateLedger* obj = tester.d_clusterStateLedger_mp.get(); @@ -1968,7 +1967,7 @@ static void test13_rolloverUncommittedAdvisories() bmqp_ctrlmsg::QueueAssignmentAdvisory& qAssignAdvisory = qAssignAdvisoryMsg.choice().makeQueueAssignmentAdvisory(); for (size_t i = 0; i < 50; ++i) { - mwcu::MemOutStream uriStream(s_allocator_p); + bmqu::MemOutStream uriStream(s_allocator_p); uriStream << "bmq://bmq.test.mmap.priority/q" << i; bmqp_ctrlmsg::QueueInfo queueInfo; @@ -2126,9 +2125,9 @@ static void test13_rolloverUncommittedAdvisories() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); - mwcsys::Time::initialize(s_allocator_p); + bmqsys::Time::initialize(s_allocator_p); bmqp::ProtocolUtil::initialize(s_allocator_p); bmqp::Crc32c::initialize(); bmqt::UriParser::initialize(s_allocator_p); @@ -2156,9 +2155,9 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); bmqp::ProtocolUtil::shutdown(); - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); - // The tester object makes use of 'mwcu::TempDirectory', which + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); + // The tester object makes use of 'bmqu::TempDirectory', which // allocates a temporary string using the default allocator. } diff --git a/src/groups/mqb/mqbc/mqbc_incoreclusterstateledgeriterator.t.cpp b/src/groups/mqb/mqbc/mqbc_incoreclusterstateledgeriterator.t.cpp index 2873e4d5b..ddf2ff07b 100644 --- a/src/groups/mqb/mqbc/mqbc_incoreclusterstateledgeriterator.t.cpp +++ b/src/groups/mqb/mqbc/mqbc_incoreclusterstateledgeriterator.t.cpp @@ -32,8 +32,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -49,9 +48,9 @@ #include // TEST DRIVER -#include -#include -#include +#include +#include +#include // CONVENIENCE using namespace BloombergLP; @@ -225,7 +224,7 @@ void writeRecord(bsl::vector* recordInfos, mqbsi::LedgerRecordId recordId; rc = ledger->writeRecord(&recordId, record, - mwcu::BlobPosition(), + bmqu::BlobPosition(), record.length()); BSLS_ASSERT_OPT(rc == 0); @@ -242,7 +241,7 @@ struct Tester { // DATA bsl::shared_ptr d_logIdGenerator_sp; bsl::shared_ptr d_logFactory_sp; - mwcu::TempDirectory d_tempDir; + bmqu::TempDirectory d_tempDir; mqbsi::LedgerConfig d_config; bslma::ManagedPtr d_ledger_mp; bdlbb::PooledBlobBufferFactory d_bufferFactory; @@ -427,7 +426,7 @@ static void test1_breathingTest() (recordInfos[idx].second - sizeof(mqbc::ClusterStateRecordHeader)) / bmqp::Protocol::k_WORD_SIZE; - mwcu::MemOutStream expected, actual; + bmqu::MemOutStream expected, actual; expected << incoreCslIt; actual << "[ headerWords = " << mqbc::ClusterStateRecordHeader::k_HEADER_NUM_WORDS @@ -453,9 +452,9 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); - mwcsys::Time::initialize(s_allocator_p); + bmqsys::Time::initialize(s_allocator_p); bmqp::ProtocolUtil::initialize(s_allocator_p); bmqp::Crc32c::initialize(); @@ -469,7 +468,7 @@ int main(int argc, char* argv[]) } bmqp::ProtocolUtil::shutdown(); - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbc/mqbc_partitionstatetable.h b/src/groups/mqb/mqbc/mqbc_partitionstatetable.h index ebed4277d..26d1c4e95 100644 --- a/src/groups/mqb/mqbc/mqbc_partitionstatetable.h +++ b/src/groups/mqb/mqbc/mqbc_partitionstatetable.h @@ -257,6 +257,9 @@ class PartitionStateTableActions { virtual void do_processBufferedLiveData(const ARGS& args) = 0; + virtual void + do_processBufferedPrimaryStatusAdvisories(const ARGS& args) = 0; + virtual void do_processLiveData(const ARGS& args) = 0; virtual void do_processPut(const ARGS& args) = 0; @@ -367,7 +370,8 @@ class PartitionStateTableActions { void do_cleanupSeqnums_resetReceiveDataCtx_reapplyDetectSelfReplica( const ARGS& args); - void do_replicaDataResponsePull_processBufferedLiveData_stopWatchDog( + void + do_replicaDataResponsePull_processBufferedLiveData_processBufferedPrimaryStatusAdvisories_stopWatchDog( const ARGS& args); void @@ -382,7 +386,7 @@ class PartitionStateTableActions { const ARGS& args); void - do_replicaDataResponsePush_resetReceiveDataCtx_closeRecoveryFileSet_openStorage_processBufferedLiveData_stopWatchDog( + do_replicaDataResponsePush_resetReceiveDataCtx_closeRecoveryFileSet_openStorage_processBufferedLiveData_processBufferedPrimaryStatusAdvisories_stopWatchDog( const ARGS& args); void @@ -579,10 +583,11 @@ class PartitionStateTable REPLICA_DATA_RQST_PULL, closeRecoveryFileSet_openStorage_startSendDataChunks, REPLICA_HEALING); - PST_CFG(REPLICA_HEALING, - DONE_SENDING_DATA_CHUNKS, - replicaDataResponsePull_processBufferedLiveData_stopWatchDog, - REPLICA_HEALED); + PST_CFG( + REPLICA_HEALING, + DONE_SENDING_DATA_CHUNKS, + replicaDataResponsePull_processBufferedLiveData_processBufferedPrimaryStatusAdvisories_stopWatchDog, + REPLICA_HEALED); PST_CFG( REPLICA_HEALING, ERROR_SENDING_DATA_CHUNKS, @@ -603,7 +608,7 @@ class PartitionStateTable PST_CFG( REPLICA_HEALING, DONE_RECEIVING_DATA_CHUNKS, - replicaDataResponsePush_resetReceiveDataCtx_closeRecoveryFileSet_openStorage_processBufferedLiveData_stopWatchDog, + replicaDataResponsePush_resetReceiveDataCtx_closeRecoveryFileSet_openStorage_processBufferedLiveData_processBufferedPrimaryStatusAdvisories_stopWatchDog, REPLICA_HEALED); PST_CFG( REPLICA_HEALING, @@ -939,11 +944,12 @@ void PartitionStateTableActions:: template void PartitionStateTableActions:: - do_replicaDataResponsePull_processBufferedLiveData_stopWatchDog( + do_replicaDataResponsePull_processBufferedLiveData_processBufferedPrimaryStatusAdvisories_stopWatchDog( const ARGS& args) { do_replicaDataResponsePull(args); do_processBufferedLiveData(args); + do_processBufferedPrimaryStatusAdvisories(args); do_stopWatchDog(args); } @@ -980,7 +986,7 @@ void PartitionStateTableActions:: template void PartitionStateTableActions:: - do_replicaDataResponsePush_resetReceiveDataCtx_closeRecoveryFileSet_openStorage_processBufferedLiveData_stopWatchDog( + do_replicaDataResponsePush_resetReceiveDataCtx_closeRecoveryFileSet_openStorage_processBufferedLiveData_processBufferedPrimaryStatusAdvisories_stopWatchDog( const ARGS& args) { do_replicaDataResponsePush(args); @@ -988,6 +994,7 @@ void PartitionStateTableActions:: do_closeRecoveryFileSet(args); do_openStorage(args); do_processBufferedLiveData(args); + do_processBufferedPrimaryStatusAdvisories(args); do_stopWatchDog(args); } diff --git a/src/groups/mqb/mqbc/mqbc_recoverymanager.cpp b/src/groups/mqb/mqbc/mqbc_recoverymanager.cpp index 9a2930581..636f4d0da 100644 --- a/src/groups/mqb/mqbc/mqbc_recoverymanager.cpp +++ b/src/groups/mqb/mqbc/mqbc_recoverymanager.cpp @@ -50,11 +50,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -165,19 +164,19 @@ void RecoveryManager::deprecateFileSet(int partitionId) d_clusterConfig.partitionConfig().numPartitions()); RecoveryContext& recoveryCtx = d_recoveryContextVec[partitionId]; - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc = -1; if (recoveryCtx.d_mappedJournalFd.isValid()) { rc = mqbs::FileSystemUtil::truncate(&recoveryCtx.d_mappedJournalFd, recoveryCtx.d_journalFilePosition, errorDesc); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to truncate journal file [" << recoveryCtx.d_recoveryFileSet.journalFile() << "], rc: " << rc << ", error: " << errorDesc.str() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; errorDesc.reset(); } @@ -186,34 +185,34 @@ void RecoveryManager::deprecateFileSet(int partitionId) recoveryCtx.d_journalFilePosition, errorDesc); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to flush journal file [" << recoveryCtx.d_recoveryFileSet.journalFile() << "], rc: " << rc << ", error: " << errorDesc.str() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; errorDesc.reset(); } rc = mqbs::FileSystemUtil::close(&recoveryCtx.d_mappedJournalFd); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to close journal file [" << recoveryCtx.d_recoveryFileSet.journalFile() - << "], rc: " << rc << MWCTSK_ALARMLOG_END; + << "], rc: " << rc << BMQTSK_ALARMLOG_END; } } rc = mqbs::FileSystemUtil::move( recoveryCtx.d_recoveryFileSet.journalFile(), d_dataStoreConfig.archiveLocation()); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to move file [" << recoveryCtx.d_recoveryFileSet.journalFile() << "] " << "to location [" << d_dataStoreConfig.archiveLocation() - << "] rc: " << rc << MWCTSK_ALARMLOG_END; + << "] rc: " << rc << BMQTSK_ALARMLOG_END; } recoveryCtx.d_journalFilePosition = 0; @@ -222,11 +221,11 @@ void RecoveryManager::deprecateFileSet(int partitionId) recoveryCtx.d_dataFilePosition, errorDesc); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to truncate data file [" << recoveryCtx.d_recoveryFileSet.dataFile() << "], rc: " << rc - << ", error: " << errorDesc.str() << MWCTSK_ALARMLOG_END; + << ", error: " << errorDesc.str() << BMQTSK_ALARMLOG_END; errorDesc.reset(); } @@ -234,32 +233,32 @@ void RecoveryManager::deprecateFileSet(int partitionId) recoveryCtx.d_dataFilePosition, errorDesc); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to flush data file [" << recoveryCtx.d_recoveryFileSet.dataFile() << "], rc: " << rc - << ", error: " << errorDesc.str() << MWCTSK_ALARMLOG_END; + << ", error: " << errorDesc.str() << BMQTSK_ALARMLOG_END; errorDesc.reset(); } rc = mqbs::FileSystemUtil::close(&recoveryCtx.d_mappedDataFd); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to close data file [" << recoveryCtx.d_recoveryFileSet.dataFile() << "], rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } } rc = mqbs::FileSystemUtil::move(recoveryCtx.d_recoveryFileSet.dataFile(), d_dataStoreConfig.archiveLocation()); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to move file [" << recoveryCtx.d_recoveryFileSet.dataFile() << "] " << "to location [" << d_dataStoreConfig.archiveLocation() - << "] rc: " << rc << MWCTSK_ALARMLOG_END; + << "] rc: " << rc << BMQTSK_ALARMLOG_END; } recoveryCtx.d_dataFilePosition = 0; } @@ -583,26 +582,26 @@ int RecoveryManager::processReceiveDataChunks( RecoveryContext& recoveryCtx = d_recoveryContextVec[partitionId]; ReceiveDataContext& receiveDataCtx = recoveryCtx.d_receiveDataContext; if (!receiveDataCtx.d_expectChunks) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Received partition-sync event from node " << source->nodeDescription() << ", but self is not expecting data chunks. " - << "Ignoring this event." << MWCTSK_ALARMLOG_END; + << "Ignoring this event." << BMQTSK_ALARMLOG_END; return rc_UNEXPECTED_DATA; // RETURN } BSLS_ASSERT_SAFE(receiveDataCtx.d_recoveryDataSource_p); if (receiveDataCtx.d_recoveryDataSource_p->nodeId() != source->nodeId()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Received partition-sync event from node " << source->nodeDescription() << ", which is not identified as recovery peer node " << receiveDataCtx.d_recoveryDataSource_p->nodeDescription() - << ". Ignoring this event." << MWCTSK_ALARMLOG_END; + << ". Ignoring this event." << BMQTSK_ALARMLOG_END; return rc_INVALID_RECOVERY_PEER; // RETURN } @@ -621,7 +620,7 @@ int RecoveryManager::processReceiveDataChunks( return rc_LAST_DATA_CHUNK; // RETURN } else if (receiveDataCtx.d_currSeqNum > receiveDataCtx.d_endSeqNum) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "The last partition sync msg inside a storage event " @@ -629,7 +628,7 @@ int RecoveryManager::processReceiveDataChunks( << receiveDataCtx.d_currSeqNum << ", larger than self's expected ending sequence number of " << "data chunks: " << receiveDataCtx.d_endSeqNum << "." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_RECORD_SEQ_NUM; // RETURN } @@ -645,10 +644,10 @@ int RecoveryManager::processReceiveDataChunks( while (1 == iter.next()) { const bmqp::StorageHeader& header = iter.header(); - mwcu::BlobPosition recordPosition; - mwcu::BlobObjectProxy recHeader; + bmqu::BlobPosition recordPosition; + bmqu::BlobObjectProxy recHeader; - mwcu::MemOutStream partitionDesc; + bmqu::MemOutStream partitionDesc; partitionDesc << d_clusterData.identity().description() << " Partition [" << partitionId << "]: "; @@ -670,7 +669,7 @@ int RecoveryManager::processReceiveDataChunks( recordSeqNum.sequenceNumber() = recHeader->sequenceNumber(); if (recordSeqNum <= receiveDataCtx.d_currSeqNum) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Received partition sync msg of type " @@ -680,12 +679,12 @@ int RecoveryManager::processReceiveDataChunks( << receiveDataCtx.d_endSeqNum << ". Record's journal offset (in words): " << header.journalOffsetWords() << ". Ignoring entire event." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_RECORD_SEQ_NUM; // RETURN } if (recordSeqNum > receiveDataCtx.d_endSeqNum) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Received partition sync msg of type " @@ -695,7 +694,7 @@ int RecoveryManager::processReceiveDataChunks( << "data chunks: " << receiveDataCtx.d_endSeqNum << ". Record's journal offset (in words): " << header.journalOffsetWords() << ". Ignoring entire event." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_RECORD_SEQ_NUM; // RETURN } @@ -714,7 +713,7 @@ int RecoveryManager::processReceiveDataChunks( if (journalPos != sourceJournalOffset) { // Source's and self views of the journal have diverged. - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Received journal record of type [" << header.messageType() << "] with journal offset mismatch. " @@ -722,7 +721,7 @@ int RecoveryManager::processReceiveDataChunks( << ", self journal offset: " << journalPos << ", msg sequence number (" << recHeader->primaryLeaseId() << ", " << recHeader->sequenceNumber() - << "). Ignoring this message." << MWCTSK_ALARMLOG_END; + << "). Ignoring this message." << BMQTSK_ALARMLOG_END; return rc_JOURNAL_OUT_OF_SYNC; // RETURN } @@ -733,8 +732,8 @@ int RecoveryManager::processReceiveDataChunks( // 'mqbs::DataHeader', options (if any), properties and message, // and is already DWORD aligned. - mwcu::BlobPosition payloadBeginPos; - rc = mwcu::BlobUtil::findOffsetSafe( + bmqu::BlobPosition payloadBeginPos; + rc = bmqu::BlobUtil::findOffsetSafe( &payloadBeginPos, *blob, recordPosition, @@ -744,7 +743,7 @@ int RecoveryManager::processReceiveDataChunks( return 10 * rc + rc_MISSING_PAYLOAD; // RETURN } - mwcu::BlobObjectProxy dataHeader( + bmqu::BlobObjectProxy dataHeader( blob.get(), payloadBeginPos, -mqbs::DataHeader::k_MIN_HEADER_SIZE, @@ -763,8 +762,8 @@ int RecoveryManager::processReceiveDataChunks( const int messageSize = dataHeader->messageWords() * bmqp::Protocol::k_WORD_SIZE; - mwcu::BlobPosition payloadEndPos; - rc = mwcu::BlobUtil::findOffsetSafe(&payloadEndPos, + bmqu::BlobPosition payloadEndPos; + rc = bmqu::BlobUtil::findOffsetSafe(&payloadEndPos, *blob, payloadBeginPos, messageSize); @@ -783,7 +782,7 @@ int RecoveryManager::processReceiveDataChunks( // Append payload to data file. - mwcu::BlobUtil::copyToRawBufferFromIndex(dataFile.block().base() + + bmqu::BlobUtil::copyToRawBufferFromIndex(dataFile.block().base() + dataFilePos, *blob, payloadBeginPos.buffer(), @@ -800,7 +799,7 @@ int RecoveryManager::processReceiveDataChunks( BSLS_ASSERT_SAFE(journal.fileSize() >= (journalPos + k_REQUESTED_JOURNAL_SPACE)); - mwcu::BlobUtil::copyToRawBufferFromIndex( + bmqu::BlobUtil::copyToRawBufferFromIndex( journal.block().base() + recordOffset, *blob, recordPosition.buffer(), @@ -837,7 +836,7 @@ int RecoveryManager::processReceiveDataChunks( const bsls::Types::Uint64 recordOffset = journalPos; - mwcu::BlobUtil::copyToRawBufferFromIndex( + bmqu::BlobUtil::copyToRawBufferFromIndex( journal.block().base() + recordOffset, *blob, recordPosition.buffer(), @@ -880,7 +879,7 @@ int RecoveryManager::createRecoveryFileSet(bsl::ostream& errorDescription, bsl::shared_ptr fileSetSp; - mwcu::MemOutStream partitionDesc; + bmqu::MemOutStream partitionDesc; partitionDesc << "Partition [" << partitionId << "] (cluster: " << d_clusterData.cluster().name() << "): "; @@ -1086,18 +1085,18 @@ int RecoveryManager::closeRecoveryFileSet(int partitionId) RecoveryContext& recoveryCtx = d_recoveryContextVec[partitionId]; int rc = rc_SUCCESS; - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; if (recoveryCtx.d_mappedJournalFd.isValid()) { rc = mqbs::FileSystemUtil::truncate(&recoveryCtx.d_mappedJournalFd, recoveryCtx.d_journalFilePosition, errorDesc); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to truncate journal file [" << recoveryCtx.d_recoveryFileSet.journalFile() << "], rc: " << rc << ", error: " << errorDesc.str() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; errorDesc.reset(); } @@ -1106,22 +1105,22 @@ int RecoveryManager::closeRecoveryFileSet(int partitionId) recoveryCtx.d_journalFilePosition, errorDesc); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to flush journal file [" << recoveryCtx.d_recoveryFileSet.journalFile() << "], rc: " << rc << ", error: " << errorDesc.str() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; errorDesc.reset(); } rc = mqbs::FileSystemUtil::close(&recoveryCtx.d_mappedJournalFd); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to close journal file [" << recoveryCtx.d_recoveryFileSet.journalFile() - << "], rc: " << rc << MWCTSK_ALARMLOG_END; + << "], rc: " << rc << BMQTSK_ALARMLOG_END; return rc * 10 + rc_JOURNAL_FD_CLOSE_FAILURE; // RETURN } @@ -1138,11 +1137,11 @@ int RecoveryManager::closeRecoveryFileSet(int partitionId) recoveryCtx.d_dataFilePosition, errorDesc); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to truncate data file [" << recoveryCtx.d_recoveryFileSet.dataFile() << "], rc: " << rc - << ", error: " << errorDesc.str() << MWCTSK_ALARMLOG_END; + << ", error: " << errorDesc.str() << BMQTSK_ALARMLOG_END; errorDesc.reset(); } @@ -1150,21 +1149,21 @@ int RecoveryManager::closeRecoveryFileSet(int partitionId) recoveryCtx.d_dataFilePosition, errorDesc); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to flush data file [" << recoveryCtx.d_recoveryFileSet.dataFile() << "], rc: " << rc - << ", error: " << errorDesc.str() << MWCTSK_ALARMLOG_END; + << ", error: " << errorDesc.str() << BMQTSK_ALARMLOG_END; errorDesc.reset(); } rc = mqbs::FileSystemUtil::close(&recoveryCtx.d_mappedDataFd); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData.identity().description() << " Partition [" << partitionId << "]: " << "Failed to close data file [" << recoveryCtx.d_recoveryFileSet.dataFile() << "], rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc * 10 + rc_DATA_FD_CLOSE_FAILURE; // RETURN } @@ -1198,7 +1197,7 @@ int RecoveryManager::recoverSeqNum( rc_FILE_ITERATOR_FAILURE = -4 }; - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; RecoveryContext& recoveryCtx = d_recoveryContextVec[partitionId]; int rc = rc_UNKNOWN; @@ -1255,7 +1254,8 @@ void RecoveryManager::setLiveDataSource(mqbnet::ClusterNode* source, // PRECONDITIONS BSLS_ASSERT_SAFE(source); BSLS_ASSERT_SAFE(0 <= partitionId); - BSLS_ASSERT_SAFE(partitionId < d_recoveryContextVec.size()); + BSLS_ASSERT_SAFE(partitionId < + static_cast(d_recoveryContextVec.size())); RecoveryContext& recoveryCtx = d_recoveryContextVec[partitionId]; diff --git a/src/groups/mqb/mqbc/mqbc_recoveryutil.cpp b/src/groups/mqb/mqbc/mqbc_recoveryutil.cpp index 7939c4d90..b9f74cabb 100644 --- a/src/groups/mqb/mqbc/mqbc_recoveryutil.cpp +++ b/src/groups/mqb/mqbc/mqbc_recoveryutil.cpp @@ -26,8 +26,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -53,7 +52,7 @@ int RecoveryUtil::loadFileDescriptors(mqbs::MappedFileDescriptor* journalFd, rc_INVALID_FILE_SET = -2 }; - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc = mqbs::FileStoreUtil::openFileSetReadMode(errorDesc, fileSet, journalFd, diff --git a/src/groups/mqb/mqbc/mqbc_storagemanager.cpp b/src/groups/mqb/mqbc/mqbc_storagemanager.cpp index d1c0289e6..f7e4eefe7 100644 --- a/src/groups/mqb/mqbc/mqbc_storagemanager.cpp +++ b/src/groups/mqb/mqbc/mqbc_storagemanager.cpp @@ -29,13 +29,12 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -51,6 +50,12 @@ namespace mqbc { namespace { const int k_GC_MESSAGES_INTERVAL_SECONDS = 30; + +bool isPrimaryActive(const mqbi::StorageManager_PartitionInfo pinfo) +{ + return pinfo.primaryStatus() == bmqp_ctrlmsg::PrimaryStatus::E_ACTIVE; +} + } // close unnamed namespace // ---------------------------- @@ -91,7 +96,7 @@ void StorageManager::startRecoveryCb(int partitionId) return; // RETURN } - d_recoveryStartTimes[partitionId] = mwcsys::Time::highResolutionTimer(); + d_recoveryStartTimes[partitionId] = bmqsys::Time::highResolutionTimer(); } void StorageManager::sendMessage(const bmqp_ctrlmsg::ControlMessage& message, @@ -179,13 +184,13 @@ void StorageManager::onWatchDogDispatched(int partitionId) partitionId < d_clusterConfig.partitionConfig().numPartitions()); - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << " Partition [" - << partitionId << "]: " - << "Watch dog triggered because partition startup healing " + << partitionId + << "]: " << "Watch dog triggered because partition startup healing " << "sequence was not completed in the configured time of " << d_watchDogTimeoutInterval.totalSeconds() << " seconds." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; mqbs::FileStore* fs = d_fileStores[partitionId].get(); BSLS_ASSERT_SAFE(fs); @@ -248,11 +253,11 @@ void StorageManager::onPartitionRecovery(int partitionId) // executed by *QUEUE_DISPATCHER* thread associated with 'partitionId' // PRECONDITIONS - BSLS_ASSERT_SAFE(d_fileStores[partitionId]->inDispatcherThread()); BSLS_ASSERT_SAFE(0 <= partitionId && partitionId < static_cast(d_fileStores.size())); + BSLS_ASSERT_SAFE(d_fileStores[partitionId]->inDispatcherThread()); - mwcu::MemOutStream out; + bmqu::MemOutStream out; mqbs::StoragePrintUtil::printRecoveredStorages( out, &d_storagesLock, @@ -286,7 +291,12 @@ void StorageManager::onPartitionRecovery(int partitionId) bdlf::BindUtil::bind(&StorageManager::forceFlushFileStores, this)); - d_recoveryStatusCb(0); + // Even though Cluster FSM and all Partition FSMs are now healed, + // we must check that all partitions have an active primary before + // transitioning ourself to E_AVAILABLE. + if (allPartitionsAvailable()) { + d_recoveryStatusCb(0); + } } else { d_recoveryStatusCb(-1); @@ -334,9 +344,9 @@ void StorageManager::setPrimaryStatusForPartitionDispatched( // executed by *QUEUE_DISPATCHER* thread associated with 'partitionId' // PRECONDITIONS - BSLS_ASSERT_SAFE(d_fileStores[partitionId]->inDispatcherThread()); BSLS_ASSERT_SAFE(0 <= partitionId && partitionId < static_cast(d_fileStores.size())); + BSLS_ASSERT_SAFE(d_fileStores[partitionId]->inDispatcherThread()); PartitionInfo& pinfo = d_partitionInfoVec[partitionId]; if (!pinfo.primary()) { @@ -349,15 +359,24 @@ void StorageManager::setPrimaryStatusForPartitionDispatched( } BSLS_ASSERT_SAFE(pinfo.primaryLeaseId() > 0); + const bmqp_ctrlmsg::PrimaryStatus::Value oldValue = pinfo.primaryStatus(); BALL_LOG_INFO << d_clusterData_p->identity().description() - << " Partition [" << partitionId << "]: " - << "Setting the status of primary: " + << " Partition [" << partitionId + << "]: " << "Setting the status of primary: " << pinfo.primary()->nodeDescription() << ", primaryLeaseId: " << pinfo.primaryLeaseId() - << ", from " << pinfo.primaryStatus() << " to " << value - << "."; + << ", from " << oldValue << " to " << value << "."; pinfo.setPrimaryStatus(value); + if (bmqp_ctrlmsg::PrimaryStatus::E_ACTIVE == value) { + d_fileStores[partitionId]->setActivePrimary(pinfo.primary(), + pinfo.primaryLeaseId()); + + if (oldValue != bmqp_ctrlmsg::PrimaryStatus::E_ACTIVE && + allPartitionsAvailable()) { + d_recoveryStatusCb(0); + } + } } void StorageManager::processPrimaryDetect(int partitionId, @@ -1065,6 +1084,25 @@ void StorageManager::processReplicaDataResponse( d_cluster_p); } +void StorageManager::bufferPrimaryStatusAdvisoryDispatched( + const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, + mqbnet::ClusterNode* source) +{ + // executed by *QUEUE_DISPATCHER* thread with the specified 'partitionId' + + // PRECONDITIONS + const int pid = advisory.partitionId(); + BSLS_ASSERT_SAFE(0 <= pid && pid < static_cast(d_fileStores.size())); + BSLS_ASSERT_SAFE(d_fileStores[pid]->inDispatcherThread()); + + BALL_LOG_INFO << d_clusterData_p->identity().description() + << " Partition [" << pid + << "]: Buffering primary status advisory: " << advisory; + + d_bufferedPrimaryStatusAdvisoryInfosVec.at(pid).push_back( + bsl::make_pair(advisory, source)); +} + void StorageManager::processShutdownEventDispatched(int partitionId) { // executed by *QUEUE_DISPATCHER* thread with the specified 'partitionId' @@ -1193,7 +1231,7 @@ void StorageManager::do_openRecoveryFileSet(const PartitionFSMArgsSp& args) return; // RETURN } - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc = d_recoveryManager_mp->openRecoveryFileSet(errorDesc, partitionId); if (rc == 1) { BALL_LOG_INFO << d_clusterData_p->identity().description() @@ -2358,11 +2396,11 @@ void StorageManager::do_processBufferedLiveData(const PartitionFSMArgsSp& args) ++cit) { rc = fs->processRecoveryEvent(*cit); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << d_clusterData_p->identity().description() << " Partition [" << partitionId << "]: " << "Failed to apply buffered storage event, rc: " << rc - << ". Closing the partition." << MWCTSK_ALARMLOG_END; + << ". Closing the partition." << BMQTSK_ALARMLOG_END; fs->close(d_clusterConfig.partitionConfig().flushAtShutdown()); EventData eventDataVecLocal; @@ -2379,6 +2417,73 @@ void StorageManager::do_processBufferedLiveData(const PartitionFSMArgsSp& args) } } +void StorageManager::do_processBufferedPrimaryStatusAdvisories( + const PartitionFSMArgsSp& args) +{ + // executed by the *QUEUE DISPATCHER* thread associated with the paritionId + // contained in 'args' + + // PRECONDITIONS + BSLS_ASSERT_SAFE(!args->eventsQueue()->empty()); + + const PartitionFSM::EventWithData& eventWithData = + args->eventsQueue()->front(); + const EventData& eventDataVec = eventWithData.second; + + BSLS_ASSERT_SAFE(eventDataVec.size() == 1); + + const PartitionFSMEventData& eventData = eventDataVec[0]; + const int partitionId = eventData.partitionId(); + + if (d_cluster_p->isStopping()) { + BALL_LOG_WARN << d_clusterData_p->identity().description() + << " Partition [" << partitionId << "]: " + << "Cluster is stopping; skipping processing of " + << "primary status advisory."; + return; // RETURN + } + + BALL_LOG_INFO + << d_clusterData_p->identity().description() << " Partition [" + << partitionId << "]: " << "Processing " + << d_bufferedPrimaryStatusAdvisoryInfosVec[partitionId].size() + << " buffered primary status advisory."; + + for (PrimaryStatusAdvisoryInfosCIter cit = + d_bufferedPrimaryStatusAdvisoryInfosVec[partitionId].cbegin(); + cit != d_bufferedPrimaryStatusAdvisoryInfosVec[partitionId].cend(); + ++cit) { + BSLS_ASSERT_SAFE(cit->first.partitionId() == partitionId); + + PartitionInfo& pinfo = d_partitionInfoVec[partitionId]; + if (cit->second->nodeId() != pinfo.primary()->nodeId() || + cit->first.primaryLeaseId() != pinfo.primaryLeaseId()) { + BALL_LOG_INFO << d_clusterData_p->identity().description() + << " Partition [" << partitionId + << "]: " << "Ignoring primary status advisory " + << cit->first + << " because primary node or leaseId is invalid. " + << "Self-perceived [prmary, leaseId] is: [" + << pinfo.primary()->nodeDescription() << "," + << pinfo.primaryLeaseId() << "]"; + continue; // CONTINUE + } + pinfo.setPrimaryStatus(cit->first.status()); + if (bmqp_ctrlmsg::PrimaryStatus::E_ACTIVE == cit->first.status()) { + d_fileStores[partitionId]->setActivePrimary( + pinfo.primary(), + pinfo.primaryLeaseId()); + + // Note: We don't check if all partitions are fully healed and have + // an active active primary here, because we will do the check soon + // after when we transition the replica to healed (see + // `onPartitionRecovery()` method). + } + } + + d_bufferedPrimaryStatusAdvisoryInfosVec[partitionId].clear(); +} + void StorageManager::do_processLiveData(const PartitionFSMArgsSp& args) { // executed by the *QUEUE DISPATCHER* thread associated with the paritionId @@ -2659,7 +2764,7 @@ void StorageManager::do_setExpectedDataChunkRange( eventData.requestId()); } else { - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << "Partition [" << partitionId << "]'s FSM " << "(state = '" << d_partitionFSMVec[partitionId]->state() << "')" << ": Unexpected event '" << eventWithData.first @@ -2717,11 +2822,11 @@ void StorageManager::do_openStorage(const PartitionFSMArgsSp& args) const int rc = fs->open(d_queueKeyInfoMapVec.at(partitionId)); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << d_clusterData_p->identity().description() << " Partition [" << partitionId << "]: " << "Failed to open FileStore after recovery was finished, " - << "rc: " << rc << MWCTSK_ALARMLOG_END; + << "rc: " << rc << BMQTSK_ALARMLOG_END; } } @@ -2853,12 +2958,12 @@ void StorageManager::do_removeStorage(const PartitionFSMArgsSp& args) d_recoveryManager_mp->deprecateFileSet(partitionId); } - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << d_clusterData_p->identity().description() << " Partition [" << partitionId << "]: " << "self's storage is out of sync with primary and cannot be healed " << "trivially. Removing entire storage and aborting broker." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; mqbu::ExitUtil::terminate(mqbu::ExitCode::e_STORAGE_OUT_OF_SYNC); // EXIT } @@ -3204,6 +3309,21 @@ void StorageManager::do_reapplyDetectSelfReplica( eventDataVecOut); } +// PRIVATE ACCESSORS +bool StorageManager::allPartitionsAvailable() const +{ + // executed by *QUEUE_DISPATCHER* thread associated with *ANY* partition + + if (d_numPartitionsRecoveredFully != + static_cast(d_fileStores.size())) { + return false; // RETURN + } + + return bsl::all_of(d_partitionInfoVec.cbegin(), + d_partitionInfoVec.cend(), + &isPrimaryActive); +} + // CREATORS StorageManager::StorageManager( const mqbcfg::ClusterDefinition& clusterConfig, @@ -3241,6 +3361,7 @@ StorageManager::StorageManager( , d_appKeysVec(allocator) , d_partitionInfoVec(allocator) , d_partitionFSMVec(allocator) +, d_bufferedPrimaryStatusAdvisoryInfosVec(allocator) , d_numPartitionsRecoveredFully(0) , d_numPartitionsRecoveredQueues(0) , d_recoveryStartTimes(allocator) @@ -3272,6 +3393,9 @@ StorageManager::StorageManager( d_storages.resize(partitionCfg.numPartitions()); d_appKeysVec.resize(partitionCfg.numPartitions()); d_partitionInfoVec.resize(partitionCfg.numPartitions()); + d_bufferedPrimaryStatusAdvisoryInfosVec.resize( + partitionCfg.numPartitions(), + PrimaryStatusAdvisoryInfos(allocator)); d_recoveryStartTimes.resize(partitionCfg.numPartitions()); d_nodeToSeqNumCtxMapVec.resize(partitionCfg.numPartitions()); d_numReplicaDataResponsesReceivedVec.resize(partitionCfg.numPartitions()); @@ -3404,7 +3528,7 @@ int StorageManager::start(bsl::ostream& errorDescription) .setMaxQlistFileSize(partitionCfg.maxQlistFileSize()); // Only relevant fields of data store config are set. - // Get named allocator from associated mwcma::CountingAllocatorStore + // Get named allocator from associated bmqma::CountingAllocatorStore bslma::Allocator* recoveryManagerAllocator = d_allocators.get( "RecoveryManager"); @@ -3593,11 +3717,11 @@ void StorageManager::unregisterQueue(const bmqt::Uri& uri, int partitionId) d_fileStores[partitionId]->dispatchEvent(queueEvent); } -int StorageManager::updateQueue(const bmqt::Uri& uri, - const mqbu::StorageKey& queueKey, - int partitionId, - const AppIdKeyPairs& addedIdKeyPairs, - const AppIdKeyPairs& removedIdKeyPairs) +int StorageManager::updateQueuePrimary(const bmqt::Uri& uri, + const mqbu::StorageKey& queueKey, + int partitionId, + const AppIdKeyPairs& addedIdKeyPairs, + const AppIdKeyPairs& removedIdKeyPairs) { // executed by *QUEUE_DISPATCHER* thread with the specified 'partitionId' @@ -3606,18 +3730,19 @@ int StorageManager::updateQueue(const bmqt::Uri& uri, partitionId < static_cast(d_fileStores.size())); BSLS_ASSERT_SAFE(d_fileStores[partitionId]->inDispatcherThread()); - return StorageUtil::updateQueue(&d_storages[partitionId], - &d_storagesLock, - d_fileStores[partitionId].get(), - &d_appKeysVec[partitionId], - &d_appKeysLock, - d_clusterData_p->identity().description(), - uri, - queueKey, - partitionId, - addedIdKeyPairs, - removedIdKeyPairs, - true); // isCSLMode + return StorageUtil::updateQueuePrimary( + &d_storages[partitionId], + &d_storagesLock, + d_fileStores[partitionId].get(), + &d_appKeysVec[partitionId], + &d_appKeysLock, + d_clusterData_p->identity().description(), + uri, + queueKey, + partitionId, + addedIdKeyPairs, + removedIdKeyPairs, + true); // isCSLMode } void StorageManager::registerQueueReplica(int partitionId, @@ -4029,10 +4154,10 @@ void StorageManager::processReplicaDataRequest( } break; // BREAK case bmqp_ctrlmsg::ReplicaDataType::E_UNKNOWN: BSLS_ANNOTATION_FALLTHROUGH; default: { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << d_clusterData_p->identity().description() << ": unexpected clusterMessage:" << message - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } break; // BREAK } } @@ -4098,13 +4223,13 @@ void StorageManager::processStorageEvent( // Ensure that 'pid' is valid. if (pid >= d_clusterState.partitions().size()) { - MWCTSK_ALARMLOG_ALARM("STORAGE") - << d_cluster_p->description() << " Partition [" << pid << "]: " - << "Received " + BMQTSK_ALARMLOG_ALARM("STORAGE") + << d_cluster_p->description() << " Partition [" << pid + << "]: " << "Received " << (rawEvent.isStorageEvent() ? "storage " : "partition-sync ") << "event from node " << source->nodeDescription() << " with " << "invalid Partition Id [" << pid << "]. Ignoring " - << "entire storage event." << MWCTSK_ALARMLOG_END; + << "entire storage event." << BMQTSK_ALARMLOG_END; return; // RETURN } BSLS_ASSERT_SAFE(d_fileStores.size() > pid); @@ -4171,14 +4296,14 @@ void StorageManager::processReceiptEvent(const bmqp::Event& event, { // executed by *IO* thread - mwcu::BlobPosition position; - BSLA_MAYBE_UNUSED const int rc = mwcu::BlobUtil::findOffsetSafe( + bmqu::BlobPosition position; + BSLA_MAYBE_UNUSED const int rc = bmqu::BlobUtil::findOffsetSafe( &position, *event.blob(), sizeof(bmqp::EventHeader)); BSLS_ASSERT_SAFE(rc == 0); - mwcu::BlobObjectProxy receipt( + bmqu::BlobObjectProxy receipt( event.blob(), position, true, // read mode @@ -4201,23 +4326,30 @@ void StorageManager::processReceiptEvent(const bmqp::Event& event, source)); } -void StorageManager::processPrimaryStatusAdvisory( +void StorageManager::bufferPrimaryStatusAdvisory( const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, mqbnet::ClusterNode* source) { - // executed by *CLUSTER DISPATCHER* thread + // executed by *ANY* thread - // PRECONDITIONS - BSLS_ASSERT_SAFE(d_dispatcher_p->inDispatcherThread(d_cluster_p)); - BSLS_ASSERT_SAFE(source); + // PRECONDITION BSLS_ASSERT_SAFE(d_fileStores.size() > static_cast(advisory.partitionId())); + if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!d_isStarted)) { + BSLS_PERFORMANCEHINT_UNLIKELY_HINT; + BALL_LOG_WARN << d_clusterData_p->identity().description() + << " Partition [" << advisory.partitionId() << "]: " + << " Not buffering primary status advisory as StorageMgr" + << " is not started."; + return; // RETURN + } + if (d_cluster_p->isStopping()) { BALL_LOG_WARN << d_clusterData_p->identity().description() << " Partition [" << advisory.partitionId() << "]: " - << "Cluster is stopping; skipping processing of " - << "PrimaryStatusAdvisory."; + << " Not buffering primary status advisory as cluster" + << " is stopping."; return; // RETURN } @@ -4225,13 +4357,23 @@ void StorageManager::processPrimaryStatusAdvisory( BSLS_ASSERT_SAFE(fs); fs->execute(bdlf::BindUtil::bind( - &StorageUtil::processPrimaryStatusAdvisoryDispatched, - fs, - &d_partitionInfoVec[advisory.partitionId()], + &StorageManager::bufferPrimaryStatusAdvisoryDispatched, + this, advisory, - d_clusterData_p->identity().description(), - source, - true)); // isFSMWorkflow + source)); +} + +void StorageManager::processPrimaryStatusAdvisory( + BSLS_ANNOTATION_UNUSED const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, + BSLS_ANNOTATION_UNUSED mqbnet::ClusterNode* source) +{ + // executed by *CLUSTER DISPATCHER* thread + + // PRECONDITION + BSLS_ASSERT_SAFE(d_dispatcher_p->inDispatcherThread(d_cluster_p)); + + BSLS_ASSERT_OPT(false && + "This method should only be invoked in non-FSM mode"); } void StorageManager::processReplicaStatusAdvisory( diff --git a/src/groups/mqb/mqbc/mqbc_storagemanager.h b/src/groups/mqb/mqbc/mqbc_storagemanager.h index 3b1bbd597..25cfbd166 100644 --- a/src/groups/mqb/mqbc/mqbc_storagemanager.h +++ b/src/groups/mqb/mqbc/mqbc_storagemanager.h @@ -157,6 +157,16 @@ class StorageManager typedef ClusterStateQueueInfo::AppIdInfosCIter AppIdInfosCIter; + /// Vector of pairs of buffered primary status advisories and their source + typedef bsl::vector< + bsl::pair > + PrimaryStatusAdvisoryInfos; + typedef PrimaryStatusAdvisoryInfos::const_iterator + PrimaryStatusAdvisoryInfosCIter; + + typedef bsl::vector + PrimaryStatusAdvisoryInfosVec; + public: // TYPES typedef PartitionFSM::PartitionFSMArgsSp PartitionFSMArgsSp; @@ -182,7 +192,7 @@ class StorageManager bslma::Allocator* d_allocator_p; // Allocator to use - mwcma::CountingAllocatorStore d_allocators; + bmqma::CountingAllocatorStore d_allocators; // Allocator store to spawn new // allocators for sub-components @@ -344,6 +354,14 @@ class StorageManager // **must** be accessed in the associated Queue dispatcher thread // for the i-th partitionId. + /// Vector, indexed by partitionId, of vectors of pairs of buffered primary + /// status advisories and their source. + /// + // THREAD: Except during the ctor, the i-th index of this data member + // **must** be accessed in the associated Queue dispatcher thread + // for the i-th partitionId. + PrimaryStatusAdvisoryInfosVec d_bufferedPrimaryStatusAdvisoryInfosVec; + bsls::AtomicInt d_numPartitionsRecoveredFully; // Number of partitions whose recovery // has been fully completed. This @@ -603,6 +621,12 @@ class StorageManager processReplicaDataResponse(const RequestManagerType::RequestSp& context, mqbnet::ClusterNode* responder); + /// THREAD: Executed by the dispatcher thread for the specified + /// `partitionId`. + void bufferPrimaryStatusAdvisoryDispatched( + const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, + mqbnet::ClusterNode* source); + /// THREAD: Executed by the dispatcher thread for the specified /// `partitionId`. void processShutdownEventDispatched(int partitionId); @@ -689,6 +713,9 @@ class StorageManager virtual void do_processBufferedLiveData(const PartitionFSMArgsSp& args) BSLS_KEYWORD_OVERRIDE; + virtual void do_processBufferedPrimaryStatusAdvisories( + const PartitionFSMArgsSp& args) BSLS_KEYWORD_OVERRIDE; + virtual void do_processLiveData(const PartitionFSMArgsSp& args) BSLS_KEYWORD_OVERRIDE; @@ -749,6 +776,14 @@ class StorageManager virtual void do_reapplyDetectSelfReplica(const PartitionFSMArgsSp& args) BSLS_KEYWORD_OVERRIDE; + // PRIVATE ACCESSORS + + /// Return true if all partitions are fully healed and have an active + /// active primary, false otherwise. + /// + /// THREAD: Executed by the Queue's dispatcher thread. + bool allPartitionsAvailable() const; + public: // TRAITS BSLMF_NESTED_TRAIT_DECLARATION(StorageManager, bslma::UsesBslmaAllocator) @@ -840,12 +875,12 @@ class StorageManager /// queue is configured in fanout mode. /// /// THREAD: Executed by the Queue's dispatcher thread. - virtual int - updateQueue(const bmqt::Uri& uri, - const mqbu::StorageKey& queueKey, - int partitionId, - const AppIdKeyPairs& addedIdKeyPairs, - const AppIdKeyPairs& removedIdKeyPairs) BSLS_KEYWORD_OVERRIDE; + virtual int updateQueuePrimary(const bmqt::Uri& uri, + const mqbu::StorageKey& queueKey, + int partitionId, + const AppIdKeyPairs& addedIdKeyPairs, + const AppIdKeyPairs& removedIdKeyPairs) + BSLS_KEYWORD_OVERRIDE; virtual void registerQueueReplica(int partitionId, @@ -978,6 +1013,11 @@ class StorageManager processReceiptEvent(const bmqp::Event& event, mqbnet::ClusterNode* source) BSLS_KEYWORD_OVERRIDE; + /// Executed by any thread. + virtual void bufferPrimaryStatusAdvisory( + const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, + mqbnet::ClusterNode* source) BSLS_KEYWORD_OVERRIDE; + /// Executed in cluster dispatcher thread. virtual void processPrimaryStatusAdvisory( const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, diff --git a/src/groups/mqb/mqbc/mqbc_storagemanager.t.cpp b/src/groups/mqb/mqbc/mqbc_storagemanager.t.cpp index ead707f45..cb2055070 100644 --- a/src/groups/mqb/mqbc/mqbc_storagemanager.t.cpp +++ b/src/groups/mqb/mqbc/mqbc_storagemanager.t.cpp @@ -42,11 +42,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -66,8 +65,8 @@ #include // TEST DRIVER -#include -#include +#include +#include // CONVENIENCE using namespace BloombergLP; @@ -130,9 +129,9 @@ struct TestHelper { bslma::ManagedPtr d_cluster_mp; - mwcu::TempDirectory d_tempDir; + bmqu::TempDirectory d_tempDir; - mwcu::TempDirectory d_tempArchiveDir; + bmqu::TempDirectory d_tempArchiveDir; // CREATORS TestHelper() @@ -189,14 +188,14 @@ struct TestHelper { BSLS_ASSERT_OPT(d_cluster_mp->_channels().size() > 0); - mwcsys::Time::initialize( + bmqsys::Time::initialize( &bsls::SystemTime::nowRealtimeClock, bdlf::BindUtil::bind(&TestHelper::nowMonotonicClock, this), bdlf::BindUtil::bind(&TestHelper::highResolutionTimer, this), s_allocator_p); // Start the cluster - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; int rc = d_cluster_mp->start(errorDescription); BSLS_ASSERT_OPT(rc == 0); } @@ -327,14 +326,14 @@ struct TestHelper { const bmqp::StorageHeader& header = iter.header(); ASSERT_EQ(static_cast(partitionId), header.partitionId()); - mwcu::MemOutStream partitionDesc; + bmqu::MemOutStream partitionDesc; partitionDesc << d_cluster_mp->_clusterData() ->identity() .description() << " Partition [" << partitionId << "]: "; - mwcu::BlobPosition recordPosition; - mwcu::BlobObjectProxy recHeader; + bmqu::BlobPosition recordPosition; + bmqu::BlobObjectProxy recHeader; int rc = mqbs::StorageUtil::loadRecordHeaderAndPos( &recHeader, &recordPosition, @@ -364,14 +363,14 @@ struct TestHelper { - currSeqNum.sequenceNumber()) * mqbs::FileStoreProtocol::k_JOURNAL_RECORD_SIZE);*/ - // mwcu::BlobPosition pos; - // mwcu::BlobUtil::findOffsetSafe(&pos, blob, recordOffset); + // bmqu::BlobPosition pos; + // bmqu::BlobUtil::findOffsetSafe(&pos, blob, recordOffset); // TODO - // mwcu::BlobObjectProxy record(&blob, + // bmqu::BlobObjectProxy record(&blob, // pos); // ASSERT(record.isSet()); - // mwcu::BlobObjectProxy recordHdr(&blob, + // bmqu::BlobObjectProxy recordHdr(&blob, // pos); // ASSERT(recordHdr.isSet()); // PV("XXM: " << currSeqNum << ", " << recordHdr->type()); @@ -448,9 +447,9 @@ struct TestHelper { // TODO While the record is only 60 bytes, we are sending 96 // redundant bytes before that. We need to improve the // send chunk logic to *only* send the required data. - mwcu::BlobPosition pos; - mwcu::BlobUtil::findOffsetSafe(&pos, blob, 96); - mwcu::BlobObjectProxy record(&blob, pos); + bmqu::BlobPosition pos; + bmqu::BlobUtil::findOffsetSafe(&pos, blob, 96); + bmqu::BlobObjectProxy record(&blob, pos); assert(record.isSet()); ASSERT_EQ(record->header(), expectedRecord.header()); @@ -742,7 +741,7 @@ struct TestHelper { // record into the specified 'handle'. Return the queue key. bsl::string uri("bmq://si.amw.bmq.stats/queue0", s_allocator_p); - mwcu::MemOutStream osstr; + bmqu::MemOutStream osstr; // Generate queue-key. for (size_t j = 0; j < mqbu::StorageKey::e_KEY_LENGTH_BINARY; ++j) { @@ -886,12 +885,12 @@ struct TestHelper { ._setDisableBroadcast(true); fs.open(); // TODO: clean this up since its a hack to set replica node as primary! - // had to explicitly setPrimary for fileStore because of the assert in - // writeRecords which allows writes only if current node is primary for - // the fileStore. + // had to explicitly setActivePrimary for fileStore because of the + // assert in writeRecords which allows writes only if current node is + // primary for the fileStore. // TODO: set primary to self but also correct it to the right node // after writing 'numRecords' records. - fs.setPrimary(selfNode, 1U); + fs.setActivePrimary(selfNode, 1U); const mqbu::StorageKey& queueKey = writeQueueCreationRecord(handle, &fs, k_PARTITION_ID); @@ -912,7 +911,7 @@ struct TestHelper { } } - ~TestHelper() { mwcsys::Time::shutdown(); } + ~TestHelper() { bmqsys::Time::shutdown(); } }; } // close unnamed namespace @@ -936,7 +935,7 @@ static void test1_breathingTest() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST - START STOP " + bmqtst::TestHelper::printTestName("BREATHING TEST - START STOP " "STORAGEMANAGER SUCCESSFULLY"); TestHelper helper; @@ -956,7 +955,7 @@ static void test1_breathingTest() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -989,7 +988,7 @@ static void test2_unknownDetectSelfPrimary() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST - DETECT PRIMARY"); + bmqtst::TestHelper::printTestName("BREATHING TEST - DETECT PRIMARY"); TestHelper helper; @@ -1005,7 +1004,7 @@ static void test2_unknownDetectSelfPrimary() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; const int rc = storageManager.start(errorDescription); @@ -1059,7 +1058,7 @@ static void test3_unknownDetectSelfReplica() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST - DETECT REPLICA"); + bmqtst::TestHelper::printTestName("BREATHING TEST - DETECT REPLICA"); TestHelper helper; @@ -1075,7 +1074,7 @@ static void test3_unknownDetectSelfReplica() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -1130,7 +1129,7 @@ static void test4_primaryHealingStage1DetectSelfReplica() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST - " + bmqtst::TestHelper::printTestName("BREATHING TEST - " "PRIMARY HEALING STAGE 1 DETECTS SELF AS" " REPLICA"); @@ -1148,7 +1147,7 @@ static void test4_primaryHealingStage1DetectSelfReplica() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -1230,7 +1229,7 @@ static void test5_primaryHealingStage1ReceivesReplicaStateRqst() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST - " + bmqtst::TestHelper::printTestName("BREATHING TEST - " "PRIMARY HEALING STAGE 1 SENDS FAILURE" " REPLICA STATE RESPONSE"); @@ -1248,7 +1247,7 @@ static void test5_primaryHealingStage1ReceivesReplicaStateRqst() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -1343,7 +1342,7 @@ static void test6_primaryHealingStage1ReceivesReplicaStateRspnQuorum() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST - " + bmqtst::TestHelper::printTestName("BREATHING TEST - " "PRIMARY HEALING STAGE 1 RECEIVES" " REPLICA STATE RESPONSE QUORUM"); @@ -1361,7 +1360,7 @@ static void test6_primaryHealingStage1ReceivesReplicaStateRspnQuorum() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -1451,7 +1450,7 @@ static void test7_primaryHealingStage1ReceivesPrimaryStateRequestQuorum() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST - " + bmqtst::TestHelper::printTestName("BREATHING TEST - " "PRIMARY HEALING STAGE 1 RECEIVES" " PRIMARY STATE REQUEST QUORUM"); @@ -1469,7 +1468,7 @@ static void test7_primaryHealingStage1ReceivesPrimaryStateRequestQuorum() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -1565,7 +1564,7 @@ static void test8_primaryHealingStage1ReceivesPrimaryStateRqst() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST - " + bmqtst::TestHelper::printTestName("BREATHING TEST - " "PRIMARY HEALING STAGE 1 RECEIVES" " PRIMARY STATE REQUEST"); @@ -1583,7 +1582,7 @@ static void test8_primaryHealingStage1ReceivesPrimaryStateRqst() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -1676,7 +1675,7 @@ static void test9_primaryHealingStage1ReceivesReplicaStateRspnNoQuorum() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST - " + bmqtst::TestHelper::printTestName("BREATHING TEST - " "PRIMARY HEALING STAGE 1 RECEIVES" " REPLICA STATE RESPONSE NO QUORUM"); @@ -1694,7 +1693,7 @@ static void test9_primaryHealingStage1ReceivesReplicaStateRspnNoQuorum() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -1792,7 +1791,7 @@ static void test10_primaryHealingStage1QuorumSendsReplicaDataRequestPull() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST - " + bmqtst::TestHelper::printTestName("BREATHING TEST - " "PRIMARY HEALING STAGE 1 QUORUM" " SENDS REPLICA DATA REQUEST PULL"); @@ -1810,7 +1809,7 @@ static void test10_primaryHealingStage1QuorumSendsReplicaDataRequestPull() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -1916,7 +1915,7 @@ static void test11_primaryHealingStage2DetectSelfReplica() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST - " + bmqtst::TestHelper::printTestName("BREATHING TEST - " "PRIMARY HEALING STAGE 2 DETECTS SELF AS" " REPLICA"); @@ -1934,7 +1933,7 @@ static void test11_primaryHealingStage2DetectSelfReplica() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -2064,7 +2063,7 @@ static void test12_replicaHealingDetectSelfPrimary() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "BREATHING TEST - " "HEALING REPLICA DETECTS SELF AS PRIMARY"); @@ -2082,7 +2081,7 @@ static void test12_replicaHealingDetectSelfPrimary() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -2163,7 +2162,7 @@ static void test13_replicaHealingReceivesReplicaStateRqst() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "BREATHING TEST - " "HEALING REPLICA RECEIVES REPLICA STATE REQUEST"); @@ -2181,7 +2180,7 @@ static void test13_replicaHealingReceivesReplicaStateRqst() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -2271,7 +2270,7 @@ static void test14_replicaHealingReceivesPrimaryStateRspn() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "BREATHING TEST - " "HEALING REPLICA RECEIVES PRIMARY STATE RESPONSE"); @@ -2289,7 +2288,7 @@ static void test14_replicaHealingReceivesPrimaryStateRspn() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -2377,7 +2376,7 @@ static void test15_replicaHealingReceivesFailedPrimaryStateRspn() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "BREATHING TEST - " "HEALING REPLICA RECEIVES FAILED PRIMARY STATE RESPONSE"); @@ -2395,7 +2394,7 @@ static void test15_replicaHealingReceivesFailedPrimaryStateRspn() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -2472,7 +2471,7 @@ static void test16_replicaHealingReceivesPrimaryStateRqst() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "BREATHING TEST - " "HEALING REPLICA RECEIVES PRIMARY STATE REQUEST"); @@ -2490,7 +2489,7 @@ static void test16_replicaHealingReceivesPrimaryStateRqst() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; @@ -2589,7 +2588,7 @@ static void test17_replicaHealingReceivesReplicaDataRqstPull() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "BREATHING TEST - " "HEALING REPLICA RECEIVES REPLICA DATA REQUEST PULL"); @@ -2616,7 +2615,7 @@ static void test17_replicaHealingReceivesReplicaDataRqstPull() static const int k_PARTITION_ID = 1; - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; BSLS_ASSERT_OPT(storageManager.partitionHealthState(k_PARTITION_ID) == mqbc::PartitionFSM::State::e_UNKNOWN); @@ -2743,7 +2742,7 @@ static void test18_primaryHealingStage1SelfHighestSendsDataChunks() // Basic functionality. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST - " + bmqtst::TestHelper::printTestName("BREATHING TEST - " "PRIMARY HEALING STAGE 1 SELF HIGHEST" " SENDS DATA CHUNKS"); @@ -2767,7 +2766,7 @@ static void test18_primaryHealingStage1SelfHighestSendsDataChunks() mockOnPartitionPrimaryStatus, s_allocator_p); - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; static const int k_PARTITION_ID = 1; static const unsigned int k_PRIMARY_LEASE_ID = 1U; @@ -2888,7 +2887,7 @@ static void test18_primaryHealingStage1SelfHighestSendsDataChunks() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); bmqt::UriParser::initialize(s_allocator_p); @@ -2936,7 +2935,7 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); // Can't ensure no default memory is allocated because // 'bdlmt::EventSchedulerTestTimeSource' inside 'mqbmock::Cluster' uses // the default allocator in its constructor. diff --git a/src/groups/mqb/mqbc/mqbc_storageutil.cpp b/src/groups/mqb/mqbc/mqbc_storageutil.cpp index ead834b26..21a3bf7a2 100644 --- a/src/groups/mqb/mqbc/mqbc_storageutil.cpp +++ b/src/groups/mqb/mqbc/mqbc_storageutil.cpp @@ -33,11 +33,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -228,11 +227,11 @@ void StorageUtil::registerQueueDispatched( timestamp, true); // Is new storage? if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << clusterDescription << ": Partition [" << partitionId << "] failed to write QueueCreationRecord for queue [" << storage->queueUri() << "] queueKey [" << storage->queueKey() - << "], rc: " << rc << MWCTSK_ALARMLOG_END; + << "], rc: " << rc << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -253,7 +252,7 @@ void StorageUtil::registerQueueDispatched( << storage->queueKey() << "] with the storage as primary."; } -void StorageUtil::updateQueueDispatched( +void StorageUtil::updateQueuePrimaryDispatched( BSLS_ANNOTATION_UNUSED const mqbi::Dispatcher::ProcessorHandle& processor, mqbs::ReplicatedStorage* storage, bslmt::Mutex* storagesLock, @@ -277,29 +276,29 @@ void StorageUtil::updateQueueDispatched( bslmt::LockGuard guard(storagesLock); // LOCK - // Simply forward to 'updateQueueRaw'. - updateQueueRaw(storage, - fs, - appKeys, - appKeysLock, - clusterDescription, - partitionId, - addedIdKeyPairs, - removedIdKeyPairs, - isFanout, - isCSLMode); + // Simply forward to 'updateQueuePrimaryRaw'. + updateQueuePrimaryRaw(storage, + fs, + appKeys, + appKeysLock, + clusterDescription, + partitionId, + addedIdKeyPairs, + removedIdKeyPairs, + isFanout, + isCSLMode); } -int StorageUtil::updateQueueRaw(mqbs::ReplicatedStorage* storage, - mqbs::FileStore* fs, - AppKeys* appKeys, - bslmt::Mutex* appKeysLock, - const bsl::string& clusterDescription, - int partitionId, - const AppIdKeyPairs& addedIdKeyPairs, - const AppIdKeyPairs& removedIdKeyPairs, - bool isFanout, - bool isCSLMode) +int StorageUtil::updateQueuePrimaryRaw(mqbs::ReplicatedStorage* storage, + mqbs::FileStore* fs, + AppKeys* appKeys, + bslmt::Mutex* appKeysLock, + const bsl::string& clusterDescription, + int partitionId, + const AppIdKeyPairs& addedIdKeyPairs, + const AppIdKeyPairs& removedIdKeyPairs, + bool isFanout, + bool isCSLMode) { // executed by *QUEUE_DISPATCHER* thread with the specified 'partitionId' @@ -328,12 +327,12 @@ int StorageUtil::updateQueueRaw(mqbs::ReplicatedStorage* storage, timestamp, false); // is new queue? if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << clusterDescription << ": Partition [" << partitionId << "] failed to write QueueCreationRecord for new appIds " << "for queue [" << storage->queueUri() << "] queueKey [" << storage->queueKey() << "], rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc; // RETURN } @@ -353,7 +352,7 @@ int StorageUtil::updateQueueRaw(mqbs::ReplicatedStorage* storage, BALL_LOG_INFO_BLOCK { - mwcu::Printer printer(&addedIdKeyPairs); + bmqu::Printer printer(&addedIdKeyPairs); BALL_LOG_OUTPUT_STREAM << clusterDescription << ": Partition [" << partitionId @@ -379,13 +378,13 @@ int StorageUtil::updateQueueRaw(mqbs::ReplicatedStorage* storage, cit->second, timestamp); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << clusterDescription << ": Partition [" << partitionId << "] failed to write QueueDeletionRecord for queue [" << storage->queueUri() << "], queueKey [" << storage->queueKey() << "], appId [" << cit->first << "], appKey [" << cit->second << "], rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc; // RETURN } @@ -410,7 +409,7 @@ int StorageUtil::updateQueueRaw(mqbs::ReplicatedStorage* storage, BALL_LOG_INFO_BLOCK { - mwcu::Printer printer(&removedIdKeyPairs); + bmqu::Printer printer(&removedIdKeyPairs); BALL_LOG_OUTPUT_STREAM << clusterDescription << ": Partition [" << partitionId @@ -425,8 +424,8 @@ int StorageUtil::updateQueueRaw(mqbs::ReplicatedStorage* storage, // away. fs->dispatcherFlush(true, false); - mwcu::Printer printer1(&addedIdKeyPairs); - mwcu::Printer printer2(&removedIdKeyPairs); + bmqu::Printer printer1(&addedIdKeyPairs); + bmqu::Printer printer2(&removedIdKeyPairs); BALL_LOG_INFO << clusterDescription << ": Partition [" << partitionId << "] updated [" << storage->queueUri() << "], queueKey [" << storage->queueKey() << "] with the storage as primary: " @@ -462,7 +461,7 @@ int StorageUtil::addVirtualStoragesInternal( bslmt::LockGuard appLockGuard(appKeysLock); // LOCK int rc = -1; - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; if (isFanout) { // Register appKeys with 'appKeys' and then with the underlying // physical 'storage'. @@ -619,7 +618,7 @@ void StorageUtil::loadStorages(bsl::vector* storages, storages->resize(storages->size() + 1); mqbcmd::StorageQueueInfo& storage = storages->back(); - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << (*cit)->queueKey(); storage.queueKey() = os.str(); storage.partitionId() = (*cit)->partitionId(); @@ -745,7 +744,7 @@ int StorageUtil::processReplicationCommand( if (bdlb::StringRefUtil::areEqualCaseless(tunable.name(), "QUORUM")) { if (!tunable.value().isTheIntegerValue() || tunable.value().theInteger() < 0) { - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "The QUORUM tunable must be a non-negative integer, " "but instead the following was specified: " << tunable.value(); @@ -772,7 +771,7 @@ int StorageUtil::processReplicationCommand( return 0; // RETURN } - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "Unknown tunable name '" << tunable.name() << "'"; replicationResult->makeError(); replicationResult->error().message() = output.str(); @@ -787,7 +786,7 @@ int StorageUtil::processReplicationCommand( return 0; // RETURN } - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "Unsupported tunable '" << tunable << "': Issue the " << "LIST_TUNABLES command for the list of supported tunables."; replicationResult->makeError(); @@ -805,7 +804,7 @@ int StorageUtil::processReplicationCommand( return 0; // RETURN } - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "Unknown command '" << command << "'"; replicationResult->makeError(); replicationResult->error().message() = output.str(); @@ -862,7 +861,7 @@ void StorageUtil::storageMonitorCb( bsls::Types::Int64 availableSpace = 0; bsls::Types::Int64 totalSpace = 0; - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; const bsl::string& clusterFileStoreLocation = partitionConfig.location(); int rc = mqbs::FileSystemUtil::loadFileSystemSpace( errorDesc, @@ -870,13 +869,13 @@ void StorageUtil::storageMonitorCb( &totalSpace, clusterFileStoreLocation.c_str()); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << clusterDescription << ": Failed to retrieve available space on file system where " << "storage files reside: [" << clusterFileStoreLocation << "]. This is not fatal but broker may not be able to handle " << "disk-space issues gracefully. Reason: " << errorDesc.str() - << ", rc: " << rc << "." << MWCTSK_ALARMLOG_END; + << ", rc: " << rc << "." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -884,16 +883,16 @@ void StorageUtil::storageMonitorCb( minimumRequiredDiskSpace) { *lowDiskspaceWarning = true; - MWCU_THROTTLEDACTION_THROTTLE( - mwcu::ThrottledActionParams(5 * 1000 * 60, 1), + BMQU_THROTTLEDACTION_THROTTLE( + bmqu::ThrottledActionParams(5 * 1000 * 60, 1), // 1 log per 5min interval BALL_LOG_INFO << "[INSUFFICIENT_DISK_SPACE] " << clusterDescription << ": Not enough disk space on file system [" << clusterFileStoreLocation << "]. Required: " - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( minimumRequiredDiskSpace) << ", available: " - << mwcu::PrintUtil::prettyBytes(availableSpace);); + << bmqu::PrintUtil::prettyBytes(availableSpace);); } else { if (*lowDiskspaceWarning) { @@ -901,12 +900,11 @@ void StorageUtil::storageMonitorCb( BALL_LOG_INFO << clusterDescription << ": Disk space on file system [" << clusterFileStoreLocation - << "] has gone back to normal. " - << "Required: " - << mwcu::PrintUtil::prettyBytes( + << "] has gone back to normal. " << "Required: " + << bmqu::PrintUtil::prettyBytes( minimumRequiredDiskSpace) << ", available: " - << mwcu::PrintUtil::prettyBytes(availableSpace); + << bmqu::PrintUtil::prettyBytes(availableSpace); } *lowDiskspaceWarning = false; @@ -921,7 +919,7 @@ StorageUtil::printRecoveryPhaseOneBanner(bsl::ostream& out, const int level = 0; const int spacesPerLevel = 4; - mwcu::MemOutStream header; + bmqu::MemOutStream header; header << "RECOVERY PHASE 1: " << clusterDescription << " Partition [" << partitionId << "]"; @@ -993,7 +991,7 @@ int StorageUtil::validateDiskSpace(const mqbcfg::PartitionConfig& config, // Raise low disk space warning, if applicable. bsls::Types::Int64 availableSpace = 0; bsls::Types::Int64 totalSpace = 0; - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc = mqbs::FileSystemUtil::loadFileSystemSpace( errorDesc, &availableSpace, @@ -1013,9 +1011,9 @@ int StorageUtil::validateDiskSpace(const mqbcfg::PartitionConfig& config, BALL_LOG_INFO << clusterData.identity().description() << ": file system for cluster's storage location [" << clusterFileStoreLocation << "] has total space: " - << mwcu::PrintUtil::prettyBytes(totalSpace) + << bmqu::PrintUtil::prettyBytes(totalSpace) << ", and available space: " - << mwcu::PrintUtil::prettyBytes(availableSpace) << "."; + << bmqu::PrintUtil::prettyBytes(availableSpace) << "."; // Available space on disk must be at least 2 times the minimum space // required. @@ -1025,9 +1023,9 @@ int StorageUtil::validateDiskSpace(const mqbcfg::PartitionConfig& config, << clusterData.identity().description() << ":(Not enough disk space on file system where storage files" << " reside [" << clusterFileStoreLocation << "]. Required: " - << mwcu::PrintUtil::prettyBytes(minDiskSpace) + << bmqu::PrintUtil::prettyBytes(minDiskSpace) << ", available: " - << mwcu::PrintUtil::prettyBytes(availableSpace); + << bmqu::PrintUtil::prettyBytes(availableSpace); // TBD: Should return error but most dev and some prod boxes are // low on disk space. So just raise an alarm for now and move @@ -1081,12 +1079,12 @@ bool StorageUtil::validateStorageEvent( return false; // RETURN } - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << clusterDescription << ": Received storage " << "event from node " << source->nodeDescription() << " for " << "Partition [" << partitionId << "] which has no primary as " << "perceived by this node. Ignoring entire storage event." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return false; // RETURN } @@ -1095,13 +1093,13 @@ bool StorageUtil::validateStorageEvent( return false; // RETURN } - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << clusterDescription << ": Received storage " << "event from node " << source->nodeDescription() << " for " << "Partition [" << partitionId << "] which has different " << "primary as perceived by this node: " << primary->nodeDescription() << " Ignoring entire " - << "storage event." << MWCTSK_ALARMLOG_END; + << "storage event." << BMQTSK_ALARMLOG_END; return false; // RETURN } @@ -1111,13 +1109,13 @@ bool StorageUtil::validateStorageEvent( return false; // RETURN } - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << clusterDescription << ": Received storage " << "event for Partition [" << partitionId << "] from: " << source->nodeDescription() << ", which is perceived as " << "non-active primary. Primary status: " << status - << ". Ignoring entire storage event." << MWCTSK_ALARMLOG_END; + << ". Ignoring entire storage event." << BMQTSK_ALARMLOG_END; return false; // RETURN } @@ -1189,13 +1187,13 @@ bool StorageUtil::validatePartitionSyncEvent( // to this is a bug in the implementation, and thus, if it occurs, // we reject the *entire* partition-sync event. - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << clusterData.identity().description() << ": Received partition-sync event from node with " << source->nodeDescription() << " with different partitionIds: " << partitionId << "vs " << header.partitionId() << ". Ignoring this entire event." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return false; // RETURN } } @@ -1211,7 +1209,7 @@ int StorageUtil::assignPartitionDispatcherThreads( const mqbcfg::PartitionConfig& config, FileStores* fileStores, BlobSpPool* blobSpPool, - mwcma::CountingAllocatorStore* allocators, + bmqma::CountingAllocatorStore* allocators, bsl::ostream& errorDescription, int replicationFactor, const RecoveredQueuesCb& recoveredQueuesCb, @@ -1269,7 +1267,7 @@ int StorageUtil::assignPartitionDispatcherThreads( dsCfg.setQueueDeletionCb(queueDeletionCb.value()); } - // Get named allocator from associated mwcma::CountingAllocatorStore + // Get named allocator from associated bmqma::CountingAllocatorStore bslma::Allocator* fileStoreAllocator = allocators->get( bsl::string("Partition") + bsl::to_string(i)); @@ -1411,14 +1409,14 @@ void StorageUtil::onPartitionPrimarySync( // StorageMgr.processStorageEvent(). Currently all of this is not // handled. - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << clusterData->identity().description() << " Partition [" << partitionId << "]: new primary (" << pinfo->primary()->nodeDescription() << ") with leaseId " << pinfo->primaryLeaseId() << " chosen while self node was undergoing partition-primary sync." << " This scenario is not handled currently." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; // No need to inform via 'partitionPrimaryStatusCb' though, since this // node is now an old primary. @@ -1426,11 +1424,11 @@ void StorageUtil::onPartitionPrimarySync( } if (0 != status) { - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << clusterData->identity().description() << " Partition [" << partitionId << "]: node failed to sync " << "after being chosen as primary, with status: " << status - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; partitionPrimaryStatusCb(partitionId, status, pinfo->primaryLeaseId()); return; // RETURN @@ -1442,7 +1440,7 @@ void StorageUtil::onPartitionPrimarySync( } // Broadcast self as active primary of this partition. This must be done - // before invoking 'FileStore::setPrimary'. + // before invoking 'FileStore::setActivePrimary'. transitionToActivePrimary(pinfo, clusterData, partitionId); partitionPrimaryStatusCb(partitionId, status, pinfo->primaryLeaseId()); @@ -1450,7 +1448,7 @@ void StorageUtil::onPartitionPrimarySync( // Safe to inform partition now. Note that partition will issue a sync // point with old leaseId (if applicable) and another with new leaseId // immediately. - fs->setPrimary(pinfo->primary(), pinfo->primaryLeaseId()); + fs->setActivePrimary(pinfo->primary(), pinfo->primaryLeaseId()); } void StorageUtil::recoveredQueuesCb( @@ -1517,10 +1515,10 @@ void StorageUtil::recoveredQueuesCb( const mqbs::DataStoreConfigQueueInfo& qinfo = qit->second; bmqt::Uri uri(qinfo.canonicalQueueUri()); if (!uri.isValid()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << clusterDescription << ": Partition [" << partitionId << "]: encountered invalid CanonicalQueueUri [" << uri << "]." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; mqbu::ExitUtil::terminate(mqbu::ExitCode::e_RECOVERY_FAILURE); // EXIT } @@ -1538,14 +1536,14 @@ void StorageUtil::recoveredQueuesCb( if (false == appIdsIrc.second) { // Duplicate AppId. - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << clusterDescription << ": Partition [" << partitionId << "]: " << "encountered a duplicate AppId while processing " << "recovered queue [" << uri << "], " << "queueKey [" << qit->first << "]. AppId [" << *(appIdsIrc.first) << "]. AppKey [" << p.second << "]." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; mqbu::ExitUtil::terminate( mqbu::ExitCode::e_RECOVERY_FAILURE); // EXIT @@ -1561,14 +1559,14 @@ void StorageUtil::recoveredQueuesCb( // appKeys) could be assigned at node startup, via // CQH::onQueueAssigned -> // StorageMgr::register/UpdateQueueReplica. - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << clusterDescription << ": Partition [" << partitionId << "]: " << "encountered a duplicate AppKey while processing " << "recovered queue [" << uri << "], queueKey [" << qit->first << "]. AppKey [" << *(appKeysIrc.first) << "]. AppId [" << p.first << "]." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; mqbu::ExitUtil::terminate( mqbu::ExitCode::e_RECOVERY_FAILURE); // EXIT @@ -1583,13 +1581,13 @@ void StorageUtil::recoveredQueuesCb( // Print the unique list of retrieved domain names (useful for debugging // purposes). - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << clusterDescription << ": Partition [" << partitionId << "]: " << "retrieved " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(queueKeyInfoMap.size())) << " queues belonging to " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(domainMap.size())) << " domains."; @@ -1675,12 +1673,12 @@ void StorageUtil::recoveredQueuesCb( // Encountered the queueKey again. This is an error. const mqbs::ReplicatedStorage* rs = it->second; - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << clusterDescription << ": Partition [" << partitionId << "]: encountered queueKey [" << queueKey << "] again, for uri [" << queueUri << "]. Uri associated with original queueKey: " << "[" - << rs->queueUri() << "]." << MWCTSK_ALARMLOG_END; + << rs->queueUri() << "]." << BMQTSK_ALARMLOG_END; mqbu::ExitUtil::terminate(mqbu::ExitCode::e_RECOVERY_FAILURE); // EXIT } @@ -1738,13 +1736,13 @@ void StorageUtil::recoveredQueuesCb( // This is an error in non-CSL mode. const StorageSp& rstorage = spmapIt->second; - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << clusterDescription << ": Partition [" << partitionId << "]: encountered queueUri [" << queueUri << "] again. QueueKey of this uri [" << queueKey << "]. Details of original queueUri:: Partition [" << rstorage->partitionId() << "], queueKey [" - << rstorage->queueKey() << "]." << MWCTSK_ALARMLOG_END; + << rstorage->queueKey() << "]." << BMQTSK_ALARMLOG_END; mqbu::ExitUtil::terminate(mqbu::ExitCode::e_RECOVERY_FAILURE); // EXIT } @@ -1779,21 +1777,21 @@ void StorageUtil::recoveredQueuesCb( const mqbconfm::StorageDefinition& storageDef = domainCfg.storage(); if (domainCfg.mode().isUndefinedValue()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << clusterDescription << ": Partition [" << partitionId << "]: Domain for queue [" << queueUri << "], queueKey [" << queueKey << "] has invalid queue mode. Aborting broker." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; mqbu::ExitUtil::terminate(mqbu::ExitCode::e_RECOVERY_FAILURE); // EXIT } if (storageDef.config().isUndefinedValue()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << clusterDescription << ": Partition [" << partitionId << "]: Domain for queue [" << queueUri << "], queueKey [" << queueKey << "] has invalid storage config. Aborting broker." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; mqbu::ExitUtil::terminate(mqbu::ExitCode::e_RECOVERY_FAILURE); // EXIT } @@ -1806,7 +1804,7 @@ void StorageUtil::recoveredQueuesCb( // mode without in-memory storage are incompatible config in a // clustered setup. - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << clusterDescription << ": Partition [" << partitionId << "]: Queue [" << queueUri << "], queueKey [" << queueKey << "] is clustered, is setup with incompatible " @@ -1814,7 +1812,7 @@ void StorageUtil::recoveredQueuesCb( << storageDef.config().isInMemoryValue() << ", broadcast mode: " << bsl::boolalpha << domainCfg.mode().isBroadcastValue() << ". Aboring broker." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; mqbu::ExitUtil::terminate(mqbu::ExitCode::e_RECOVERY_FAILURE); // EXIT } @@ -1829,7 +1827,7 @@ void StorageUtil::recoveredQueuesCb( queueKeyStorageMap.insert(bsl::make_pair(queueKey, rs_sp.get())); // Create and add virtual storages, if any. - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc; if (domain->config().mode().isFanoutValue()) { for (AppIdKeyPairsCIter ait = appIdKeyPairs.begin(); @@ -1846,13 +1844,13 @@ void StorageUtil::recoveredQueuesCb( appKey))) { // TBD: does this mean storage is corrupt? Should we abort? - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << clusterDescription << ": Partition [" << partitionId << "]: failed to create virtual storage with appId [" << appId << "], appKey [" << appKey << "] for queueUri [" << queueUri << "], queueKey [" << queueKey << "]. Reason: [" << errorDesc.str() - << "], rc: " << rc << "." << MWCTSK_ALARMLOG_END; + << "], rc: " << rc << "." << BMQTSK_ALARMLOG_END; continue; // CONTINUE } @@ -1981,12 +1979,12 @@ void StorageUtil::recoveredQueuesCb( } // If queue is not recovered - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << clusterDescription << ": Partition [" << partitionId << "], dropping record " << "because queue key '" << queueKey << "' not found in the " << "list of recovered queues, record: " << fsIt - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; continue; // CONTINUE } @@ -2000,14 +1998,14 @@ void StorageUtil::recoveredQueuesCb( // must be a file-backed storage. if (!rs->isPersistent()) { - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << clusterDescription << ": Partition [" << partitionId << "]: For queue [" << rs->queueUri() << "] queueKey [" << queueKey << "] which is configured with in-memory storage, " << " encountered a record of incompatible type [" << fsIt.type() << "] during recovery at startup. " - << "Skipping this record." << MWCTSK_ALARMLOG_END; + << "Skipping this record." << BMQTSK_ALARMLOG_END; continue; // CONTINUE } } @@ -2061,7 +2059,7 @@ void StorageUtil::recoveredQueuesCb( // (dynamic appId registration...). if (!appKey.isNull() && !rs->hasVirtualStorage(appKey)) { - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << clusterDescription << ": Partition [" << partitionId << "], appKey [" << appKey << "] specified in " << fsIt.type() << " record, with guid [" << guid @@ -2069,7 +2067,7 @@ void StorageUtil::recoveredQueuesCb( << "storages associated with file-backed " << "storage for queue [" << rs->queueUri() << "], queueKey [" << rs->queueKey() - << "]. Dropping this record." << MWCTSK_ALARMLOG_END; + << "]. Dropping this record." << BMQTSK_ALARMLOG_END; continue; // CONTINUE } rs->processConfirmRecord(guid, appKey, confirmReason, handle); @@ -2148,7 +2146,7 @@ void StorageUtil::dumpUnknownRecoveredDomains( } bsl::sort(keys.begin(), keys.end()); - mwcu::MemOutStream out; + bmqu::MemOutStream out; const int level = 0; bdlb::Print::newlineAndIndent(out, level); @@ -2182,7 +2180,7 @@ void StorageUtil::dumpUnknownRecoveredDomains( ++qmlcit) { bdlb::Print::newlineAndIndent(out, level + 2); out << qmlcit->first << ": " - << mwcu::PrintUtil::prettyNumber(qmlcit->second) << " msgs"; + << bmqu::PrintUtil::prettyNumber(qmlcit->second) << " msgs"; } } @@ -2247,7 +2245,7 @@ void StorageUtil::stop(FileStores* fileStores, << ": Enqueuing event to close FileStores."; bslmt::Latch latch(fileStores->size()); - bsls::Types::Int64 shutdownStartTime = mwcsys::Time::highResolutionTimer(); + bsls::Types::Int64 shutdownStartTime = bmqsys::Time::highResolutionTimer(); for (unsigned int i = 0; i < fileStores->size(); ++i) { const bsl::shared_ptr& fs = (*fileStores)[i]; // 'fs' could be null because partition might not have been created at @@ -2266,13 +2264,13 @@ void StorageUtil::stop(FileStores* fileStores, BALL_LOG_INFO << clusterDescription << ": About to wait for partition shutdown to complete."; latch.wait(); - bsls::Types::Int64 shutdownEndTime = mwcsys::Time::highResolutionTimer(); + bsls::Types::Int64 shutdownEndTime = bmqsys::Time::highResolutionTimer(); BALL_LOG_INFO << clusterDescription << ": Shutdown complete for all partitions. Total time spent in " << "shutdown: " - << mwcu::PrintUtil::prettyTimeInterval(shutdownEndTime - + << bmqu::PrintUtil::prettyTimeInterval(shutdownEndTime - shutdownStartTime) << " (" << (shutdownEndTime - shutdownStartTime) << " nanoseconds)"; } @@ -2334,7 +2332,7 @@ void StorageUtil::registerQueue( mqbs::FileStore* fs, AppKeys* appKeys, bslmt::Mutex* appKeysLock, - mwcma::CountingAllocatorStore* allocators, + bmqma::CountingAllocatorStore* allocators, const mqbi::Dispatcher::ProcessorHandle& processor, const bmqt::Uri& uri, const mqbu::StorageKey& queueKey, @@ -2386,11 +2384,11 @@ void StorageUtil::registerQueue( const mqbconfm::QueueMode& queueMode = domain->config().mode(); if (queueMode.isUndefinedValue()) { - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << "Partition [" << partitionId << "] Invalid queue-mode in the domain configuration while " << "attempting to register queue '" << uri << "', queueKey '" - << queueKey << "'." << MWCTSK_ALARMLOG_END; + << queueKey << "'." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -2401,12 +2399,12 @@ void StorageUtil::registerQueue( // configured. if (storageDef.config().isInMemoryValue() != queueMode.isBroadcastValue()) { - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << "Partition [" << partitionId << "] Incompatible " << "queue mode (" << queueMode.selectionName() << ") " << "and storage type (" << storageDef.config().selectionName() << ") while attempting to register clustered queue '" << uri - << "', queueKey '" << queueKey << "'." << MWCTSK_ALARMLOG_END; + << "', queueKey '" << queueKey << "'." << BMQTSK_ALARMLOG_END; return; // RETURN } } @@ -2474,8 +2472,8 @@ void StorageUtil::registerQueue( } // Some AppId/Key pairs need to be updated. Invoke - // 'updateQueueDispatched' in the right thread to carry out the - // addition/removal of those pairs. + // 'updateQueuePrimaryDispatched' in the right thread to carry out + // the addition/removal of those pairs. mqbi::DispatcherEvent* queueEvent = dispatcher->getEvent( mqbi::DispatcherClientType::e_QUEUE); @@ -2483,7 +2481,7 @@ void StorageUtil::registerQueue( (*queueEvent) .setType(mqbi::DispatcherEventType::e_DISPATCHER) .setCallback(bdlf::BindUtil::bind( - updateQueueDispatched, + updateQueuePrimaryDispatched, bdlf::PlaceHolders::_1, // processor storageSp.get(), storagesLock, @@ -2501,13 +2499,13 @@ void StorageUtil::registerQueue( mqbi::DispatcherClientType::e_QUEUE, processor); - // Wait for 'updateQueueDispatched' operation to complete. We need - // to wait because 'updateQueueDispatched' creates virtual storages - // corresponding to 'addedAppIdKeyPairs' (if any), and the caller - // of 'registerQueue' expects these virtual storages to be created - // this routine or its caller returns. Before waiting, release the - // 'storagesLock' guard and unlock it to avoid any deadlock b/w - // cluster and partition dispatcher threads. + // Wait for 'updateQueuePrimaryDispatched' operation to complete. + // We need to wait because 'updateQueuePrimaryDispatched' creates + // virtual storages corresponding to 'addedAppIdKeyPairs' (if any), + // and the caller of 'registerQueue' expects these virtual storages + // to be created this routine or its caller returns. Before + // waiting, release the 'storagesLock' guard and unlock it to avoid + // any deadlock b/w cluster and partition dispatcher threads. guard.release()->unlock(); @@ -2535,7 +2533,7 @@ void StorageUtil::registerQueue( BSLS_ASSERT_SAFE(storageMap->end() == storageMap->find(uri)); storageMap->insert(bsl::make_pair(uri, storageSp)); - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc = 0; AppIdKeyPairs appIdKeyPairsToUse; if (queueMode.isFanoutValue()) { @@ -2631,7 +2629,7 @@ void StorageUtil::unregisterQueueDispatched( // This method must be invoked only at partition's primary node. if (clusterData->membership().selfNode() != pinfo.primary()) { - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << clusterData->identity().description() << " Partition [" << partitionId << "]: queue [" << uri << "] unregistration requested but self is not primary. Current " @@ -2640,18 +2638,18 @@ void StorageUtil::unregisterQueueDispatched( : "** none **") << ", current leaseId: " << pinfo.primaryLeaseId() << ", primary status: " << pinfo.primaryStatus() << "." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } if (bmqp_ctrlmsg::PrimaryStatus::E_ACTIVE != pinfo.primaryStatus()) { - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << clusterData->identity().description() << " Partition [" << partitionId << "]: queue [" << uri << "] unregistration requested but self is not ACTIVE primary." << ". Current leaseId: " << pinfo.primaryLeaseId() << ", primary status: " << pinfo.primaryStatus() << "." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -2686,13 +2684,13 @@ void StorageUtil::unregisterQueueDispatched( // number of outstanding messages for the queue is zero. If that's not // the case here, its an error. - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << clusterData->identity().description() << ": Partition [" << partitionId << "]: cannot unregister queue" << " because it has [" << numMsgs << "] outstanding messages. Queue [" << uri << "], queueKey [" << storage->queueKey() << "]." - << MWCTSK_ALARMLOG_END return; // RETURN + << BMQTSK_ALARMLOG_END return; // RETURN } // Storage has no outstanding messages. @@ -2713,12 +2711,12 @@ void StorageUtil::unregisterQueueDispatched( bdlt::EpochUtil::convertToTimeT64(bdlt::CurrentTime::utc())); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << clusterData->identity().description() << ": Partition [" << partitionId << "] failed to write QueueDeletionRecord for queue [" << uri << "], queueKey [" << storage->queueKey() << "], rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -2755,18 +2753,18 @@ void StorageUtil::unregisterQueueDispatched( fs->dispatcherFlush(true, false); } -int StorageUtil::updateQueue(StorageSpMap* storageMap, - bslmt::Mutex* storagesLock, - mqbs::FileStore* fs, - AppKeys* appKeys, - bslmt::Mutex* appKeysLock, - const bsl::string& clusterDescription, - const bmqt::Uri& uri, - const mqbu::StorageKey& queueKey, - int partitionId, - const AppIdKeyPairs& addedIdKeyPairs, - const AppIdKeyPairs& removedIdKeyPairs, - bool isCSLMode) +int StorageUtil::updateQueuePrimary(StorageSpMap* storageMap, + bslmt::Mutex* storagesLock, + mqbs::FileStore* fs, + AppKeys* appKeys, + bslmt::Mutex* appKeysLock, + const bsl::string& clusterDescription, + const bmqt::Uri& uri, + const mqbu::StorageKey& queueKey, + int partitionId, + const AppIdKeyPairs& addedIdKeyPairs, + const AppIdKeyPairs& removedIdKeyPairs, + bool isCSLMode) { // executed by *QUEUE_DISPATCHER* thread with the specified 'partitionId' @@ -2785,8 +2783,8 @@ int StorageUtil::updateQueue(StorageSpMap* storageMap, StorageSpMapIter it = storageMap->find(uri); if (storageMap->end() == it) { - mwcu::Printer printer1(&addedIdKeyPairs); - mwcu::Printer printer2(&removedIdKeyPairs); + bmqu::Printer printer1(&addedIdKeyPairs); + bmqu::Printer printer2(&removedIdKeyPairs); BALL_LOG_ERROR << clusterDescription << " Partition [" << partitionId << "]: Error when updating queue '" << uri << "' with addedAppIds: [" << printer1 @@ -2801,16 +2799,16 @@ int StorageUtil::updateQueue(StorageSpMap* storageMap, BSLS_ASSERT_SAFE(storageSp->partitionId() == partitionId); BSLS_ASSERT_SAFE(storageSp->queueKey() == queueKey); - return updateQueueRaw(storageSp.get(), - fs, - appKeys, - appKeysLock, - clusterDescription, - partitionId, - addedIdKeyPairs, - removedIdKeyPairs, - true, // isFanout - isCSLMode); + return updateQueuePrimaryRaw(storageSp.get(), + fs, + appKeys, + appKeysLock, + clusterDescription, + partitionId, + addedIdKeyPairs, + removedIdKeyPairs, + true, // isFanout + isCSLMode); } void StorageUtil::registerQueueReplicaDispatched( @@ -2819,7 +2817,7 @@ void StorageUtil::registerQueueReplicaDispatched( bslmt::Mutex* storagesLock, mqbs::FileStore* fs, mqbi::DomainFactory* domainFactory, - mwcma::CountingAllocatorStore* allocators, + bmqma::CountingAllocatorStore* allocators, const bsl::string& clusterDescription, int partitionId, const bmqt::Uri& uri, @@ -3020,11 +3018,11 @@ void StorageUtil::unregisterQueueReplicaDispatched( // Storage manager is not aware of this uri. This indicates a bug BMQ // replication. - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << clusterDescription << " Partition [" << partitionId << "]: unaware of uri while deleting " << "storage for queue [ " << uri << "], queueKey [" << queueKey << "]. Ignoring this event." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; if (status) { *status = rc_UNKNOWN_QUEUE_URI; } @@ -3038,12 +3036,12 @@ void StorageUtil::unregisterQueueReplicaDispatched( if (queueKey != rs->queueKey()) { // This really means that cluster state is out of sync across nodes. - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << clusterDescription << " Partition [" << partitionId << "]: queueKey mismatch while deleting " << "storage for queue [ " << uri << "]. Specified queueKey [" << queueKey << "], queueKey associated with storage [" << rs->queueKey() - << "]. Ignoring this event." << MWCTSK_ALARMLOG_END; + << "]. Ignoring this event." << BMQTSK_ALARMLOG_END; if (status) { *status = rc_QUEUE_KEY_MISMATCH; } @@ -3058,12 +3056,12 @@ void StorageUtil::unregisterQueueReplicaDispatched( const bsls::Types::Int64 numMsgs = rs->numMessages( mqbu::StorageKey::k_NULL_KEY); if (0 != numMsgs) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << clusterDescription << " Partition [" << partitionId << "]: Attempt to delete storage for queue [ " << uri << "], queueKey [" << queueKey << "] which has [" << numMsgs << "] outstanding messages." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; if (status) { *status = rc_QUEUE_HAS_MESSAGES; } @@ -3102,12 +3100,12 @@ void StorageUtil::unregisterQueueReplicaDispatched( appKey, partitionId); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << clusterDescription << " Partition [" << partitionId << "]: Failed to remove virtual storage " << "for appKey [" << appKey << "] for queue [" << uri << "] and queueKey [" << queueKey << ", rc: " << rc << ". Ignoring this event." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; if (status) { *status = rc_MISC; } @@ -3168,12 +3166,12 @@ void StorageUtil::updateQueueReplicaDispatched( if (it == storageMap->end()) { // Cluster state and/or partition are out of sync at this replica. - mwcu::Printer printer(&appIdKeyPairs); - MWCTSK_ALARMLOG_ALARM("REPLICATION") + bmqu::Printer printer(&appIdKeyPairs); + BMQTSK_ALARMLOG_ALARM("REPLICATION") << "At partition [" << partitionId << "], failure while registering appIds [" << printer << "] for queue [" << uri << "], queueKey [" << queueKey - << "], rc: " << rc_QUEUE_UNKNOWN << MWCTSK_ALARMLOG_END; + << "], rc: " << rc_QUEUE_UNKNOWN << BMQTSK_ALARMLOG_END; if (status) { *status = rc_QUEUE_UNKNOWN; } @@ -3200,13 +3198,13 @@ void StorageUtil::updateQueueReplicaDispatched( isCSLMode); if (rc != 0) { if (!allowDuplicate) { - mwcu::Printer printer(&appIdKeyPairs); - MWCTSK_ALARMLOG_ALARM("REPLICATION") + bmqu::Printer printer(&appIdKeyPairs); + BMQTSK_ALARMLOG_ALARM("REPLICATION") << "At partition [" << partitionId << "], failure while registering appIds [" << printer << "] for queue [" << uri << "], queueKey [" << queueKey << "], rc: " << (rc * 10 + rc_VIRTUAL_STORAGE_CREATION_FAILURE) - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; if (status) { *status = rc * 10 + rc_VIRTUAL_STORAGE_CREATION_FAILURE; } @@ -3215,7 +3213,7 @@ void StorageUtil::updateQueueReplicaDispatched( return; // RETURN } - mwcu::Printer printer(&appIdKeyPairs); + bmqu::Printer printer(&appIdKeyPairs); BALL_LOG_INFO << clusterDescription << ": Partition [" << partitionId << "] updated [" << uri << "], queueKey [" << queueKey << "] with the storage as replica: " << "addedIdKeyPairs:" @@ -3346,14 +3344,14 @@ void StorageUtil::processPrimaryStatusAdvisoryDispatched( if (source == pinfo->primary()) { if (advisory.primaryLeaseId() != pinfo->primaryLeaseId()) { - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << clusterDescription << " Partition [" << advisory.partitionId() << "]: received primary advisory: " << advisory << ", from perceived primary: " << source->nodeDescription() << ", but with different leaseId. LeaseId " << "perceived by self: " << pinfo->primaryLeaseId() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -3372,14 +3370,14 @@ void StorageUtil::processPrimaryStatusAdvisoryDispatched( if (0 != pinfo->primary()) { // Primary status advisory from a different node. - MWCTSK_ALARMLOG_ALARM("CLUSTER_STATE") + BMQTSK_ALARMLOG_ALARM("CLUSTER_STATE") << clusterDescription << " Partition [" << advisory.partitionId() << "]: received primary advisory: " << advisory << ", from: " << source->nodeDescription() << ", but self perceives: " << pinfo->primary()->nodeDescription() - << " as current primary." << MWCTSK_ALARMLOG_END; + << " as current primary." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -3405,17 +3403,12 @@ void StorageUtil::processPrimaryStatusAdvisoryDispatched( << "node as primary."; } - BALL_LOG_INFO << clusterDescription << " Partition [" - << advisory.partitionId() - << "]: received primary status advisory: " << advisory - << ", from: " << source->nodeDescription(); - pinfo->setPrimary(source); pinfo->setPrimaryLeaseId(advisory.primaryLeaseId()); pinfo->setPrimaryStatus(advisory.status()); if (bmqp_ctrlmsg::PrimaryStatus::E_ACTIVE == advisory.status()) { - fs->setPrimary(source, advisory.primaryLeaseId()); + fs->setActivePrimary(source, advisory.primaryLeaseId()); } } @@ -3641,7 +3634,7 @@ void StorageUtil::purgeQueueDispatched( bdlf::BindUtil::bind(&optionalSemaphorePost, purgeFinishedSemaphore)); if (!fileStore->primaryNode()) { - mwcu::MemOutStream errorMsg; + bmqu::MemOutStream errorMsg; errorMsg << "Not purging queue '" << storage->queueUri() << "' " << " with file store: " << fileStore->description() << "[reason: unset primary node]"; @@ -3653,7 +3646,7 @@ void StorageUtil::purgeQueueDispatched( const bool isPrimary = (fileStore->primaryNode()->nodeId() == fileStore->config().nodeId()); if (!isPrimary) { - mwcu::MemOutStream errorMsg; + bmqu::MemOutStream errorMsg; errorMsg << "Not purging queue '" << storage->queueUri() << "' " << " with primary node: " << fileStore->primaryNode()->nodeDescription() @@ -3672,7 +3665,7 @@ void StorageUtil::purgeQueueDispatched( else { // A specific appId (i.e., virtual storage) needs to be purged. if (!storage->hasVirtualStorage(appId, &appKey)) { - mwcu::MemOutStream errorMsg; + bmqu::MemOutStream errorMsg; errorMsg << "Specified appId '" << appId << "' not found in the " << "storage of queue '" << storage->queueUri() << "'."; mqbcmd::Error& error = purgedQueueResult->makeError(); @@ -3686,7 +3679,7 @@ void StorageUtil::purgeQueueDispatched( const mqbi::StorageResult::Enum rc = storage->removeAll(appKey); if (rc != mqbi::StorageResult::e_SUCCESS) { - mwcu::MemOutStream errorMsg; + bmqu::MemOutStream errorMsg; errorMsg << "Failed to purge appId '" << appId << "', appKey '" << appKey << "' of queue '" << storage->queueUri() << "' [reason: " << mqbi::StorageResult::toAscii(rc) << "]"; @@ -3704,7 +3697,7 @@ void StorageUtil::purgeQueueDispatched( mqbcmd::PurgedQueueDetails& queueDetails = purgedQueueResult->makeQueue(); queueDetails.queueUri() = storage->queueUri().asString(); queueDetails.appId() = appId; - mwcu::MemOutStream appKeyStr; + bmqu::MemOutStream appKeyStr; appKeyStr << appKey; queueDetails.appKey() = appKeyStr.str(); queueDetails.numMessagesPurged() = numMsgs; @@ -3741,7 +3734,7 @@ int StorageUtil::processCommand(mqbcmd::StorageResult* result, if (partitionId < 0 || partitionId >= static_cast(fileStores->size())) { bdlma::LocalSequentialAllocator<256> localAllocator(allocator); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "Invalid partitionId value: '" << partitionId << "'"; result->makeError().message() = os.str(); return -1; // RETURN @@ -3771,7 +3764,7 @@ int StorageUtil::processCommand(mqbcmd::StorageResult* result, else if (command.isDomainValue()) { if (!domainFactory->getDomain(command.domain().name())) { bdlma::LocalSequentialAllocator<256> localAllocator(allocator); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "Unknown domain '" << command.domain().name() << "'"; result->makeError().message() = os.str(); return -1; // RETURN @@ -3841,7 +3834,7 @@ int StorageUtil::processCommand(mqbcmd::StorageResult* result, if (!queueStorage) { bdlma::LocalSequentialAllocator<256> localAllocator(allocator); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "Queue was not found in a storage '" << uri << "'"; result->makeError().message() = os.str(); return -1; // RETURN @@ -3888,7 +3881,7 @@ int StorageUtil::processCommand(mqbcmd::StorageResult* result, } bdlma::LocalSequentialAllocator<256> localAllocator(allocator); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); os << "Unknown command '" << command << "'"; result->makeError().message() = os.str(); return -1; diff --git a/src/groups/mqb/mqbc/mqbc_storageutil.h b/src/groups/mqb/mqbc/mqbc_storageutil.h index f98f91ff3..8db21fcfb 100644 --- a/src/groups/mqb/mqbc/mqbc_storageutil.h +++ b/src/groups/mqb/mqbc/mqbc_storageutil.h @@ -49,8 +49,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -212,34 +211,34 @@ struct StorageUtil { const AppIdKeyPairs& appIdKeyPairs); /// THREAD: This method is called from the Queue's dispatcher thread. - static void - updateQueueDispatched(const mqbi::Dispatcher::ProcessorHandle& processor, - mqbs::ReplicatedStorage* storage, - bslmt::Mutex* storagesLock, - mqbs::FileStore* fs, - AppKeys* appKeys, - bslmt::Mutex* appKeysLock, - const bsl::string& clusterDescription, - int partitionId, - const AppIdKeyPairs& addedIdKeyPairs, - const AppIdKeyPairs& removedIdKeyPairs, - bool isFanout, - bool isCSLMode); + static void updateQueuePrimaryDispatched( + const mqbi::Dispatcher::ProcessorHandle& processor, + mqbs::ReplicatedStorage* storage, + bslmt::Mutex* storagesLock, + mqbs::FileStore* fs, + AppKeys* appKeys, + bslmt::Mutex* appKeysLock, + const bsl::string& clusterDescription, + int partitionId, + const AppIdKeyPairs& addedIdKeyPairs, + const AppIdKeyPairs& removedIdKeyPairs, + bool isFanout, + bool isCSLMode); /// StorageManager's storages lock must be locked before calling this /// method. /// /// THREAD: Executed by the Queue's dispatcher thread. - static int updateQueueRaw(mqbs::ReplicatedStorage* storage, - mqbs::FileStore* fs, - AppKeys* appKeys, - bslmt::Mutex* appKeysLock, - const bsl::string& clusterDescription, - int partitionId, - const AppIdKeyPairs& addedIdKeyPairs, - const AppIdKeyPairs& removedIdKeyPairs, - bool isFanout, - bool isCSLMode); + static int updateQueuePrimaryRaw(mqbs::ReplicatedStorage* storage, + mqbs::FileStore* fs, + AppKeys* appKeys, + bslmt::Mutex* appKeysLock, + const bsl::string& clusterDescription, + int partitionId, + const AppIdKeyPairs& addedIdKeyPairs, + const AppIdKeyPairs& removedIdKeyPairs, + bool isFanout, + bool isCSLMode); static int addVirtualStoragesInternal(mqbs::ReplicatedStorage* storage, @@ -503,7 +502,7 @@ struct StorageUtil { const mqbcfg::PartitionConfig& config, FileStores* fileStores, BlobSpPool* blobSpPool, - mwcma::CountingAllocatorStore* allocators, + bmqma::CountingAllocatorStore* allocators, bsl::ostream& errorDescription, int replicationFactor, const RecoveredQueuesCb& recoveredQueuesCb, @@ -634,7 +633,7 @@ struct StorageUtil { mqbs::FileStore* fs, AppKeys* appKeys, bslmt::Mutex* appKeysLock, - mwcma::CountingAllocatorStore* allocators, + bmqma::CountingAllocatorStore* allocators, const mqbi::Dispatcher::ProcessorHandle& processor, const bmqt::Uri& uri, const mqbu::StorageKey& queueKey, @@ -663,18 +662,18 @@ struct StorageUtil { /// queue is configured in fanout mode. /// /// THREAD: Executed by the Queue's dispatcher thread. - static int updateQueue(StorageSpMap* storageMap, - bslmt::Mutex* storagesLock, - mqbs::FileStore* fs, - AppKeys* appKeys, - bslmt::Mutex* appKeysLock, - const bsl::string& clusterDescription, - const bmqt::Uri& uri, - const mqbu::StorageKey& queueKey, - int partitionId, - const AppIdKeyPairs& addedIdKeyPairs, - const AppIdKeyPairs& removedIdKeyPairs, - bool isCSLMode); + static int updateQueuePrimary(StorageSpMap* storageMap, + bslmt::Mutex* storagesLock, + mqbs::FileStore* fs, + AppKeys* appKeys, + bslmt::Mutex* appKeysLock, + const bsl::string& clusterDescription, + const bmqt::Uri& uri, + const mqbu::StorageKey& queueKey, + int partitionId, + const AppIdKeyPairs& addedIdKeyPairs, + const AppIdKeyPairs& removedIdKeyPairs, + bool isCSLMode); static void registerQueueReplicaDispatched(int* status, @@ -682,7 +681,7 @@ struct StorageUtil { bslmt::Mutex* storagesLock, mqbs::FileStore* fs, mqbi::DomainFactory* domainFactory, - mwcma::CountingAllocatorStore* allocators, + bmqma::CountingAllocatorStore* allocators, const bsl::string& clusterDescription, int partitionId, const bmqt::Uri& uri, diff --git a/src/groups/mqb/mqbc/test/mqbc_clusterstate.t.cpp b/src/groups/mqb/mqbc/test/mqbc_clusterstate.t.cpp index edc06b0ad..db614a389 100644 --- a/src/groups/mqb/mqbc/test/mqbc_clusterstate.t.cpp +++ b/src/groups/mqb/mqbc/test/mqbc_clusterstate.t.cpp @@ -23,7 +23,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -66,7 +66,7 @@ static void test1_partitionIdExtractor() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -77,5 +77,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbcfg/mqbcfg_brokerconfig.t.cpp b/src/groups/mqb/mqbcfg/mqbcfg_brokerconfig.t.cpp index e826357db..c126dfe2e 100644 --- a/src/groups/mqb/mqbcfg/mqbcfg_brokerconfig.t.cpp +++ b/src/groups/mqb/mqbcfg/mqbcfg_brokerconfig.t.cpp @@ -17,8 +17,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -48,9 +47,9 @@ TEST(breathing) int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); - mwctst::runTest(_testCase); + bmqtst::runTest(_testCase); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbcmd/mqbcmd_humanprinter.cpp b/src/groups/mqb/mqbcmd/mqbcmd_humanprinter.cpp index 5bef5e820..cd4e1d1fe 100644 --- a/src/groups/mqb/mqbcmd/mqbcmd_humanprinter.cpp +++ b/src/groups/mqb/mqbcmd/mqbcmd_humanprinter.cpp @@ -23,10 +23,9 @@ // BMQ #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -69,23 +68,23 @@ void printCapacityMeter(bsl::ostream& os, } os << capacityMeter.name() << ":" - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Messages: [current: " - << mwcu::PrintUtil::prettyNumber(capacityMeter.numMessages()) + << bmqu::PrintUtil::prettyNumber(capacityMeter.numMessages()) << ", limit: " - << mwcu::PrintUtil::prettyNumber(capacityMeter.messageCapacity()); + << bmqu::PrintUtil::prettyNumber(capacityMeter.messageCapacity()); if (capacityMeter.numMessagesReserved() != 0) { os << ", reserved: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( capacityMeter.numMessagesReserved()); } - os << "]" << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << "]" << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Bytes : [current: " - << mwcu::PrintUtil::prettyBytes(capacityMeter.numBytes()) << ", limit: " - << mwcu::PrintUtil::prettyBytes(capacityMeter.byteCapacity()); + << bmqu::PrintUtil::prettyBytes(capacityMeter.numBytes()) << ", limit: " + << bmqu::PrintUtil::prettyBytes(capacityMeter.byteCapacity()); if (capacityMeter.numBytesReserved() != 0) { os << ", reserved: " - << mwcu::PrintUtil::prettyBytes(capacityMeter.numBytesReserved()); + << bmqu::PrintUtil::prettyBytes(capacityMeter.numBytesReserved()); } os << "]"; @@ -106,23 +105,23 @@ void printQueueStatus(bsl::ostream& os, return; // RETURN } - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << " QueueKey Partition NumMsgs NumBytes" << " QueueUri"; typedef bsl::vector Storages; const Storages& storages = storageContent.storages(); - mwcu::OutStreamFormatSaver fmtSaver(os); + bmqu::OutStreamFormatSaver fmtSaver(os); for (Storages::const_iterator cit = storages.cbegin(); cit != storages.cend(); ++cit) { - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << cit->queueKey() << " " << bsl::setfill(' ') << bsl::setw(7) << cit->partitionId() << " " << bsl::setfill(' ') - << bsl::setw(8) << mwcu::PrintUtil::prettyNumber(cit->numMessages()) + << bsl::setw(8) << bmqu::PrintUtil::prettyNumber(cit->numMessages()) << " " << bsl::setfill(' ') << bsl::setw(10) - << mwcu::PrintUtil::prettyBytes(cit->numBytes()) << " " + << bmqu::PrintUtil::prettyBytes(cit->numBytes()) << " " << cit->queueUri() << (cit->isPersistent() ? "" : " (non-persistent)"); } @@ -134,32 +133,32 @@ void printDomainInfo(bsl::ostream& os, int spacesPerLevel) { bdlb::Print::indent(os, level, spacesPerLevel); - os << "Domain:" << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << "Domain:" << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "-------" - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Name ............: " << domainInfo.name() - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Config ..........:\n" << domainInfo.configJson() - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Cluster .........: " << domainInfo.clusterName() - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Capacity Meter ..: "; printCapacityMeter(os, domainInfo.capacityMeter(), level + 2, spacesPerLevel); - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Queues ..........: " - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "------------------" - << mwcu::PrintUtil::newlineAndIndent(level + 2, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 2, spacesPerLevel) << "ActiveQueues ..: " << domainInfo.queueUris().size(); { - mwcu::OutStreamFormatSaver fmtSaver(os); + bmqu::OutStreamFormatSaver fmtSaver(os); for (size_t i = 0; i < domainInfo.queueUris().size(); ++i) { const bsl::string& queueUri = domainInfo.queueUris()[i]; - os << mwcu::PrintUtil::newlineAndIndent(level + 2, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 2, spacesPerLevel) << " " << bsl::setfill(' ') << bsl::setw(3) << i << ". " << queueUri; } @@ -168,7 +167,7 @@ void printDomainInfo(bsl::ostream& os, bdlb::Print::indent(os, level, spacesPerLevel); os << "Storage ......." - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Number of assigned queue-storages: " << domainInfo.storageContent().storages().size(); @@ -180,7 +179,7 @@ void printDomainInfo(bsl::ostream& os, void printClusterList(bsl::ostream& os, const ClusterList& clusterList) { - mwcu::OutStreamFormatSaver fmtSaver(os); + bmqu::OutStreamFormatSaver fmtSaver(os); os << "The following clusters are active:"; for (bsl::vector::const_iterator itCluster = @@ -250,7 +249,7 @@ void printTunable(bsl::ostream& os, const Tunable& tunable) void printTunableList(bsl::ostream& os, const Tunables& tunables) { - mwcu::OutStreamFormatSaver fmtSaver(os); + bmqu::OutStreamFormatSaver fmtSaver(os); // Compute the longest tunable name, for pretty-alignment bsl::size_t longestName = 0; @@ -297,8 +296,8 @@ void printPurgedQueues(bsl::ostream& os, const PurgedQueues& purgedQueueList) bsl::sort(queues.begin(), queues.end(), SortPurgeQueueResultByBytesDesc()); - mwcu::MemOutStream stream; - mwcu::MemOutStream errorStream; + bmqu::MemOutStream stream; + bmqu::MemOutStream errorStream; bsls::Types::Int64 totalBytes = 0; bsls::Types::Int64 totalMessages = 0; @@ -313,9 +312,9 @@ void printPurgedQueues(bsl::ostream& os, const PurgedQueues& purgedQueueList) const PurgedQueueDetails& queue = it->queue(); stream << bsl::endl << " " << bsl::setfill(' ') << bsl::setw(10) << bsl::right - << mwcu::PrintUtil::prettyBytes(queue.numBytesPurged()) << " " + << bmqu::PrintUtil::prettyBytes(queue.numBytesPurged()) << " " << bsl::setfill(' ') << bsl::setw(10) << bsl::right - << mwcu::PrintUtil::prettyNumber(queue.numMessagesPurged()) + << bmqu::PrintUtil::prettyNumber(queue.numMessagesPurged()) << bsl::left << " " << queue.appKey() << " " << bsl::setfill(' ') << bsl::setw(16) << bsl::right << queue.appId() << bsl::left << " " << queue.queueUri(); @@ -323,20 +322,12 @@ void printPurgedQueues(bsl::ostream& os, const PurgedQueues& purgedQueueList) totalMessages += queue.numMessagesPurged(); } - os << "Purged " << mwcu::PrintUtil::prettyNumber(totalMessages) + os << "Purged " << bmqu::PrintUtil::prettyNumber(totalMessages) << " message(s) for a total of " - << mwcu::PrintUtil::prettyBytes(totalBytes) << " from " << queues.size() + << bmqu::PrintUtil::prettyBytes(totalBytes) << " from " << queues.size() << " queue(s):\n" - << " " - << " NumBytes" - << " " - << " NumMsgs" - << " " - << " AppKey" - << " " - << " AppId" - << " " - << "QueueName" << stream.str(); + << " " << " NumBytes" << " " << " NumMsgs" << " " << " AppKey" + << " " << " AppId" << " " << "QueueName" << stream.str(); if (!errorStream.str().empty()) { os << "\nErrors encountered: " << errorStream.str(); @@ -345,7 +336,7 @@ void printPurgedQueues(bsl::ostream& os, const PurgedQueues& purgedQueueList) void printQueueContents(bsl::ostream& os, const QueueContents& queueContents) { - mwcu::MemOutStream msgListing; + bmqu::MemOutStream msgListing; bsls::Types::Int64 totalBytes = 0; bsl::vector::const_iterator it = @@ -356,7 +347,7 @@ void printQueueContents(bsl::ostream& os, const QueueContents& queueContents) totalBytes += it->sizeBytes(); msgListing << bsl::setw(5) << sequenceNo << ": " << bsl::setw(32) << it->guid() << " " << bsl::setw(10) - << mwcu::PrintUtil::prettyBytes(it->sizeBytes()) << " " + << bmqu::PrintUtil::prettyBytes(it->sizeBytes()) << " " << it->arrivalTimestamp() << "\n"; } @@ -372,8 +363,8 @@ void printQueueContents(bsl::ostream& os, const QueueContents& queueContents) os << "Printing " << numMessages << " message(s) [" << queueContents.offset() << "-" << endInterval << " / " - << mwcu::PrintUtil::prettyNumber(queueContents.totalQueueMessages()) - << "] (total: " << mwcu::PrintUtil::prettyBytes(totalBytes) << ")\n" + << bmqu::PrintUtil::prettyNumber(queueContents.totalQueueMessages()) + << "] (total: " << bmqu::PrintUtil::prettyBytes(totalBytes) << ")\n" << " GUID Size Timestamp " "(UTC)\n" << msgListing.str(); @@ -383,7 +374,7 @@ void printMessage(bsl::ostream& os, const Message& message) { os << "GUID Size Timestamp (UTC)\n" << bsl::setw(32) << message.guid() << " " << bsl::setw(10) - << mwcu::PrintUtil::prettyBytes(message.sizeBytes()) << " " + << bmqu::PrintUtil::prettyBytes(message.sizeBytes()) << " " << message.arrivalTimestamp(); } @@ -393,7 +384,7 @@ void printFileStoreSummary(bsl::ostream& os, int level, int spacesPerLevel) { - using namespace mwcu::PrintUtil; + using namespace bmqu::PrintUtil; os << indent(level, spacesPerLevel) << "Partition [" << partitionId << "]:" << newlineAndIndent(level, spacesPerLevel) << "----------------" @@ -491,9 +482,9 @@ void printClusterStorageSummary(bsl::ostream& os, { bdlb::Print::indent(os, level, spacesPerLevel); os << "Storage Summary:" - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "----------------" - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Storage location: " << summary.clusterFileStoreLocation() << "\n\n"; typedef bsl::vector FileStores; @@ -502,12 +493,12 @@ void printClusterStorageSummary(bsl::ostream& os, cit != fileStores.cend(); ++cit) { if (cit->state() == FileStoreState::CLOSED) { - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "Partition [" << cit->partitionId() << "]: NOT OPEN."; continue; // CONTINUE } else if (cit->state() == FileStoreState::STOPPING) { - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "Partition [" << cit->partitionId() << "]: STOPPING."; continue; // CONTINUE } @@ -528,22 +519,22 @@ void printClusterQueueHelper(bsl::ostream& os, { os << "ClusterQueueHelper :\n" << "--------------------" - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "cluster......................: " << clusterQueueHelper.clusterName() << " (" << Locality::toString(clusterQueueHelper.locality()) << ")" - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "nbQueues.....................: " << clusterQueueHelper.numQueues() - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "nbQueueKeys..................: " << clusterQueueHelper.numQueueKeys() - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "nbPendingReopenQueueRequests.: " << clusterQueueHelper.numPendingReopenQueueRequests() << "\n"; // Domains - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Domains :" - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "---------"; bsl::size_t maxDomainLength = 0; @@ -558,7 +549,7 @@ void printClusterQueueHelper(bsl::ostream& os, for (ClusterDomains::const_iterator cit = clusterDomains.cbegin(); cit != clusterDomains.cend(); ++cit) { - os << mwcu::PrintUtil::newlineAndIndent(level + 2, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 2, spacesPerLevel) << cit->name() << bsl::setw(maxDomainLength - cit->name().length()) << bsl::setfill('.') << ": numAssignedQueues=" << cit->numAssignedQueues(); @@ -569,9 +560,9 @@ void printClusterQueueHelper(bsl::ostream& os, } // Queues - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Queues :" - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "--------"; typedef bsl::vector ClusterQueues; @@ -580,20 +571,20 @@ void printClusterQueueHelper(bsl::ostream& os, cit != clusterQueues.cend(); ++cit) { // Queue URI - os << mwcu::PrintUtil::newlineAndIndent(level + 2, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 2, spacesPerLevel) << cit->uri(); // Info - os << mwcu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) << "inFlightContexts.: " << cit->numInFlightContexts() - << mwcu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) << "assigned.........: " << bsl::boolalpha << cit->isAssigned() - << mwcu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) << "primaryAvailable..: " << bsl::boolalpha << cit->isPrimaryAvailable() - << mwcu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) << "id...............: " << bmqp::QueueId::QueueIdInt(cit->id()) - << mwcu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) << "subIds...........: "; typedef bsl::vector SubIds; @@ -609,23 +600,23 @@ void printClusterQueueHelper(bsl::ostream& os, } } - os << mwcu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) << "partitionId......: " << cit->partitionId(); if (!cit->primaryNodeDescription().isNull()) { os << cit->primaryNodeDescription().value(); } - os << mwcu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) << "key..............: " << cit->key() - << mwcu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) << "queue............: " << (cit->isCreated() ? "created" : "*NOT* created"); // Contexts - os << mwcu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 3, spacesPerLevel) << "nbContext........: " << cit->contexts().size(); for (size_t ctxId = 0; ctxId != cit->contexts().size(); ++ctxId) { const Context& context = cit->contexts()[ctxId]; - os << mwcu::PrintUtil::newlineAndIndent(level + 4, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 4, spacesPerLevel) << "#" << (ctxId + 1) << ": " << "[handle parameters: " << context.queueHandleParametersJson() << "]"; @@ -638,32 +629,31 @@ void printResourceUsageMonitor(bsl::ostream& os, int level, int spacesPerLevel) { - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) - << usageMonitor.state() << " " - << "[Messages (" << usageMonitor.messagesState() - << "): " << mwcu::PrintUtil::prettyNumber(usageMonitor.numMessages()) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << usageMonitor.state() << " " << "[Messages (" + << usageMonitor.messagesState() + << "): " << bmqu::PrintUtil::prettyNumber(usageMonitor.numMessages()) << " (" - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( usageMonitor.messagesLowWatermarkRatio() * usageMonitor.messagesCapacity())) << " - " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( usageMonitor.messagesHighWatermarkRatio() * usageMonitor.messagesCapacity())) << " - " - << mwcu::PrintUtil::prettyNumber(usageMonitor.messagesCapacity()) - << "), " - << "Bytes (" << usageMonitor.bytesState() - << "): " << mwcu::PrintUtil::prettyBytes(usageMonitor.numBytes()) + << bmqu::PrintUtil::prettyNumber(usageMonitor.messagesCapacity()) + << "), " << "Bytes (" << usageMonitor.bytesState() + << "): " << bmqu::PrintUtil::prettyBytes(usageMonitor.numBytes()) << " (" - << mwcu::PrintUtil::prettyBytes(usageMonitor.bytesLowWatermarkRatio() * + << bmqu::PrintUtil::prettyBytes(usageMonitor.bytesLowWatermarkRatio() * usageMonitor.bytesCapacity(), 2) << " - " - << mwcu::PrintUtil::prettyBytes(usageMonitor.bytesHighWatermarkRatio() * + << bmqu::PrintUtil::prettyBytes(usageMonitor.bytesHighWatermarkRatio() * usageMonitor.bytesCapacity(), 2) - << " - " << mwcu::PrintUtil::prettyBytes(usageMonitor.bytesCapacity()) + << " - " << bmqu::PrintUtil::prettyBytes(usageMonitor.bytesCapacity()) << ")] "; } @@ -672,18 +662,18 @@ void printQueueHandleSubStream(bsl::ostream& os, int level, int spacesPerLevel) { - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "subId .................: " << subStream.subId(); if (!subStream.appId().isNull()) { - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "appId .................: " << subStream.appId().value(); } - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "Stream Parameters .....: " << subStream.parametersJson() - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "UnconfirmedMonitors ...:" - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "--------"; for (size_t i = 0; i != subStream.unconfirmedMonitors().size(); ++i) { @@ -694,9 +684,9 @@ void printQueueHandleSubStream(bsl::ostream& os, } if (!subStream.numUnconfirmedMessages().isNull()) { - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "UnconfirmedMessages ...: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( subStream.numUnconfirmedMessages().value())); } @@ -708,9 +698,9 @@ void printQueueHandle(bsl::ostream& os, int level, int spacesPerLevel) { - os << mwcu::PrintUtil::indent(level, spacesPerLevel) + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "Handle Parameters .....: " << handle.parametersJson() - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "IsClientClusterMember .: " << bsl::boolalpha << handle.isClientClusterMember(); @@ -728,10 +718,10 @@ void printQueueHandles(bsl::ostream& os, int level, int spacesPerLevel) { - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << handles.size() << " handles:\n"; for (unsigned int idx = 1; idx <= handles.size(); ++idx) { - os << mwcu::PrintUtil::indent(level + 2, spacesPerLevel) << idx << ". " + os << bmqu::PrintUtil::indent(level + 2, spacesPerLevel) << idx << ". " << handles[idx - 1].clientDescription() << "\n"; printQueueHandle(os, handles[idx - 1], level + 3, spacesPerLevel); } @@ -742,16 +732,16 @@ void printQueueState(bsl::ostream& os, int level, int spacesPerLevel) { - os << mwcu::PrintUtil::indent(level, spacesPerLevel) - << "State:" << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::indent(level, spacesPerLevel) + << "State:" << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "------" - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "URI ...............: " << state.uri() - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Handle Parameters .: " << state.handleParametersJson() - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Stream Parameters .: " << state.streamParametersJson() - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Id/Key ............: "; if (state.id() == bmqp::QueueId::k_UNASSIGNED_QUEUE_ID) { @@ -765,17 +755,17 @@ void printQueueState(bsl::ostream& os, } os << " ~ " << state.key() - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "PartitionId .......: " << state.partitionId() - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Storage ...........: "; if (!state.storage().isNull()) { const QueueStorage& storage = state.storage().value(); - os << mwcu::PrintUtil::prettyNumber( + os << bmqu::PrintUtil::prettyNumber( static_cast(storage.numMessages())) - << " messages, " << mwcu::PrintUtil::prettyBytes(storage.numBytes()) - << mwcu::PrintUtil::newlineAndIndent(level + 2, spacesPerLevel) + << " messages, " << bmqu::PrintUtil::prettyBytes(storage.numBytes()) + << bmqu::PrintUtil::newlineAndIndent(level + 2, spacesPerLevel) << "Num virtual storages: " << storage.virtualStorages().size(); if (storage.virtualStorages().size()) { @@ -788,7 +778,7 @@ void printQueueState(bsl::ostream& os, bdlb::Print::newlineAndIndent(os, level + 2, spacesPerLevel); os << cit->appId() << " : [appKey: " << cit->appKey() << ", numMessages: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(cit->numMessages())) << "]"; } @@ -798,7 +788,7 @@ void printQueueState(bsl::ostream& os, os << "none"; } - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Capacity Meter ....:"; if (!state.capacityMeter().isNull()) { printCapacityMeter(os, @@ -811,9 +801,9 @@ void printQueueState(bsl::ostream& os, } os << "\n" - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "QueueHandleCatalog:" - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "-------------------"; printQueueHandles(os, state.handles(), level + 1, spacesPerLevel); os << "\n"; @@ -825,8 +815,8 @@ void printMessageGroupIdManagerIndex( int level, int spacesPerLevel) { - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "Lru:" - << "\n"; + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << "Lru:" << "\n"; { bslim::Printer printer(&os, level, spacesPerLevel); @@ -841,7 +831,7 @@ void printMessageGroupIdManagerIndex( bsl::ostringstream key; bsl::ostringstream timeDelta; key << cit->clientDescription() << "#" << cit->msgGroupId(); - mwcu::PrintUtil::prettyTimeInterval( + bmqu::PrintUtil::prettyTimeInterval( timeDelta, cit->lastSeenDeltaNanoseconds()); printer.printAttribute(key.str().c_str(), timeDelta.str()); @@ -849,8 +839,7 @@ void printMessageGroupIdManagerIndex( printer.end(); } - os << mwcu::PrintUtil::indent(level, spacesPerLevel) << "Handles:" - << "\n"; + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "Handles:" << "\n"; { bslim::Printer printer(&os, level, spacesPerLevel); printer.start(); @@ -875,18 +864,18 @@ void printMessageGroupIdHelper( int level, int spacesPerLevel) { - mwcu::OutStreamFormatSaver fmtSaver(os); + bmqu::OutStreamFormatSaver fmtSaver(os); - os << mwcu::PrintUtil::indent(level, spacesPerLevel) + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "MessageGroupIdManager:" - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "timeout........: " << messageGroupIdHelper.timeoutNanoseconds() - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "maxMsgGroupIds.: " << messageGroupIdHelper.maxMsgGroupIds() - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "rebalance......: " << bsl::boolalpha << messageGroupIdHelper.isRebalanceOn() - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "status.........: ["; printMessageGroupIdManagerIndex(os, @@ -894,7 +883,7 @@ void printMessageGroupIdHelper( level + 1, spacesPerLevel); - os << mwcu::PrintUtil::indent(level, spacesPerLevel) << "]"; + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "]"; } void printAppState(bsl::ostream& os, @@ -902,11 +891,11 @@ void printAppState(bsl::ostream& os, int level, int spacesPerLevel) { - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "Consumers .........: " << appState.numConsumers() - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "RedeliveryList ....: " << appState.redeliveryListLength() - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "RoundRobinRouter ..:\n"; appState.roundRobinRouter().print(os, level + 1, spacesPerLevel); @@ -917,13 +906,13 @@ void printFanoutQueueEngine(bsl::ostream& os, int level, int spacesPerLevel) { - os << mwcu::PrintUtil::indent(level, spacesPerLevel) + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "FanoutQueueEngine (" << queueEngine.mode() - << "):" << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << "):" << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "-----------------"; if (queueEngine.maxConsumers() != 0) { - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << " (maxConsumers: " << queueEngine.maxConsumers() << ")"; } @@ -939,7 +928,7 @@ void printFanoutQueueEngine(bsl::ostream& os, for (ConsumerStates::const_iterator cit = consumerStates.begin(); cit != consumerStates.end(); ++cit) { - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << bsl::setw(maxAppIdLength) << bsl::setfill(' ') << bsl::left << cit->appId() << ": status=" << cit->status(); @@ -948,7 +937,7 @@ void printFanoutQueueEngine(bsl::ostream& os, << cit->isAtEndOfStorage().value(); } - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << bsl::setw(maxAppIdLength) << bsl::setfill('-') << "-"; printAppState(os, cit->appState(), level + 2, spacesPerLevel); @@ -961,11 +950,11 @@ void printRelayQueueEngine(bsl::ostream& os, int level, int spacesPerLevel) { - os << mwcu::PrintUtil::indent(level, spacesPerLevel) << "RelayQueueEngine:" - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "RelayQueueEngine:" + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "-----------------"; - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Num SubStreams ....: " << queueEngine.numSubstreams(); if (queueEngine.numSubstreams()) { @@ -974,7 +963,7 @@ void printRelayQueueEngine(bsl::ostream& os, for (SubStreams::const_iterator cit = subStreams.cbegin(); cit != subStreams.cend(); ++cit) { - os << mwcu::PrintUtil::newlineAndIndent(level + 2, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 2, spacesPerLevel) << "[" << cit->appId() << "] - [" << cit->appKey() << "] : " << cit->numMessages(); } @@ -985,9 +974,9 @@ void printRelayQueueEngine(bsl::ostream& os, for (AppStates::const_iterator cit = appStates.begin(); cit != appStates.end(); ++cit) { - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "App: " << cit->appId() - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "-----------------"; printAppState(os, *cit, level + 2, spacesPerLevel); } @@ -1019,8 +1008,8 @@ void printLocalQueue(bsl::ostream& os, int level, int spacesPerLevel) { - os << mwcu::PrintUtil::indent(level, spacesPerLevel) << "LocalQueue:" - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "LocalQueue:" + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "-----------\n"; printQueueEngine(os, localQueue.queueEngine(), level + 1, spacesPerLevel); } @@ -1030,7 +1019,7 @@ void printRemoteStream(bsl::ostream& os, int level, int spacesPerLevel) { - os << mwcu::PrintUtil::indent(level, spacesPerLevel) + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "[Id: " << info.id() << ", state: " << info.state() << ", genCount: " << info.genCount() << "]\n"; } @@ -1039,29 +1028,28 @@ void printRemoteQueue(bsl::ostream& os, int level, int spacesPerLevel) { - os << mwcu::PrintUtil::indent(level, spacesPerLevel) << "RemoteQueue:" - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "RemoteQueue:" + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "------------\n"; - os << mwcu::PrintUtil::indent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::indent(level + 1, spacesPerLevel) << "Pending PUTs .......................: " << remoteQueue.numPendingPuts() << " items\n"; - os << mwcu::PrintUtil::indent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::indent(level + 1, spacesPerLevel) << "Pending CONFIRMs ...................: " << remoteQueue.numPendingConfirms() << " items\n"; - os << mwcu::PrintUtil::indent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::indent(level + 1, spacesPerLevel) << "Has PUSH expiration timer scheduled : " << (remoteQueue.isPushExpirationTimerScheduled() ? "yes" : "no") << "\n"; - os << mwcu::PrintUtil::indent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::indent(level + 1, spacesPerLevel) << "Upstream generation count ..........: " << remoteQueue.numUpstreamGeneration() << "\n"; size_t num = remoteQueue.streams().size(); - os << mwcu::PrintUtil::indent(level + 1, spacesPerLevel) - << "Streams ............................: " - << "\n"; + os << bmqu::PrintUtil::indent(level + 1, spacesPerLevel) + << "Streams ............................: " << "\n"; typedef bsl::vector Streams; const Streams& streams = remoteQueue.streams(); @@ -1103,23 +1091,23 @@ void printQueuesInfo(bsl::ostream& os, int level, int spacesPerLevel) { - mwcu::OutStreamFormatSaver fmtSaver(os); + bmqu::OutStreamFormatSaver fmtSaver(os); - os << mwcu::PrintUtil::indent(level, spacesPerLevel) << "Queues" - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "------" - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel); + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "Queues" + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "------" + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel); typedef bsl::vector QueuesInfo; const QueuesInfo& queues = queuesInfo.storages(); os << "Num Queues: " << queues.size(); if (!queues.empty()) { - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << " QueueKey Partition Internal QueueId QueueUri"; } for (QueuesInfo::const_iterator cit = queues.begin(); cit != queues.end(); ++cit) { - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << cit->queueKey() << " " << cit->partitionId() << " " << bsl::setfill(' ') << bsl::setw(10) << bmqp::QueueId::QueueIdInt(cit->internalQueueId()) << " " @@ -1132,20 +1120,20 @@ void printPartitionsInfo(bsl::ostream& os, int level, int spacesPerLevel) { - os << mwcu::PrintUtil::indent(level, spacesPerLevel) << "Partitions" - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "Partitions" + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "----------"; const bsl::vector& partitions = partitionsInfo.partitions(); for (unsigned int i = 0; i < partitions.size(); ++i) { - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "PartitionId: " << i - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) - << "Num Queues :" - << " mapped (" << partitions[i].numQueuesMapped() << ")," - << " active (" << partitions[i].numActiveQueues() << ")"; + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << "Num Queues :" << " mapped (" + << partitions[i].numQueuesMapped() << ")," << " active (" + << partitions[i].numActiveQueues() << ")"; - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel); + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel); if (!partitions[i].primaryNode().isNull()) { os << "Primary Node : " << partitions[i].primaryNode().value(); } @@ -1153,9 +1141,9 @@ void printPartitionsInfo(bsl::ostream& os, os << "Primary Node : " << "[ ** NONE ** ]"; } - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Primary LeaseId: " << partitions[i].primaryLeaseId() - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Primary Status : " << partitions[i].primaryStatus(); } } @@ -1165,19 +1153,19 @@ void printElectorInfo(bsl::ostream& os, int level, int spacesPerLevel) { - os << mwcu::PrintUtil::indent(level, spacesPerLevel) << "Elector" - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "Elector" + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "-------\n" - << mwcu::PrintUtil::indent(level, spacesPerLevel) + << bmqu::PrintUtil::indent(level, spacesPerLevel) << "Self State : " << electorInfo.electorState() - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "Leader Node : " << electorInfo.leaderNode() - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "Leader Sequence Number: [ electorTerm = " << electorInfo.leaderMessageSequence().electorTerm() << " sequenceNumber = " << electorInfo.leaderMessageSequence().sequenceNumber() << " ]" - << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "Leader Status : " << electorInfo.leaderStatus(); } @@ -1186,17 +1174,17 @@ void printNodeStatuses(bsl::ostream& os, int level, int spacesPerLevel) { - mwcu::OutStreamFormatSaver fmtSaver(os); + bmqu::OutStreamFormatSaver fmtSaver(os); - os << mwcu::PrintUtil::indent(level, spacesPerLevel) << "Nodes"; - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "-----"; + os << bmqu::PrintUtil::indent(level, spacesPerLevel) << "Nodes"; + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << "-----"; typedef bsl::vector Nodes; const Nodes& nodes = nodeStatuses.nodes(); for (Nodes::const_iterator cit = nodes.cbegin(); cit != nodes.cend(); ++cit) { - os << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) << cit->description(); - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel); + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel); if (cit->isAvailable().isNull()) { os << "IsConnected: self"; } @@ -1204,11 +1192,11 @@ void printNodeStatuses(bsl::ostream& os, os << "IsConnected: " << bsl::boolalpha << cit->isAvailable().value(); } - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Node Status: " << cit->status(); if (cit->primaryForPartitionIds().size() > 0) { - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Primary for partitions: [ "; for (unsigned int i = 0; i < cit->primaryForPartitionIds().size(); ++i) { @@ -1233,14 +1221,14 @@ void printClusterStatus(bsl::ostream& os, for (size_t i = 0; i < clusterStatus.name().size() + 5; ++i) { os << "-"; } - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Cluster name : " << clusterStatus.description(); - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Cluster size : " << clusterStatus.nodeStatuses().nodes().size() << " node(s)"; - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Self Node : " << clusterStatus.selfNodeDescription(); - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Is Healthy : " << (clusterStatus.isHealthy() ? "Yes" : "No"); os << "\n\n"; @@ -1272,13 +1260,13 @@ void printClusterProxyStatus(bsl::ostream& os, int level, int spacesPerLevel) { - mwcu::OutStreamFormatSaver fmtSaver(os); + bmqu::OutStreamFormatSaver fmtSaver(os); os << "Cluster\n" << "-------" - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Cluster name: " << clusterProxyStatus.description() - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Active node : "; if (!clusterProxyStatus.activeNodeDescription().isNull()) { @@ -1288,7 +1276,7 @@ void printClusterProxyStatus(bsl::ostream& os, os << "* none *"; } - os << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + os << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Is Healthy : " << (clusterProxyStatus.isHealthy() ? "Yes" : "No") << "\n"; diff --git a/src/groups/mqb/mqbcmd/mqbcmd_parseutil.cpp b/src/groups/mqb/mqbcmd/mqbcmd_parseutil.cpp index 232ad91c7..f47994770 100644 --- a/src/groups/mqb/mqbcmd/mqbcmd_parseutil.cpp +++ b/src/groups/mqb/mqbcmd/mqbcmd_parseutil.cpp @@ -20,9 +20,8 @@ // MQB #include -// MWC -#include -#include +#include +#include // BDE #include @@ -1128,7 +1127,7 @@ int ParseUtil::parse(Command* command, int rc = decoder.decode(&jsonStreamBuf, command, options); if (rc != 0) { - mwcu::MemOutStream err; + bmqu::MemOutStream err; err << "Error decoding JSON command " << "[rc: " << rc << ", error: '" << decoder.loggedMessages() << "']"; @@ -1143,10 +1142,10 @@ int ParseUtil::parse(Command* command, // contiguous spaces so that the resulting split doesn't contain any empty // strings. bsl::string inputString(input); - mwcu::StringUtil::squeeze(&inputString, " "); + bmqu::StringUtil::squeeze(&inputString, " "); const bsl::vector words = - mwcu::StringUtil::strTokenizeRef(inputString, " "); + bmqu::StringUtil::strTokenizeRef(inputString, " "); return parseCommand(command, error, diff --git a/src/groups/mqb/mqbcmd/mqbcmd_parseutil.t.cpp b/src/groups/mqb/mqbcmd/mqbcmd_parseutil.t.cpp index 79f8eff16..12fe53cdd 100644 --- a/src/groups/mqb/mqbcmd/mqbcmd_parseutil.t.cpp +++ b/src/groups/mqb/mqbcmd/mqbcmd_parseutil.t.cpp @@ -30,7 +30,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -68,7 +68,7 @@ mqbcmd::Command fromJson(const bslstl::StringRef& json) void verifyExpected(const Test& test) { - mwctst::TestHelper::printTestName(test.d_description); + bmqtst::TestHelper::printTestName(test.d_description); BSLS_ASSERT_OPT(test.d_expectedJson); @@ -85,7 +85,7 @@ void verifyExpected(const Test& test) void verifyFailure(const Test& test) { - mwctst::TestHelper::printTestName(test.d_description); + bmqtst::TestHelper::printTestName(test.d_description); BSLS_ASSERT_OPT(test.d_expectedJson == 0); @@ -386,7 +386,7 @@ void test3_parseFailsWithExtra() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -398,5 +398,5 @@ int main(int argc, char* argv[]) s_testStatus = -1; } - TEST_EPILOG(mwctst::TestHelper::e_DEFAULT); + TEST_EPILOG(bmqtst::TestHelper::e_DEFAULT); } diff --git a/src/groups/mqb/mqbconfm/mqbconfm_messages.cpp b/src/groups/mqb/mqbconfm/mqbconfm_messages.cpp index 6487fe2c4..d53a6a4b1 100644 --- a/src/groups/mqb/mqbconfm/mqbconfm_messages.cpp +++ b/src/groups/mqb/mqbconfm/mqbconfm_messages.cpp @@ -1124,7 +1124,7 @@ QueueModeFanout::~QueueModeFanout() QueueModeFanout& QueueModeFanout::operator=(const QueueModeFanout& rhs) { if (this != &rhs) { - d_appIDs = rhs.d_appIDs; + d_appIDs = rhs.d_appIDs; d_publishAppIdMetrics = rhs.d_publishAppIdMetrics; } @@ -1136,7 +1136,7 @@ QueueModeFanout& QueueModeFanout::operator=(const QueueModeFanout& rhs) QueueModeFanout& QueueModeFanout::operator=(QueueModeFanout&& rhs) { if (this != &rhs) { - d_appIDs = bsl::move(rhs.d_appIDs); + d_appIDs = bsl::move(rhs.d_appIDs); d_publishAppIdMetrics = bsl::move(rhs.d_publishAppIdMetrics); } diff --git a/src/groups/mqb/mqbi/mqbi_cluster.h b/src/groups/mqb/mqbi/mqbi_cluster.h index a211c36e7..fc0a44a85 100644 --- a/src/groups/mqb/mqbi/mqbi_cluster.h +++ b/src/groups/mqb/mqbi/mqbi_cluster.h @@ -50,8 +50,7 @@ #include #include -// MWC -#include +#include // BDE #include diff --git a/src/groups/mqb/mqbi/mqbi_dispatcher.cpp b/src/groups/mqb/mqbi/mqbi_dispatcher.cpp index 828e4aaca..3f8ba170d 100644 --- a/src/groups/mqb/mqbi/mqbi_dispatcher.cpp +++ b/src/groups/mqb/mqbi/mqbi_dispatcher.cpp @@ -17,8 +17,8 @@ #include #include -// MWC -#include + +#include // BDE #include @@ -369,7 +369,7 @@ bsl::ostream& DispatcherEvent::print(bsl::ostream& stream, for (bmqp::Protocol::SubQueueInfosArray::size_type i = 0; i < d_subQueueInfos.size(); ++i) { - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << "subQueueInfo[" << i << "]: "; printer.printAttribute(out.str().data(), d_subQueueInfos[i]); } diff --git a/src/groups/mqb/mqbi/mqbi_dispatcher.h b/src/groups/mqb/mqbi/mqbi_dispatcher.h index 9fcfc21ac..f09ea521c 100644 --- a/src/groups/mqb/mqbi/mqbi_dispatcher.h +++ b/src/groups/mqb/mqbi/mqbi_dispatcher.h @@ -102,7 +102,7 @@ // functionally equivalent to dispatching an event of type 'e_DISPATCHER' and // 'e_CALLBACK' respectively. The comparison of such executor objects and the // blocking behavior of their 'dispatch' member functions is implementation- -// defined. For more information about executors see the 'mwcex' package +// defined. For more information about executors see the 'bmqex' package // documentation. // MQB @@ -113,11 +113,9 @@ #include #include -// MWC -#include +#include -// MWC -#include +#include // BDE #include @@ -467,7 +465,7 @@ class Dispatcher { /// Note that the returned executor can be used to submit work even /// after the specified `client` has been unregistered from this /// dispatcher. - virtual mwcex::Executor executor(const DispatcherClient* client) const = 0; + virtual bmqex::Executor executor(const DispatcherClient* client) const = 0; /// Return an executor object suitable for executing function objects by /// the specified `client` on the processor in charge of that client. @@ -478,7 +476,7 @@ class Dispatcher { /// Note that submitting work on the returned executor is undefined /// behavior if the specified `client` was unregistered from this /// dispatcher. - virtual mwcex::Executor + virtual bmqex::Executor clientExecutor(const mqbi::DispatcherClient* client) const = 0; }; @@ -739,7 +737,7 @@ class DispatcherPutEvent { /// dropped to avoid out of order PUTs. virtual bsls::Types::Uint64 genCount() const = 0; - virtual const bsl::shared_ptr& state() const = 0; + virtual const bsl::shared_ptr& state() const = 0; }; // ======================== @@ -1005,7 +1003,7 @@ class DispatcherEvent : public DispatcherDispatcherEvent, bsls::Types::Uint64 d_genCount; - bsl::shared_ptr d_state; + bsl::shared_ptr d_state; public: // TRAITS @@ -1059,7 +1057,7 @@ class DispatcherEvent : public DispatcherDispatcherEvent, // Return the value of the corresponding member. Refer to the various // DispatcherEvent view interfaces for more specific information. - const bsl::shared_ptr& + const bsl::shared_ptr& state() const BSLS_KEYWORD_OVERRIDE; public: @@ -1103,7 +1101,7 @@ class DispatcherEvent : public DispatcherDispatcherEvent, /// dropped to avoid out of order PUTs. DispatcherEvent& setGenCount(unsigned int genCount); - DispatcherEvent& setState(const bsl::shared_ptr& state); + DispatcherEvent& setState(const bsl::shared_ptr& state); /// Reset all members of this `DispatcherEvent` to a default value. void reset(); @@ -1425,7 +1423,7 @@ inline bsls::Types::Uint64 DispatcherEvent::genCount() const return d_genCount; } -inline const bsl::shared_ptr& DispatcherEvent::state() const +inline const bsl::shared_ptr& DispatcherEvent::state() const { return d_state; } @@ -1593,7 +1591,7 @@ inline DispatcherEvent& DispatcherEvent::setGenCount(unsigned int genCount) } inline DispatcherEvent& -DispatcherEvent::setState(const bsl::shared_ptr& state) +DispatcherEvent::setState(const bsl::shared_ptr& state) { d_state = state; return *this; diff --git a/src/groups/mqb/mqbi/mqbi_domain.h b/src/groups/mqb/mqbi/mqbi_domain.h index 6dcd8064a..6f9ac5112 100644 --- a/src/groups/mqb/mqbi/mqbi_domain.h +++ b/src/groups/mqb/mqbi/mqbi_domain.h @@ -70,7 +70,7 @@ class CapacityMeter; namespace mqbstat { class DomainStats; } -namespace mwcst { +namespace bmqst { class StatContext; } @@ -203,7 +203,7 @@ class Domain { virtual mqbstat::DomainStats* domainStats() = 0; /// Return the stat context associated to this Domain. - virtual mwcst::StatContext* queueStatContext() = 0; + virtual bmqst::StatContext* queueStatContext() = 0; /// Return the cluster associated to this Domain. virtual Cluster* cluster() const = 0; diff --git a/src/groups/mqb/mqbi/mqbi_queue.h b/src/groups/mqb/mqbi/mqbi_queue.h index 2ae5d34c4..b1a0e321e 100644 --- a/src/groups/mqb/mqbi/mqbi_queue.h +++ b/src/groups/mqb/mqbi/mqbi_queue.h @@ -61,8 +61,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -432,7 +431,7 @@ class QueueHandle { typedef bsl::function VoidFunctor; /// An ordered hash map of GUID and associated message info. - typedef mwcc::OrderedHashMap > UnconfirmedMessageInfoMap; diff --git a/src/groups/mqb/mqbi/mqbi_queue.t.cpp b/src/groups/mqb/mqbi/mqbi_queue.t.cpp index 12a6722bc..2d2188f9c 100644 --- a/src/groups/mqb/mqbi/mqbi_queue.t.cpp +++ b/src/groups/mqb/mqbi/mqbi_queue.t.cpp @@ -29,7 +29,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -79,7 +79,7 @@ static void test1_hashAppendSubQueueIdInfo() // const bmqp_ctrlmsg::SubQueueIdInfo& subQueueIdInfo) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HASH APPEND SUBQUEUEIDINFO"); + bmqtst::TestHelper::printTestName("HASH APPEND SUBQUEUEIDINFO"); { PV("HASH FUNCTION DETERMINISTIC"); @@ -149,7 +149,7 @@ static void test1_hashAppendSubQueueIdInfo() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); unsigned int seed = bsl::time(NULL); bsl::srand(seed); @@ -164,5 +164,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbi/mqbi_queueengine.cpp b/src/groups/mqb/mqbi/mqbi_queueengine.cpp index 582956c6b..014de7509 100644 --- a/src/groups/mqb/mqbi/mqbi_queueengine.cpp +++ b/src/groups/mqb/mqbi/mqbi_queueengine.cpp @@ -63,5 +63,12 @@ void QueueEngine::unregisterStorage( // NOTHING } +bsl::ostream& +QueueEngine::logAppSubscriptionInfo(bsl::ostream& stream, + const mqbu::StorageKey& appKey) const +{ + return stream; +}; + } // close package namespace } // close enterprise namespace diff --git a/src/groups/mqb/mqbi/mqbi_queueengine.h b/src/groups/mqb/mqbi/mqbi_queueengine.h index cf6f27195..79982bbeb 100644 --- a/src/groups/mqb/mqbi/mqbi_queueengine.h +++ b/src/groups/mqb/mqbi/mqbi_queueengine.h @@ -246,6 +246,14 @@ class QueueEngine { /// Load into the specified `out` object the internal information about /// this queue engine and associated queue handles. virtual void loadInternals(mqbcmd::QueueEngine* out) const = 0; + + /// Log appllication subscription info for the specified `appKey` into the + /// specified `stream`. + /// + /// THREAD: This method is called from the Queue's dispatcher thread. + virtual bsl::ostream& + logAppSubscriptionInfo(bsl::ostream& stream, + const mqbu::StorageKey& appKey) const; }; } // close package namespace diff --git a/src/groups/mqb/mqbi/mqbi_queueengine.t.cpp b/src/groups/mqb/mqbi/mqbi_queueengine.t.cpp index 6941795ac..a96e3e3af 100644 --- a/src/groups/mqb/mqbi/mqbi_queueengine.t.cpp +++ b/src/groups/mqb/mqbi/mqbi_queueengine.t.cpp @@ -28,7 +28,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -52,7 +52,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); bsl::string emptyString("", s_allocator_p); @@ -81,7 +81,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -92,5 +92,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbi/mqbi_storage.h b/src/groups/mqb/mqbi/mqbi_storage.h index 73748f33e..b05a42aa5 100644 --- a/src/groups/mqb/mqbi/mqbi_storage.h +++ b/src/groups/mqb/mqbi/mqbi_storage.h @@ -47,8 +47,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -383,7 +382,7 @@ class Storage { /// `AppIdKeyPairs` is an alias for a list of pairs of appId and appKey typedef bsl::vector AppIdKeyPairs; - typedef mwcc::Array StorageKeys; diff --git a/src/groups/mqb/mqbi/mqbi_storagemanager.h b/src/groups/mqb/mqbi/mqbi_storagemanager.h index a89683511..a157f66dc 100644 --- a/src/groups/mqb/mqbi/mqbi_storagemanager.h +++ b/src/groups/mqb/mqbi/mqbi_storagemanager.h @@ -43,6 +43,7 @@ // BDE #include +#include #include #include #include @@ -255,11 +256,11 @@ class StorageManager : public mqbi::AppKeyGenerator { /// queue is configured in fanout mode. /// /// THREAD: Executed by the Queue's dispatcher thread. - virtual int updateQueue(const bmqt::Uri& uri, - const mqbu::StorageKey& queueKey, - int partitionId, - const AppIdKeyPairs& addedIdKeyPairs, - const AppIdKeyPairs& removedIdKeyPairs) = 0; + virtual int updateQueuePrimary(const bmqt::Uri& uri, + const mqbu::StorageKey& queueKey, + int partitionId, + const AppIdKeyPairs& addedIdKeyPairs, + const AppIdKeyPairs& removedIdKeyPairs) = 0; virtual void registerQueueReplica(int partitionId, const bmqt::Uri& uri, @@ -382,6 +383,11 @@ class StorageManager : public mqbi::AppKeyGenerator { virtual void processReceiptEvent(const bmqp::Event& event, mqbnet::ClusterNode* source) = 0; + /// Executed by any thread. + virtual void bufferPrimaryStatusAdvisory( + const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, + mqbnet::ClusterNode* source) = 0; + /// Executed by any thread. virtual void processPrimaryStatusAdvisory( const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, diff --git a/src/groups/mqb/mqbmock/mqbmock_cluster.cpp b/src/groups/mqb/mqbmock/mqbmock_cluster.cpp index 3d9b39e4f..0ffacdc1a 100644 --- a/src/groups/mqb/mqbmock/mqbmock_cluster.cpp +++ b/src/groups/mqb/mqbmock/mqbmock_cluster.cpp @@ -27,9 +27,8 @@ // BMQ #include -// MWC -#include -#include +#include +#include // BDE #include @@ -146,13 +145,13 @@ void Cluster::_initializeNetcluster() for (NodesListIter iter = nodes.begin(); iter != nodes.end(); ++iter) { d_channels.emplace( *iter, - bsl::allocate_shared(d_allocator_p), + bsl::allocate_shared(d_allocator_p), d_allocator_p); - bsl::weak_ptr channelWp(d_channels.at(*iter)); + bsl::weak_ptr channelWp(d_channels.at(*iter)); (*iter)->setChannel(channelWp, bmqp_ctrlmsg::ClientIdentity(), - mwcio::Channel::ReadCallback()); + bmqio::Channel::ReadCallback()); } const int selfNodeId = d_isLeader ? k_LEADER_NODE_ID @@ -184,7 +183,7 @@ void Cluster::_initializeNodeSessions() nodeSessionSp->setNodeStatus(bmqp_ctrlmsg::NodeStatus::E_AVAILABLE); // Create stat context for each cluster node - mwcst::StatContextConfiguration config((*nodeIter)->hostName()); + bmqst::StatContextConfiguration config((*nodeIter)->hostName()); nodeSessionSp->statContext() = d_clusterData_mp->clusterNodesStatContext()->addSubcontext(config); @@ -481,7 +480,7 @@ void Cluster::onDomainReconfigured( int Cluster::processCommand(mqbcmd::ClusterResult* result, const mqbcmd::ClusterCommand& command) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "MockCluster::processCommand '" << command << "' not implemented!"; result->makeError().message() = os.str(); return -1; diff --git a/src/groups/mqb/mqbmock/mqbmock_cluster.h b/src/groups/mqb/mqbmock/mqbmock_cluster.h index d8cfc5cc6..e26421b3e 100644 --- a/src/groups/mqb/mqbmock/mqbmock_cluster.h +++ b/src/groups/mqb/mqbmock/mqbmock_cluster.h @@ -51,10 +51,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -108,7 +107,7 @@ namespace mqbmock { // class Cluster // ============= -/// Mock cluster implementation of the `mqbi::Cluster` inteface. +/// Mock cluster implementation of the `mqbi::Cluster` interface. class Cluster : public mqbi::Cluster { private: // PRIVATE TYPES @@ -127,7 +126,7 @@ class Cluster : public mqbi::Cluster { typedef mqbnet::Cluster::NodesList NodesList; typedef NodesList::iterator NodesListIter; - typedef bsl::shared_ptr StatContextSp; + typedef bsl::shared_ptr StatContextSp; typedef mqbc::ClusterData::StatContextsMap StatContextsMap; typedef bdlcc::SharedObjectPool< @@ -140,7 +139,7 @@ class Cluster : public mqbi::Cluster { // TYPES typedef bsl::vector ClusterNodeDefs; - typedef bsl::shared_ptr TestChannelSp; + typedef bsl::shared_ptr TestChannelSp; typedef bsl::unordered_map TestChannelMap; typedef TestChannelMap::iterator TestChannelMapIter; @@ -611,20 +610,20 @@ inline void Cluster::advanceTime(const bsls::TimeInterval& interval) d_timeSource.advanceTime(interval); } -inline void Cluster::getPrimaryNodes(int* rc, - bsl::ostream& errorDescription, - bsl::vector* nodes, - bool* isSelfPrimary) const +inline void Cluster::getPrimaryNodes(int*, + bsl::ostream&, + bsl::vector*, + bool*) const { // no implementation -- this should never run. BSLS_ASSERT_SAFE(false); } -inline void Cluster::getPartitionPrimaryNode(int* rc, - bsl::ostream& errorDescription, - mqbnet::ClusterNode** node, - bool* isSelfPrimary, - int partitionId) const +inline void Cluster::getPartitionPrimaryNode(int*, + bsl::ostream&, + mqbnet::ClusterNode**, + bool*, + int) const { // no implementation -- this should never run. BSLS_ASSERT_SAFE(false); diff --git a/src/groups/mqb/mqbmock/mqbmock_dispatcher.cpp b/src/groups/mqb/mqbmock/mqbmock_dispatcher.cpp index 832123cfa..4738d1135 100644 --- a/src/groups/mqb/mqbmock/mqbmock_dispatcher.cpp +++ b/src/groups/mqb/mqbmock/mqbmock_dispatcher.cpp @@ -163,18 +163,18 @@ bool Dispatcher::inDispatcherThread( return d_inDispatcherThread; } -mwcex::Executor Dispatcher::executor( +bmqex::Executor Dispatcher::executor( BSLS_ANNOTATION_UNUSED const mqbi::DispatcherClient* client) const { BSLS_ASSERT(false && "Not yet implemented"); - return mwcex::Executor(); + return bmqex::Executor(); } -mwcex::Executor Dispatcher::clientExecutor( +bmqex::Executor Dispatcher::clientExecutor( BSLS_ANNOTATION_UNUSED const mqbi::DispatcherClient* client) const { BSLS_ASSERT(false && "Not yet implemented"); - return mwcex::Executor(); + return bmqex::Executor(); } // --------------------------------- diff --git a/src/groups/mqb/mqbmock/mqbmock_dispatcher.h b/src/groups/mqb/mqbmock/mqbmock_dispatcher.h index d000fed14..da208f680 100644 --- a/src/groups/mqb/mqbmock/mqbmock_dispatcher.h +++ b/src/groups/mqb/mqbmock/mqbmock_dispatcher.h @@ -42,8 +42,7 @@ #include -// MWC -#include +#include // BDE #include @@ -224,11 +223,11 @@ class Dispatcher : public mqbi::Dispatcher { BSLS_KEYWORD_OVERRIDE; /// Not implemented. - mwcex::Executor + bmqex::Executor executor(const mqbi::DispatcherClient* client) const BSLS_KEYWORD_OVERRIDE; /// Not implemented. - mwcex::Executor clientExecutor(const mqbi::DispatcherClient* client) const + bmqex::Executor clientExecutor(const mqbi::DispatcherClient* client) const BSLS_KEYWORD_OVERRIDE; class InnerEventGuard; diff --git a/src/groups/mqb/mqbmock/mqbmock_domain.cpp b/src/groups/mqb/mqbmock/mqbmock_domain.cpp index e8fc4d8e9..7839bd262 100644 --- a/src/groups/mqb/mqbmock/mqbmock_domain.cpp +++ b/src/groups/mqb/mqbmock/mqbmock_domain.cpp @@ -22,8 +22,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -144,7 +143,7 @@ mqbu::CapacityMeter* Domain::capacityMeter() int Domain::processCommand(mqbcmd::DomainResult* result, const mqbcmd::DomainCommand& command) { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "MockDomain::processCommand '" << command << "' not implemented!"; result->makeError().message() = os.str(); return -1; @@ -205,7 +204,7 @@ mqbstat::DomainStats* Domain::domainStats() return &d_domainsStats; } -mwcst::StatContext* Domain::queueStatContext() +bmqst::StatContext* Domain::queueStatContext() { return d_statContext.get(); } diff --git a/src/groups/mqb/mqbmock/mqbmock_domain.h b/src/groups/mqb/mqbmock/mqbmock_domain.h index 2a6ebba06..b79335bcd 100644 --- a/src/groups/mqb/mqbmock/mqbmock_domain.h +++ b/src/groups/mqb/mqbmock/mqbmock_domain.h @@ -24,7 +24,7 @@ // //@DESCRIPTION: This component provides a mock implementation, // 'mqbmock::Domain', of the 'mqbi::Domain' interface that is used to emulate -// a a real domain for testing purposes. +// a real domain for testing purposes. // /// Notes ///------ @@ -44,8 +44,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -91,7 +90,7 @@ namespace mqbmock { // class Domain // ============ -/// Mock domain implementation of the `mqbi::Domain` inteface. +/// Mock domain implementation of the `mqbi::Domain` interface. class Domain : public mqbi::Domain { private: // PRIVATE TYPES @@ -114,13 +113,13 @@ class Domain : public mqbi::Domain { // domain mqbi::Cluster* d_cluster_p; - bsl::shared_ptr d_domainsStatContext; + bsl::shared_ptr d_domainsStatContext; mqbstat::DomainStats d_domainsStats; // Stat context dedicated to this domain, to use as the parent stat // context for any queue in this domain - bsl::shared_ptr d_statContext; + bsl::shared_ptr d_statContext; // Configuration for the domain mqbconfm::Domain d_config; @@ -234,7 +233,7 @@ class Domain : public mqbi::Domain { mqbstat::DomainStats* domainStats() BSLS_KEYWORD_OVERRIDE; /// Return the stat context associated to this Domain. - mwcst::StatContext* queueStatContext() BSLS_KEYWORD_OVERRIDE; + bmqst::StatContext* queueStatContext() BSLS_KEYWORD_OVERRIDE; /// Return the cluster associated to this Domain. mqbi::Cluster* cluster() const BSLS_KEYWORD_OVERRIDE; @@ -249,7 +248,7 @@ class Domain : public mqbi::Domain { // class DomainFactory // =================== -/// Mock implementation of the `mqbi::DomainFactory` inteface. +/// Mock implementation of the `mqbi::DomainFactory` interface. class DomainFactory : public mqbi::DomainFactory { private: // DATA diff --git a/src/groups/mqb/mqbmock/mqbmock_logidgenerator.h b/src/groups/mqb/mqbmock/mqbmock_logidgenerator.h index 9b00e2e4f..f8eb33f9b 100644 --- a/src/groups/mqb/mqbmock/mqbmock_logidgenerator.h +++ b/src/groups/mqb/mqbmock/mqbmock_logidgenerator.h @@ -45,7 +45,7 @@ namespace mqbmock { // class LogIdGenerator // ==================== -/// Mock implementation of the `mqbsi::LogIdGenerator` inteface. +/// Mock implementation of the `mqbsi::LogIdGenerator` interface. class LogIdGenerator : public mqbsi::LogIdGenerator { private: // DATA diff --git a/src/groups/mqb/mqbmock/mqbmock_queue.cpp b/src/groups/mqb/mqbmock/mqbmock_queue.cpp index 76505fcf6..fda477727 100644 --- a/src/groups/mqb/mqbmock/mqbmock_queue.cpp +++ b/src/groups/mqb/mqbmock/mqbmock_queue.cpp @@ -30,8 +30,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -62,7 +61,7 @@ Queue::Queue(mqbi::Domain* domain, bslma::Allocator* allocator) { BSLS_ASSERT_SAFE(d_uri.isValid()); - mwcu::MemOutStream ss(allocator); + bmqu::MemOutStream ss(allocator); ss << "|mock-queue|" << d_uri.asString(); d_description.assign(ss.str()); @@ -388,7 +387,7 @@ int Queue::processCommand(mqbcmd::QueueResult* result, const mqbcmd::QueueCommand& command) { mqbcmd::Error error = result->makeError(); - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "MockQueue::processCommand " << command << " not implemented!"; error.message() = os.str(); return -1; diff --git a/src/groups/mqb/mqbmock/mqbmock_queue.h b/src/groups/mqb/mqbmock/mqbmock_queue.h index d9b5a6869..3f5ff769d 100644 --- a/src/groups/mqb/mqbmock/mqbmock_queue.h +++ b/src/groups/mqb/mqbmock/mqbmock_queue.h @@ -89,7 +89,7 @@ class Storage; namespace mqbstat { class QueueStatsDomain; } -namespace mwcst { +namespace bmqst { class StatContext; } @@ -99,7 +99,7 @@ namespace mqbmock { // Class Queue // =========== -/// Mock queue implementation of the `mqbi::Queue` inteface +/// Mock queue implementation of the `mqbi::Queue` interface class Queue : public mqbi::Queue { private: // CLASS-SCOPE CATEGORY diff --git a/src/groups/mqb/mqbmock/mqbmock_queuehandle.cpp b/src/groups/mqb/mqbmock/mqbmock_queuehandle.cpp index 3ab0b7b64..201106a50 100644 --- a/src/groups/mqb/mqbmock/mqbmock_queuehandle.cpp +++ b/src/groups/mqb/mqbmock/mqbmock_queuehandle.cpp @@ -26,10 +26,9 @@ // BMQ #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -573,7 +572,7 @@ bsls::Types::Int64 QueueHandle::countUnconfirmed(unsigned int subId) const void QueueHandle::loadInternals(mqbcmd::QueueHandle* out) const { - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << d_handleParameters; out->parametersJson() = os.str(); @@ -630,7 +629,7 @@ bsl::string QueueHandle::_messages(const bsl::string& appId) const } // bsl::vector msgs(d_allocator_p); - mwcu::MemOutStream out(d_allocator_p); + bmqu::MemOutStream out(d_allocator_p); for (GUIDMap::const_iterator msgCiter = cit->second.d_unconfirmedMessages.begin(); msgCiter != cit->second.d_unconfirmedMessages.end(); @@ -673,7 +672,7 @@ size_t QueueHandle::_numActiveSubstreams() const const bsl::string QueueHandle::_appIds() const { - mwcu::MemOutStream out(d_allocator_p); + bmqu::MemOutStream out(d_allocator_p); bsl::vector appIds(d_allocator_p); for (SubStreams::const_iterator citer = d_subStreamInfos.begin(); diff --git a/src/groups/mqb/mqbmock/mqbmock_queuehandle.h b/src/groups/mqb/mqbmock/mqbmock_queuehandle.h index 0427814f7..2af1eda78 100644 --- a/src/groups/mqb/mqbmock/mqbmock_queuehandle.h +++ b/src/groups/mqb/mqbmock/mqbmock_queuehandle.h @@ -52,9 +52,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -92,7 +91,7 @@ class QueueHandle : public mqbi::QueueHandle { /// guid -> message. /// Must be a container in which iteration order is same as insertion /// order. - typedef mwcc::OrderedHashMap< + typedef bmqc::OrderedHashMap< bmqt::MessageGUID, bsl::pair, unsigned>, bslh::Hash > diff --git a/src/groups/mqb/mqbmock/mqbmock_storagemanager.cpp b/src/groups/mqb/mqbmock/mqbmock_storagemanager.cpp index f18b842a1..3264e0110 100644 --- a/src/groups/mqb/mqbmock/mqbmock_storagemanager.cpp +++ b/src/groups/mqb/mqbmock/mqbmock_storagemanager.cpp @@ -73,7 +73,7 @@ void StorageManager::unregisterQueue( // NOTHING } -int StorageManager::updateQueue( +int StorageManager::updateQueuePrimary( BSLS_ANNOTATION_UNUSED const bmqt::Uri& uri, BSLS_ANNOTATION_UNUSED const mqbu::StorageKey& queueKey, BSLS_ANNOTATION_UNUSED int partitionId, @@ -237,6 +237,13 @@ void StorageManager::processReceiptEvent( // NOTHING } +void StorageManager::bufferPrimaryStatusAdvisory( + BSLS_ANNOTATION_UNUSED const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, + BSLS_ANNOTATION_UNUSED mqbnet::ClusterNode* source) +{ + // NOTHING +} + void StorageManager::processPrimaryStatusAdvisory( BSLS_ANNOTATION_UNUSED const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, BSLS_ANNOTATION_UNUSED mqbnet::ClusterNode* source) diff --git a/src/groups/mqb/mqbmock/mqbmock_storagemanager.h b/src/groups/mqb/mqbmock/mqbmock_storagemanager.h index 96d248ea3..028e17a3f 100644 --- a/src/groups/mqb/mqbmock/mqbmock_storagemanager.h +++ b/src/groups/mqb/mqbmock/mqbmock_storagemanager.h @@ -100,12 +100,12 @@ class StorageManager : public mqbi::StorageManager { /// queue is configured in fanout mode. /// /// THREAD: Executed by the Queue's dispatcher thread. - virtual int - updateQueue(const bmqt::Uri& uri, - const mqbu::StorageKey& queueKey, - int partitionId, - const AppIdKeyPairs& addedIdKeyPairs, - const AppIdKeyPairs& removedIdKeyPairs) BSLS_KEYWORD_OVERRIDE; + virtual int updateQueuePrimary(const bmqt::Uri& uri, + const mqbu::StorageKey& queueKey, + int partitionId, + const AppIdKeyPairs& addedIdKeyPairs, + const AppIdKeyPairs& removedIdKeyPairs) + BSLS_KEYWORD_OVERRIDE; virtual void registerQueueReplica(int partitionId, @@ -237,6 +237,11 @@ class StorageManager : public mqbi::StorageManager { processReceiptEvent(const bmqp::Event& event, mqbnet::ClusterNode* source) BSLS_KEYWORD_OVERRIDE; + /// Executed by any thread. + virtual void bufferPrimaryStatusAdvisory( + const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, + mqbnet::ClusterNode* source) BSLS_KEYWORD_OVERRIDE; + /// Executed by any thread. virtual void processPrimaryStatusAdvisory( const bmqp_ctrlmsg::PrimaryStatusAdvisory& advisory, diff --git a/src/groups/mqb/mqbnet/mqbnet_channel.cpp b/src/groups/mqb/mqbnet/mqbnet_channel.cpp index 6c53d56b4..9a53f0c0f 100644 --- a/src/groups/mqb/mqbnet/mqbnet_channel.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_channel.cpp @@ -24,9 +24,8 @@ #include #include -// MWC -#include -#include +#include +#include namespace BloombergLP { namespace mqbnet { @@ -83,7 +82,7 @@ Channel::Channel(bdlbb::BlobBufferFactory* blobBufferFactory, , d_name(name, d_allocator_p) , d_stats() { - bslmt::ThreadAttributes attr = mwcsys::ThreadUtil::defaultAttributes(); + bslmt::ThreadAttributes attr = bmqsys::ThreadUtil::defaultAttributes(); bsl::string threadName("bmqNet-"); attr.setThreadName(threadName + d_name); d_buffer.setWatermarks(50000, 100000, 500000); @@ -116,7 +115,7 @@ void Channel::deleteItem(void* item, void* cookie) bmqt::GenericResult::Enum Channel::writePut(const bmqp::PutHeader& ph, const bsl::shared_ptr& data, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bool keepWeakPtr) { bslma::ManagedPtr item( @@ -135,7 +134,7 @@ Channel::writePush(const bsl::shared_ptr& payload, bmqt::CompressionAlgorithmType::Enum compressionType, const bmqp::MessagePropertiesInfo& logic, const bmqp::Protocol::SubQueueInfosArray& subQueueInfos, - const bsl::shared_ptr& state) + const bsl::shared_ptr& state) { bslma::ManagedPtr item(new (d_itemPool_p->allocate()) Item(queueId, @@ -159,7 +158,7 @@ Channel::writePush(int queueId, bmqt::CompressionAlgorithmType::Enum compressionType, const bmqp::MessagePropertiesInfo& logic, const bmqp::Protocol::SubQueueInfosArray& subQueueInfos, - const bsl::shared_ptr& state) + const bsl::shared_ptr& state) { bslma::ManagedPtr item(new (d_itemPool_p->allocate()) Item(queueId, @@ -180,7 +179,7 @@ Channel::writeAck(int status, int correlationId, const bmqt::MessageGUID& guid, int queueId, - const bsl::shared_ptr& state) + const bsl::shared_ptr& state) { bslma::ManagedPtr item( new (d_itemPool_p->allocate()) @@ -194,7 +193,7 @@ bmqt::GenericResult::Enum Channel::writeConfirm(int queueId, int subQueueId, const bmqt::MessageGUID& guid, - const bsl::shared_ptr& state) + const bsl::shared_ptr& state) { bslma::ManagedPtr item(new (d_itemPool_p->allocate()) Item(queueId, @@ -212,7 +211,7 @@ bmqt::GenericResult::Enum Channel::writeReject(int queueId, int subQueueId, const bmqt::MessageGUID& guid, - const bsl::shared_ptr& state) + const bsl::shared_ptr& state) { bslma::ManagedPtr item(new (d_itemPool_p->allocate()) Item(queueId, @@ -229,7 +228,7 @@ Channel::writeReject(int queueId, bmqt::GenericResult::Enum Channel::writeBlob(const bdlbb::Blob& data, bmqp::EventType::Enum type, - const bsl::shared_ptr& state) + const bsl::shared_ptr& state) { bslma::ManagedPtr item(new (d_itemPool_p->allocate()) Item(data, type, state, d_allocator_p), @@ -264,7 +263,7 @@ void Channel::resetChannel() void Channel::closeChannel() { - bsl::shared_ptr channel; + bsl::shared_ptr channel; { bslmt::LockGuard guard(&d_mutex); // LOCK channel = d_channel_wp.lock(); @@ -279,11 +278,11 @@ void Channel::closeChannel() } } -void Channel::setChannel(const bsl::weak_ptr& value) +void Channel::setChannel(const bsl::weak_ptr& value) { bslmt::LockGuard guard(&d_mutex); // LOCK - bsl::shared_ptr channelSp = value.lock(); + bsl::shared_ptr channelSp = value.lock(); BSLS_ASSERT(channelSp); BSLS_ASSERT(!isAvailable()); @@ -317,8 +316,8 @@ void Channel::reset() bsls::Types::Int64 count = numItems(); if (count) { BALL_LOG_INFO << "Reset '" << d_description << "', dropping " - << mwcu::PrintUtil::prettyNumber(count) << " items and " - << mwcu::PrintUtil::prettyBytes(numBytes()) << " bytes."; + << bmqu::PrintUtil::prettyNumber(count) << " items and " + << bmqu::PrintUtil::prettyBytes(numBytes()) << " bytes."; } d_secondaryBuffer.reset(); @@ -345,29 +344,29 @@ void Channel::flush() d_buffer.pushBack(bslmf::MovableRefUtil::move(item)); } -void Channel::onWatermark(mwcio::ChannelWatermarkType::Enum type) +void Channel::onWatermark(bmqio::ChannelWatermarkType::Enum type) { bslmt::LockGuard guard(&d_mutex); // LOCK switch (type) { - case mwcio::ChannelWatermarkType::e_LOW_WATERMARK: + case bmqio::ChannelWatermarkType::e_LOW_WATERMARK: BALL_LOG_INFO << "[CHANNEL_LOW_WATERMARK] hit for '" << d_description << "' with " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( bsls::Types::Int64(d_stats.d_numItemsTotal)) << " items and " - << mwcu::PrintUtil::prettyBytes(d_stats.d_numBytes) + << bmqu::PrintUtil::prettyBytes(d_stats.d_numBytes) << " pending bytes."; d_state = e_LWM; d_stateCondition.signal(); break; - case mwcio::ChannelWatermarkType::e_HIGH_WATERMARK: + case bmqio::ChannelWatermarkType::e_HIGH_WATERMARK: BALL_LOG_WARN << "[CHANNEL_HIGH_WATERMARK] hit for '" << d_description << "' with " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( bsls::Types::Int64(d_stats.d_numItemsTotal)) << " items and " - << mwcu::PrintUtil::prettyBytes(d_stats.d_numBytes) + << bmqu::PrintUtil::prettyBytes(d_stats.d_numBytes) << " pending bytes."; d_state = e_HWM; break; @@ -381,7 +380,7 @@ void Channel::onWatermark(mwcio::ChannelWatermarkType::Enum type) bmqt::GenericResult::Enum Channel::writeBufferedItem(bool* isConsumed, - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bsl::string& description, Item& item) { @@ -593,57 +592,57 @@ bmqt::EventBuilderResult::Enum Channel::pack(ControlArgs& builder, return bmqt::EventBuilderResult::e_SUCCESS; } -mwcio::StatusCategory::Enum -Channel::flushAll(const bsl::shared_ptr& channel) +bmqio::StatusCategory::Enum +Channel::flushAll(const bsl::shared_ptr& channel) { // executed by the internal thread // PRECONDITIONS BSLS_ASSERT_SAFE(d_internalThreadChecker.inSameThread()); - mwcio::StatusCategory::Enum rc; + bmqio::StatusCategory::Enum rc; rc = flushBuilder(d_pushBuilder, channel); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( - rc != mwcio::StatusCategory::e_SUCCESS)) { + rc != bmqio::StatusCategory::e_SUCCESS)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; return rc; // RETURN } rc = flushBuilder(d_confirmBuilder, channel); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( - rc != mwcio::StatusCategory::e_SUCCESS)) { + rc != bmqio::StatusCategory::e_SUCCESS)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; return rc; // RETURN } rc = flushBuilder(d_putBuilder, channel); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( - rc != mwcio::StatusCategory::e_SUCCESS)) { + rc != bmqio::StatusCategory::e_SUCCESS)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; return rc; // RETURN } rc = flushBuilder(d_ackBuilder, channel); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( - rc != mwcio::StatusCategory::e_SUCCESS)) { + rc != bmqio::StatusCategory::e_SUCCESS)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; return rc; // RETURN } rc = flushBuilder(d_rejectBuilder, channel); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( - rc != mwcio::StatusCategory::e_SUCCESS)) { + rc != bmqio::StatusCategory::e_SUCCESS)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; return rc; // RETURN } - return mwcio::StatusCategory::e_SUCCESS; + return bmqio::StatusCategory::e_SUCCESS; } template bmqt::GenericResult::Enum Channel::writeImmediate(bool* isConsumed, - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bsl::string& description, Builder& builder, const Args& args, - const bsl::shared_ptr& state) + const bsl::shared_ptr& state) { // executed by the internal thread // PRECONDITIONS @@ -700,19 +699,19 @@ Channel::writeImmediate(bool* isConsumed, } if (doFlush) { - mwcio::StatusCategory::Enum writeRc = flushBuilder(builder, + bmqio::StatusCategory::Enum writeRc = flushBuilder(builder, channel); switch (writeRc) { - case mwcio::StatusCategory::e_SUCCESS: + case bmqio::StatusCategory::e_SUCCESS: rc = bmqt::GenericResult::e_SUCCESS; break; - case mwcio::StatusCategory::e_LIMIT: + case bmqio::StatusCategory::e_LIMIT: rc = bmqt::GenericResult::e_NOT_READY; break; - case mwcio::StatusCategory::e_GENERIC_ERROR: - case mwcio::StatusCategory::e_CONNECTION: - case mwcio::StatusCategory::e_TIMEOUT: - case mwcio::StatusCategory::e_CANCELED: + case bmqio::StatusCategory::e_GENERIC_ERROR: + case bmqio::StatusCategory::e_CONNECTION: + case bmqio::StatusCategory::e_TIMEOUT: + case bmqio::StatusCategory::e_CANCELED: default: BALL_LOG_ERROR << "#CLUSTER_SEND_FAILURE " @@ -738,41 +737,41 @@ void Channel::threadFn() BSLS_ASSERT_SAFE(d_internalThreadChecker.inSameThread()); bslma::ManagedPtr item; - bsl::shared_ptr channel; + bsl::shared_ptr channel; bsl::string description; int mode = e_BLOCK; BSLS_ASSERT(d_state == e_INITIAL || d_state == e_RESET); while (!d_doStop) { - mwcc::MonitoredQueueState::Enum queueState; + bmqc::MonitoredQueueState::Enum queueState; while (d_queueStates.tryPopFront(&queueState) == 0) { switch (queueState) { - case mwcc::MonitoredQueueState::e_NORMAL: { + case bmqc::MonitoredQueueState::e_NORMAL: { BALL_LOG_INFO << "Buffer is in normal state (" << d_buffer.lowWatermark() << ") for channel " << description << " with " << numItems() << " items and " - << mwcu::PrintUtil::prettyBytes(numBytes()) + << bmqu::PrintUtil::prettyBytes(numBytes()) << " pending bytes"; } break; - case mwcc::MonitoredQueueState::e_HIGH_WATERMARK_REACHED: { + case bmqc::MonitoredQueueState::e_HIGH_WATERMARK_REACHED: { BALL_LOG_WARN << "[CHANNEL_BUFFER_HIGH_WATERMARK] reached (" << d_buffer.highWatermark() << ") for channel " << description << " with " << numItems() << " items and " - << mwcu::PrintUtil::prettyBytes(numBytes()) + << bmqu::PrintUtil::prettyBytes(numBytes()) << " pending bytes"; } break; - case mwcc::MonitoredQueueState::e_HIGH_WATERMARK_2_REACHED: { + case bmqc::MonitoredQueueState::e_HIGH_WATERMARK_2_REACHED: { BALL_LOG_ERROR << "[CHANNEL_BUFFER_HIGH_WATERMARK2] reached (" << d_buffer.highWatermark2() << ") for channel " << description << " with " << numItems() << " items and " - << mwcu::PrintUtil::prettyBytes(numBytes()) + << bmqu::PrintUtil::prettyBytes(numBytes()) << " pending bytes"; } break; - case mwcc::MonitoredQueueState::e_QUEUE_FILLED: { + case bmqc::MonitoredQueueState::e_QUEUE_FILLED: { // We're using an unbounded queue so this state is not // expected. BALL_LOG_ERROR << "Unexpected queue state for buffer " @@ -818,14 +817,14 @@ void Channel::threadFn() d_stateCondition.signal(); BALL_LOG_INFO << "Ready to write to " << description << " with " << numItems() << " items and " - << mwcu::PrintUtil::prettyBytes(numBytes()) + << bmqu::PrintUtil::prettyBytes(numBytes()) << " pending bytes"; } else { // wait for 'setChannel' or LWM BALL_LOG_INFO << "Waiting for " << description << " with " << numItems() << " items and " - << mwcu::PrintUtil::prettyBytes(numBytes()) + << bmqu::PrintUtil::prettyBytes(numBytes()) << " pending bytes"; d_stateCondition.wait(&d_mutex); } @@ -858,7 +857,7 @@ void Channel::threadFn() } break; case e_IDLE: { // Idle. First, flush all builders. - if (flushAll(channel) == mwcio::StatusCategory::e_SUCCESS) { + if (flushAll(channel) == bmqio::StatusCategory::e_SUCCESS) { // Then, drain the secondary buffer mode = e_SECONDARY; } @@ -892,7 +891,7 @@ void Channel::threadFn() BALL_LOG_WARN << "Reached a limit while writing event " << item->d_type << " to " << description << " with " << numItems() << " items and " - << mwcu::PrintUtil::prettyBytes(numBytes()) + << bmqu::PrintUtil::prettyBytes(numBytes()) << " pending bytes"; // If 'onWatermark' did not happen yet, do go into e_HWM to // avoid calling BTE until LWM @@ -921,7 +920,7 @@ void Channel::threadFn() reset(); } -void Channel::onBufferStateChange(mwcc::MonitoredQueueState::Enum state) +void Channel::onBufferStateChange(bmqc::MonitoredQueueState::Enum state) { // Assuming 'd_buffer' is not empty. Signal 'd_stateCondition' in case // 'threadFn' is waiting (for LWM). Signal without locking since diff --git a/src/groups/mqb/mqbnet/mqbnet_channel.h b/src/groups/mqb/mqbnet/mqbnet_channel.h index a42c70b22..65a00a27f 100644 --- a/src/groups/mqb/mqbnet/mqbnet_channel.h +++ b/src/groups/mqb/mqbnet/mqbnet_channel.h @@ -17,19 +17,19 @@ #ifndef INCLUDED_MQBNET_CHANNEL #define INCLUDED_MQBNET_CHANNEL -//@PURPOSE: Provide a mechanism to handle mwcio::Channel watermarks. This is +//@PURPOSE: Provide a mechanism to handle bmqio::Channel watermarks. This is // different from ChannelPool buffer for the following reasons: // - cancel write if it has not been processed (for example, to expire PUTs) // - a room for overload condition handling when different types need // different treatment (NACKing excessive PUTs). // //@CLASSES: -// mqbnet::Channel : Mechanism to interact with mwcio::Channel. +// mqbnet::Channel : Mechanism to interact with bmqio::Channel. // //@DESCRIPTION: Methods to build and write PUT, PUSH, ACK, CONFIRM, and control // messages. 'mqbnet::Channel' buffers data in high watermark and resumes // writing when reaching low watermark. It allows for canceling data by -// checking 'mwcu::AtomicState' when it is provided as an argument to a write +// checking 'bmqu::AtomicState' when it is provided as an argument to a write // call. // To meet the requirement to cancel write request, 'mqbnet::Channel' does not // build events in high watermark. Instead, it buffers the request data @@ -77,14 +77,13 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -258,7 +257,7 @@ class Channel { const int d_correlationId; const int d_status; - const bsl::shared_ptr d_state; + const bsl::shared_ptr d_state; bsl::shared_ptr d_tempData_sp; bsl::shared_ptr d_tempOptions_sp; @@ -270,7 +269,7 @@ class Channel { Item(const bmqp::PutHeader& ph, const bsl::shared_ptr& data, bool keepWeakPtr, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bslma::Allocator* allocator); Item(int queueId, @@ -280,7 +279,7 @@ class Channel { const bmqp::MessagePropertiesInfo& messagePropertiesInfo, const bsl::shared_ptr& payload, const bmqp::Protocol::SubQueueInfosArray& subQueueInfos, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bslma::Allocator* allocator); Item(int queueId, @@ -289,26 +288,26 @@ class Channel { bmqt::CompressionAlgorithmType::Enum compressionAlgorithmType, const bmqp::MessagePropertiesInfo& messagePropertiesInfo, const bmqp::Protocol::SubQueueInfosArray& subQueueInfos, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bslma::Allocator* allocator); Item(int status, int correlationId, const bmqt::MessageGUID& msgId, int queueId, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bslma::Allocator* allocator); Item(int queueId, int subQueueId, const bmqt::MessageGUID& guid, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bmqp::EventType::Enum type, bslma::Allocator* allocator); Item(const bdlbb::Blob& data, bmqp::EventType::Enum type, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bslma::Allocator* allocator); ~Item(); @@ -351,7 +350,7 @@ class Channel { // PUBLIC TYPES typedef bdlma::ConcurrentPool ItemPool; - typedef mwcc::MonitoredQueue< + typedef bmqc::MonitoredQueue< bdlcc::SingleConsumerQueue > > ItemQueue; enum EnumState { @@ -376,7 +375,7 @@ class Channel { static const int k_NAGLE_PACKET_SIZE = 1024 * 1024; // 1MB; // DATA - mwcma::CountingAllocatorStore d_allocators; + bmqma::CountingAllocatorStore d_allocators; // Counting allocator bslma::Allocator* d_allocator_p; @@ -407,13 +406,13 @@ class Channel { bsls::AtomicInt d_state; - bdlcc::SingleConsumerQueue d_queueStates; + bdlcc::SingleConsumerQueue d_queueStates; // 'ItemQueue' threshold events get // processed in the 'threadFn' (instead of // 'onBufferStateChange'. This container // keeps events to be processed. - bsl::weak_ptr d_channel_wp; + bsl::weak_ptr d_channel_wp; // Channel associated to this node, // if any @@ -424,7 +423,7 @@ class Channel { // Name of the cluster node which owns this // channel. - mwcu::SameThreadChecker d_internalThreadChecker; + bmqu::SameThreadChecker d_internalThreadChecker; // Mechanism to check if a method is called // in the internal thread. Stats d_stats; @@ -443,14 +442,14 @@ class Channel { /// Flush the specified `builder` to the specified `channel`. Return /// result category. template - mwcio::StatusCategory::Enum + bmqio::StatusCategory::Enum flushBuilder(Builder& builder, - const bsl::shared_ptr& channel); + const bsl::shared_ptr& channel); /// Flush all internal builders to the specified `channel`. Return /// result category. - mwcio::StatusCategory::Enum - flushAll(const bsl::shared_ptr& channel); + bmqio::StatusCategory::Enum + flushAll(const bsl::shared_ptr& channel); /// Enqueue the specified `item`. bmqt::GenericResult::Enum enqueue(bslma::ManagedPtr& item); @@ -461,7 +460,7 @@ class Channel { /// has ended up in the builder / got written to the channel or not. bmqt::GenericResult::Enum writeBufferedItem(bool* isConsumed, - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bsl::string& description, Item& item); @@ -473,11 +472,11 @@ class Channel { template bmqt::GenericResult::Enum writeImmediate(bool* isConsumed, - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bsl::string& description, Builder& builder, const Args& args, - const bsl::shared_ptr& state); + const bsl::shared_ptr& state); /// Overloads to pack events data using corresponding builder. bmqt::EventBuilderResult::Enum pack(bmqp::PutEventBuilder& builder, @@ -500,7 +499,7 @@ class Channel { /// Callback invoked within the d_buffer when the state of the queue /// changes. Currently logs the state of the buffer. - void onBufferStateChange(mwcc::MonitoredQueueState::Enum state); + void onBufferStateChange(bmqc::MonitoredQueueState::Enum state); private: // PRIVATE CLASS METHODS @@ -523,7 +522,7 @@ class Channel { // MANIPULATORS /// Set the channel associated to this node to the specified `value`. - void setChannel(const bsl::weak_ptr& value); + void setChannel(const bsl::weak_ptr& value); /// Reset the channel associated to this node. void resetChannel(); @@ -538,7 +537,7 @@ class Channel { bmqt::GenericResult::Enum writePut(const bmqp::PutHeader& ph, const bsl::shared_ptr& data, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bool keepWeakPtr = false); /// Write `explicit` PUSH message using the specified `payload`, @@ -552,8 +551,8 @@ class Channel { bmqt::CompressionAlgorithmType::Enum compressionType, const bmqp::MessagePropertiesInfo& messagePropertiesInfo, const bmqp::Protocol::SubQueueInfosArray& subQueueInfos, - const bsl::shared_ptr& state = - bsl::shared_ptr()); + const bsl::shared_ptr& state = + bsl::shared_ptr()); /// Write `implicit` PUSH message using the specified `subQueueInfos`, /// `queueId`, `msgId`, `flags`, `compressionType`, and `state`. Return @@ -565,8 +564,8 @@ class Channel { bmqt::CompressionAlgorithmType::Enum compressionType, const bmqp::MessagePropertiesInfo& messagePropertiesInfo, const bmqp::Protocol::SubQueueInfosArray& subQueueInfos, - const bsl::shared_ptr& state = - bsl::shared_ptr()); + const bsl::shared_ptr& state = + bsl::shared_ptr()); /// Write ACK message using the specified `status`, `correlationId`, /// `guid`, `queueId`, and `state`. Return e_SUCCESS even if the @@ -576,8 +575,8 @@ class Channel { int correlationId, const bmqt::MessageGUID& guid, int queueId, - const bsl::shared_ptr& state = - bsl::shared_ptr()); + const bsl::shared_ptr& state = + bsl::shared_ptr()); /// Write CONFIRM message using the specified `queueId`, `subQueueId`, /// `guid`, and `state`. Return e_SUCCESS even if the channel is in @@ -586,15 +585,15 @@ class Channel { writeConfirm(int queueId, int subQueueId, const bmqt::MessageGUID& guid, - const bsl::shared_ptr& state = - bsl::shared_ptr()); + const bsl::shared_ptr& state = + bsl::shared_ptr()); bmqt::GenericResult::Enum writeReject(int queueId, int subQueueId, const bmqt::MessageGUID& guid, - const bsl::shared_ptr& state = - bsl::shared_ptr()); + const bsl::shared_ptr& state = + bsl::shared_ptr()); /// Send the specified `data` using the specified `state`. The /// specified `type` controls whether to flush everything accumulated @@ -606,20 +605,20 @@ class Channel { bmqt::GenericResult::Enum writeBlob(const bdlbb::Blob& data, bmqp::EventType::Enum type, - const bsl::shared_ptr& state = 0); + const bsl::shared_ptr& state = 0); /// Write everything unless there is a thread actively writing already. void flush(); /// Notify the channel when a watermark of the specified `type` is being /// reached. - void onWatermark(mwcio::ChannelWatermarkType::Enum type); + void onWatermark(bmqio::ChannelWatermarkType::Enum type); // ACCESSORS bool isAvailable() const; - /// Return associated mwcio channel or empty shared_ptr. - const bsl::shared_ptr channel() const; + /// Return associated bmqio channel or empty shared_ptr. + const bsl::shared_ptr channel() const; unsigned int numItems() const; @@ -821,7 +820,7 @@ inline Channel::Item::Item(bslma::Allocator* allocator) inline Channel::Item::Item(const bmqp::PutHeader& ph, const bsl::shared_ptr& data, bool keepWeakPtr, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bslma::Allocator* allocator) : d_type(bmqp::EventType::e_PUT) , d_putHeader(ph) @@ -850,7 +849,7 @@ inline Channel::Item::Item( const bmqp::MessagePropertiesInfo& messagePropertiesInfo, const bsl::shared_ptr& payload, const bmqp::Protocol::SubQueueInfosArray& subQueueInfos, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bslma::Allocator* allocator) : d_type(bmqp::EventType::e_PUSH) , d_hasWeakPtr(false) @@ -878,7 +877,7 @@ inline Channel::Item::Item( bmqt::CompressionAlgorithmType::Enum compressionAlgorithmType, const bmqp::MessagePropertiesInfo& messagePropertiesInfo, const bmqp::Protocol::SubQueueInfosArray& subQueueInfos, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bslma::Allocator* allocator) : d_type(bmqp::EventType::e_PUSH) , d_hasWeakPtr(false) @@ -903,7 +902,7 @@ inline Channel::Item::Item(int status, int correlationId, const bmqt::MessageGUID& guid, int queueId, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bslma::Allocator* allocator) : d_type(bmqp::EventType::e_ACK) , d_hasWeakPtr(false) @@ -925,7 +924,7 @@ inline Channel::Item::Item(int status, inline Channel::Item::Item(int queueId, int subQueueId, const bmqt::MessageGUID& guid, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bmqp::EventType::Enum type, bslma::Allocator* allocator) : d_type(type) @@ -956,7 +955,7 @@ inline Channel::Item::Item(int queueId, inline Channel::Item::Item(const bdlbb::Blob& data, bmqp::EventType::Enum type, - const bsl::shared_ptr& state, + const bsl::shared_ptr& state, bslma::Allocator* allocator) : d_type(type) , d_hasWeakPtr(false) @@ -1024,11 +1023,11 @@ inline void Channel::Stats::removeItem(bmqp::EventType::Enum type, size_t size) // ------------- template <> -inline mwcio::StatusCategory::Enum Channel::flushBuilder( +inline bmqio::StatusCategory::Enum Channel::flushBuilder( ControlArgs& args, - const bsl::shared_ptr& channel) + const bsl::shared_ptr& channel) { - mwcio::StatusCategory::Enum rc = mwcio::StatusCategory::e_SUCCESS; + bmqio::StatusCategory::Enum rc = bmqio::StatusCategory::e_SUCCESS; if (args.d_type == bmqp::EventType::e_CONTROL || args.d_type == bmqp::EventType::e_CLUSTER_STATE) { @@ -1043,19 +1042,19 @@ inline mwcio::StatusCategory::Enum Channel::flushBuilder( } if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( - rc != mwcio::StatusCategory::e_SUCCESS)) { + rc != bmqio::StatusCategory::e_SUCCESS)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; return rc; // RETURN } - mwcio::Status st; + bmqio::Status st; BSLS_ASSERT_SAFE(args.messageCount()); channel->write(&st, args.blob()); if (BSLS_PERFORMANCEHINT_PREDICT_LIKELY( - st.category() == mwcio::StatusCategory::e_SUCCESS)) { + st.category() == bmqio::StatusCategory::e_SUCCESS)) { args.reset(); } @@ -1063,20 +1062,20 @@ inline mwcio::StatusCategory::Enum Channel::flushBuilder( } template -inline mwcio::StatusCategory::Enum +inline bmqio::StatusCategory::Enum Channel::flushBuilder(Builder& builder, - const bsl::shared_ptr& channel) + const bsl::shared_ptr& channel) { // This is the last 'write' method in the call hierarchy before actually - // calling mwcio. + // calling bmqio. - mwcio::Status st; + bmqio::Status st; if (builder.messageCount()) { channel->write(&st, builder.blob()); if (BSLS_PERFORMANCEHINT_PREDICT_LIKELY( - st.category() == mwcio::StatusCategory::e_SUCCESS)) { + st.category() == bmqio::StatusCategory::e_SUCCESS)) { builder.reset(); } } @@ -1105,7 +1104,7 @@ inline bool Channel::isAvailable() const return d_state != e_INITIAL && d_state != e_RESET && d_state != e_CLOSE; } -inline const bsl::shared_ptr Channel::channel() const +inline const bsl::shared_ptr Channel::channel() const { bslmt::LockGuard guard(&d_mutex); // LOCK return d_channel_wp.lock(); diff --git a/src/groups/mqb/mqbnet/mqbnet_channel.t.cpp b/src/groups/mqb/mqbnet/mqbnet_channel.t.cpp index 62318975e..a667e1117 100644 --- a/src/groups/mqb/mqbnet/mqbnet_channel.t.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_channel.t.cpp @@ -24,9 +24,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -44,14 +43,14 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; using namespace bsl; namespace BloombergLP { -namespace mwcio { +namespace bmqio { class TestChannelEx : public TestChannel { private: @@ -67,12 +66,12 @@ class TestChannelEx : public TestChannel { bslma::Allocator* basicAllocator); ~TestChannelEx() BSLS_KEYWORD_OVERRIDE; - void write(mwcio::Status* status, + void write(bmqio::Status* status, const bdlbb::Blob& blob, bsls::Types::Int64 watermark = bsl::numeric_limits::max()) BSLS_KEYWORD_OVERRIDE; - void setWriteStatus(const mwcio::Status& status); + void setWriteStatus(const bmqio::Status& status); void setLimit(size_t limit); bool waitForChannel(const bsls::TimeInterval& interval); void lowWatermark(); @@ -126,7 +125,7 @@ class Tester { bslma::Allocator* allocator_p); void test(); - size_t verify(const bsl::shared_ptr& testChannel); + size_t verify(const bsl::shared_ptr& testChannel); void createThread(bslmt::Barrier* phase1, bslmt::Barrier* phase2); void stop(); @@ -289,7 +288,7 @@ inline void setContent(bdlbb::BlobBuffer* buffer) // ----------------- namespace BloombergLP { -namespace mwcio { +namespace bmqio { TestChannelEx::TestChannelEx(mqbnet::Channel& channel, bdlbb::BlobBufferFactory* factory, @@ -316,7 +315,7 @@ TestChannelEx::~TestChannelEx() // NOTHING } -void TestChannelEx::setWriteStatus(const mwcio::Status& status) +void TestChannelEx::setWriteStatus(const bmqio::Status& status) { bslmt::WriteLockGuard guard(&d_mutex); // WRITE-LOCK @@ -332,12 +331,12 @@ void TestChannelEx::setLimit(size_t limit) if (limit == 0 || writeCalls().size() < limit) { d_isInHWM = false; d_channel.onWatermark( - mwcio::ChannelWatermarkType::e_LOW_WATERMARK); + bmqio::ChannelWatermarkType::e_LOW_WATERMARK); } } else if (writeCalls().size() >= limit) { d_isInHWM = true; - d_channel.onWatermark(mwcio::ChannelWatermarkType::e_HIGH_WATERMARK); + d_channel.onWatermark(bmqio::ChannelWatermarkType::e_HIGH_WATERMARK); } d_limit = limit; } @@ -349,31 +348,31 @@ void TestChannelEx::lowWatermark() if (d_isInHWM) { d_isInHWM = false; - d_channel.onWatermark(mwcio::ChannelWatermarkType::e_LOW_WATERMARK); + d_channel.onWatermark(bmqio::ChannelWatermarkType::e_LOW_WATERMARK); } } -void TestChannelEx::write(mwcio::Status* status, +void TestChannelEx::write(bmqio::Status* status, const bdlbb::Blob& blob, bsls::Types::Int64 watermark) { bslmt::ReadLockGuard guard( &d_mutex); // READ-LOCK - if (writeStatus().category() != mwcio::StatusCategory::e_SUCCESS) { + if (writeStatus().category() != bmqio::StatusCategory::e_SUCCESS) { *status = writeStatus(); return; // RETURN } if (d_isInHWM) { - status->setCategory(mwcio::StatusCategory::e_LIMIT); + status->setCategory(bmqio::StatusCategory::e_LIMIT); return; // RETURN } if (d_limit && writeCalls().size() >= d_limit) { d_isInHWM = true; - status->setCategory(mwcio::StatusCategory::e_LIMIT); - d_channel.onWatermark(mwcio::ChannelWatermarkType::e_HIGH_WATERMARK); + status->setCategory(bmqio::StatusCategory::e_LIMIT); + d_channel.onWatermark(bmqio::ChannelWatermarkType::e_HIGH_WATERMARK); } TestChannel::write(status, blob, watermark); @@ -437,8 +436,8 @@ inline bmqt::EventBuilderResult::Enum Tester::build() new (*d_allocator_p) bdlbb::Blob(&d_bufferFactory, d_allocator_p), d_allocator_p); bdlbb::BlobBuffer blobBuffer; - bsl::shared_ptr state(new (*d_allocator_p) - mwcu::AtomicState, + bsl::shared_ptr state(new (*d_allocator_p) + bmqu::AtomicState, d_allocator_p); d_bufferFactory.allocate(&blobBuffer); @@ -615,14 +614,14 @@ inline bmqt::EventBuilderResult::Enum Tester::build() template inline size_t Tester::verify( - const bsl::shared_ptr& testChannel) + const bsl::shared_ptr& testChannel) { if (d_builder.messageCount()) { d_history.push_back(d_builder.blob()); d_builder.reset(); } - typedef bsl::deque::const_iterator Writes; + typedef bsl::deque::const_iterator Writes; Writes writes = testChannel->writeCalls().begin(); Iterator itEvents(&d_bufferFactory, d_allocator_p); @@ -730,9 +729,9 @@ static void test1_write() s_allocator_p); mqbnet::Channel channel(&bufferFactory, &itemPool, "test", s_allocator_p); - bsl::shared_ptr testChannel( + bsl::shared_ptr testChannel( new (*s_allocator_p) - mwcio::TestChannelEx(channel, &bufferFactory, s_allocator_p), + bmqio::TestChannelEx(channel, &bufferFactory, s_allocator_p), s_allocator_p); Tester put(channel, bufferFactory, s_allocator_p); @@ -745,7 +744,7 @@ static void test1_write() bufferFactory, s_allocator_p); - channel.setChannel(bsl::weak_ptr(testChannel)); + channel.setChannel(bsl::weak_ptr(testChannel)); for (size_t i = 0; i < 5000; i++) { put.test(); @@ -755,7 +754,7 @@ static void test1_write() reject.test(); } - testChannel->setWriteStatus(mwcio::StatusCategory::e_LIMIT); + testChannel->setWriteStatus(bmqio::StatusCategory::e_LIMIT); for (size_t i = 0; i < 5000; i++) { put.test(); @@ -765,8 +764,8 @@ static void test1_write() reject.test(); } - testChannel->setWriteStatus(mwcio::StatusCategory::e_SUCCESS); - channel.onWatermark(mwcio::ChannelWatermarkType::e_LOW_WATERMARK); + testChannel->setWriteStatus(bmqio::StatusCategory::e_SUCCESS); + channel.onWatermark(bmqio::ChannelWatermarkType::e_LOW_WATERMARK); size_t writeBlobs = 0; @@ -798,9 +797,9 @@ static void test2_highWatermark() s_allocator_p); mqbnet::Channel channel(&bufferFactory, &itemPool, "test", s_allocator_p); - bsl::shared_ptr testChannel( + bsl::shared_ptr testChannel( new (*s_allocator_p) - mwcio::TestChannelEx(channel, &bufferFactory, s_allocator_p), + bmqio::TestChannelEx(channel, &bufferFactory, s_allocator_p), s_allocator_p); Tester put(channel, bufferFactory, s_allocator_p); @@ -817,7 +816,7 @@ static void test2_highWatermark() bslmt::Barrier phase1(6 + 1); bslmt::Barrier phase2(6 + 1); - channel.setChannel(bsl::weak_ptr(testChannel)); + channel.setChannel(bsl::weak_ptr(testChannel)); confirm.createThread(&phase1, &phase2); put.createThread(&phase1, &phase2); @@ -836,8 +835,8 @@ static void test2_highWatermark() control.stop(); reject.stop(); - testChannel->setWriteStatus(mwcio::StatusCategory::e_LIMIT); - channel.onWatermark(mwcio::ChannelWatermarkType::e_HIGH_WATERMARK); + testChannel->setWriteStatus(bmqio::StatusCategory::e_LIMIT); + channel.onWatermark(bmqio::ChannelWatermarkType::e_HIGH_WATERMARK); phase2.wait(); @@ -855,8 +854,8 @@ static void test2_highWatermark() control.join(); reject.join(); - testChannel->setWriteStatus(mwcio::StatusCategory::e_SUCCESS); - channel.onWatermark(mwcio::ChannelWatermarkType::e_LOW_WATERMARK); + testChannel->setWriteStatus(bmqio::StatusCategory::e_SUCCESS); + channel.onWatermark(bmqio::ChannelWatermarkType::e_LOW_WATERMARK); size_t writeBlobs = 0; @@ -890,9 +889,9 @@ static void test3_highWatermarkInWriteCb() s_allocator_p); mqbnet::Channel channel(&bufferFactory, &itemPool, "test", s_allocator_p); - bsl::shared_ptr testChannel( + bsl::shared_ptr testChannel( new (*s_allocator_p) - mwcio::TestChannelEx(channel, &bufferFactory, s_allocator_p), + bmqio::TestChannelEx(channel, &bufferFactory, s_allocator_p), s_allocator_p); Tester put(channel, bufferFactory, s_allocator_p); @@ -908,7 +907,7 @@ static void test3_highWatermarkInWriteCb() bslmt::Barrier phase1(5 + 1); bslmt::Barrier phase2(5 + 1); - channel.setChannel(bsl::weak_ptr(testChannel)); + channel.setChannel(bsl::weak_ptr(testChannel)); confirm.createThread(&phase1, &phase2); put.createThread(&phase1, &phase2); @@ -982,9 +981,9 @@ static void test4_controlBlob() s_allocator_p); mqbnet::Channel channel(&bufferFactory, &itemPool, "test", s_allocator_p); - bsl::shared_ptr testChannel( + bsl::shared_ptr testChannel( new (*s_allocator_p) - mwcio::TestChannelEx(channel, &bufferFactory, s_allocator_p), + bmqio::TestChannelEx(channel, &bufferFactory, s_allocator_p), s_allocator_p); Tester put(channel, bufferFactory, s_allocator_p); @@ -997,7 +996,7 @@ static void test4_controlBlob() bufferFactory, s_allocator_p); - channel.setChannel(bsl::weak_ptr(testChannel)); + channel.setChannel(bsl::weak_ptr(testChannel)); put.test(); push.test(); @@ -1053,12 +1052,12 @@ static void test5_reconnect() s_allocator_p); mqbnet::Channel channel(&bufferFactory, &itemPool, "test", s_allocator_p); - bsl::shared_ptr testChannel( + bsl::shared_ptr testChannel( new (*s_allocator_p) - mwcio::TestChannelEx(channel, &bufferFactory, s_allocator_p), + bmqio::TestChannelEx(channel, &bufferFactory, s_allocator_p), s_allocator_p); - channel.setChannel(bsl::weak_ptr(testChannel)); + channel.setChannel(bsl::weak_ptr(testChannel)); { bdlbb::Blob payload = bdlbb::Blob(&bufferFactory, s_allocator_p); @@ -1078,7 +1077,7 @@ static void test5_reconnect() } ASSERT_EQ(testChannel->writeCalls().size(), 1U); - testChannel->setWriteStatus(mwcio::StatusCategory::e_CONNECTION); + testChannel->setWriteStatus(bmqio::StatusCategory::e_CONNECTION); { bdlbb::Blob payload = bdlbb::Blob(&bufferFactory, s_allocator_p); @@ -1095,9 +1094,9 @@ static void test5_reconnect() // simulate reconnection channel.resetChannel(); - channel.setChannel(bsl::weak_ptr(testChannel)); + channel.setChannel(bsl::weak_ptr(testChannel)); - testChannel->setWriteStatus(mwcio::StatusCategory::e_SUCCESS); + testChannel->setWriteStatus(bmqio::StatusCategory::e_SUCCESS); { bdlbb::Blob payload = bdlbb::Blob(&bufferFactory, s_allocator_p); @@ -1134,23 +1133,23 @@ static void test6_weakData() s_allocator_p); mqbnet::Channel channel(&bufferFactory, &itemPool, "test", s_allocator_p); - bsl::shared_ptr testChannel( + bsl::shared_ptr testChannel( new (*s_allocator_p) - mwcio::TestChannelEx(channel, &bufferFactory, s_allocator_p), + bmqio::TestChannelEx(channel, &bufferFactory, s_allocator_p), s_allocator_p); - channel.setChannel(bsl::weak_ptr(testChannel)); + channel.setChannel(bsl::weak_ptr(testChannel)); // Saturate the channel causing it to buffer next write - channel.onWatermark(mwcio::ChannelWatermarkType::e_HIGH_WATERMARK); + channel.onWatermark(bmqio::ChannelWatermarkType::e_HIGH_WATERMARK); { bsl::shared_ptr payload( new (*s_allocator_p) bdlbb::Blob(&bufferFactory, s_allocator_p), s_allocator_p); bdlbb::BlobBuffer blobBuffer; - bsl::shared_ptr state(new (*s_allocator_p) - mwcu::AtomicState, + bsl::shared_ptr state(new (*s_allocator_p) + bmqu::AtomicState, s_allocator_p); bmqp::PutHeader ph; @@ -1172,8 +1171,8 @@ static void test6_weakData() new (*s_allocator_p) bdlbb::Blob(&bufferFactory, s_allocator_p), s_allocator_p); bdlbb::BlobBuffer blobBuffer; - bsl::shared_ptr state(new (*s_allocator_p) - mwcu::AtomicState, + bsl::shared_ptr state(new (*s_allocator_p) + bmqu::AtomicState, s_allocator_p); bmqp::PutHeader ph; @@ -1186,7 +1185,7 @@ static void test6_weakData() bmqt::GenericResult::e_SUCCESS); } - channel.onWatermark(mwcio::ChannelWatermarkType::e_LOW_WATERMARK); + channel.onWatermark(bmqio::ChannelWatermarkType::e_LOW_WATERMARK); ASSERT_EQ(testChannel->waitForChannel(bsls::TimeInterval(1)), true); @@ -1203,7 +1202,7 @@ int main(int argc, char* argv[]) // Initialize Crc32c bmqp::Crc32c::initialize(); - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqp::ProtocolUtil::initialize(s_allocator_p); // expect BALL_LOG_ERROR @@ -1223,5 +1222,5 @@ int main(int argc, char* argv[]) bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbnet/mqbnet_cluster.cpp b/src/groups/mqb/mqbnet/mqbnet_cluster.cpp index 38d7c07ba..af2491b79 100644 --- a/src/groups/mqb/mqbnet/mqbnet_cluster.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_cluster.cpp @@ -41,7 +41,7 @@ void ClusterObserver::onNodeStateChange( } void ClusterObserver::onProxyConnectionUp( - BSLS_ANNOTATION_UNUSED const bsl::shared_ptr& channel, + BSLS_ANNOTATION_UNUSED const bsl::shared_ptr& channel, BSLS_ANNOTATION_UNUSED const bmqp_ctrlmsg::ClientIdentity& identity, BSLS_ANNOTATION_UNUSED const bsl::string& description) { diff --git a/src/groups/mqb/mqbnet/mqbnet_cluster.h b/src/groups/mqb/mqbnet/mqbnet_cluster.h index e1a7ee89b..dfd2192b2 100644 --- a/src/groups/mqb/mqbnet/mqbnet_cluster.h +++ b/src/groups/mqb/mqbnet/mqbnet_cluster.h @@ -37,9 +37,8 @@ // BMQ #include -// MWC -#include -#include +#include +#include // BDE #include @@ -97,7 +96,7 @@ class ClusterObserver { /// Process incoming proxy connection virtual void - onProxyConnectionUp(const bsl::shared_ptr& channel, + onProxyConnectionUp(const bsl::shared_ptr& channel, const bmqp_ctrlmsg::ClientIdentity& identity, const bsl::string& description); }; @@ -129,9 +128,9 @@ class ClusterNode { /// The specified `readCb` serves as read data callback when /// `enableRead` is called. virtual ClusterNode* - setChannel(const bsl::weak_ptr& value, + setChannel(const bsl::weak_ptr& value, const bmqp_ctrlmsg::ClientIdentity& identity, - const mwcio::Channel::ReadCallback& readCb) = 0; + const bmqio::Channel::ReadCallback& readCb) = 0; /// Start reading from the channel. Return true if `read` is successful /// or if it is already reading. @@ -240,7 +239,7 @@ class Cluster { /// Process incoming proxy connection. virtual void - onProxyConnectionUp(const bsl::shared_ptr& channel, + onProxyConnectionUp(const bsl::shared_ptr& channel, const bmqp_ctrlmsg::ClientIdentity& identity, const bsl::string& description) = 0; diff --git a/src/groups/mqb/mqbnet/mqbnet_cluster.t.cpp b/src/groups/mqb/mqbnet/mqbnet_cluster.t.cpp index 9f39aefa6..46853c437 100644 --- a/src/groups/mqb/mqbnet/mqbnet_cluster.t.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_cluster.t.cpp @@ -22,7 +22,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -59,9 +59,9 @@ struct ClusterObserverTestImp /// A test implementation of the `mqbnet::ClusterNode` protocol struct ClusterNodeTestImp : bsls::ProtocolTestImp { mqbnet::ClusterNode* setChannel( - const bsl::weak_ptr& value, + const bsl::weak_ptr& value, const bmqp_ctrlmsg::ClientIdentity& identity, - const mwcio::Channel::ReadCallback& readCb) BSLS_KEYWORD_OVERRIDE + const bmqio::Channel::ReadCallback& readCb) BSLS_KEYWORD_OVERRIDE { return markDone(); } @@ -156,7 +156,7 @@ struct ClusterTestImp : bsls::ProtocolTestImp { void enableRead() BSLS_KEYWORD_OVERRIDE { markDone(); } void - onProxyConnectionUp(const bsl::shared_ptr& channel, + onProxyConnectionUp(const bsl::shared_ptr& channel, const bmqp_ctrlmsg::ClientIdentity& identity, const bsl::string& description) BSLS_KEYWORD_OVERRIDE { @@ -217,7 +217,7 @@ static void test1_ClusterObserver() // PROTOCOL TEST // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ClusterObserver"); + bmqtst::TestHelper::printTestName("ClusterObserver"); PV("Creating a test object"); bsls::ProtocolTest testObj(s_verbosityLevel > 2); @@ -284,7 +284,7 @@ static void test2_ClusterNode() // PROTOCOL TEST // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ClusterNode"); + bmqtst::TestHelper::printTestName("ClusterNode"); PV("Creating a test object"); bsls::ProtocolTest testObj(s_verbosityLevel > 2); @@ -301,14 +301,14 @@ static void test2_ClusterNode() { PV("Verify that methods are public and virtual"); - bsl::weak_ptr dummyWeakChannel; + bsl::weak_ptr dummyWeakChannel; bdlbb::Blob dummyBlob; bmqp_ctrlmsg::ClientIdentity identity; BSLS_PROTOCOLTEST_ASSERT(testObj, setChannel(dummyWeakChannel, identity, - mwcio::Channel::ReadCallback())); + bmqio::Channel::ReadCallback())); BSLS_PROTOCOLTEST_ASSERT(testObj, enableRead()); BSLS_PROTOCOLTEST_ASSERT(testObj, closeChannel()); BSLS_PROTOCOLTEST_ASSERT(testObj, resetChannel()); @@ -365,7 +365,7 @@ static void test3_Cluster() // PROTOCOL TEST // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Cluster"); + bmqtst::TestHelper::printTestName("Cluster"); PV("Creating a test object"); bsls::ProtocolTest testObj(s_verbosityLevel > 2); @@ -399,7 +399,7 @@ static void test3_Cluster() BSLS_PROTOCOLTEST_ASSERT(testObj, enableRead()); BSLS_PROTOCOLTEST_ASSERT( testObj, - onProxyConnectionUp(bsl::shared_ptr(), + onProxyConnectionUp(bsl::shared_ptr(), bmqp_ctrlmsg::ClientIdentity(), bsl::string())); BSLS_PROTOCOLTEST_ASSERT(testObj, nodes()); @@ -426,7 +426,7 @@ static void test3_Cluster() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -439,5 +439,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbnet/mqbnet_clusteractivenodemanager.cpp b/src/groups/mqb/mqbnet/mqbnet_clusteractivenodemanager.cpp index 7d4d8683c..706381402 100644 --- a/src/groups/mqb/mqbnet/mqbnet_clusteractivenodemanager.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_clusteractivenodemanager.cpp @@ -21,9 +21,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -215,9 +214,9 @@ void ClusterActiveNodeManager::onNewActiveNode(ClusterNode* node) // alarm in the case of single-node cluster, as this is bound to happen // when that node bounces. if (d_nodes.size() > 1) { - MWCTSK_ALARMLOG_PANIC("CLUSTER_ACTIVE_NODE") + BMQTSK_ALARMLOG_PANIC("CLUSTER_ACTIVE_NODE") << d_description << ": no node available !!!" - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } else { BALL_LOG_INFO << "No node available for '" << d_description << "'"; diff --git a/src/groups/mqb/mqbnet/mqbnet_clusteractivenodemanager.h b/src/groups/mqb/mqbnet/mqbnet_clusteractivenodemanager.h index ad13fc677..ab29f9b0e 100644 --- a/src/groups/mqb/mqbnet/mqbnet_clusteractivenodemanager.h +++ b/src/groups/mqb/mqbnet/mqbnet_clusteractivenodemanager.h @@ -175,7 +175,7 @@ // // } // -// mwcio::StatusCategory::Enum +// bmqio::StatusCategory::Enum // ClusterProxy::sendData(const bdlbb::Blob& blob) // { // return d_activeNodeManager.write(0, blob, 64 * 1024 * 1024); @@ -192,9 +192,8 @@ // BMQ #include -// MWC -#include -#include +#include +#include // BDE #include diff --git a/src/groups/mqb/mqbnet/mqbnet_clusterimp.cpp b/src/groups/mqb/mqbnet/mqbnet_clusterimp.cpp index 98690a01b..091d9e5db 100644 --- a/src/groups/mqb/mqbnet/mqbnet_clusterimp.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_clusterimp.cpp @@ -19,7 +19,7 @@ #include // BMQ #include -#include +#include // BDE #include @@ -57,7 +57,7 @@ ClusterNodeImp::ClusterNodeImp(ClusterImp* cluster, BSLS_ASSERT_SAFE(d_cluster_p && "A ClusterNode should always be part of a Cluster"); - mwcu::MemOutStream osstr; + bmqu::MemOutStream osstr; osstr << "[" << hostName() << ", " << nodeId() << "]"; d_description.assign(osstr.str().data(), osstr.str().length()); } @@ -68,9 +68,9 @@ ClusterNodeImp::~ClusterNodeImp() } ClusterNode* -ClusterNodeImp::setChannel(const bsl::weak_ptr& value, +ClusterNodeImp::setChannel(const bsl::weak_ptr& value, const bmqp_ctrlmsg::ClientIdentity& identity, - const mwcio::Channel::ReadCallback& readCb) + const bmqio::Channel::ReadCallback& readCb) { // Save the value d_readCb = readCb; @@ -87,7 +87,7 @@ ClusterNodeImp::setChannel(const bsl::weak_ptr& value, bool ClusterNodeImp::enableRead() { - const bsl::shared_ptr channelSp = d_channel.channel(); + const bsl::shared_ptr channelSp = d_channel.channel(); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!channelSp)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; return false; // RETURN @@ -99,7 +99,7 @@ bool ClusterNodeImp::enableRead() return true; // RETURN } - mwcio::Status readStatus; + bmqio::Status readStatus; channelSp->read(&readStatus, bmqp::Protocol::k_PACKET_MIN_SIZE, d_readCb); if (!readStatus) { @@ -126,7 +126,7 @@ ClusterNode* ClusterNodeImp::resetChannel() d_channel.resetChannel(); d_isReading = false; d_identity.reset(); - d_readCb = mwcio::Channel::ReadCallback(); + d_readCb = bmqio::Channel::ReadCallback(); // Notify the cluster of changes to this node d_cluster_p->notifyObserversOfNodeStateChange(this, false); @@ -310,7 +310,7 @@ void ClusterImp::enableRead() } void ClusterImp::onProxyConnectionUp( - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bmqp_ctrlmsg::ClientIdentity& identity, const bsl::string& description) { diff --git a/src/groups/mqb/mqbnet/mqbnet_clusterimp.h b/src/groups/mqb/mqbnet/mqbnet_clusterimp.h index 69d2068cc..3d53a69d6 100644 --- a/src/groups/mqb/mqbnet/mqbnet_clusterimp.h +++ b/src/groups/mqb/mqbnet/mqbnet_clusterimp.h @@ -37,9 +37,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -90,7 +89,7 @@ class ClusterNodeImp : public ClusterNode { bmqp_ctrlmsg::ClientIdentity d_identity; - mwcio::Channel::ReadCallback d_readCb; + bmqio::Channel::ReadCallback d_readCb; bool d_isReading; // Indicates if post-negotiation read has @@ -129,9 +128,9 @@ class ClusterNodeImp : public ClusterNode { /// return a pointer to this object. Store the specified `identity`. /// The specified `readCb` serves as read data callback when /// `enableRead` is called. - ClusterNode* setChannel(const bsl::weak_ptr& value, + ClusterNode* setChannel(const bsl::weak_ptr& value, const bmqp_ctrlmsg::ClientIdentity& identity, - const mwcio::Channel::ReadCallback& readCb) + const bmqio::Channel::ReadCallback& readCb) BSLS_KEYWORD_OVERRIDE; /// Start reading from the channel. Return true if `read` is successful @@ -324,7 +323,7 @@ class ClusterImp : public Cluster { /// Process incoming proxy connection. void - onProxyConnectionUp(const bsl::shared_ptr& channel, + onProxyConnectionUp(const bsl::shared_ptr& channel, const bmqp_ctrlmsg::ClientIdentity& identity, const bsl::string& description) BSLS_KEYWORD_OVERRIDE; diff --git a/src/groups/mqb/mqbnet/mqbnet_dummysession.cpp b/src/groups/mqb/mqbnet/mqbnet_dummysession.cpp index 340e64fc1..b51b8a75e 100644 --- a/src/groups/mqb/mqbnet/mqbnet_dummysession.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_dummysession.cpp @@ -30,7 +30,7 @@ namespace mqbnet { // ------------------ DummySession::DummySession( - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bmqp_ctrlmsg::NegotiationMessage& negotiationMessage, ClusterNode* clusterNode, const bsl::string& description, diff --git a/src/groups/mqb/mqbnet/mqbnet_dummysession.h b/src/groups/mqb/mqbnet/mqbnet_dummysession.h index 8c192c827..b5ba9bf15 100644 --- a/src/groups/mqb/mqbnet/mqbnet_dummysession.h +++ b/src/groups/mqb/mqbnet/mqbnet_dummysession.h @@ -24,7 +24,7 @@ // //@DESCRIPTION: The channel and session factory framework requires creation of // a 'mqbnet::Session' object that is associated to the created -// 'mwcio::Channel'. This session's lifecycle is tied to the one of the +// 'bmqio::Channel'. This session's lifecycle is tied to the one of the // channel and usually is in charge of processing the reads. When creating a // cluster, we actually want to have a higher level object // ('mqbnet::ClusterNode') that will be associated to a channel, but which @@ -56,7 +56,7 @@ namespace BloombergLP { namespace bmqp_ctrlmsg { class NegotiationMessage; } -namespace mwcio { +namespace bmqio { class Channel; } @@ -77,7 +77,7 @@ class DummySession : public Session { private: // DATA - bsl::shared_ptr d_channel_sp; + bsl::shared_ptr d_channel_sp; // Channel associated to this session. bmqp_ctrlmsg::NegotiationMessage d_negotiationMessage; @@ -109,7 +109,7 @@ class DummySession : public Session { /// `negotiationMessage`, `clusterNode` and having the specified /// `description`. Use the specified `allocator` for any memory /// allocation. - DummySession(const bsl::shared_ptr& channel, + DummySession(const bsl::shared_ptr& channel, const bmqp_ctrlmsg::NegotiationMessage& negotiationMessage, ClusterNode* clusterNode, const bsl::string& description, @@ -158,7 +158,7 @@ class DummySession : public Session { // (virtual: mqbnet::Session) /// Return the channel associated to this session. - bsl::shared_ptr channel() const BSLS_KEYWORD_OVERRIDE; + bsl::shared_ptr channel() const BSLS_KEYWORD_OVERRIDE; /// Return the clusterNode associated to this session, or 0 if there are /// none. @@ -184,7 +184,7 @@ class DummySession : public Session { // class DummySession // ------------------ -inline bsl::shared_ptr DummySession::channel() const +inline bsl::shared_ptr DummySession::channel() const { return d_channel_sp; } diff --git a/src/groups/mqb/mqbnet/mqbnet_dummysession.t.cpp b/src/groups/mqb/mqbnet/mqbnet_dummysession.t.cpp index 2c5c69161..b4ca99870 100644 --- a/src/groups/mqb/mqbnet/mqbnet_dummysession.t.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_dummysession.t.cpp @@ -22,8 +22,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -31,7 +30,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -43,7 +42,7 @@ using namespace bsl; static void test1_BreathingTest() { - mwctst::TestHelper::printTestName("BreathingTest"); + bmqtst::TestHelper::printTestName("BreathingTest"); // Create some needed dummy/mocked objects bsl::string description("DummyDescription", s_allocator_p); @@ -67,7 +66,7 @@ static void test1_BreathingTest() &itemPool, s_allocator_p); - bsl::shared_ptr testChannel; + bsl::shared_ptr testChannel; testChannel.createInplace(s_allocator_p); // Create a test object @@ -103,7 +102,7 @@ static void test1_BreathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -116,5 +115,5 @@ int main(int argc, char* argv[]) // NOTE: Can't check default allocation because of BALL logging from // constructor/desctructor of the object under test. - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbnet/mqbnet_elector.cpp b/src/groups/mqb/mqbnet/mqbnet_elector.cpp index e765a8775..5b6f71798 100644 --- a/src/groups/mqb/mqbnet/mqbnet_elector.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_elector.cpp @@ -22,10 +22,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -471,7 +470,7 @@ void ElectorStateMachine::applyLeaderHeartbeatEventToFollower( d_leaderNodeId = sourceNodeId; d_tentativeLeaderNodeId = k_INVALID_NODE_ID; d_reason = ElectorTransitionReason::e_NONE; - d_lastLeaderHeartbeatTime = mwcsys::Time::highResolutionTimer(); + d_lastLeaderHeartbeatTime = bmqsys::Time::highResolutionTimer(); d_scoutingInfo.reset(); // Indicate elector to schedule a recurring heart beat check event, @@ -488,7 +487,7 @@ void ElectorStateMachine::applyLeaderHeartbeatEventToFollower( if (sourceNodeId == d_leaderNodeId) { // This follower already knows about this leader BSLS_ASSERT_SAFE(k_INVALID_NODE_ID == d_tentativeLeaderNodeId); - d_lastLeaderHeartbeatTime = mwcsys::Time::highResolutionTimer(); + d_lastLeaderHeartbeatTime = bmqsys::Time::highResolutionTimer(); // No state change return; // RETURN @@ -502,7 +501,7 @@ void ElectorStateMachine::applyLeaderHeartbeatEventToFollower( d_tentativeLeaderNodeId = k_INVALID_NODE_ID; d_leaderNodeId = sourceNodeId; d_reason = ElectorTransitionReason::e_NONE; - d_lastLeaderHeartbeatTime = mwcsys::Time::highResolutionTimer(); + d_lastLeaderHeartbeatTime = bmqsys::Time::highResolutionTimer(); d_scoutingInfo.reset(); // Indicate elector to schedule a recurring heart beat check event, @@ -568,7 +567,7 @@ void ElectorStateMachine::applyLeaderHeartbeatEventToFollower( d_leaderNodeId = sourceNodeId; d_term = term; d_reason = ElectorTransitionReason::e_NONE; - d_lastLeaderHeartbeatTime = mwcsys::Time::highResolutionTimer(); + d_lastLeaderHeartbeatTime = bmqsys::Time::highResolutionTimer(); d_scoutingInfo.reset(); // Indicate elector to schedule a recurring heart beat check event, and to @@ -618,7 +617,7 @@ void ElectorStateMachine::applyLeaderHeartbeatEventToCandidate( d_tentativeLeaderNodeId = k_INVALID_NODE_ID; d_leaderNodeId = sourceNodeId; d_reason = ElectorTransitionReason::e_NONE; - d_lastLeaderHeartbeatTime = mwcsys::Time::highResolutionTimer(); + d_lastLeaderHeartbeatTime = bmqsys::Time::highResolutionTimer(); // Indicate elector to schedule a recurring heart beat check event. out->setTimer(ElectorTimerEventType::e_HEARTBEAT_CHECK_TIMER); @@ -666,7 +665,7 @@ void ElectorStateMachine::applyLeaderHeartbeatEventToLeader( d_term = term; d_tentativeLeaderNodeId = k_INVALID_NODE_ID; d_leaderNodeId = sourceNodeId; - d_lastLeaderHeartbeatTime = mwcsys::Time::highResolutionTimer(); + d_lastLeaderHeartbeatTime = bmqsys::Time::highResolutionTimer(); d_reason = ElectorTransitionReason::e_NONE; // TBD: specify 'e_LEADER_PREEMPTED' as the reason, instead of 'e_NONE' ? @@ -728,7 +727,7 @@ void ElectorStateMachine::applyElectionProposalEventToFollower( d_term = term; d_tentativeLeaderNodeId = sourceNodeId; d_leaderNodeId = k_INVALID_NODE_ID; - d_lastLeaderHeartbeatTime = mwcsys::Time::highResolutionTimer(); + d_lastLeaderHeartbeatTime = bmqsys::Time::highResolutionTimer(); d_scoutingInfo.reset(); } @@ -764,7 +763,7 @@ void ElectorStateMachine::applyElectionProposalEventToCandidate( d_leaderNodeId = k_INVALID_NODE_ID; d_tentativeLeaderNodeId = sourceNodeId; d_reason = ElectorTransitionReason::e_ELECTION_PREEMPTED; - d_lastLeaderHeartbeatTime = mwcsys::Time::highResolutionTimer(); + d_lastLeaderHeartbeatTime = bmqsys::Time::highResolutionTimer(); d_supporters.clear(); // Indicate state change. @@ -1428,7 +1427,7 @@ void ElectorStateMachine::applyHeartbeatCheckTimerEvent( BSLS_ASSERT(d_supporters.empty()); - bsls::Types::Int64 currTime = mwcsys::Time::highResolutionTimer(); + bsls::Types::Int64 currTime = bmqsys::Time::highResolutionTimer(); if ((currTime - d_lastLeaderHeartbeatTime) < d_leaderInactivityInterval) { // Received heart beat from leader within the configured time interval. // No state change. @@ -1941,7 +1940,7 @@ void Elector::scheduleTimer(ElectorTimerEventType::Enum type) switch (type) { case ElectorTimerEventType::e_INITIAL_WAIT_TIMER: { - bsls::TimeInterval after(mwcsys::Time::nowMonotonicClock()); + bsls::TimeInterval after(bmqsys::Time::nowMonotonicClock()); after.addMilliseconds(d_config.initialWaitTimeoutMs()); d_scheduler.scheduleEvent( @@ -1957,7 +1956,7 @@ void Elector::scheduleTimer(ElectorTimerEventType::Enum type) int randomMs = bsl::rand() % (d_config.maxRandomWaitTimeoutMs() + 1); - bsls::TimeInterval after(mwcsys::Time::nowMonotonicClock()); + bsls::TimeInterval after(bmqsys::Time::nowMonotonicClock()); after.addMilliseconds(randomMs); d_scheduler.scheduleEvent( @@ -1968,7 +1967,7 @@ void Elector::scheduleTimer(ElectorTimerEventType::Enum type) case ElectorTimerEventType::e_ELECTION_RESULT_TIMER: { // Schedule election timer - bsls::TimeInterval after(mwcsys::Time::nowMonotonicClock()); + bsls::TimeInterval after(bmqsys::Time::nowMonotonicClock()); after.addMilliseconds(d_config.electionResultTimeoutMs()); d_scheduler.scheduleEvent( @@ -2000,7 +1999,7 @@ void Elector::scheduleTimer(ElectorTimerEventType::Enum type) } break; // BREAK case ElectorTimerEventType::e_SCOUTING_RESULT_TIMER: { - bsls::TimeInterval after(mwcsys::Time::nowMonotonicClock()); + bsls::TimeInterval after(bmqsys::Time::nowMonotonicClock()); after.addMilliseconds(d_config.scoutingResultTimeoutMs()); d_scheduler.scheduleEvent( @@ -2233,13 +2232,13 @@ Elector::Elector(mqbcfg::ElectorConfig& config, d_state.setTerm(initialTerm); - if (mwcsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { + if (bmqsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { // Per scheduler's contract, it's ok to schedule events before its // started. d_scheduler.scheduleEvent( bsls::TimeInterval(0, 0), // now - bdlf::BindUtil::bind(&mwcsys::ThreadUtil::setCurrentThreadName, + bdlf::BindUtil::bind(&bmqsys::ThreadUtil::setCurrentThreadName, "bmqSchedElec")); } } @@ -2336,7 +2335,7 @@ int Elector::start() // is enabled // Schedule initial wait timer and return success - bsls::TimeInterval after(mwcsys::Time::nowMonotonicClock()); + bsls::TimeInterval after(bmqsys::Time::nowMonotonicClock()); after.addMilliseconds(d_config.initialWaitTimeoutMs()); d_scheduler.scheduleEvent( @@ -2460,7 +2459,7 @@ int Elector::processCommand(mqbcmd::ElectorResult* electorResult, if (bdlb::StringRefUtil::areEqualCaseless(tunable.name(), "QUORUM")) { if (!tunable.value().isTheIntegerValue() || tunable.value().theInteger() < 0) { - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "The QUORUM tunable must be a non-negative integer, " "but instead the following was specified: " << tunable.value(); @@ -2482,7 +2481,7 @@ int Elector::processCommand(mqbcmd::ElectorResult* electorResult, return 0; // RETURN } - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "Unknown tunable name '" << tunable.name() << "'"; electorResult->makeError(); electorResult->error().message() = output.str(); @@ -2497,7 +2496,7 @@ int Elector::processCommand(mqbcmd::ElectorResult* electorResult, return 0; // RETURN } - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "Unsupported tunable '" << tunable << "': Issue the " << "LIST_TUNABLES command for the list of supported tunables."; electorResult->makeError(); @@ -2515,7 +2514,7 @@ int Elector::processCommand(mqbcmd::ElectorResult* electorResult, return 0; // RETURN } - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "Unknown command '" << command << "'"; electorResult->makeError(); electorResult->error().message() = output.str(); diff --git a/src/groups/mqb/mqbnet/mqbnet_elector.t.cpp b/src/groups/mqb/mqbnet/mqbnet_elector.t.cpp index 1e783f0e7..aa85907f2 100644 --- a/src/groups/mqb/mqbnet/mqbnet_elector.t.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_elector.t.cpp @@ -19,9 +19,8 @@ // MQB #include -// MWC -#include -#include +#include +#include // BDE #include @@ -31,7 +30,7 @@ #include // TEST DRIVER -#include +#include using namespace BloombergLP; using namespace bsl; @@ -48,7 +47,7 @@ using namespace BloombergLP::mqbnet; namespace { /// Elector clock with static storage used in various test cases -static mwcsys::MockTime* s_electorClock; +static bmqsys::MockTime* s_electorClock; // ==================== // struct ExpectedState @@ -179,7 +178,7 @@ static void test1_breathingTest() // Dormant -> Follower -> Candidate -> Leader // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { PV("Ensure constants values"); @@ -253,7 +252,7 @@ static void test2() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 2"); + bmqtst::TestHelper::printTestName("TEST 2"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -406,7 +405,7 @@ static void test3() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 3"); + bmqtst::TestHelper::printTestName("TEST 3"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -546,7 +545,7 @@ static void test4() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 4"); + bmqtst::TestHelper::printTestName("TEST 4"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -851,7 +850,7 @@ static void test5() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 5"); + bmqtst::TestHelper::printTestName("TEST 5"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -1001,7 +1000,7 @@ static void test6() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 6"); + bmqtst::TestHelper::printTestName("TEST 6"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -1188,7 +1187,7 @@ static void test7() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 7"); + bmqtst::TestHelper::printTestName("TEST 7"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -1340,7 +1339,7 @@ static void test8() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 8"); + bmqtst::TestHelper::printTestName("TEST 8"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -1490,7 +1489,7 @@ static void test9() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 9"); + bmqtst::TestHelper::printTestName("TEST 9"); const int k_SELFID = 0; const int k_QUORUM = 1; @@ -1566,7 +1565,7 @@ static void test10() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 10"); + bmqtst::TestHelper::printTestName("TEST 10"); const int k_SELFID = 0; const int k_QUORUM = 1; @@ -1651,7 +1650,7 @@ static void test11() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 11"); + bmqtst::TestHelper::printTestName("TEST 11"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -1819,7 +1818,7 @@ static void test12() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 12"); + bmqtst::TestHelper::printTestName("TEST 12"); const int k_SELFID = 0; const int k_QUORUM = 4; @@ -1876,7 +1875,7 @@ static void test13() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 13"); + bmqtst::TestHelper::printTestName("TEST 13"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -1953,7 +1952,7 @@ static void test14() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 14"); + bmqtst::TestHelper::printTestName("TEST 14"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -2065,7 +2064,7 @@ static void test15() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 15"); + bmqtst::TestHelper::printTestName("TEST 15"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -2152,7 +2151,7 @@ static void test16() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 16"); + bmqtst::TestHelper::printTestName("TEST 16"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -2256,7 +2255,7 @@ static void test17() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 17"); + bmqtst::TestHelper::printTestName("TEST 17"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -2360,7 +2359,7 @@ static void test18() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 18"); + bmqtst::TestHelper::printTestName("TEST 18"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -2454,7 +2453,7 @@ static void test19() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 19"); + bmqtst::TestHelper::printTestName("TEST 19"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -2529,7 +2528,7 @@ static void test20() // Logging infrastructure allocates using the default allocator, and // that logging is beyond the control of this function. - mwctst::TestHelper::printTestName("TEST 20"); + bmqtst::TestHelper::printTestName("TEST 20"); const int k_SELFID = 0; const int k_QUORUM = 3; @@ -2666,12 +2665,12 @@ static void test20() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); using namespace mqbnet; // Setup the test clock (once per task) - s_electorClock = new (*s_allocator_p) mwcsys::MockTime; + s_electorClock = new (*s_allocator_p) bmqsys::MockTime; switch (_testCase) { case 0: @@ -2703,5 +2702,5 @@ int main(int argc, char* argv[]) s_allocator_p->deallocate(s_electorClock); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbnet/mqbnet_mockcluster.cpp b/src/groups/mqb/mqbnet/mqbnet_mockcluster.cpp index 7b26d7ec4..842a6472f 100644 --- a/src/groups/mqb/mqbnet/mqbnet_mockcluster.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_mockcluster.cpp @@ -19,7 +19,7 @@ #include // BMQ #include -#include +#include // BDE #include @@ -53,7 +53,7 @@ MockClusterNode::MockClusterNode(MockCluster* cluster, BSLS_ASSERT_SAFE(d_cluster_p && "A ClusterNode should always be part of a Cluster"); - mwcu::MemOutStream osstr; + bmqu::MemOutStream osstr; osstr << "[" << hostName() << ", " << nodeId() << "]"; d_description.assign(osstr.str().data(), osstr.str().length()); } @@ -64,9 +64,9 @@ MockClusterNode::~MockClusterNode() } ClusterNode* -MockClusterNode::setChannel(const bsl::weak_ptr& value, +MockClusterNode::setChannel(const bsl::weak_ptr& value, const bmqp_ctrlmsg::ClientIdentity& identity, - const mwcio::Channel::ReadCallback& readCb) + const bmqio::Channel::ReadCallback& readCb) { // Save the value d_channel.setChannel(value); @@ -81,7 +81,7 @@ MockClusterNode::setChannel(const bsl::weak_ptr& value, bool MockClusterNode::enableRead() { - const bsl::shared_ptr channelSp = d_channel.channel(); + const bsl::shared_ptr channelSp = d_channel.channel(); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!channelSp)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; return false; // RETURN @@ -91,7 +91,7 @@ bool MockClusterNode::enableRead() return true; // RETURN } - mwcio::Status readStatus; + bmqio::Status readStatus; channelSp->read(&readStatus, bmqp::Protocol::k_PACKET_MIN_SIZE, d_readCb); if (!readStatus) { @@ -260,7 +260,7 @@ void MockCluster::enableRead() } void MockCluster::onProxyConnectionUp( - BSLS_ANNOTATION_UNUSED const bsl::shared_ptr& channel, + BSLS_ANNOTATION_UNUSED const bsl::shared_ptr& channel, BSLS_ANNOTATION_UNUSED const bmqp_ctrlmsg::ClientIdentity& identity, BSLS_ANNOTATION_UNUSED const bsl::string& description) { diff --git a/src/groups/mqb/mqbnet/mqbnet_mockcluster.h b/src/groups/mqb/mqbnet/mqbnet_mockcluster.h index fefe93512..c68ca501c 100644 --- a/src/groups/mqb/mqbnet/mqbnet_mockcluster.h +++ b/src/groups/mqb/mqbnet/mqbnet_mockcluster.h @@ -33,9 +33,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -78,7 +77,7 @@ class MockClusterNode : public ClusterNode { bmqp_ctrlmsg::ClientIdentity d_identity; - mwcio::Channel::ReadCallback d_readCb; + bmqio::Channel::ReadCallback d_readCb; bool d_isReading; // Indicates if post-negotiation read @@ -117,9 +116,9 @@ class MockClusterNode : public ClusterNode { /// return a pointer to this object. Store the specified `identity`. /// The specified `readCb` serves as read data callback when /// `enableRead` is called. - ClusterNode* setChannel(const bsl::weak_ptr& value, + ClusterNode* setChannel(const bsl::weak_ptr& value, const bmqp_ctrlmsg::ClientIdentity& identity, - const mwcio::Channel::ReadCallback& readCb) + const bmqio::Channel::ReadCallback& readCb) BSLS_KEYWORD_OVERRIDE; /// Start reading from the channel. Return true if `read` is successful @@ -299,7 +298,7 @@ class MockCluster : public Cluster { /// Process incoming proxy connection. void - onProxyConnectionUp(const bsl::shared_ptr& channel, + onProxyConnectionUp(const bsl::shared_ptr& channel, const bmqp_ctrlmsg::ClientIdentity& identity, const bsl::string& description) BSLS_KEYWORD_OVERRIDE; diff --git a/src/groups/mqb/mqbnet/mqbnet_multirequestmanager.h b/src/groups/mqb/mqbnet/mqbnet_multirequestmanager.h index 577ad3124..411de3e28 100644 --- a/src/groups/mqb/mqbnet/mqbnet_multirequestmanager.h +++ b/src/groups/mqb/mqbnet/mqbnet_multirequestmanager.h @@ -38,8 +38,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -197,7 +196,7 @@ class MultiRequestManager { private: // PRIVATE MANIPULATORS - static bmqt::GenericResult::Enum sendHelper(mwcio::Channel* channel, + static bmqt::GenericResult::Enum sendHelper(bmqio::Channel* channel, const bdlbb::Blob& blob); /// Create a `MultiRequestManagerRequestContext` object at the specified @@ -337,22 +336,22 @@ MultiRequestManagerRequestContext::response() const template inline bmqt::GenericResult::Enum MultiRequestManager::sendHelper( - mwcio::Channel* channel, + bmqio::Channel* channel, const bdlbb::Blob& blob) { - mwcio::Status status; + bmqio::Status status; channel->write(&status, blob); switch (status.category()) { - case mwcio::StatusCategory::e_SUCCESS: + case bmqio::StatusCategory::e_SUCCESS: return bmqt::GenericResult::e_SUCCESS; - case mwcio::StatusCategory::e_CONNECTION: + case bmqio::StatusCategory::e_CONNECTION: return bmqt::GenericResult::e_NOT_CONNECTED; - case mwcio::StatusCategory::e_LIMIT: + case bmqio::StatusCategory::e_LIMIT: return bmqt::GenericResult::e_NOT_READY; - case mwcio::StatusCategory::e_GENERIC_ERROR: - case mwcio::StatusCategory::e_TIMEOUT: - case mwcio::StatusCategory::e_CANCELED: + case bmqio::StatusCategory::e_GENERIC_ERROR: + case bmqio::StatusCategory::e_TIMEOUT: + case bmqio::StatusCategory::e_CANCELED: default: return bmqt::GenericResult::e_UNKNOWN; } return bmqt::GenericResult::e_UNKNOWN; @@ -474,7 +473,7 @@ void MultiRequestManager::sendRequest( (void)rc; // compiler happiness failure.code() = static_cast(sendRc); - mwcu::MemOutStream errorMsg; + bmqu::MemOutStream errorMsg; errorMsg << "Unable to send request to '" << targetDescription(it->first) << "' [reason: " << errorMsg.str() diff --git a/src/groups/mqb/mqbnet/mqbnet_multirequestmanager.t.cpp b/src/groups/mqb/mqbnet/mqbnet_multirequestmanager.t.cpp index 1df1abb4f..7ba1e4156 100644 --- a/src/groups/mqb/mqbnet/mqbnet_multirequestmanager.t.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_multirequestmanager.t.cpp @@ -30,8 +30,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -57,8 +56,8 @@ #include // TEST DRIVER -#include -#include +#include +#include // CONVENIENCE using namespace BloombergLP; @@ -99,7 +98,7 @@ typedef ReqManagerType::RequestSp ReqSp; typedef bsl::vector ReqVec; typedef bmqp_ctrlmsg::ControlMessageChoice ReqChoice; typedef bsl::unordered_set ReqChoiceSet; -typedef bsl::shared_ptr ChannelSp; +typedef bsl::shared_ptr ChannelSp; const bsls::TimeInterval SEND_REQUEST_TIMEOUT(30); const bsls::Types::Int64 WATERMARK = 64 * 1024 * 1024; @@ -139,7 +138,7 @@ class TestContext { Nodes d_nodes; // Cluster nodes used to send them request by MultiRequestManager - mwcu::TempDirectory d_tempDir; + bmqu::TempDirectory d_tempDir; // Temp directory needed for Cluster object bslma::Allocator* d_allocator_p; @@ -273,8 +272,8 @@ TestContext::TestContext(int nodesCount, bslma::Allocator* allocator) d_requestContextSp = d_multiRequestManager->createRequestContext(); d_requestContextSp->setDestinationNodes(d_nodes); - mwcsys::Time::shutdown(); - mwcsys::Time::initialize( + bmqsys::Time::shutdown(); + bmqsys::Time::initialize( bdlf::BindUtil::bind(&mqbmock::Cluster::getTime, d_cluster_mp.get()), bdlf::BindUtil::bind(&mqbmock::Cluster::getTime, d_cluster_mp.get()), bdlf::BindUtil::bind(&mqbmock::Cluster::getTimeInt64, @@ -366,7 +365,7 @@ Mes TestContext::createResponseCancel() Mes TestContext::getNextRequest(const ChannelSp& channel) { ASSERT(channel->waitFor(1, true, bsls::TimeInterval(1))); - mwcio::TestChannel::WriteCall wc = channel->popWriteCall(); + bmqio::TestChannel::WriteCall wc = channel->popWriteCall(); bmqp::Event ev(&wc.d_blob, d_allocator_p); ASSERT(ev.isControlEvent()); Mes controlMessage(d_allocator_p); @@ -455,7 +454,7 @@ static void test1_contextTest() // MultiRequestManagerRequestContext // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CONTEXT TEST"); + bmqtst::TestHelper::printTestName("CONTEXT TEST"); { ReqContextSp reqContext; @@ -469,7 +468,7 @@ static void test1_contextTest() mqbmock::Cluster::ClusterNodeDefs defs = TestContext::generateNodeDefs(5, s_allocator_p); bdlbb::PooledBlobBufferFactory blobBufferFactory(1024, s_allocator_p); - mwcu::TempDirectory tempDir(s_allocator_p); + bmqu::TempDirectory tempDir(s_allocator_p); mqbmock::Cluster cluster(&blobBufferFactory, s_allocator_p, true, // isClusterMember @@ -504,7 +503,7 @@ static void test2_creatorsTest() // MultiRequestManager::MultiRequestManager() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CREATORS TEST"); + bmqtst::TestHelper::printTestName("CREATORS TEST"); { // Null RequestManager pointer @@ -525,7 +524,7 @@ static void test3_sendRequestTest() // MultiRequestManager::sendRequest() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SEND REQUEST TEST"); + bmqtst::TestHelper::printTestName("SEND REQUEST TEST"); { // Send one request and check it was delivered @@ -537,7 +536,7 @@ static void test3_sendRequestTest() NodesIt it = context.nodes().begin(); for (; it != context.nodes().end(); ++it) { - ChannelSp ch = bsl::dynamic_pointer_cast( + ChannelSp ch = bsl::dynamic_pointer_cast( (*it)->channel().channel()); ASSERT(ch); // checking that MultiRequestManager has really sent the requests @@ -553,7 +552,7 @@ static void test4_handleResponseTest() // MultiRequestManager::response() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HANDLE RESPONSE TEST"); + bmqtst::TestHelper::printTestName("HANDLE RESPONSE TEST"); { // Successfully receive responses from all the nodes @@ -570,7 +569,7 @@ static void test4_handleResponseTest() responses.reserve(context.nodes().size()); NodesIt it = context.nodes().begin(); for (; it != context.nodes().end(); ++it) { - ChannelSp ch = bsl::dynamic_pointer_cast( + ChannelSp ch = bsl::dynamic_pointer_cast( (*it)->channel().channel()); ASSERT(ch); // checking that MultiRequestManager has really sent the requests @@ -665,7 +664,7 @@ static void test4_handleResponseTest() NodesIt it = context.nodes().begin(); for (; it != context.nodes().end(); ++it) { - ChannelSp ch = bsl::dynamic_pointer_cast( + ChannelSp ch = bsl::dynamic_pointer_cast( (*it)->channel().channel()); ASSERT(ch); // checking that MultiRequestManager has really sent the requests @@ -698,9 +697,9 @@ static void test4_handleResponseTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); - mwcsys::Time::initialize(s_allocator_p); + bmqsys::Time::initialize(s_allocator_p); bmqp::ProtocolUtil::initialize(s_allocator_p); switch (_testCase) { @@ -715,10 +714,10 @@ int main(int argc, char* argv[]) } break; } - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); bmqp::ProtocolUtil::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); // RETURN - // Default: EventQueue uses mwcex::BindUtil::bindExecute(), which uses + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); // RETURN + // Default: EventQueue uses bmqex::BindUtil::bindExecute(), which uses // default allocator. } diff --git a/src/groups/mqb/mqbnet/mqbnet_negotiator.h b/src/groups/mqb/mqbnet/mqbnet_negotiator.h index d0120a90c..07c1d5370 100644 --- a/src/groups/mqb/mqbnet/mqbnet_negotiator.h +++ b/src/groups/mqb/mqbnet/mqbnet_negotiator.h @@ -54,7 +54,7 @@ namespace BloombergLP { // FORWARD DECLARATION -namespace mwcio { +namespace bmqio { class Channel; } @@ -209,7 +209,7 @@ class Negotiator { /// `negotiationCb` may be invoked directly from inside the call to /// `negotiate`. virtual void negotiate(NegotiatorContext* context, - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const NegotiationCb& negotiationCb) = 0; }; diff --git a/src/groups/mqb/mqbnet/mqbnet_negotiator.t.cpp b/src/groups/mqb/mqbnet/mqbnet_negotiator.t.cpp index d8e4d1c65..ae042fa82 100644 --- a/src/groups/mqb/mqbnet/mqbnet_negotiator.t.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_negotiator.t.cpp @@ -19,15 +19,14 @@ // MQB #include -// MWC -#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -54,7 +53,7 @@ using namespace bsl; /// A test implementation of the `mqbnet::Negotiator` protocol struct NegotiatorTestImp : bsls::ProtocolTestImp { void negotiate(mqbnet::NegotiatorContext* context, - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const mqbnet::Negotiator::NegotiationCb& negotiationCb) BSLS_KEYWORD_OVERRIDE { @@ -118,7 +117,7 @@ static void test1_Negotiator() // PROTOCOL TEST // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Negotiator"); + bmqtst::TestHelper::printTestName("Negotiator"); PV("Creating a test object"); bsls::ProtocolTest testObj(s_verbosityLevel > 2); @@ -136,7 +135,7 @@ static void test1_Negotiator() PV("Verify that methods are public and virtual"); mqbnet::NegotiatorContext* dummyNegotiatorContext_p = 0; - bsl::shared_ptr dummyChannelSp; + bsl::shared_ptr dummyChannelSp; mqbnet::Negotiator::NegotiationCb dummyNegotiationCb; BSLS_PROTOCOLTEST_ASSERT(testObj, @@ -148,7 +147,7 @@ static void test1_Negotiator() static void test2_NegotiatorContext() { - mwctst::TestHelper::printTestName("NegotiatorContext"); + bmqtst::TestHelper::printTestName("NegotiatorContext"); { PV("Constructor"); @@ -200,7 +199,7 @@ static void test2_NegotiatorContext() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -212,5 +211,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbnet/mqbnet_session.h b/src/groups/mqb/mqbnet/mqbnet_session.h index a395bff47..4fe9d1c3f 100644 --- a/src/groups/mqb/mqbnet/mqbnet_session.h +++ b/src/groups/mqb/mqbnet/mqbnet_session.h @@ -44,7 +44,7 @@ namespace BloombergLP { namespace bmqp_ctrlmsg { class NegotiationMessage; } -namespace mwcio { +namespace bmqio { class Channel; } @@ -141,7 +141,7 @@ class Session : public SessionEventProcessor { virtual void invalidate() = 0; /// Return the channel associated to this session. - virtual bsl::shared_ptr channel() const = 0; + virtual bsl::shared_ptr channel() const = 0; /// Return the clusterNode associated to this session, or 0 if there are /// none. diff --git a/src/groups/mqb/mqbnet/mqbnet_session.t.cpp b/src/groups/mqb/mqbnet/mqbnet_session.t.cpp index bf19fe2a7..55f944496 100644 --- a/src/groups/mqb/mqbnet/mqbnet_session.t.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_session.t.cpp @@ -19,15 +19,14 @@ // BMQ #include -// MWC -#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -78,7 +77,7 @@ struct SessionTestImp : bsls::ProtocolTestImp { void invalidate() BSLS_KEYWORD_OVERRIDE { markDone(); } - bsl::shared_ptr channel() const BSLS_KEYWORD_OVERRIDE + bsl::shared_ptr channel() const BSLS_KEYWORD_OVERRIDE { return markDone(); } @@ -152,7 +151,7 @@ static void test1_SessionEventProcessor() // PROTOCOL TEST // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SessionEventProcessor"); + bmqtst::TestHelper::printTestName("SessionEventProcessor"); PV("Creating a test object"); bsls::ProtocolTest testObj(s_verbosityLevel > @@ -218,7 +217,7 @@ static void test2_Session() // PROTOCOL TEST // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Session"); + bmqtst::TestHelper::printTestName("Session"); PV("Creating a test object"); bsls::ProtocolTest testObj(s_verbosityLevel > 2); @@ -256,7 +255,7 @@ static void test2_Session() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -268,5 +267,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.cpp b/src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.cpp index 77512c42d..652321510 100644 --- a/src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.cpp @@ -37,20 +37,19 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -132,7 +131,7 @@ char calculateInitialMissedHbCounter(const mqbcfg::TcpInterfaceConfig& config) return -retVal; } -bsl::ostream& operator<<(bsl::ostream& os, const mwcio::Channel* channel) +bsl::ostream& operator<<(bsl::ostream& os, const bmqio::Channel* channel) { // 'pretty-print' the specified 'channel' to the specified 'os'. The // printed channel from that function includes the address of the channel @@ -153,9 +152,9 @@ bsl::ostream& operator<<(bsl::ostream& os, const mwcio::Channel* channel) /// a property on the channel, that higher levels (such as the /// `SessionNegotiator` can extract and leverage). void ntcChannelPreCreation( - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, BSLS_ANNOTATION_UNUSED const - bsl::shared_ptr& operationHandle) + bsl::shared_ptr& operationHandle) { ntsa::Endpoint peerEndpoint = channel->peerEndpoint(); ntsa::Endpoint sourceEndpoint = channel->sourceEndpoint(); @@ -206,30 +205,30 @@ ntcCreateInterfaceConfig(const mqbcfg::TcpInterfaceConfig& tcpConfig) /// Load into the specified `resolvedUri` the reverse-DNS resolved URI of /// the remote peer represented by the specified `baseChannel`. This is a /// thin wrapper around the default DNS resolution from -/// `mwcio::ResolvingChannelFactoryUtil` that just adds final resolution +/// `bmqio::ResolvingChannelFactoryUtil` that just adds final resolution /// logging with time instrumentation. void monitoredDNSResolution(bsl::string* resolvedUri, - const mwcio::Channel& baseChannel) + const bmqio::Channel& baseChannel) { - const bsls::Types::Int64 start = mwcsys::Time::highResolutionTimer(); + const bsls::Types::Int64 start = bmqsys::Time::highResolutionTimer(); - mwcio::ResolvingChannelFactoryUtil::defaultResolutionFn( + bmqio::ResolvingChannelFactoryUtil::defaultResolutionFn( resolvedUri, baseChannel, - &mwcio::ResolveUtil::getDomainName, + &bmqio::ResolveUtil::getDomainName, true); - const bsls::Types::Int64 end = mwcsys::Time::highResolutionTimer(); + const bsls::Types::Int64 end = bmqsys::Time::highResolutionTimer(); BALL_LOG_INFO << "Channel " << static_cast(&baseChannel) << " with remote peer " << baseChannel.peerUri() << " resolved to '" << *resolvedUri << "' (took: " - << mwcu::PrintUtil::prettyTimeInterval(end - start) << ", " + << bmqu::PrintUtil::prettyTimeInterval(end - start) << ", " << (end - start) << " nanoseconds)"; // NOTE: cast the channel to actually just print the address and not the // overload << operator. The channel's address printed here is that - // one of the 'mwcio::TcpChannel', while application will actually - // only see the 'mwcio::ResolvingChannelFactory_Channel'. + // one of the 'bmqio::TcpChannel', while application will actually + // only see the 'bmqio::ResolvingChannelFactory_Channel'. } bool isClientOrProxy(const mqbnet::Session* session) @@ -237,10 +236,10 @@ bool isClientOrProxy(const mqbnet::Session* session) return mqbnet::ClusterUtil::isClientOrProxy(session->negotiationMessage()); } -void stopChannelFactory(mwcio::ChannelFactory* channelFactory) +void stopChannelFactory(bmqio::ChannelFactory* channelFactory) { - mwcio::NtcChannelFactory* factory = - dynamic_cast(channelFactory); + bmqio::NtcChannelFactory* factory = + dynamic_cast(channelFactory); BSLS_ASSERT_SAFE(factory); factory->stop(); } @@ -284,25 +283,25 @@ struct TCPSessionFactory_OperationContext { // class TCPSessionFactory // ----------------------- -bslma::ManagedPtr +bslma::ManagedPtr TCPSessionFactory::channelStatContextCreator( - const bsl::shared_ptr& channel, - const bsl::shared_ptr& handle) + const bsl::shared_ptr& channel, + const bsl::shared_ptr& handle) { int peerAddress; channel->properties().load(&peerAddress, k_CHANNEL_PROPERTY_PEER_IP); ntsa::Ipv4Address ipv4Address(static_cast(peerAddress)); ntsa::IpAddress ipAddress(ipv4Address); - mwcst::StatContext* parent = d_statController_p->channelsStatContext( - mwcio::ChannelUtil::isLocalHost(ipAddress) + bmqst::StatContext* parent = d_statController_p->channelsStatContext( + bmqio::ChannelUtil::isLocalHost(ipAddress) ? mqbstat::StatController::ChannelSelector::e_LOCAL : mqbstat::StatController::ChannelSelector::e_REMOTE); BSLS_ASSERT_SAFE(parent); bsl::string endpoint = - handle->options().is() - ? handle->options().the().endpoint() + handle->options().is() + ? handle->options().the().endpoint() : channel->peerUri(); int localPort; @@ -317,7 +316,7 @@ TCPSessionFactory::channelStatContextCreator( } void TCPSessionFactory::negotiate( - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bsl::shared_ptr& context) { // executed by one of the *IO* threads @@ -352,7 +351,7 @@ void TCPSessionFactory::negotiate( negotiatorContextSp)); } -void TCPSessionFactory::readCallback(const mwcio::Status& status, +void TCPSessionFactory::readCallback(const bmqio::Status& status, int* numNeeded, bdlbb::Blob* blob, ChannelInfo* channelInfo) @@ -360,7 +359,7 @@ void TCPSessionFactory::readCallback(const mwcio::Status& status, // executed by one of the *IO* threads if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( - status.category() == mwcio::StatusCategory::e_CANCELED)) { + status.category() == bmqio::StatusCategory::e_CANCELED)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; // There is nothing to do in the event of a 'e_CANCELED' event, so // simply return. @@ -369,13 +368,13 @@ void TCPSessionFactory::readCallback(const mwcio::Status& status, } if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY( - status.category() == mwcio::StatusCategory::e_CONNECTION)) { + status.category() == bmqio::StatusCategory::e_CONNECTION)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; // There is a slight difference in behavior between BTE and NTZ when // the peer shuts down the connection. BTE implicitly calls channel // close(), and vast majority of the time does not trigger a read - // callback with CLOSED event (translated to a mwcio e_CONNECTION event - // by mwcio::Channel); OTH, NTZ always trigger a CLOSED event, but + // callback with CLOSED event (translated to a bmqio e_CONNECTION event + // by bmqio::Channel); OTH, NTZ always trigger a CLOSED event, but // doesn't call close(). We explicitly call close() on the channel // here to preserve the same behavior in NTZ as BTE and prevent a // warning from being logged. @@ -407,7 +406,7 @@ void TCPSessionFactory::readCallback(const mwcio::Status& status, bsl::vector readBlobs(&lsa); readBlobs.reserve(32); - const int rc = mwcio::ChannelUtil::handleRead(&readBlobs, numNeeded, blob); + const int rc = bmqio::ChannelUtil::handleRead(&readBlobs, numNeeded, blob); // NOTE: The blobs in readBlobs will be created using the vector's // allocator, which is LSA, but that is ok because the blobs at the // end are passed as pointer (through bmqp::Event) to the @@ -420,7 +419,7 @@ void TCPSessionFactory::readCallback(const mwcio::Status& status, << ": ReadCallback unrecoverable error " << "[status: " << status << ", channel: '" << channelInfo->d_channel_p << "']:\n" - << mwcu::BlobStartHexDumper(blob); + << bmqu::BlobStartHexDumper(blob); // Nothing much we can do, close the channel channelInfo->d_channel_p->close(); @@ -443,7 +442,7 @@ void TCPSessionFactory::readCallback(const mwcio::Status& status, BALL_LOG_TRACE << channelInfo->d_session_sp->description() << ": ReadCallback got a blob\n" - << mwcu::BlobStartHexDumper(&readBlob); + << bmqu::BlobStartHexDumper(&readBlob); bmqp::Event event(&readBlob, d_allocator_p); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!event.isValid())) { @@ -452,7 +451,7 @@ void TCPSessionFactory::readCallback(const mwcio::Status& status, BALL_LOG_ERROR << "#TCP_INVALID_PACKET " << channelInfo->d_session_sp->description() << ": Received an invalid packet:\n" - << mwcu::BlobStartHexDumper(&readBlob); + << bmqu::BlobStartHexDumper(&readBlob); continue; // CONTINUE } @@ -488,7 +487,7 @@ void TCPSessionFactory::negotiationComplete( int statusCode, const bsl::string& errorDescription, const bsl::shared_ptr& session, - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bsl::shared_ptr& context, const bsl::shared_ptr& negotiatorContext) { @@ -501,14 +500,14 @@ void TCPSessionFactory::negotiationComplete( << "', status: " << statusCode << ", error: '" << errorDescription << "']"; - mwcio::Status status(mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::Status status(bmqio::StatusCategory::e_GENERIC_ERROR, "negotiationError", statusCode, d_allocator_p); channel->close(status); bdlma::LocalSequentialAllocator<64> localAlloc(d_allocator_p); - mwcu::MemOutStream logStream(&localAlloc); + bmqu::MemOutStream logStream(&localAlloc); logStream << "[channel: '" << channel.get() << "]"; logOpenSessionTime(logStream.str(), channel); return; // RETURN @@ -564,7 +563,7 @@ void TCPSessionFactory::negotiationComplete( info->d_missedHeartbeatCounter = d_initialMissedHeartbeatCounter; // See comments in 'calculateInitialMissedHbCounter'. - bsl::pair toInsert(channel.get(), + bsl::pair toInsert(channel.get(), info); inserted = d_channels.insert(toInsert); info = inserted.first->second; @@ -577,8 +576,8 @@ void TCPSessionFactory::negotiationComplete( // Do not initiate reading from the channel. Transport observer(s) will // enable the read when they are ready. bool result = context->d_resultCb( - mwcio::ChannelFactoryEvent::e_CHANNEL_UP, - mwcio::Status(), + bmqio::ChannelFactoryEvent::e_CHANNEL_UP, + bmqio::Status(), monitoredSession, negotiatorContext->cluster(), negotiatorContext->resultState(), @@ -590,7 +589,7 @@ void TCPSessionFactory::negotiationComplete( info.get())); if (!result || !d_isListening) { - // TODO: Revisit if still needed, following move to mwcio. + // TODO: Revisit if still needed, following move to bmqio. // // If 'stopListening' have been called, 'tearDown' may or may not // have been called, depending whether the 'callback' has been @@ -659,17 +658,17 @@ void TCPSessionFactory::onSessionDestroyed( } void TCPSessionFactory::channelStateCallback( - mwcio::ChannelFactoryEvent::Enum event, - const mwcio::Status& status, - const bsl::shared_ptr& channel, + bmqio::ChannelFactoryEvent::Enum event, + const bmqio::Status& status, + const bsl::shared_ptr& channel, const bsl::shared_ptr& context) { // This function (over time) will be executed by each of the IO threads. // This is an infrequent enough operation (compared to a 'readCb') that it // is fine to do this here (since we have no other ways to // proactively-execute code in the IO threads created by the channelPool). - if (mwcsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { - mwcsys::ThreadUtil::setCurrentThreadNameOnce(d_threadName); + if (bmqsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { + bmqsys::ThreadUtil::setCurrentThreadNameOnce(d_threadName); } BALL_LOG_TRACE << "TCPSessionFactory '" << d_config.name() @@ -678,7 +677,7 @@ void TCPSessionFactory::channelStateCallback( << "', " << d_nbActiveChannels << " active channels]"; switch (event) { - case mwcio::ChannelFactoryEvent::e_CHANNEL_UP: { + case bmqio::ChannelFactoryEvent::e_CHANNEL_UP: { BSLS_ASSERT_SAFE(status); // got a channel up, it must be success BSLS_ASSERT_SAFE(channel); @@ -688,18 +687,18 @@ void TCPSessionFactory::channelStateCallback( << "rejecting empty peer URI: '" << channel.get() << "'"; - mwcio::Status closeStatus(mwcio::StatusCategory::e_GENERIC_ERROR, + bmqio::Status closeStatus(bmqio::StatusCategory::e_GENERIC_ERROR, d_allocator_p); channel->close(closeStatus); } else { { // Save begin session timestamp // TODO: it's possible to store this timestamp directly in one - // of the mwcio::Channel implementations, so we don't need a + // of the bmqio::Channel implementations, so we don't need a // mutex synchronization for them at all. bslmt::LockGuard guard(&d_mutex); // LOCK d_timestampMap[channel.get()] = - mwcsys::Time::highResolutionTimer(); + bmqsys::Time::highResolutionTimer(); } // close mutex lock guard // UNLOCK // Keep track of active channels, for logging purposes @@ -710,15 +709,15 @@ void TCPSessionFactory::channelStateCallback( &TCPSessionFactory::onClose, this, channel, - bdlf::PlaceHolders::_1 /* mwcio::Status */)); + bdlf::PlaceHolders::_1 /* bmqio::Status */)); negotiate(channel, context); } } break; - case mwcio::ChannelFactoryEvent::e_CONNECT_ATTEMPT_FAILED: { + case bmqio::ChannelFactoryEvent::e_CONNECT_ATTEMPT_FAILED: { // Nothing } break; - case mwcio::ChannelFactoryEvent::e_CONNECT_FAILED: { + case bmqio::ChannelFactoryEvent::e_CONNECT_FAILED: { // This means the session in 'listen' or 'connect' failed to // negotiate (maybe rejected by the remote peer..) context->d_resultCb(event, @@ -726,13 +725,13 @@ void TCPSessionFactory::channelStateCallback( bsl::shared_ptr(), 0, // Cluster* context->d_resultState_p, - mwcio::Channel::ReadCallback()); + bmqio::Channel::ReadCallback()); } break; } } -void TCPSessionFactory::onClose(const bsl::shared_ptr& channel, - const mwcio::Status& status) +void TCPSessionFactory::onClose(const bsl::shared_ptr& channel, + const bmqio::Status& status) { --d_nbActiveChannels; @@ -792,7 +791,7 @@ void TCPSessionFactory::onClose(const bsl::shared_ptr& channel, // TearDown the session int isBrokerShutdown = false; - if (status.category() == mwcio::StatusCategory::e_SUCCESS) { + if (status.category() == bmqio::StatusCategory::e_SUCCESS) { status.properties().load(&isBrokerShutdown, k_CHANNEL_STATUS_CLOSE_REASON); } @@ -805,7 +804,7 @@ void TCPSessionFactory::onHeartbeatSchedulerEvent() { // executed by the *SCHEDULER* thread - bsl::unordered_map::const_iterator it; + bsl::unordered_map::const_iterator it; for (it = d_heartbeatChannels.begin(); it != d_heartbeatChannels.end(); ++it) { ChannelInfo* info = it->second; @@ -836,7 +835,7 @@ void TCPSessionFactory::onHeartbeatSchedulerEvent() // 'incoming' traffic). But this can't be done with current design // as we don't have access to the lower level channel 'write' // wrapper, allowing us to capture all sent out traffic; once - // dmcsbte is forked into mwc, smart-heartbeat technology can be + // dmcsbte is forked into bmq, smart-heartbeat technology can be // embedded into it: the new channel will keep track of its own // metric (in/out bytes and packets) which can be leveraged to // detect if the channel is idle. @@ -895,7 +894,7 @@ void TCPSessionFactory::disableHeartbeat( void TCPSessionFactory::logOpenSessionTime( const bsl::string& sessionDescription, - const bsl::shared_ptr& channel) + const bsl::shared_ptr& channel) { bsls::Types::Int64 begin = 0; { @@ -913,10 +912,10 @@ void TCPSessionFactory::logOpenSessionTime( BALL_LOG_INFO_BLOCK { const bsls::Types::Int64 elapsed = - mwcsys::Time::highResolutionTimer() - begin; + bmqsys::Time::highResolutionTimer() - begin; BALL_LOG_OUTPUT_STREAM << "Open session '" << sessionDescription - << "' took: " << mwcu::PrintUtil::prettyTimeInterval(elapsed) + << "' took: " << bmqu::PrintUtil::prettyTimeInterval(elapsed) << " (" << elapsed << " nanoseconds)"; } } @@ -964,7 +963,7 @@ TCPSessionFactory::TCPSessionFactory( // Resolve the default address of this host bsl::string hostname; - ntsa::Error error = mwcio::ResolveUtil::getHostname(&hostname); + ntsa::Error error = bmqio::ResolveUtil::getHostname(&hostname); if (error.code() != ntsa::Error::e_OK) { BALL_LOG_ERROR << "Failed to get local hostname, error: " << error; BSLS_ASSERT_OPT(false && "Failed to get local host name"); @@ -972,7 +971,7 @@ TCPSessionFactory::TCPSessionFactory( } ntsa::Ipv4Address defaultIP; - error = mwcio::ResolveUtil::getIpAddress(&defaultIP, hostname); + error = bmqio::ResolveUtil::getIpAddress(&defaultIP, hostname); if (error.code() != ntsa::Error::e_OK) { BALL_LOG_ERROR << "Failed to get IP address of the host '" << hostname << "' error: " << error; @@ -1014,9 +1013,9 @@ int TCPSessionFactory::start(bsl::ostream& errorDescription) ntca::InterfaceConfig interfaceConfig = ntcCreateInterfaceConfig(d_config); - bslma::ManagedPtr channelFactory; + bslma::ManagedPtr channelFactory; channelFactory.load(new (*d_allocator_p) - mwcio::NtcChannelFactory(interfaceConfig, + bmqio::NtcChannelFactory(interfaceConfig, d_blobBufferFactory_p, d_allocator_p), d_allocator_p); @@ -1040,16 +1039,16 @@ int TCPSessionFactory::start(bsl::ostream& errorDescription) d_tcpChannelFactory_mp.get())); bslmt::ThreadAttributes attributes = - mwcsys::ThreadUtil::defaultAttributes(); + bmqsys::ThreadUtil::defaultAttributes(); attributes.setThreadName("bmqDNSResolver"); rc = d_resolutionContext.start(attributes); BSLS_ASSERT_SAFE(rc == 0); d_resolvingChannelFactory_mp.load( - new (*d_allocator_p) mwcio::ResolvingChannelFactory( - mwcio::ResolvingChannelFactoryConfig( + new (*d_allocator_p) bmqio::ResolvingChannelFactory( + bmqio::ResolvingChannelFactoryConfig( d_tcpChannelFactory_mp.get(), - mwcex::ExecutionPolicyUtil::oneWay() + bmqex::ExecutionPolicyUtil::oneWay() .neverBlocking() .useExecutor(d_resolutionContext.executor()), d_allocator_p) @@ -1061,13 +1060,13 @@ int TCPSessionFactory::start(bsl::ostream& errorDescription) d_allocator_p); d_reconnectingChannelFactory_mp.load( - new (*d_allocator_p) mwcio::ReconnectingChannelFactory( - mwcio::ReconnectingChannelFactoryConfig( + new (*d_allocator_p) bmqio::ReconnectingChannelFactory( + bmqio::ReconnectingChannelFactoryConfig( d_resolvingChannelFactory_mp.get(), d_scheduler_p, d_allocator_p) .setReconnectIntervalFn(bdlf::BindUtil::bind( - &mwcio::ReconnectingChannelFactoryUtil :: + &bmqio::ReconnectingChannelFactoryUtil :: defaultConnectIntervalFn, bdlf::PlaceHolders::_1, // interval bdlf::PlaceHolders::_2, // options @@ -1086,12 +1085,12 @@ int TCPSessionFactory::start(bsl::ostream& errorDescription) } bdlb::ScopeExitAny reconnectingScopeGuard( - bdlf::BindUtil::bind(&mwcio::ReconnectingChannelFactory::stop, + bdlf::BindUtil::bind(&bmqio::ReconnectingChannelFactory::stop, d_reconnectingChannelFactory_mp.get())); d_statChannelFactory_mp.load( - new (*d_allocator_p) mwcio::StatChannelFactory( - mwcio::StatChannelFactoryConfig( + new (*d_allocator_p) bmqio::StatChannelFactory( + bmqio::StatChannelFactoryConfig( d_reconnectingChannelFactory_mp.get(), bdlf::BindUtil::bind( &TCPSessionFactory::channelStatContextCreator, @@ -1106,7 +1105,7 @@ int TCPSessionFactory::start(bsl::ostream& errorDescription) BALL_LOG_INFO << "TCPSessionFactory '" << d_config.name() << "' heartbeat enabled (interval: " - << mwcu::PrintUtil::prettyTimeInterval( + << bmqu::PrintUtil::prettyTimeInterval( d_config.heartbeatIntervalMs() * bdlt::TimeUnitRatio::k_NANOSECONDS_PER_MILLISECOND) << ")"; @@ -1188,7 +1187,7 @@ void TCPSessionFactory::closeClients() BALL_LOG_INFO << "TCPSessionFactory '" << d_config.name() << "' closing " << d_nbOpenClients << " open client(s)"; - mwcio::Status status(mwcio::StatusCategory::e_SUCCESS, + bmqio::Status status(bmqio::StatusCategory::e_SUCCESS, k_CHANNEL_STATUS_CLOSE_REASON, true, d_allocator_p); @@ -1336,14 +1335,14 @@ int TCPSessionFactory::listen(int port, const ResultCallback& resultCallback) context->d_resultState_p = 0; bdlma::LocalSequentialAllocator<64> localAlloc(d_allocator_p); - mwcu::MemOutStream endpoint(&localAlloc); + bmqu::MemOutStream endpoint(&localAlloc); endpoint << ":" << port; // Empty hostname, listen from all interfaces - mwcio::ListenOptions listenOptions; + bmqio::ListenOptions listenOptions; listenOptions.setEndpoint(endpoint.str()); d_isListening = true; - mwcio::Status status; + bmqio::Status status; d_statChannelFactory_mp->listen( &status, &d_listeningHandle_mp, @@ -1386,18 +1385,18 @@ int TCPSessionFactory::connect(const bslstl::StringRef& endpoint, context->d_negotiationUserData_sp = *negotiationUserData; } - mwcio::TCPEndpoint tcpEndpoint(endpoint); + bmqio::TCPEndpoint tcpEndpoint(endpoint); bdlma::LocalSequentialAllocator<64> localAlloc(d_allocator_p); - mwcu::MemOutStream endpointStream(&localAlloc); + bmqu::MemOutStream endpointStream(&localAlloc); endpointStream << tcpEndpoint.host() << ":" << tcpEndpoint.port(); - mwcio::ConnectOptions options; + bmqio::ConnectOptions options; options.setNumAttempts(bsl::numeric_limits::max()) .setAttemptInterval(bsls::TimeInterval(k_CONNECT_INTERVAL)) .setEndpoint(endpointStream.str()) .setAutoReconnect(shouldAutoReconnect); - mwcio::Status status; + bmqio::Status status; d_statChannelFactory_mp->connect( &status, 0, // no handle .. @@ -1445,11 +1444,11 @@ bool TCPSessionFactory::setNodeWriteQueueWatermarks(const Session& session) return false; // RETURN } - mwcio::NtcChannelFactory* factory = - dynamic_cast(d_tcpChannelFactory_mp.get()); + bmqio::NtcChannelFactory* factory = + dynamic_cast(d_tcpChannelFactory_mp.get()); BSLS_ASSERT_SAFE(factory); - bsl::shared_ptr ntcChannel; + bsl::shared_ptr ntcChannel; int rc = factory->lookupChannel(&ntcChannel, channelId); if (rc != 0) { BALL_LOG_ERROR << "TCPSessionFactory '" << d_config.name() << "' " @@ -1467,10 +1466,10 @@ bool TCPSessionFactory::setNodeWriteQueueWatermarks(const Session& session) // ACCESSORS bool TCPSessionFactory::isEndpointLoopback(const bslstl::StringRef& uri) const { - mwcio::TCPEndpoint endpoint(uri); + bmqio::TCPEndpoint endpoint(uri); return (endpoint.port() == d_config.port()) && - mwcio::ChannelUtil::isLocalHost(endpoint.host()); + bmqio::ChannelUtil::isLocalHost(endpoint.host()); } // ------------------------------------ @@ -1483,15 +1482,15 @@ TCPSessionFactory::PortManager::PortManager(bslma::Allocator* allocator) { } -bslma::ManagedPtr -TCPSessionFactory::PortManager::addChannelContext(mwcst::StatContext* parent, +bslma::ManagedPtr +TCPSessionFactory::PortManager::addChannelContext(bmqst::StatContext* parent, const bsl::string& endpoint, bsl::uint16_t port) { bdlma::LocalSequentialAllocator<2048> localAllocator(d_allocator_p); - mwcst::StatContextConfiguration statConfig(endpoint, &localAllocator); + bmqst::StatContextConfiguration statConfig(endpoint, &localAllocator); - bslma::ManagedPtr channelStatContext; + bslma::ManagedPtr channelStatContext; PortMap::iterator portIt = d_portMap.find(port); @@ -1501,10 +1500,10 @@ TCPSessionFactory::PortManager::addChannelContext(mwcst::StatContext* parent, ++portIt->second.d_numChannels; } else { - mwcst::StatContextConfiguration portConfig( + bmqst::StatContextConfiguration portConfig( static_cast(port), &localAllocator); - bsl::shared_ptr portStatContext = + bsl::shared_ptr portStatContext = parent->addSubcontext( portConfig.storeExpiredSubcontextValues(true)); channelStatContext = portStatContext->addSubcontext(statConfig); diff --git a/src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.h b/src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.h index d3552c6f7..14fb4501c 100644 --- a/src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.h +++ b/src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.h @@ -28,7 +28,7 @@ //@DESCRIPTION: 'mqbnet::TCPSessionFactory' is a mechanism allowing to listen // to, or establish connection with a remote peer over a TCP connection. This // component allows to establish TCP channels with remote peers, and uses the -// provided 'mqbnet::Negotiator' to convert a 'mwcio::Channel' to an +// provided 'mqbnet::Negotiator' to convert a 'bmqio::Channel' to an // 'mqbnet::Session': a session is a negotiated channel decorated inside an // associated session object. The 'TCPSessionFactory' owns the sessions having // been created. 'mqbnet::TCPSessionFactoryIterator' provides thread safe @@ -83,16 +83,15 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -164,12 +163,12 @@ class TCPSessionFactory { /// specified cluster name (as in the case of Client connection), the /// `cluster` is 0. The callback returns `true` upon successful /// registration / read enabling; `false` otherwise. - typedef bsl::function& session, Cluster* cluster, void* resultState, - const mwcio::Channel::ReadCallback& readCb)> + const bmqio::Channel::ReadCallback& readCb)> ResultCallback; private: @@ -177,7 +176,7 @@ class TCPSessionFactory { /// Struct holding internal data associated to an active channel struct ChannelInfo { - mwcio::Channel* d_channel_p; + bmqio::Channel* d_channel_p; // The channel bsl::shared_ptr d_session_sp; @@ -222,7 +221,7 @@ class TCPSessionFactory { public: // PUBLIC TYPES struct PortContext { - bsl::shared_ptr d_portContext; + bsl::shared_ptr d_portContext; bsl::size_t d_numChannels; }; typedef bsl::unordered_map PortMap; @@ -244,8 +243,8 @@ class TCPSessionFactory { /// Create a sub context of the specified 'parent' with the specified /// 'endpoint' as the StatContext's name. Increases the number of /// channels on the specified 'port'. - bslma::ManagedPtr - addChannelContext(mwcst::StatContext* parent, + bslma::ManagedPtr + addChannelContext(bmqst::StatContext* parent, const bsl::string& endpoint, bsl::uint16_t port); @@ -258,29 +257,29 @@ class TCPSessionFactory { /// Map associating a `Channel` to its corresponding `ChannelInfo` (as /// shared_ptr because of the atomicInt which has no copy constructor). - typedef bsl::unordered_map ChannelMap; + typedef bsl::unordered_map ChannelMap; - /// Shortcut for a managedPtr to the `mwcio::TCPChannelFactory` - typedef bslma::ManagedPtr TCPChannelFactoryMp; + /// Shortcut for a managedPtr to the `bmqio::TCPChannelFactory` + typedef bslma::ManagedPtr TCPChannelFactoryMp; - typedef bslma::ManagedPtr + typedef bslma::ManagedPtr ResolvingChannelFactoryMp; - typedef bslma::ManagedPtr + typedef bslma::ManagedPtr ReconnectingChannelFactoryMp; - typedef bslma::ManagedPtr StatChannelFactoryMp; + typedef bslma::ManagedPtr StatChannelFactoryMp; typedef TCPSessionFactory_OperationContext OperationContext; - typedef bslma::ManagedPtr OpHandleMp; + typedef bslma::ManagedPtr OpHandleMp; - typedef bsl::unordered_map + typedef bsl::unordered_map TimestampMap; private: // DATA - mwcu::SharedResource d_self; + bmqu::SharedResource d_self; // Used to make sure no callback // is invoked on a destroyed // object. @@ -312,7 +311,7 @@ class TCPSessionFactory { TCPChannelFactoryMp d_tcpChannelFactory_mp; // ChannelFactory - mwcex::SequentialContext d_resolutionContext; + bmqex::SequentialContext d_resolutionContext; // Executor context used for // performing DNS resolution @@ -376,7 +375,7 @@ class TCPSessionFactory { // heartbeat monitor the // channels. - bsl::unordered_map d_heartbeatChannels; + bsl::unordered_map d_heartbeatChannels; // Map of all channels which are // heartbeat enabled; only // manipulated from the event @@ -423,13 +422,13 @@ class TCPSessionFactory { /// Create and return the statContext to be used for tracking stats of /// the specified `channel` obtained from the specified `handle`. - bslma::ManagedPtr channelStatContextCreator( - const bsl::shared_ptr& channel, - const bsl::shared_ptr& handle); + bslma::ManagedPtr channelStatContextCreator( + const bsl::shared_ptr& channel, + const bsl::shared_ptr& handle); /// Asynchronously negotiate on the specified `channel` using the /// specified `context`. - void negotiate(const bsl::shared_ptr& channel, + void negotiate(const bsl::shared_ptr& channel, const bsl::shared_ptr& context); // PRIVATE MANIPULATORS @@ -443,7 +442,7 @@ class TCPSessionFactory { /// member of `channelInfo` with the event. Note that once the channel /// onClose event has been fired, `channelInfo` will be dangling and /// should not be accessed. - void readCallback(const mwcio::Status& status, + void readCallback(const bmqio::Status& status, int* numNeeded, bdlbb::Blob* blob, ChannelInfo* channelInfo); @@ -466,7 +465,7 @@ class TCPSessionFactory { int statusCode, const bsl::string& errorDescription, const bsl::shared_ptr& session, - const bsl::shared_ptr& channel, + const bsl::shared_ptr& channel, const bsl::shared_ptr& context, const bsl::shared_ptr& negotiatorContext); @@ -486,9 +485,9 @@ class TCPSessionFactory { /// associated with the `listen` or `connect` associated with the /// invocation. The specified `channel` is provided on `e_CHANNEL_UP`. void - channelStateCallback(mwcio::ChannelFactoryEvent::Enum event, - const mwcio::Status& status, - const bsl::shared_ptr& channel, + channelStateCallback(bmqio::ChannelFactoryEvent::Enum event, + const bmqio::Status& status, + const bsl::shared_ptr& channel, const bsl::shared_ptr& context); // PRIVATE MANIPULATORS @@ -498,8 +497,8 @@ class TCPSessionFactory { /// the channel's status, `userData` corresponding to the one provided /// when calling `addObserver` to register this object as observer of /// the channel. - virtual void onClose(const bsl::shared_ptr& channel, - const mwcio::Status& status); + virtual void onClose(const bsl::shared_ptr& channel, + const bmqio::Status& status); /// Reccuring scheduler event to check for all `heartbeat-enabled` /// channels : this will send a heartbeat if no data has been received @@ -522,7 +521,7 @@ class TCPSessionFactory { /// timestamp. After logging, begin timestamp is removed from /// timestamps map. void logOpenSessionTime(const bsl::string& sessionDescription, - const bsl::shared_ptr& channel); + const bsl::shared_ptr& channel); private: // NOT IMPLEMENTED diff --git a/src/groups/mqb/mqbnet/mqbnet_transportmanager.cpp b/src/groups/mqb/mqbnet/mqbnet_transportmanager.cpp index 26c99634b..b1f689745 100644 --- a/src/groups/mqb/mqbnet/mqbnet_transportmanager.cpp +++ b/src/groups/mqb/mqbnet/mqbnet_transportmanager.cpp @@ -27,11 +27,10 @@ #include #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -53,7 +52,7 @@ namespace mqbnet { namespace { -bsl::ostream& operator<<(bsl::ostream& os, const mwcio::Channel* channel) +bsl::ostream& operator<<(bsl::ostream& os, const bmqio::Channel* channel) { // 'pretty-print' the specified 'channel' to the specified 'os'. The // printed channel from that function includes the address of the channel @@ -129,7 +128,7 @@ bool TransportManager::processSession( Cluster* cluster, ConnectionState* state, const bsl::shared_ptr& session, - const mwcio::Channel::ReadCallback& readCb) + const bmqio::Channel::ReadCallback& readCb) { // PRECONDITIONS BSLS_ASSERT_SAFE(session); @@ -164,14 +163,14 @@ bool TransportManager::processSession( d_tcpSessionFactory_mp->setNodeWriteQueueWatermarks(*session); // Notify the node it now has a channel - bsl::weak_ptr channel(session->channel()); + bsl::weak_ptr channel(session->channel()); state->d_node_p->setChannel(channel, peerIdentity, readCb); } } // Add self as observer of the channel (so that we can monitor when it // goes down, and eventually initiate a reconnection). - mwcu::MemOutStream channelDescription; + bmqu::MemOutStream channelDescription; channelDescription << session->channel().get(); session->channel()->onClose( @@ -201,7 +200,7 @@ bool TransportManager::processSession( << session->channel().get() << "']"; } - mwcio::Status readStatus; + bmqio::Status readStatus; session->channel()->read(&readStatus, bmqp::Protocol::k_PACKET_MIN_SIZE, readCb); @@ -218,12 +217,12 @@ bool TransportManager::processSession( } bool TransportManager::sessionResult( - mwcio::ChannelFactoryEvent::Enum event, - const mwcio::Status& status, + bmqio::ChannelFactoryEvent::Enum event, + const bmqio::Status& status, const bsl::shared_ptr& session, Cluster* cluster, void* resultState, - const mwcio::Channel::ReadCallback& readCb, + const bmqio::Channel::ReadCallback& readCb, bool isListen) { // executed by one of the *IO* threads @@ -236,13 +235,13 @@ bool TransportManager::sessionResult( bool result = false; switch (event) { - case mwcio::ChannelFactoryEvent::e_CHANNEL_UP: { + case bmqio::ChannelFactoryEvent::e_CHANNEL_UP: { result = processSession(cluster, state, session, readCb); } break; - case mwcio::ChannelFactoryEvent::e_CONNECT_ATTEMPT_FAILED: { + case bmqio::ChannelFactoryEvent::e_CONNECT_ATTEMPT_FAILED: { // Nothing to do, it will keep retrying automatically } break; - case mwcio::ChannelFactoryEvent::e_CONNECT_FAILED: { + case bmqio::ChannelFactoryEvent::e_CONNECT_FAILED: { if (isListen) { BALL_LOG_INFO << "Accept failed: " << status; return result; // RETURN @@ -511,7 +510,7 @@ int TransportManager::createCluster( << "' (selfNodeId: " << myNodeId << "), using mode " << connectionMode << " and config: "; - mwcu::Printer > printer(&nodes); + bmqu::Printer > printer(&nodes); BALL_LOG_OUTPUT_STREAM << printer; } @@ -631,7 +630,7 @@ int TransportManager::connectOut(bsl::ostream& errorDescription, // Validation: At the moment, the only supported protocol is TCP. // If/once/when we'll support more, we should use a factory method. - if (!mwcu::StringUtil::startsWith(uri, "tcp://")) { + if (!bmqu::StringUtil::startsWith(uri, "tcp://")) { errorDescription << "Unsupported transport protocol '" << uri << "'"; return rc_INVALID_PROTOCOL; // RETURN } @@ -707,7 +706,7 @@ void* TransportManager::getClusterNodeAndState( bool TransportManager::isEndpointLoopback(const bslstl::StringRef& uri) const { - if (mwcu::StringUtil::startsWith(uri, "tcp://")) { + if (bmqu::StringUtil::startsWith(uri, "tcp://")) { // NOTE: If we ever will listen to multiple TCP interfaces, we should // update here and return true if *any* one returns true. return d_tcpSessionFactory_mp && diff --git a/src/groups/mqb/mqbnet/mqbnet_transportmanager.h b/src/groups/mqb/mqbnet/mqbnet_transportmanager.h index 5267627a9..ccfb39da3 100644 --- a/src/groups/mqb/mqbnet/mqbnet_transportmanager.h +++ b/src/groups/mqb/mqbnet/mqbnet_transportmanager.h @@ -70,9 +70,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -242,7 +241,7 @@ class TransportManager { bool processSession(Cluster* cluster, ConnectionState* state, const bsl::shared_ptr& session, - const mwcio::Channel::ReadCallback& readCb); + const bmqio::Channel::ReadCallback& readCb); /// Signature of the callback method for a `connect` or `listen` call /// (as indicated by the specified `isListen` flags) where the specified @@ -258,12 +257,12 @@ class TransportManager { /// the negotiation has not specified cluster name (as in the case of /// Client connection), the `cluster` is 0. Return `true` upon /// successful registration / read enabling; `false` otherwise. - bool sessionResult(mwcio::ChannelFactoryEvent::Enum event, - const mwcio::Status& status, + bool sessionResult(bmqio::ChannelFactoryEvent::Enum event, + const bmqio::Status& status, const bsl::shared_ptr& session, Cluster* cluster, void* resultState, - const mwcio::Channel::ReadCallback& readCb, + const bmqio::Channel::ReadCallback& readCb, bool isListen); int connect(ConnectionState* state); @@ -282,7 +281,7 @@ class TransportManager { /// to this channel. Note that we do not bind the channel but rather /// the `channelDescription` because we have a hierarchy of channel /// (`TCP < Resolving < Stat`); and when the close is invoked, it comes - /// from the lower channel (`mwcio::TCPChannel`) while the higher + /// from the lower channel (`bmqio::TCPChannel`) while the higher /// channel (which is the one that would have been bindable at the time /// of the `onClose` slot registration) has already been destroyed. virtual void onClose(const bsl::string& channelDescription, diff --git a/src/groups/mqb/mqbplug/mqbplug_plugininfo.h b/src/groups/mqb/mqbplug/mqbplug_plugininfo.h index f4a820d14..bbbf8688e 100644 --- a/src/groups/mqb/mqbplug/mqbplug_plugininfo.h +++ b/src/groups/mqb/mqbplug/mqbplug_plugininfo.h @@ -20,7 +20,7 @@ //@PURPOSE: Provide definition for plugin description. // //@CLASSES: -// mqbplug::PluginInfo: VST representing metadata of a a plugin. +// mqbplug::PluginInfo: VST representing metadata of a plugin. // //@DESCRIPTION: This component provide definitions for structure // ('mqbplug::PluginInfo') used to define plugin for BlazingMQ broker. diff --git a/src/groups/mqb/mqbplug/mqbplug_pluginmanager.cpp b/src/groups/mqb/mqbplug/mqbplug_pluginmanager.cpp index 8fc20709e..67878dc6d 100644 --- a/src/groups/mqb/mqbplug/mqbplug_pluginmanager.cpp +++ b/src/groups/mqb/mqbplug/mqbplug_pluginmanager.cpp @@ -20,9 +20,8 @@ // MQB #include -// MWC -#include -#include +#include +#include // BDE #include @@ -318,9 +317,9 @@ int PluginManager::start(const mqbcfg::Plugins& pluginsConfig, // If no plugin is enabled at all, log a warning. if (requiredPlugins.empty()) { - MWCTSK_ALARMLOG_ALARM("PLUGIN_MISSING") + BMQTSK_ALARMLOG_ALARM("PLUGIN_MISSING") << "No plugin is enabled at all. Please double check if this is " - << "intended." << MWCTSK_ALARMLOG_END; + << "intended." << BMQTSK_ALARMLOG_END; return rc_SUCCESS; // RETURN } @@ -387,7 +386,7 @@ int PluginManager::start(const mqbcfg::Plugins& pluginsConfig, } } - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; errorDesc << "Could not find unique candidates for all required " "plugins [missingOrDuplicate: [" << libraryList.str() << "]]"; @@ -400,8 +399,8 @@ int PluginManager::start(const mqbcfg::Plugins& pluginsConfig, // If there are missing plugins but no duplicates, we will log an // error but we can still start the broker. - MWCTSK_ALARMLOG_ALARM("PLUGIN_MISSING") - << errorDesc.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_ALARM("PLUGIN_MISSING") + << errorDesc.str() << BMQTSK_ALARMLOG_END; } } return rc; diff --git a/src/groups/mqb/mqbplug/mqbplug_statconsumer.h b/src/groups/mqb/mqbplug/mqbplug_statconsumer.h index 77a2e7d49..406c8a111 100644 --- a/src/groups/mqb/mqbplug/mqbplug_statconsumer.h +++ b/src/groups/mqb/mqbplug/mqbplug_statconsumer.h @@ -48,7 +48,7 @@ namespace BloombergLP { // FORWARD DECLARATION -namespace mwcst { +namespace bmqst { class StatContext; } @@ -62,7 +62,7 @@ namespace mqbplug { class StatConsumer { public: // TYPES - typedef bsl::unordered_map + typedef bsl::unordered_map StatContextsMap; // Map of StatContext names to StatContext diff --git a/src/groups/mqb/mqbs/mqbs_datafileiterator.t.cpp b/src/groups/mqb/mqbs/mqbs_datafileiterator.t.cpp index 5f7b852bf..d51e597d3 100644 --- a/src/groups/mqb/mqbs/mqbs_datafileiterator.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_datafileiterator.t.cpp @@ -34,7 +34,7 @@ #include // TEST DRIVER -#include +#include using namespace BloombergLP; using namespace bsl; @@ -150,7 +150,7 @@ static void test1_breathingTest() // Basic functionality of the component // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { // Default Object @@ -212,7 +212,7 @@ static void test2_forwardIteration() // Forward iteration. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("FORWARD ITERATION"); + bmqtst::TestHelper::printTestName("FORWARD ITERATION"); const Message MESSAGES[] = { { @@ -289,7 +289,7 @@ static void test3_reverseIteration() // Reverse iteration. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("REVERSE ITERATION"); + bmqtst::TestHelper::printTestName("REVERSE ITERATION"); const Message MESSAGES[] = { { @@ -390,7 +390,7 @@ static void test3_reverseIteration() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -403,5 +403,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbs/mqbs_datastore.h b/src/groups/mqb/mqbs/mqbs_datastore.h index 70ea91568..7130a2fd0 100644 --- a/src/groups/mqb/mqbs/mqbs_datastore.h +++ b/src/groups/mqb/mqbs/mqbs_datastore.h @@ -44,8 +44,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -327,7 +326,7 @@ class DataStoreConfig { typedef QueueKeyInfoMap::const_iterator QueueKeyInfoMapConstIter; typedef bsl::pair QueueKeyInfoMapInsertRc; - typedef mwcc::OrderedHashMap Records; @@ -675,10 +674,10 @@ class DataStore : public mqbi::DispatcherClient { virtual int issueSyncPoint() = 0; /// Set the specified `primaryNode` with the specified `primaryLeaseId` - /// as the primary for this data store partition. Note that + /// as the active primary for this data store partition. Note that /// `primaryNode` could refer to the node which owns this data store. - virtual void setPrimary(mqbnet::ClusterNode* primaryNode, - unsigned int primaryLeaseId) = 0; + virtual void setActivePrimary(mqbnet::ClusterNode* primaryNode, + unsigned int primaryLeaseId) = 0; /// Clear the current primary associated with this partition. virtual void clearPrimary() = 0; diff --git a/src/groups/mqb/mqbs/mqbs_datastore.t.cpp b/src/groups/mqb/mqbs/mqbs_datastore.t.cpp index 9328299d6..2a1fe2c14 100644 --- a/src/groups/mqb/mqbs/mqbs_datastore.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_datastore.t.cpp @@ -17,10 +17,9 @@ #include // TEST DRIVER -#include +#include -// MWC -#include +#include // BDE #include @@ -51,7 +50,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { PV("DataStoreRecordKey"); @@ -132,7 +131,7 @@ static void test2_defaultHashUniqueness() // created upon insertion of objects in the map uses the default // allocator. - mwctst::TestHelper::printTestName("DEFAULT HASH UNIQUENESS"); + bmqtst::TestHelper::printTestName("DEFAULT HASH UNIQUENESS"); #ifdef BSLS_PLATFORM_OS_SOLARIS // This test case times out if 'k_NUM_GUIDS' is close to 1 million @@ -218,7 +217,7 @@ static void test3_customHashUniqueness() // created upon insertion of objects in the map uses the default // allocator. - mwctst::TestHelper::printTestName("CUSTOM HASH UNIQUENESS"); + bmqtst::TestHelper::printTestName("CUSTOM HASH UNIQUENESS"); #if defined(__has_feature) // Avoid timeout under MemorySanitizer @@ -295,7 +294,7 @@ static void testN1_defaultHashBenchmark() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("DEFAULT HASH BENCHMARK"); const size_t k_NUM_ITERATIONS = 10000000; // 10M bsl::hash hasher; @@ -308,11 +307,11 @@ static void testN1_defaultHashBenchmark() bsls::Types::Int64 end = bsls::TimeUtil::getTimer(); cout << "Calculated " << k_NUM_ITERATIONS << " default hashes of the Key" - << " in " << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << " in " << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 hash of the Key was calculated in " << (end - begin) / k_NUM_ITERATIONS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ITERATIONS * 1000000000) / (end - begin))) << " hashes per second.\n"; } @@ -329,7 +328,7 @@ static void testN2_customHashBenchmark() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CUSTOM HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("CUSTOM HASH BENCHMARK"); const size_t k_NUM_ITERATIONS = 10000000; // 10M mqbs::DataStoreRecordKeyHashAlgo hasher; @@ -341,11 +340,11 @@ static void testN2_customHashBenchmark() bsls::Types::Int64 end = bsls::TimeUtil::getTimer(); cout << "Calculated " << k_NUM_ITERATIONS << " custom hashes of the Key" - << "in " << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << "in " << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 hash of the Key was calculated in " << (end - begin) / k_NUM_ITERATIONS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ITERATIONS * 1000000000) / (end - begin))) << " hashes per second.\n"; } @@ -360,12 +359,12 @@ static void testN3_orderedMapWithDefaultHashBenchmark() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ORDERED MAP DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("ORDERED MAP DEFAULT HASH BENCHMARK"); const size_t k_NUM_ELEMS = 10000000; // 10M mqbs::DataStoreRecordKey key; - mwcc::OrderedHashMap ht(k_NUM_ELEMS, + bmqc::OrderedHashMap ht(k_NUM_ELEMS, s_allocator_p); // Warmup for (size_t i = 1; i <= 1000; ++i) { @@ -382,11 +381,11 @@ static void testN3_orderedMapWithDefaultHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in ordered map using " << "default hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second." << endl; } @@ -401,12 +400,12 @@ static void testN4_orderedMapWithCustomHashBenchmark() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ORDERED MAP CUSTOM HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("ORDERED MAP CUSTOM HASH BENCHMARK"); const size_t k_NUM_ELEMS = 10000000; // 10M mqbs::DataStoreRecordKey key; - mwcc::OrderedHashMap ht(k_NUM_ELEMS, s_allocator_p); @@ -426,11 +425,11 @@ static void testN4_orderedMapWithCustomHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in ordered map using " << "custom hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second.\n"; } @@ -450,7 +449,7 @@ testN1_defaultHashBenchmark_GoogleBenchmark(benchmark::State& state) // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "GOOGLE BENCHMARK DEFAULT HASH BENCHMARK"); bsl::hash hasher; @@ -474,7 +473,7 @@ static void testN2_customHashBenchmark_GoogleBenchmark(benchmark::State& state) // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "GOOGLE BENCHMARK CUSTOM HASH BENCHMARK"); mqbs::DataStoreRecordKeyHashAlgo hasher; @@ -497,12 +496,12 @@ static void testN3_orderedMapWithDefaultHashBenchmark_GoogleBenchmark( // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK ORDERED" + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK ORDERED" "MAP DEFAULT HASH BENCHMARK"); mqbs::DataStoreRecordKey key; - mwcc::OrderedHashMap ht(state.range(0), + bmqc::OrderedHashMap ht(state.range(0), s_allocator_p); // Warmup for (size_t i = 1; i <= 1000; ++i) { @@ -529,12 +528,12 @@ static void testN4_orderedMapWithCustomHashBenchmark_GoogleBenchmark( // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK ORDERED MAP" + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK ORDERED MAP" "CUSTOM HASH BENCHMARK"); mqbs::DataStoreRecordKey key; - mwcc::OrderedHashMap ht(state.range(0), s_allocator_p); @@ -558,7 +557,7 @@ static void testN4_orderedMapWithCustomHashBenchmark_GoogleBenchmark( int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -566,28 +565,28 @@ int main(int argc, char* argv[]) case 2: test2_defaultHashUniqueness(); break; case 1: test1_breathingTest(); break; case -1: - MWC_BENCHMARK_WITH_ARGS(testN1_defaultHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN1_defaultHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -2: - MWC_BENCHMARK_WITH_ARGS(testN2_customHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN2_customHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -3: - MWC_BENCHMARK_WITH_ARGS(testN3_orderedMapWithDefaultHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN3_orderedMapWithDefaultHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -4: - MWC_BENCHMARK_WITH_ARGS(testN4_orderedMapWithCustomHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN4_orderedMapWithCustomHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; default: { cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; @@ -601,7 +600,7 @@ int main(int argc, char* argv[]) } #endif - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } // ---------------------------------------------------------------------------- diff --git a/src/groups/mqb/mqbs/mqbs_filebackedstorage.cpp b/src/groups/mqb/mqbs/mqbs_filebackedstorage.cpp index 31a48a145..74586be55 100644 --- a/src/groups/mqb/mqbs/mqbs_filebackedstorage.cpp +++ b/src/groups/mqb/mqbs/mqbs_filebackedstorage.cpp @@ -34,11 +34,10 @@ // BMQ #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -94,6 +93,9 @@ void FileBackedStorage::purgeCommon(const mqbu::StorageKey& appKey) queue()->stats()->onEvent( mqbstat::QueueStatsDomain::EventType::e_PURGE, 0); + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_UPDATE_HISTORY, + d_handles.historySize()); } } } @@ -106,7 +108,7 @@ FileBackedStorage::FileBackedStorage( const mqbconfm::Domain& config, mqbu::CapacityMeter* parentCapacityMeter, bslma::Allocator* allocator, - mwcma::CountingAllocatorStore* allocatorStore) + bmqma::CountingAllocatorStore* allocatorStore) : d_allocator_p(allocator) , d_store_p(dataStore) , d_queueKey(queueKey) @@ -116,9 +118,14 @@ FileBackedStorage::FileBackedStorage( this, allocatorStore ? allocatorStore->get("VirtualHandles") : d_allocator_p) , d_ttlSeconds(config.messageTtl()) -, d_capacityMeter("queue [" + queueUri.asString() + "]", - parentCapacityMeter, - allocator) +, d_capacityMeter( + "queue [" + queueUri.asString() + "]", + parentCapacityMeter, + allocator, + bdlf::BindUtil::bind(&FileBackedStorage::logAppsSubscriptionInfoCb, + this, + bdlf::PlaceHolders::_1) // stream + ) , d_handles(bsls::TimeInterval() .addMilliseconds(config.deduplicationTimeMs()) .totalNanoseconds(), @@ -246,7 +253,6 @@ void FileBackedStorage::setQueue(mqbi::Queue* queue) d_virtualStorageCatalog.setQueue(queue); // Update queue stats if a queue has been associated with the storage. - if (queue) { const bsls::Types::Int64 numMessage = numMessages( mqbu::StorageKey::k_NULL_KEY); @@ -258,9 +264,9 @@ void FileBackedStorage::setQueue(mqbi::Queue* queue) BALL_LOG_INFO << "Associated queue [" << queue->uri() << "] with key [" << queueKey() << "] and Partition [" << queue->partitionId() << "] with its storage having " - << mwcu::PrintUtil::prettyNumber(numMessage) + << bmqu::PrintUtil::prettyNumber(numMessage) << " messages and " - << mwcu::PrintUtil::prettyNumber(numByte) + << bmqu::PrintUtil::prettyNumber(numByte) << " bytes of outstanding data."; } } @@ -381,8 +387,8 @@ FileBackedStorage::confirm(const bmqt::MessageGUID& msgGUID, return mqbi::StorageResult::e_GUID_NOT_FOUND; // RETURN } - mqbi::StorageResult::Enum rc = d_virtualStorageCatalog.confirm(msgGUID, - appKey); + const mqbi::StorageResult::Enum rc = + d_virtualStorageCatalog.confirm(msgGUID, appKey); if (mqbi::StorageResult::e_SUCCESS != rc) { return rc; // RETURN } @@ -391,7 +397,7 @@ FileBackedStorage::confirm(const bmqt::MessageGUID& msgGUID, BSLS_ASSERT_SAFE(!handles.empty()); DataStoreRecordHandle handle; - int writeResult = d_store_p->writeConfirmRecord( + const int writeResult = d_store_p->writeConfirmRecord( &handle, msgGUID, d_queueKey, @@ -445,12 +451,12 @@ FileBackedStorage::releaseRef(const bmqt::MessageGUID& guid) bdlt::EpochUtil::convertToTimeT64(bdlt::CurrentTime::utc())); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << "PartitionId [" << partitionId() << "] failed to write " << "DELETION record for GUID: " << guid << ", for queue '" << d_queueUri << "', queueKey '" << d_queueKey << "' while attempting to purge the message, rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } // If a queue is associated, inform it about the message being @@ -477,6 +483,12 @@ FileBackedStorage::releaseRef(const bmqt::MessageGUID& guid) d_capacityMeter.remove(1, msgLen); d_handles.erase(it); + if (queue()) { + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_UPDATE_HISTORY, + d_handles.historySize()); + } + return mqbi::StorageResult::e_ZERO_REFERENCES; } else { @@ -524,6 +536,9 @@ FileBackedStorage::remove(const bmqt::MessageGUID& msgGUID, int* msgSize) queue()->stats()->onEvent( mqbstat::QueueStatsDomain::EventType::e_DEL_MESSAGE, msgLen); + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_UPDATE_HISTORY, + d_handles.historySize()); if (msgSize) { *msgSize = msgLen; @@ -578,6 +593,12 @@ FileBackedStorage::removeAll(const mqbu::StorageKey& appKey) d_isEmpty.storeRelaxed(1); } + if (queue()) { + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_UPDATE_HISTORY, + d_handles.historySize()); + } + return mqbi::StorageResult::e_SUCCESS; } @@ -600,7 +621,7 @@ int FileBackedStorage::gcExpiredMessages( int numMsgsDeleted = 0; int numMsgsUnreceipted = 0; - bsls::Types::Int64 now = mwcsys::Time::highResolutionTimer(); + bsls::Types::Int64 now = bmqsys::Time::highResolutionTimer(); int limit = k_GC_MESSAGES_BATCH_SIZE; bsls::Types::Int64 deduplicationTimeNs = queue() ? queue()->domain()->config().deduplicationTimeMs() * @@ -646,13 +667,13 @@ int FileBackedStorage::gcExpiredMessages( deletionFlag, secondsFromEpoch); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << "Partition [" << partitionId() << "]" << " failed to write DELETION record for " << "GUID: " << cit->first << ", for queue '" << d_queueUri << "', queueKey '" << d_queueKey << "' while attempting to GC " << "the message due to TTL/ACK expiration, rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; // Do NOT remove the expired record without replicating Deletion. return numMsgsDeleted; // RETURN } @@ -694,6 +715,9 @@ int FileBackedStorage::gcExpiredMessages( mqbstat::QueueStatsDomain::EventType::e_NO_SC_MESSAGE, numMsgsUnreceipted); } + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_UPDATE_HISTORY, + d_handles.historySize()); } if (d_handles.empty()) { @@ -705,8 +729,16 @@ int FileBackedStorage::gcExpiredMessages( bool FileBackedStorage::gcHistory() { - return d_handles.gc(mwcsys::Time::highResolutionTimer(), - k_GC_MESSAGES_BATCH_SIZE); + bool hasMoreToGc = d_handles.gc(bmqsys::Time::highResolutionTimer(), + k_GC_MESSAGES_BATCH_SIZE); + + if (queue()) { + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_UPDATE_HISTORY, + d_handles.historySize()); + } + + return hasMoreToGc; } void FileBackedStorage::processMessageRecord( @@ -721,7 +753,7 @@ void FileBackedStorage::processMessageRecord( RecordHandleMapIter it = d_handles.find(guid); if (d_handles.end() == it) { InsertRc irc = d_handles.insert(bsl::make_pair(guid, Item()), - mwcsys::Time::highResolutionTimer()); + bmqsys::Time::highResolutionTimer()); irc.first->second.d_array.push_back(handle); irc.first->second.d_refCount = refCount; @@ -737,14 +769,14 @@ void FileBackedStorage::processMessageRecord( &dataStreamMessage); // Move auto confirms to the data record - for (AutoConfirms::const_iterator it = + for (AutoConfirms::const_iterator cit = d_autoConfirms.begin(); - it != d_autoConfirms.end(); - ++it) { + cit != d_autoConfirms.end(); + ++cit) { irc.first->second.d_array.push_back( - it->d_confirmRecordHandle); + cit->d_confirmRecordHandle); d_virtualStorageCatalog.autoConfirm(dataStreamMessage, - it->d_appKey); + cit->d_appKey); } } else { @@ -771,12 +803,12 @@ void FileBackedStorage::processMessageRecord( // Received a message record for a guid for which an entry already // exists. This is an error. - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << "Partition [" << partitionId() << "]" << " received MESSAGE record for GUID '" << guid << "' for queue '" << queueUri() << "', queueKey '" << queueKey() << "' for which an entry already exists. Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } } @@ -802,23 +834,23 @@ void FileBackedStorage::processConfirmRecord( RecordHandleMapIter it = d_handles.find(guid); if (it == d_handles.end()) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << "Partition [" << partitionId() << "]" << " received CONFIRM record for GUID '" << guid << "' for queue '" << queueUri() << "', queueKey '" << queueKey() << "' for which no entry exists. Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } if (0 == it->second.d_refCount) { // Outstanding refCount for this message is already zero at this node. - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << "Partition [" << partitionId() << "]" << "' received CONFIRM record for GUID '" << guid << "' for queue '" << queueUri() << "', queueKey '" << queueKey() << "' for which refCount is already zero. Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -830,8 +862,8 @@ void FileBackedStorage::processConfirmRecord( --it->second.d_refCount; // Update outstanding refCount if (!appKey.isNull()) { - mqbi::StorageResult::Enum rc = d_virtualStorageCatalog.confirm(guid, - appKey); + const mqbi::StorageResult::Enum rc = + d_virtualStorageCatalog.confirm(guid, appKey); if (mqbi::StorageResult::e_SUCCESS != rc) { BALL_LOG_ERROR << "#STORAGE_INVALID_CONFIRM " << "Partition [" << partitionId() << "]" @@ -850,12 +882,12 @@ void FileBackedStorage::processDeletionRecord(const bmqt::MessageGUID& guid) { RecordHandleMapIter it = d_handles.find(guid); if (it == d_handles.end()) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << "Partition [" << partitionId() << "]" << " received DELETION record for GUID '" << guid << "' for queue '" << queueUri() << "', queueKey '" << queueKey() << "' for which no entry exists. Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -904,6 +936,12 @@ void FileBackedStorage::processDeletionRecord(const bmqt::MessageGUID& guid) if (d_handles.empty()) { d_isEmpty.storeRelaxed(1); } + + if (queue()) { + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_UPDATE_HISTORY, + d_handles.historySize()); + } } void FileBackedStorage::addQueueOpRecordHandle( @@ -983,5 +1021,24 @@ void FileBackedStorage::clearSelection() d_currentlyAutoConfirming = bmqt::MessageGUID(); } +bsl::ostream& +FileBackedStorage::logAppsSubscriptionInfoCb(bsl::ostream& stream) const +{ + if (queue()) { + mqbi::Storage::AppIdKeyPairs appIdKeyPairs; + loadVirtualStorageDetails(&appIdKeyPairs); + + for (mqbi::Storage::AppIdKeyPairs::const_iterator cit = + appIdKeyPairs.begin(); + cit != appIdKeyPairs.end(); + ++cit) { + queue()->queueEngine()->logAppSubscriptionInfo(stream, + cit->second); + } + } + + return stream; +} + } // close package namespace } // close enterprise namespace diff --git a/src/groups/mqb/mqbs/mqbs_filebackedstorage.h b/src/groups/mqb/mqbs/mqbs_filebackedstorage.h index 8c37e08ec..303c6c13d 100644 --- a/src/groups/mqb/mqbs/mqbs_filebackedstorage.h +++ b/src/groups/mqb/mqbs/mqbs_filebackedstorage.h @@ -44,9 +44,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -73,7 +72,7 @@ namespace BloombergLP { namespace mqbi { class Queue; } -namespace mwcma { +namespace bmqma { class CountingAllocatorStore; } @@ -100,7 +99,7 @@ class FileBackedStorage BSLS_KEYWORD_FINAL : public ReplicatedStorage { static const size_t k_MOST_LIKELY_NUM_RECORDS = 3; // PRIVATE TYPES - typedef mwcc::Array + typedef bmqc::Array RecordHandlesArray; struct Item { @@ -139,7 +138,7 @@ class FileBackedStorage BSLS_KEYWORD_FINAL : public ReplicatedStorage { /// Must be a container in which iteration order is same as insertion /// order. - typedef mwcc::OrderedHashMapWithHistory< + typedef bmqc::OrderedHashMapWithHistory< bmqt::MessageGUID, Item, bslh::Hash > @@ -175,7 +174,7 @@ class FileBackedStorage BSLS_KEYWORD_FINAL : public ReplicatedStorage { RecordHandleMap d_handles; // Each value in the map is an - // 'mwcc::Array' of type 'RecordHandles'. + // 'bmqc::Array' of type 'RecordHandles'. // First handle in this vector *always* // points to the message record. @@ -221,6 +220,12 @@ class FileBackedStorage BSLS_KEYWORD_FINAL : public ReplicatedStorage { /// Clear the state created by 'selectForAutoConfirming'. void clearSelection(); + // PRIVATE ACCESSORS + + /// Callback function called by `d_capacityMeter` to log appllications + /// subscription info into the specified `stream`. + bsl::ostream& logAppsSubscriptionInfoCb(bsl::ostream& stream) const; + public: // TRAITS BSLMF_NESTED_TRAIT_DECLARATION(FileBackedStorage, @@ -238,7 +243,7 @@ class FileBackedStorage BSLS_KEYWORD_FINAL : public ReplicatedStorage { const mqbconfm::Domain& config, mqbu::CapacityMeter* parentCapacityMeter, bslma::Allocator* allocator, - mwcma::CountingAllocatorStore* allocatorStore = 0); + bmqma::CountingAllocatorStore* allocatorStore = 0); virtual ~FileBackedStorage() BSLS_KEYWORD_OVERRIDE; diff --git a/src/groups/mqb/mqbs/mqbs_fileset.t.cpp b/src/groups/mqb/mqbs/mqbs_fileset.t.cpp index 991ce3864..dad1fad74 100644 --- a/src/groups/mqb/mqbs/mqbs_fileset.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_fileset.t.cpp @@ -26,7 +26,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -47,7 +47,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // Default constructor mqbs::FileSet obj(static_cast(0), s_allocator_p); @@ -81,7 +81,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -92,5 +92,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbs/mqbs_filestore.cpp b/src/groups/mqb/mqbs/mqbs_filestore.cpp index 6b873ee4a..45d5b7b06 100644 --- a/src/groups/mqb/mqbs/mqbs_filestore.cpp +++ b/src/groups/mqb/mqbs/mqbs_filestore.cpp @@ -48,14 +48,13 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -111,7 +110,7 @@ const unsigned int k_REQUESTED_JOURNAL_SPACE = // Above, 3 == 1 journal record being written + // 1 journal sync point if rolling over + // 1 journal sync point if self needs to issue another sync point -// in 'setPrimary' with old values +// in 'setActivePrimary' with old values /// Return a rounded (down) percentage value (range [0-100]) representing /// the space in use on a file with the specified `capacity`, currently @@ -137,10 +136,10 @@ void printSpaceInUse(bsl::ostream& out, bsls::Types::Uint64 inUsePercent) { out << prefix << ": " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(inUse)) << " / " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(capacity)) << ", [" << inUsePercent << "%]"; } @@ -385,7 +384,7 @@ int FileStore::openInRecoveryMode(bsl::ostream& errorDescription, const JournalOpRecord& lsp = jit.lastSyncPoint(); BSLS_ASSERT_SAFE(JournalOpType::e_SYNCPOINT == lsp.type()); - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << partitionDesc() << " Last sync point details: " << "SyncPoint sub-type: " << lsp.syncPointType() << ", PrimaryNodeId: " << lsp.primaryNodeId() @@ -867,7 +866,7 @@ int FileStore::openInRecoveryMode(bsl::ostream& errorDescription, return rc_PARTITION_FULL; // RETURN } - // Check if DATA and QLIST files are full. This is not a a show stopper, + // Check if DATA and QLIST files are full. This is not a show stopper, // as we may still get some deletions which may make space in those files. if (dataFileOffset == d_config.maxDataFileSize() || @@ -886,7 +885,7 @@ int FileStore::openInRecoveryMode(bsl::ostream& errorDescription, false); // flush // Re-open in write mode, grow & map (do not delete on failure). - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; recoveryFileSet.setJournalFileSize(d_config.maxJournalFileSize()) .setDataFileSize(d_config.maxDataFileSize()); if (needQList) { @@ -1308,14 +1307,14 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, // two. In other words, two queues with same queueKey (which // may or may not have same URI) are alive at the same time. - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Encountered a QueueOp.ADDITION record for queueKey [" << queueKey << "] for which a QueueOp.CREATION record " << "was seen earlier during first pass backward iteration." << " Record offset: " << journalIt.recordOffset() << ", record index: " << journalIt.recordIndex() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_DUPLICATE_QUEUE_KEY; // RETURN } @@ -1381,14 +1380,14 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, // may or may not have same URI) are alive at the same // time. - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Encountered a second QueueOp.CREATION record for " << "queueKey [" << queueKey << "] during 1st pass " << "reverse iteration. Record offset: " << journalIt.recordOffset() << ", record index: " << journalIt.recordIndex() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_DUPLICATE_QUEUE_KEY; // RETURN } } @@ -1401,14 +1400,14 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, << ", record index: " << journalIt.recordIndex() << "."; } else { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Encountered a QueueOp record with unexpected QueueOpType: " << queueOpType << ", for queueKey [" << queueKey << "] during first pass backward iteration. " << "Record offset: " << journalIt.recordOffset() << ", record index: " << journalIt.recordIndex() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_UNEXPECTED_QUEUE_OP_TYPE; // RETURN } } @@ -1612,7 +1611,7 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, // upon being chosen as the primary. if (rec.primaryLeaseId() > primaryLeaseId) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Encountered a SyncPt during backward journal " << "iteration with higher primaryLeaseId: " @@ -1620,14 +1619,14 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, << ", current primaryLeaseId: " << primaryLeaseId << ". Record offset: " << jit->recordOffset() << ", record index: " << jit->recordIndex() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_PRIMARY_LEASE_ID; // RETURN } if (rec.primaryLeaseId() == primaryLeaseId) { if (rec.sequenceNum() != sequenceNum) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Encountered a Syncpt during backward journal " << "iteration with incorrect sequence number: " @@ -1635,7 +1634,7 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, << ", expected sequence number: " << sequenceNum << ". Record offset: " << jit->recordOffset() << ", record index: " << jit->recordIndex() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_SEQ_NUMBER; // RETURN } } @@ -1721,14 +1720,14 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, return rc_INVALID_QUEUE_KEY; // RETURN } else { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Encountered a QueueOp.PURGE record for " << "queueKey [" << queueKey << "], offset: " << jit->recordOffset() << ", index: " << jit->recordIndex() << ", for which a QueueOp.CREATION record was not " - << "seen in first pass." << MWCTSK_ALARMLOG_END; + << "seen in first pass." << BMQTSK_ALARMLOG_END; return rc_INVALID_QUEUE_KEY; // RETURN } } @@ -1929,7 +1928,7 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, if (!d_isFSMWorkflow && QueueOpType::e_ADDITION == queueOpType && iter == queueKeyInfoMap->end()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Encountered a QueueOp.ADDITION record for queueKey" << " [" << queueKey @@ -1937,7 +1936,7 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, << ", index: " << jit->recordIndex() << ", for which a " << "QueueOp.CREATION record was not seen in first " - << "pass." << MWCTSK_ALARMLOG_END; + << "pass." << BMQTSK_ALARMLOG_END; return rc_INVALID_QUEUE_KEY; // RETURN } @@ -1985,7 +1984,7 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, // Must have seen a QueueOp.ADDITION record earlier but // uri *must* match. - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Encountered a QueueOp [" << queueOpType << "] record for queueKey [" << queueKey << "], offset: " << jit->recordOffset() @@ -1993,7 +1992,7 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, << ", with QueueUri mismatch. Expected URI [" << qinfo.canonicalQueueUri() << "], recovered URI [" << uri << "]." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_QUEUE_URI_MISMATCH; // RETURN } else { @@ -2135,14 +2134,14 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, return rc_INVALID_QUEUE_KEY; // RETURN } else { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() - << "Encountered a DELETION record for " - << "queueKey [" << rec.queueKey() + << "Encountered a DELETION record for " << "queueKey [" + << rec.queueKey() << "], offset: " << jit->recordOffset() << ", index: " << jit->recordIndex() << ", for which a QueueOp.CREATION record was not " - << "seen in first pass." << MWCTSK_ALARMLOG_END; + << "seen in first pass." << BMQTSK_ALARMLOG_END; return rc_INVALID_QUEUE_KEY; // RETURN } } @@ -2212,7 +2211,7 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, return rc_INVALID_QUEUE_KEY; // RETURN } else { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Encountered a CONFIRM record for queueKey [" << rec.queueKey() @@ -2220,7 +2219,7 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, << ", index: " << jit->recordIndex() << ", for which a " << "QueueOp.CREATION record was not seen in first " - << "pass." << MWCTSK_ALARMLOG_END; + << "pass." << BMQTSK_ALARMLOG_END; return rc_INVALID_QUEUE_KEY; // RETURN } } @@ -2433,7 +2432,7 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, return rc_INVALID_QUEUE_KEY; // RETURN } else { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Encountered a MESSAGE record for queueKey [" << rec.queueKey() @@ -2441,7 +2440,7 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, << ", index: " << jit->recordIndex() << ", for which a " << "QueueOp.CREATION record was not seen in first " - << "pass." << MWCTSK_ALARMLOG_END; + << "pass." << BMQTSK_ALARMLOG_END; return rc_INVALID_QUEUE_KEY; // RETURN } } @@ -2458,7 +2457,7 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, appDataLen); if (rec.crc32c() != checksum) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Recovery: CRC mismatch for guid [" << rec.messageGUID() << "] for queueKey [" @@ -2469,7 +2468,7 @@ int FileStore::recoverMessages(QueueKeyInfoMap* queueKeyInfoMap, << ". CRC32-C in JOURNAL record: " << rec.crc32c() << ". CRC32-C of payload in DATA file: " << checksum << ". Payload offset in DATA file: " << appDataOffset - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; continue; // CONTINUE } } @@ -2506,7 +2505,7 @@ int FileStore::create(FileSetSp* fileSetSp) // PRECONDITIONS BSLS_ASSERT_SAFE(fileSetSp); - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; return FileStoreUtil::create(errorDesc, fileSetSp, this, @@ -2539,7 +2538,7 @@ int FileStore::rollover(bsls::Types::Uint64 timestamp) // Start a StatMonitorSnapshotRecorder to track system stats during // rollover - mwcsys::StatMonitorSnapshotRecorder statRecorder(partitionDesc(), + bmqsys::StatMonitorSnapshotRecorder statRecorder(partitionDesc(), d_allocator_p); // Create new files, add header etc. @@ -2564,7 +2563,7 @@ int FileStore::rollover(bsls::Types::Uint64 timestamp) } // Print summary of rolled over queues. - mwcu::MemOutStream outStream; + bmqu::MemOutStream outStream; outStream << partitionDesc() << "Queue rollover summary:" << "\n QueueKey NumMsgs NumBytes QueueUri"; @@ -2587,10 +2586,10 @@ int FileStore::rollover(bsls::Types::Uint64 timestamp) outStream << "\n [" << queueCountersCIter->first << "] " << bsl::setw(8) - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(queueCountersCIter->second.first)) << " " << bsl::setw(10) - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( queueCountersCIter->second.second) << " " << sit->second->queueUri(); } @@ -2702,22 +2701,22 @@ int FileStore::rollover(bsls::Types::Uint64 timestamp) // Print some rollover-related metrics. - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << partitionDesc() << "Compaction metrics: \n" << " DATA file size (new/old): " - << mwcu::PrintUtil::prettyBytes(newActiveFileSetSp->d_dataFilePosition) + << bmqu::PrintUtil::prettyBytes(newActiveFileSetSp->d_dataFilePosition) << "/" - << mwcu::PrintUtil::prettyBytes(activeFileSet->d_dataFilePosition) + << bmqu::PrintUtil::prettyBytes(activeFileSet->d_dataFilePosition) << " (" << ((newActiveFileSetSp->d_dataFilePosition * 100) / activeFileSet->d_dataFilePosition) << "%)\n"; out << " JOURNAL file size (new/old): " - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( newActiveFileSetSp->d_journalFilePosition) << "/" - << mwcu::PrintUtil::prettyBytes(activeFileSet->d_journalFilePosition) + << bmqu::PrintUtil::prettyBytes(activeFileSet->d_journalFilePosition) << " (" << ((newActiveFileSetSp->d_journalFilePosition * 100) / activeFileSet->d_journalFilePosition) @@ -2725,10 +2724,10 @@ int FileStore::rollover(bsls::Types::Uint64 timestamp) if (!d_isFSMWorkflow) { out << " QLIST file size (new/old): " - << mwcu::PrintUtil::prettyBytes( + << bmqu::PrintUtil::prettyBytes( newActiveFileSetSp->d_qlistFilePosition) << "/" - << mwcu::PrintUtil::prettyBytes(activeFileSet->d_qlistFilePosition) + << bmqu::PrintUtil::prettyBytes(activeFileSet->d_qlistFilePosition) << " (" << ((newActiveFileSetSp->d_qlistFilePosition * 100) / activeFileSet->d_qlistFilePosition) @@ -2823,7 +2822,7 @@ int FileStore::rollover(bsls::Types::Uint64 timestamp) // to avoid any race while deleting archived files. d_config.scheduler()->scheduleEvent( - mwcsys::Time::nowMonotonicClock(), + bmqsys::Time::nowMonotonicClock(), bdlf::BindUtil::bind(&FileStore::deleteArchiveFilesCb, this)); BALL_LOG_INFO_BLOCK @@ -2883,29 +2882,28 @@ int FileStore::rolloverIfNeeded(FileType::Enum fileType, activeFileSet->d_journalFileAvailable = false; } - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << partitionDesc() << "Rollover is required due to " << fileType << " file [" << fileName << "] reaching capacity. Current size: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(currentSize)) << ", capacity: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(file.fileSize())) << ". Checking if JOURNAL" << (d_isFSMWorkflow ? "" : ", QLIST") << " and DATA files satisfy " << "rollover criteria. Minimum required available space in each file: " << "[" << k_MIN_AVAILABLE_SPACE_PERCENT << "%]. " << "Requested record length: " << requestedSpace - << ". Outstanding bytes in each file:" - << "\nJOURNAL: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << ". Outstanding bytes in each file:" << "\nJOURNAL: " + << bmqu::PrintUtil::prettyNumber(static_cast( activeFileSet->d_outstandingBytesJournal)) << "\nDATA: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( activeFileSet->d_outstandingBytesData)); if (!d_isFSMWorkflow) { out << "\nQLIST: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( activeFileSet->d_outstandingBytesQlist)); } @@ -3048,8 +3046,8 @@ int FileStore::rolloverIfNeeded(FileType::Enum fileType, activeFileSet->d_fileSetRolloverPolicyAlarm = true; - MWCTSK_ALARMLOG_PANIC("PARTITION_READONLY") - << out.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_PANIC("PARTITION_READONLY") + << out.str() << BMQTSK_ALARMLOG_END; return rc; // RETURN } @@ -3102,27 +3100,27 @@ int FileStore::rolloverIfNeeded(FileType::Enum fileType, void FileStore::truncate(FileSet* fileSet) { - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc = FileSystemUtil::truncate(&fileSet->d_dataFile, fileSet->d_dataFilePosition, errorDesc); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << "[FILE_IO] " << partitionDesc() << "Failed to truncate data file [" << fileSet->d_dataFileName << "], rc: " << rc << ", error: " << errorDesc.str() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } rc = FileSystemUtil::truncate(&fileSet->d_journalFile, fileSet->d_journalFilePosition, errorDesc); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << partitionDesc() << "Failed to truncate journal [" << fileSet->d_journalFileName << "], rc: " << rc - << ", error: " << errorDesc.str() << MWCTSK_ALARMLOG_END; + << ", error: " << errorDesc.str() << BMQTSK_ALARMLOG_END; } if (!d_isFSMWorkflow) { @@ -3130,10 +3128,10 @@ void FileStore::truncate(FileSet* fileSet) fileSet->d_qlistFilePosition, errorDesc); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << partitionDesc() << "Failed to truncate qlist file [" << fileSet->d_qlistFileName << "], rc: " << rc - << ", error: " << errorDesc.str() << MWCTSK_ALARMLOG_END; + << ", error: " << errorDesc.str() << BMQTSK_ALARMLOG_END; } } } @@ -3143,15 +3141,15 @@ void FileStore::close(FileSet& fileSetRef, bool flush) if (flush) { BALL_LOG_INFO << partitionDesc() << "Flushing partition to disk."; - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc = FileSystemUtil::flush(fileSetRef.d_dataFile.mapping(), fileSetRef.d_dataFilePosition, errorDesc); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << partitionDesc() << "Failed to flush data file [" << fileSetRef.d_dataFileName << "], error: " << errorDesc.str() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; errorDesc.reset(); } @@ -3159,10 +3157,10 @@ void FileStore::close(FileSet& fileSetRef, bool flush) fileSetRef.d_journalFilePosition, errorDesc); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << partitionDesc() << "Failed to sync journal file [" << fileSetRef.d_journalFileName - << "], error: " << errorDesc.str() << MWCTSK_ALARMLOG_END; + << "], error: " << errorDesc.str() << BMQTSK_ALARMLOG_END; errorDesc.reset(); } @@ -3171,10 +3169,10 @@ void FileStore::close(FileSet& fileSetRef, bool flush) fileSetRef.d_qlistFilePosition, errorDesc); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << partitionDesc() << "Failed to sync qlist file [" << fileSetRef.d_qlistFileName - << "], error: " << errorDesc.str() << MWCTSK_ALARMLOG_END; + << "], error: " << errorDesc.str() << BMQTSK_ALARMLOG_END; errorDesc.reset(); } } @@ -3184,27 +3182,27 @@ void FileStore::close(FileSet& fileSetRef, bool flush) int rc = FileSystemUtil::close(&fileSetRef.d_dataFile); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << partitionDesc() << "Failed to close data file [" << fileSetRef.d_dataFileName << "], rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } rc = FileSystemUtil::close(&fileSetRef.d_journalFile); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << partitionDesc() << "Failed to close journal file [" << fileSetRef.d_journalFileName << "], rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } if (!d_isFSMWorkflow) { rc = FileSystemUtil::close(&fileSetRef.d_qlistFile); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << partitionDesc() << "Failed to close qlist file [" << fileSetRef.d_qlistFileName << "], rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } } } @@ -3214,32 +3212,32 @@ void FileStore::archive(FileSet* fileSet) int rc = FileSystemUtil::move(fileSet->d_dataFileName, d_config.archiveLocation()); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << partitionDesc() << "Failed to move file [" - << fileSet->d_dataFileName << "] " - << "to location [" << d_config.archiveLocation() << "] rc: " << rc - << MWCTSK_ALARMLOG_END; + << fileSet->d_dataFileName << "] " << "to location [" + << d_config.archiveLocation() << "] rc: " << rc + << BMQTSK_ALARMLOG_END; } rc = FileSystemUtil::move(fileSet->d_journalFileName, d_config.archiveLocation()); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << partitionDesc() << "Failed to move file [" - << fileSet->d_journalFileName << "] " - << "to location [" << d_config.archiveLocation() << "] rc: " << rc - << MWCTSK_ALARMLOG_END; + << fileSet->d_journalFileName << "] " << "to location [" + << d_config.archiveLocation() << "] rc: " << rc + << BMQTSK_ALARMLOG_END; } if (!d_isFSMWorkflow) { rc = FileSystemUtil::move(fileSet->d_qlistFileName, d_config.archiveLocation()); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << partitionDesc() << "Failed to move file [" - << fileSet->d_qlistFileName << "] " - << "to location [" << d_config.archiveLocation() - << "] rc: " << rc << MWCTSK_ALARMLOG_END; + << fileSet->d_qlistFileName << "] " << "to location [" + << d_config.archiveLocation() << "] rc: " << rc + << BMQTSK_ALARMLOG_END; } } } @@ -3341,19 +3339,19 @@ void FileStore::gcWorkerDispatched(const bsl::shared_ptr& fileSet) BALL_LOG_OUTPUT_STREAM << " as it can be gc'd."; } - bsls::Types::Int64 startTime = mwcsys::Time::highResolutionTimer(); + bsls::Types::Int64 startTime = bmqsys::Time::highResolutionTimer(); close(*fileSet, false); - bsls::Types::Int64 closeTime = mwcsys::Time::highResolutionTimer(); + bsls::Types::Int64 closeTime = bmqsys::Time::highResolutionTimer(); BALL_LOG_INFO << partitionDesc() << "File set closed. Time taken: " - << mwcu::PrintUtil::prettyTimeInterval(closeTime - + << bmqu::PrintUtil::prettyTimeInterval(closeTime - startTime); - bsls::Types::Int64 archiveStartTime = mwcsys::Time::highResolutionTimer(); + bsls::Types::Int64 archiveStartTime = bmqsys::Time::highResolutionTimer(); archive(fileSet.get()); - bsls::Types::Int64 archiveEndTime = mwcsys::Time::highResolutionTimer(); + bsls::Types::Int64 archiveEndTime = bmqsys::Time::highResolutionTimer(); BALL_LOG_INFO << partitionDesc() << "File set archived. Time taken: " - << mwcu::PrintUtil::prettyTimeInterval(archiveEndTime - + << bmqu::PrintUtil::prettyTimeInterval(archiveEndTime - archiveStartTime); } @@ -3382,10 +3380,10 @@ int FileStore::writeQueueOpRecord(DataStoreRecordHandle* handle, if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!d_isPrimary)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Not the primary. Not writing & replicating queueOp record with" - << " queueKey [" << queueKey << "]" << MWCTSK_ALARMLOG_END; + << " queueKey [" << queueKey << "]" << BMQTSK_ALARMLOG_END; return rc_NOT_PRIMARY; // RETURN } @@ -3670,7 +3668,7 @@ void FileStore::alarmHighwatermarkIfNeededDispatched() // Alarm that the high watermark (soft-limit) has been reached if (d_alarmSoftLimiter.requestPermission()) { - mwcu::MemOutStream out; + bmqu::MemOutStream out; out << partitionDesc() << "Outstanding data has accumulated beyond" << " the threshold of " << k_SPACE_USED_PERCENT_SOFT << "% of partition's usage. File set status:"; @@ -3703,8 +3701,8 @@ void FileStore::alarmHighwatermarkIfNeededDispatched() needAlarmFileType, d_storages); - MWCTSK_ALARMLOG_ALARM("PARTITION_AVAILABLESPACE_SOFTLIMIT") - << out.str() << MWCTSK_ALARMLOG_END; + BMQTSK_ALARMLOG_ALARM("PARTITION_AVAILABLESPACE_SOFTLIMIT") + << out.str() << BMQTSK_ALARMLOG_END; } } } @@ -3758,8 +3756,8 @@ int FileStore::issueSyncPointInternal(SyncPointType::Enum type, // New primary and no force issue requested. Currently, // this check is redundant because we always force issue a // sync point when a primary is chosen (see - // 'setPrimary()'), which always bumps up 'd_sequenceNum' - // to 1. + // 'setActivePrimary()'), which always bumps up + // 'd_sequenceNum' to 1. return rc_SUCCESS; // RETURN } @@ -3793,9 +3791,9 @@ int FileStore::issueSyncPointInternal(SyncPointType::Enum type, // Write to self. int rc = writeSyncPointRecord(*spptr, type); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << partitionDesc() << "Failed to write sync point: " << *spptr - << ", rc: " << rc << MWCTSK_ALARMLOG_END; + << ", rc: " << rc << BMQTSK_ALARMLOG_END; // Don't broadcast sync point because we failed to apply it to self return 10 * rc + rc_WRITE_FAILURE; // RETURN @@ -3932,7 +3930,7 @@ void FileStore::processReceiptEvent(unsigned int primaryLeaseId, int FileStore::writeMessageRecord(const bmqp::StorageHeader& header, const mqbs::RecordHeader& recHeader, const bsl::shared_ptr& event, - const mwcu::BlobPosition& recordPosition) + const bmqu::BlobPosition& recordPosition) { // PRECONDITIONS BSLS_ASSERT_SAFE(0 < d_fileSets.size()); @@ -3974,14 +3972,14 @@ int FileStore::writeMessageRecord(const bmqp::StorageHeader& header, if (journalPos != primaryJournalOffset) { // Primary's and self views of the journal have diverged. - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Received DATA record with journal offset mismatch. " << "Primary's journal offset: " << primaryJournalOffset << ", self journal offset: " << journalPos << ", msg sequence number (" << recHeader.primaryLeaseId() << ", " << recHeader.sequenceNumber() << "). Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_JOURNAL_OUT_OF_SYNC; // RETURN } @@ -3990,8 +3988,8 @@ int FileStore::writeMessageRecord(const bmqp::StorageHeader& header, // by payload. Payload contains 'mqbs::DataHeader', options (if any), // properties and message, and is already DWORD aligned. - mwcu::BlobPosition payloadBeginPos; - int rc = mwcu::BlobUtil::findOffsetSafe( + bmqu::BlobPosition payloadBeginPos; + int rc = bmqu::BlobUtil::findOffsetSafe( &payloadBeginPos, *event, recordPosition, @@ -4001,7 +3999,7 @@ int FileStore::writeMessageRecord(const bmqp::StorageHeader& header, return 10 * rc + rc_MISSING_PAYLOAD; // RETURN } - mwcu::BlobObjectProxy dataHeader( + bmqu::BlobObjectProxy dataHeader( event.get(), payloadBeginPos, -DataHeader::k_MIN_HEADER_SIZE, @@ -4022,8 +4020,8 @@ int FileStore::writeMessageRecord(const bmqp::StorageHeader& header, const int messageSize = dataHeader->messageWords() * bmqp::Protocol::k_WORD_SIZE; - mwcu::BlobPosition payloadEndPos; - rc = mwcu::BlobUtil::findOffsetSafe(&payloadEndPos, + bmqu::BlobPosition payloadEndPos; + rc = bmqu::BlobUtil::findOffsetSafe(&payloadEndPos, *event, payloadBeginPos, messageSize); @@ -4036,7 +4034,7 @@ int FileStore::writeMessageRecord(const bmqp::StorageHeader& header, // Append payload to data file. - mwcu::BlobUtil::copyToRawBufferFromIndex(dataFile.block().base() + + bmqu::BlobUtil::copyToRawBufferFromIndex(dataFile.block().base() + dataFilePos, *event, payloadBeginPos.buffer(), @@ -4053,7 +4051,7 @@ int FileStore::writeMessageRecord(const bmqp::StorageHeader& header, BSLS_ASSERT_SAFE(journal.fileSize() >= (journalPos + k_REQUESTED_JOURNAL_SPACE)); - mwcu::BlobUtil::copyToRawBufferFromIndex( + bmqu::BlobUtil::copyToRawBufferFromIndex( journal.block().base() + recordOffset, *event, recordPosition.buffer(), @@ -4129,7 +4127,7 @@ int FileStore::writeQueueCreationRecord( const bmqp::StorageHeader& header, const mqbs::RecordHeader& recHeader, const bsl::shared_ptr& event, - const mwcu::BlobPosition& recordPosition) + const bmqu::BlobPosition& recordPosition) { enum { rc_SUCCESS = 0, @@ -4171,18 +4169,18 @@ int FileStore::writeQueueCreationRecord( if (journalPos != primaryJournalOffset) { // Primary's and self views of the journal have diverged. - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Received QLIST record with journal offset mismatch. " << "Primary's journal offset: " << primaryJournalOffset << ", self journal offset: " << journalPos << ", msg sequence number (" << recHeader.primaryLeaseId() << ", " << recHeader.sequenceNumber() << "). Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_JOURNAL_OUT_OF_SYNC; // RETURN } - mwcu::BlobObjectProxy queueRecHeader; + bmqu::BlobObjectProxy queueRecHeader; unsigned int queueRecHeaderLen = 0; unsigned int queueRecLength = 0; if (!d_isFSMWorkflow) { @@ -4191,8 +4189,8 @@ int FileStore::writeQueueCreationRecord( // with journal record followed by queue record. Queue record already // contains 'mqbs::QueueRecordHeader' and is already WORD aligned. - mwcu::BlobPosition queueRecBeginPos; - int rc = mwcu::BlobUtil::findOffsetSafe( + bmqu::BlobPosition queueRecBeginPos; + int rc = bmqu::BlobUtil::findOffsetSafe( &queueRecBeginPos, *event, recordPosition, @@ -4220,8 +4218,8 @@ int FileStore::writeQueueCreationRecord( queueRecLength = queueRecHeader->queueRecordWords() * bmqp::Protocol::k_WORD_SIZE; - mwcu::BlobPosition queueRecEndPos; - rc = mwcu::BlobUtil::findOffsetSafe(&queueRecEndPos, + bmqu::BlobPosition queueRecEndPos; + rc = bmqu::BlobUtil::findOffsetSafe(&queueRecEndPos, *event, queueRecBeginPos, queueRecLength); @@ -4235,7 +4233,7 @@ int FileStore::writeQueueCreationRecord( // Append payload to QLIST file. - mwcu::BlobUtil::copyToRawBufferFromIndex(qlistFile.block().base() + + bmqu::BlobUtil::copyToRawBufferFromIndex(qlistFile.block().base() + qlistFilePos, *event, queueRecBeginPos.buffer(), @@ -4252,7 +4250,7 @@ int FileStore::writeQueueCreationRecord( BSLS_ASSERT_SAFE(journal.fileSize() >= (journalPos + k_REQUESTED_JOURNAL_SPACE)); - mwcu::BlobUtil::copyToRawBufferFromIndex( + bmqu::BlobUtil::copyToRawBufferFromIndex( journal.block().base() + recordOffset, *event, recordPosition.buffer(), @@ -4378,7 +4376,7 @@ int FileStore::writeQueueCreationRecord( int FileStore::writeJournalRecord(const bmqp::StorageHeader& header, const mqbs::RecordHeader& recHeader, const bsl::shared_ptr& event, - const mwcu::BlobPosition& recordPosition, + const bmqu::BlobPosition& recordPosition, bmqp::StorageMessageType::Enum messageType) { enum { @@ -4419,14 +4417,14 @@ int FileStore::writeJournalRecord(const bmqp::StorageHeader& header, if (journalPos != primaryJournalOffset) { // Primary's and self views of the journal have diverged. - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Received journal record of type [" << messageType << "] with journal offset mismatch. Primary's journal offset: " << primaryJournalOffset << ", self journal offset: " << journalPos << ", msg sequence number (" << recHeader.primaryLeaseId() << ", " << recHeader.sequenceNumber() << "). Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_JOURNAL_OUT_OF_SYNC; // RETURN } @@ -4443,7 +4441,7 @@ int FileStore::writeJournalRecord(const bmqp::StorageHeader& header, const bsls::Types::Uint64 recordOffset = journalPos; - mwcu::BlobUtil::copyToRawBufferFromIndex( + bmqu::BlobUtil::copyToRawBufferFromIndex( journal.block().base() + recordOffset, *event, recordPosition.buffer(), @@ -4582,13 +4580,13 @@ int FileStore::writeJournalRecord(const bmqp::StorageHeader& header, // Take appropriate action based on JournalOpType. if (JournalOpType::e_UNDEFINED == journalOpType) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Received JournalOp msg with invalid type: " << journalOpType << ", sequence number (" << recHeader.primaryLeaseId() << ", " << recHeader.sequenceNumber() << "). Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_CONTENT; // RETURN } @@ -4597,13 +4595,13 @@ int FileStore::writeJournalRecord(const bmqp::StorageHeader& header, recordOffset); if (SyncPointType::e_UNDEFINED == jOpRec->syncPointType()) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Received sync point record with invalid type: " << jOpRec->syncPointType() << ", sequence number (" << recHeader.primaryLeaseId() << ", " << recHeader.sequenceNumber() - << "). Ignoring this message." << MWCTSK_ALARMLOG_END; + << "). Ignoring this message." << BMQTSK_ALARMLOG_END; return rc_INVALID_CONTENT; // RETURN } @@ -4638,13 +4636,13 @@ int FileStore::writeJournalRecord(const bmqp::StorageHeader& header, (static_cast( syncPoint.dataFileOffsetDwords()) * bmqp::Protocol::k_DWORD_SIZE)) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "DATA file offset mismatch. Received sync point: " << syncPoint << ", offset maintained by self (DWORDS): " << (activeFileSet->d_dataFilePosition / bmqp::Protocol::k_DWORD_SIZE) - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_DATA_FILE_OUT_OF_SYNC; // RETURN } @@ -4657,13 +4655,13 @@ int FileStore::writeJournalRecord(const bmqp::StorageHeader& header, (static_cast( syncPoint.qlistFileOffsetWords()) * bmqp::Protocol::k_WORD_SIZE)) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "QLIST file offset mismatch. Received sync point: " << syncPoint << ", offset maintained by self (WORDS): " << (activeFileSet->d_qlistFilePosition / bmqp::Protocol::k_WORD_SIZE) - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_QLIST_FILE_OUT_OF_SYNC; // RETURN } @@ -4680,12 +4678,12 @@ int FileStore::writeJournalRecord(const bmqp::StorageHeader& header, int rc = rollover(jOpRec->header().timestamp()); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Failed to rollover partition as notified by the " << "primary, rc: " << rc << ", sync point: " << syncPoint - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return 10 * rc + rc_ROLLOVER_FAILURE; // RETURN } } @@ -4719,13 +4717,13 @@ int FileStore::writeJournalRecord(const bmqp::StorageHeader& header, // QueueCreation event is not a journal record. Its replicated as // a StorageMessageType::e_QLIST message. - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Received QueueOp message with invalid type: " << queueOpType << ", sequence number (" << recHeader.primaryLeaseId() << ", " << recHeader.sequenceNumber() << "). Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_CONTENT; // RETURN } @@ -4771,12 +4769,12 @@ int FileStore::writeJournalRecord(const bmqp::StorageHeader& header, const bsls::Types::Int64 numMsgs = rstorage->numMessages( mqbu::StorageKey::k_NULL_KEY); if (0 != numMsgs) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Received QueueOpRecord.DELETION for queue [" << rstorage->queueUri() << "] which has [" << numMsgs << "] outstanding messages." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_QUEUE_DELETION_ERROR; // RETURN } @@ -4875,7 +4873,7 @@ void FileStore::replicateRecord(bmqp::StorageMessageType::Enum type, } while (doRetry); if (bmqt::EventBuilderResult::e_SUCCESS != buildRc) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Failed to pack storage record of type: " << type << ", of length " << FileStoreProtocol::k_JOURNAL_RECORD_SIZE @@ -4884,7 +4882,7 @@ void FileStore::replicateRecord(bmqp::StorageMessageType::Enum type, << d_sequenceNum << "). Current storage " << "event builder size: " << d_storageEventBuilder.eventSize() << ", message count: " << d_storageEventBuilder.messageCount() - << "." << MWCTSK_ALARMLOG_END; + << "." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -4980,26 +4978,26 @@ void FileStore::replicateRecord(bmqp::StorageMessageType::Enum type, } while (flushAndRetry); if (bmqt::EventBuilderResult::e_SUCCESS != buildRc) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Failed to pack storage record of type: " << type << ", of length " - << mwcu::PrintUtil::prettyNumber(dataBlobBuffer.size()) + << bmqu::PrintUtil::prettyNumber(dataBlobBuffer.size()) << ", at JOURNAL offset: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(journalOffset)) << ", rc: " << buildRc << ". Sequence number was: (" - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(d_primaryLeaseId)) << ", " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( static_cast(d_sequenceNum)) << "). Current storage event builder size: " - << mwcu::PrintUtil::prettyNumber(d_storageEventBuilder.eventSize()) + << bmqu::PrintUtil::prettyNumber(d_storageEventBuilder.eventSize()) << ", message count: " - << mwcu::PrintUtil::prettyNumber( + << bmqu::PrintUtil::prettyNumber( d_storageEventBuilder.messageCount()) - << "." << MWCTSK_ALARMLOG_END; + << "." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -5043,11 +5041,11 @@ int FileStore::validateWritingRecord(const bmqt::MessageGUID& guid, if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!d_isPrimary)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Not the primary. Not writing & replicating record with guid " << guid << " and queueKey [" << queueKey << "]" - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_NOT_PRIMARY; // RETURN } @@ -5194,7 +5192,7 @@ FileStore::FileStore(const DataStoreConfig& config, BSLS_ASSERT(d_cluster_p); BSLS_ASSERT(1 <= clusterSize()); - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Partition [" << d_config.partitionId() << "] (cluster: " << d_cluster_p->name() << "): "; d_partitionDescription.assign(os.str().data(), os.str().length()); @@ -5241,7 +5239,7 @@ int FileStore::open(const QueueKeyInfoMap& queueKeyInfoMap) return rc_SUCCESS; // RETURN } - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; int rc = openInRecoveryMode(errorDescription, queueKeyInfoMap); if (rc == 0) { d_isOpen = true; @@ -5422,11 +5420,11 @@ int FileStore::writeMessageRecord(mqbi::StorageMessageAttributes* attributes, if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!d_isPrimary)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Not the primary. Not writing & replicating message with guid " << guid << " and queueKey [" << queueKey << "]" - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_NOT_PRIMARY; // RETURN } @@ -5630,11 +5628,11 @@ int FileStore::writeQueueCreationRecord(DataStoreRecordHandle* handle, if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!d_isPrimary)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Not the primary. Not writing & replicating QueueUriRecord for " << "uri: " << queueUri << " and queueKey [" << queueKey << "]" - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_NOT_PRIMARY; // RETURN } @@ -6152,17 +6150,17 @@ void FileStore::processStorageEvent(const bsl::shared_ptr& blob, // the *same* partition. Any exception to this is a bug in the // implementation of replication. - MWCTSK_ALARMLOG_ALARM("STORAGE") + BMQTSK_ALARMLOG_ALARM("STORAGE") << partitionDesc() << ": Received storage event from node " << source->nodeDescription() << " with" << " different PartitionId: [" << pid << "] vs [" << header.partitionId() << "]" << ". Ignoring storage event." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; continue; // CONTINUE } - mwcu::BlobPosition recordPosition; - mwcu::BlobObjectProxy recHeader; + bmqu::BlobPosition recordPosition; + bmqu::BlobObjectProxy recHeader; int rc = mqbs::StorageUtil::loadRecordHeaderAndPos(&recHeader, &recordPosition, @@ -6180,7 +6178,7 @@ void FileStore::processStorageEvent(const bsl::shared_ptr& blob, // step from the new (passive) primary. if (d_primaryLeaseId > recHeader->primaryLeaseId()) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Received storage msg " << header.messageType() << " with smaller leaseId in RecordHeader: " @@ -6190,13 +6188,13 @@ void FileStore::processStorageEvent(const bsl::shared_ptr& blob, << ", self seqNum: " << d_sequenceNum << " Record's journal offset (in words): " << header.journalOffsetWords() << ". Ignoring entire event." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } if (d_primaryLeaseId == recHeader->primaryLeaseId()) { if (recHeader->sequenceNumber() != (d_sequenceNum + 1)) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Received storage msg " << header.messageType() << " with missing sequence num. Expected: " @@ -6205,7 +6203,7 @@ void FileStore::processStorageEvent(const bsl::shared_ptr& blob, << ". PrimaryLeaseId: " << recHeader->primaryLeaseId() << " Record's journal offset (in words): " << header.journalOffsetWords() << ". Aborting broker." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; mqbu::ExitUtil::terminate( mqbu::ExitCode::e_STORAGE_OUT_OF_SYNC); // EXIT @@ -6249,7 +6247,7 @@ void FileStore::processStorageEvent(const bsl::shared_ptr& blob, // If we are processing a partition-sync event, we have to // bump up the leaseId to that of the message, because we don't // get a separate notification about leaseId (unlike in steady - // state when StorageMgr invokes fs.setPrimary()). + // state when StorageMgr invokes fs.setActivePrimary()). d_primaryLeaseId = recHeader->primaryLeaseId(); @@ -6263,14 +6261,14 @@ void FileStore::processStorageEvent(const bsl::shared_ptr& blob, } else { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Failed to write storage msg " << header.messageType() << " with sequence number (" << recHeader->primaryLeaseId() << ", " << recHeader->sequenceNumber() << "), journal offset words: " << header.journalOffsetWords() << ", rc: " << rc << ". Ignoring this message." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } } while (1 == iter.next()); @@ -6319,36 +6317,36 @@ int FileStore::processRecoveryEvent(const bsl::shared_ptr& blob) static_cast(d_config.partitionId())); if (bmqp::StorageMessageType::e_UNDEFINED == header.messageType()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Received an unexpected storage message " << "type: " << header.messageType() << " at journal offset (in words): " - << header.journalOffsetWords() << MWCTSK_ALARMLOG_END; + << header.journalOffsetWords() << BMQTSK_ALARMLOG_END; return rc_INVALID_MSG_TYPE; // RETURN } - mwcu::BlobPosition recordPosition; + bmqu::BlobPosition recordPosition; int rc = iter.loadDataPosition(&recordPosition); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Failed to load record position for storage msg " << header.messageType() << ", with journal offset (in words): " << header.journalOffsetWords() << ", rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_PAYLOAD_OFFSET; // RETURN } - mwcu::BlobObjectProxy recHeader(blob.get(), + bmqu::BlobObjectProxy recHeader(blob.get(), recordPosition, true, // read false); // write if (!recHeader.isSet()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Failed to read RecordHeader for storage msg " << header.messageType() << ", with journal offset (in words): " - << header.journalOffsetWords() << MWCTSK_ALARMLOG_END; + << header.journalOffsetWords() << BMQTSK_ALARMLOG_END; return rc_INVALID_PAYLOAD_OFFSET; // RETURN } @@ -6361,7 +6359,7 @@ int FileStore::processRecoveryEvent(const bsl::shared_ptr& blob) // Validate leaseId, sequence number, etc. if (d_primaryLeaseId > recHeader->primaryLeaseId()) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Encountered smaller primaryLeaseId [" << recHeader->primaryLeaseId() << "] " @@ -6371,7 +6369,7 @@ int FileStore::processRecoveryEvent(const bsl::shared_ptr& blob) << ", self primary leaseId: " << d_primaryLeaseId << ", with journal offset (words): " << header.journalOffsetWords() << "." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_PRIMARY_LEASE_ID; // RETURN } else if (d_primaryLeaseId < recHeader->primaryLeaseId()) { @@ -6393,7 +6391,7 @@ int FileStore::processRecoveryEvent(const bsl::shared_ptr& blob) return rc_SUCCESS; // RETURN } else if (recHeader->sequenceNumber() != (d_sequenceNum + 1)) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Encountered buffered storage " << "message " << header.messageType() << " with missing sequence num. " @@ -6402,7 +6400,7 @@ int FileStore::processRecoveryEvent(const bsl::shared_ptr& blob) << ". PrimaryLeaseId: " << recHeader->primaryLeaseId() << ". Journal offset (words): " << header.journalOffsetWords() << "." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_SEQ_NUM; // RETURN } @@ -6430,14 +6428,14 @@ int FileStore::processRecoveryEvent(const bsl::shared_ptr& blob) } if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("RECOVERY") + BMQTSK_ALARMLOG_ALARM("RECOVERY") << partitionDesc() << "Failed to write buffered storage message " << header.messageType() << " with sequence number (" << recHeader->primaryLeaseId() << ", " << recHeader->sequenceNumber() << "), with journal " << "offset (words): " << header.journalOffsetWords() - << ", rc: " << rc << MWCTSK_ALARMLOG_END; + << ", rc: " << rc << BMQTSK_ALARMLOG_END; return 10 * rc + rc_WRITE_FAILURE; // RETURN } } @@ -6593,8 +6591,8 @@ int FileStore::issueSyncPoint() return rc_SUCCESS; } -void FileStore::setPrimary(mqbnet::ClusterNode* primaryNode, - unsigned int primaryLeaseId) +void FileStore::setActivePrimary(mqbnet::ClusterNode* primaryNode, + unsigned int primaryLeaseId) { // executed by the *DISPATCHER* thread @@ -6605,12 +6603,12 @@ void FileStore::setPrimary(mqbnet::ClusterNode* primaryNode, // Specified leaseId must be greater than or equal to 'd_primaryLeaseId'. if (d_primaryLeaseId > primaryLeaseId) { - MWCTSK_ALARMLOG_ALARM("CLUSTER") + BMQTSK_ALARMLOG_ALARM("CLUSTER") << partitionDesc() << "Invalid primary leaseId specified: " << primaryLeaseId << ", current self leaseId: " << d_primaryLeaseId << ". Specified primaryNode: " << primaryNode->nodeDescription() - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -6760,7 +6758,7 @@ void FileStore::setPrimary(mqbnet::ClusterNode* primaryNode, if (fs->d_journalFile.fileSize() < (fs->d_journalFilePosition + 2 * FileStoreProtocol::k_JOURNAL_RECORD_SIZE)) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "Not enough space in journal for new primary to issue a " << "SyncPt on behalf of previous primary. Max journal file " @@ -6769,7 +6767,7 @@ void FileStore::setPrimary(mqbnet::ClusterNode* primaryNode, << fs->d_journalFilePosition << ", minimum required space: " << 2 * FileStoreProtocol::k_JOURNAL_RECORD_SIZE << ". Partition will be marked unavailable." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; fs->d_fileSetRolloverPolicyAlarm = true; fs->d_journalFileAvailable = false; @@ -6806,10 +6804,10 @@ void FileStore::setPrimary(mqbnet::ClusterNode* primaryNode, true, // ImmediateFlush &syncPoint); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "New primary failed to issue SyncPt on behalf of previous " - << "primary, rc: " << rc << MWCTSK_ALARMLOG_END; + << "primary, rc: " << rc << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -6828,10 +6826,10 @@ void FileStore::setPrimary(mqbnet::ClusterNode* primaryNode, int rc = issueSyncPoint(); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc() << "New primary failed to issue SyncPt , rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return; // RETURN } } diff --git a/src/groups/mqb/mqbs/mqbs_filestore.h b/src/groups/mqb/mqbs/mqbs_filestore.h index 3aeeec1bf..d2f1a2d23 100644 --- a/src/groups/mqb/mqbs/mqbs_filestore.h +++ b/src/groups/mqb/mqbs/mqbs_filestore.h @@ -51,10 +51,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -151,9 +150,9 @@ class FileStore : public DataStore { BlobSpPool; typedef bdlcc::SharedObjectPool< - mwcu::AtomicState, + bmqu::AtomicState, bdlcc::ObjectPoolFunctors::DefaultCreator, - bdlcc::ObjectPoolFunctors::Reset > + bdlcc::ObjectPoolFunctors::Reset > StateSpPool; /// It is important for this to be a deque instead of a vector, because @@ -247,13 +246,13 @@ class FileStore : public DataStore { // node (Replica/Primary). bdlbb::Blob d_blob; // Receipt to this node. - bsl::shared_ptr d_state; + bsl::shared_ptr d_state; NodeContext(bdlbb::BlobBufferFactory* factory, const DataStoreRecordKey& key, bslma::Allocator* basicAllocator = 0); }; - typedef mwcc::OrderedHashMap Unreceipted; @@ -265,11 +264,11 @@ class FileStore : public DataStore { // DATA bslma::Allocator* d_allocator_p; - mwcma::CountingAllocatorStore d_allocators; + bmqma::CountingAllocatorStore d_allocators; // Allocator store to spawn new // allocators for sub-components - mwcma::CountingAllocatorStore d_storageAllocatorStore; + bmqma::CountingAllocatorStore d_storageAllocatorStore; // Allocator store to pass to all the // queue storages (file-backed or // in-memory) assigned to this @@ -558,17 +557,17 @@ class FileStore : public DataStore { int writeMessageRecord(const bmqp::StorageHeader& header, const mqbs::RecordHeader& recHeader, const bsl::shared_ptr& event, - const mwcu::BlobPosition& recordPosition); + const bmqu::BlobPosition& recordPosition); int writeQueueCreationRecord(const bmqp::StorageHeader& header, const mqbs::RecordHeader& recHeader, const bsl::shared_ptr& event, - const mwcu::BlobPosition& recordPosition); + const bmqu::BlobPosition& recordPosition); int writeJournalRecord(const bmqp::StorageHeader& header, const mqbs::RecordHeader& recHeader, const bsl::shared_ptr& event, - const mwcu::BlobPosition& recordPosition, + const bmqu::BlobPosition& recordPosition, bmqp::StorageMessageType::Enum messageType); /// Replicate the record of specified `type` starting at specified @@ -859,10 +858,10 @@ class FileStore : public DataStore { int issueSyncPoint() BSLS_KEYWORD_OVERRIDE; /// Set the specified `primaryNode` with the specified `primaryLeaseId` - /// as the primary for this data store partition. Note that + /// as the active primary for this data store partition. Note that /// `primaryNode` could refer to the node which owns this data store. - void setPrimary(mqbnet::ClusterNode* primaryNode, - unsigned int primaryLeaseId) BSLS_KEYWORD_OVERRIDE; + void setActivePrimary(mqbnet::ClusterNode* primaryNode, + unsigned int primaryLeaseId) BSLS_KEYWORD_OVERRIDE; /// Clear the current primary associated with this partition. void clearPrimary() BSLS_KEYWORD_OVERRIDE; diff --git a/src/groups/mqb/mqbs/mqbs_filestore.t.cpp b/src/groups/mqb/mqbs/mqbs_filestore.t.cpp index 6e4ca278e..6977a451b 100644 --- a/src/groups/mqb/mqbs/mqbs_filestore.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_filestore.t.cpp @@ -36,12 +36,11 @@ #include #include -// MWC -#include -#include +#include +#include // TEST DRIVER -#include +#include // BDE #include @@ -155,7 +154,7 @@ struct Tester { bsl::vector d_clusterNodesCfg; mqbcfg::ClusterNode d_clusterNodeCfg; bslma::ManagedPtr d_cluster_mp; - bsl::shared_ptr d_clusterStatsRootContext_sp; + bsl::shared_ptr d_clusterStatsRootContext_sp; mqbstat::ClusterStats d_clusterStats; mqbnet::ClusterNode* d_node_p; mqbs::DataStoreConfig d_dsCfg; @@ -333,7 +332,7 @@ struct Tester { // Write a queue creation record. bsl::string uri(uriBase, s_allocator_p); - mwcu::MemOutStream osstr; + bmqu::MemOutStream osstr; osstr << "queue" << i; uri.append(osstr.str().data(), osstr.str().length()); @@ -799,7 +798,7 @@ static void test1_breathingTest() unsigned int primaryLeaseId = 1; bsls::Types::Uint64 seqNum = 1; - fs.setPrimary(tester.node(), primaryLeaseId); + fs.setActivePrimary(tester.node(), primaryLeaseId); ASSERT_EQ(primaryLeaseId, fs.primaryLeaseId()); ASSERT_EQ(seqNum, fs.sequenceNumber()); @@ -889,7 +888,7 @@ static void test2_printTest() // operator<<(bsl::ostream& stream, const FileStoreIterator& rhs // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PRINT TEST"); + bmqtst::TestHelper::printTestName("PRINT TEST"); s_ignoreCheckDefAlloc = true; @@ -902,7 +901,7 @@ static void test2_printTest() // Set primary. unsigned int primaryLeaseId = 1; bsls::Types::Uint64 seqNum = 1; - fs.setPrimary(tester.node(), primaryLeaseId); + fs.setActivePrimary(tester.node(), primaryLeaseId); // Write various records to the partition. SyncPointOffsetPairs spOffsetPairs(s_allocator_p); @@ -956,7 +955,7 @@ static void test2_printTest() BSLS_ASSERT_OPT(expectedOut.isPrepared()); mqbs::FileStoreIterator fsIt(&fs); - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); while (fsIt.next()) { stream << fsIt << "\n"; } @@ -981,9 +980,9 @@ static void test2_printTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); - mwcsys::Time::initialize(); + bmqsys::Time::initialize(); mqbu::MessageGUIDUtil::initialize(); bmqp::ProtocolUtil::initialize(); @@ -998,7 +997,7 @@ int main(int argc, char* argv[]) } bmqp::ProtocolUtil::shutdown(); - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_ALLOC); } diff --git a/src/groups/mqb/mqbs/mqbs_filestoreprintutil.cpp b/src/groups/mqb/mqbs/mqbs_filestoreprintutil.cpp index 974c89bbd..94657b424 100644 --- a/src/groups/mqb/mqbs/mqbs_filestoreprintutil.cpp +++ b/src/groups/mqb/mqbs/mqbs_filestoreprintutil.cpp @@ -20,10 +20,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -122,9 +121,9 @@ void FileStorePrintUtil::loadQueueStatus(mqbcmd::StorageQueueInfo* queueInfo, // PRECONDITIONS BSLS_ASSERT_SAFE(storage); - using namespace mwcu::PrintUtil; + using namespace bmqu::PrintUtil; - mwcu::MemOutStream field; + bmqu::MemOutStream field; field << storage->queueKey(); queueInfo->queueKey() = field.str(); queueInfo->partitionId() = storage->partitionId(); diff --git a/src/groups/mqb/mqbs/mqbs_filestoreprotocol.cpp b/src/groups/mqb/mqbs/mqbs_filestoreprotocol.cpp index 7ecfce125..15e5afec3 100644 --- a/src/groups/mqb/mqbs/mqbs_filestoreprotocol.cpp +++ b/src/groups/mqb/mqbs/mqbs_filestoreprotocol.cpp @@ -411,7 +411,7 @@ RecordHeader::print(bsl::ostream& stream, int level, int spacesPerLevel) const // struct MessageRecord // -------------------- -const char MessageRecord::k_CAT_MASK = 7; // 00000111 +const char MessageRecord::k_CAT_MASK = 7; // 00000111 const int MessageRecord::k_REFCOUNT_LOW_BITS_MASK = RecordHeader::k_FLAGS_MASK; bsl::ostream& @@ -464,6 +464,7 @@ const char* ConfirmReason::toAscii(ConfirmReason::Enum value) switch (value) { CASE(CONFIRMED) CASE(REJECTED) + CASE(AUTO_CONFIRMED) default: return "(* UNKNOWN *)"; } diff --git a/src/groups/mqb/mqbs/mqbs_filestoreprotocol.t.cpp b/src/groups/mqb/mqbs/mqbs_filestoreprotocol.t.cpp index 80aab5703..d9e125fe6 100644 --- a/src/groups/mqb/mqbs/mqbs_filestoreprotocol.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_filestoreprotocol.t.cpp @@ -19,8 +19,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -29,7 +28,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -67,7 +66,7 @@ static void test1_breathingTest() // Basic functionality of protocol structs // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); using namespace mqbs; typedef FileStoreProtocol FSP; @@ -466,7 +465,7 @@ static void test2_manipulators() // Test protocol structs with edge/corner values // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("MANIPULATORS"); + bmqtst::TestHelper::printTestName("MANIPULATORS"); using namespace mqbs; @@ -560,7 +559,7 @@ static void test3_printTest() // operator<<(bsl::ostream& stream, const JournalOpRecord& rhs) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PRINT TEST"); + bmqtst::TestHelper::printTestName("PRINT TEST"); using namespace mqbs; @@ -587,7 +586,7 @@ static void test3_printTest() "[ type = MESSAGE flags = 0 primaryLeaseId = 8 sequenceNumber = 33" " timestamp = 123456 ]"; - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); stream << rh; ASSERT_EQ(stream.str(), k_EXPECTED_OUTPUT); stream.reset(); @@ -623,7 +622,7 @@ static void test3_printTest() "messageGUID = ** UNSET ** crc32c = 2333 compressionAlgorithmType " "= ZLIB ]"; - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); stream << msgRec; ASSERT_EQ(stream.str(), k_EXPECTED_OUTPUT); stream.reset(); @@ -655,7 +654,7 @@ static void test3_printTest() "queueKey = DEADFACE13 appKey = FACEDAFACE messageGUID = ** UNSET " "** ]"; - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); stream << confRec; ASSERT_EQ(stream.str(), k_EXPECTED_OUTPUT); stream.reset(); @@ -685,7 +684,7 @@ static void test3_printTest() "IMPLICIT_CONFIRM queueKey = DEADFACE13 messageGUID = " "** UNSET ** ]"; - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); stream << delRec; ASSERT_EQ(stream.str(), k_EXPECTED_OUTPUT); stream.reset(); @@ -717,7 +716,7 @@ static void test3_printTest() "DEADFACE13 appKey = FACEDAFACE type = CREATION " "queueUriRecordOffsetWords = 69 ]"; - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); stream << qOpRec; ASSERT_EQ(stream.str(), k_EXPECTED_OUTPUT); stream.reset(); @@ -753,7 +752,7 @@ static void test3_printTest() "primaryNodeId = 1 primaryLeaseId = 8 dataFileOffsetDwords = 666 " "qlistFileOffsetWords = 23 ]"; - mwcu::MemOutStream stream(s_allocator_p); + bmqu::MemOutStream stream(s_allocator_p); stream << jOpRec; ASSERT_EQ(stream.str(), expectedOut); stream.reset(); @@ -772,7 +771,7 @@ static void test3_printTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -785,5 +784,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbs/mqbs_filestoreprotocolprinter.cpp b/src/groups/mqb/mqbs/mqbs_filestoreprotocolprinter.cpp index b4a80f829..a8e99f45c 100644 --- a/src/groups/mqb/mqbs/mqbs_filestoreprotocolprinter.cpp +++ b/src/groups/mqb/mqbs/mqbs_filestoreprotocolprinter.cpp @@ -27,12 +27,11 @@ #include #include -// MWC -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include // BDE #include @@ -66,7 +65,7 @@ BALL_LOG_SET_NAMESPACE_CATEGORY("MQBS.FILESTOREPROTOCOLPRINTER"); bsl::ostream& operator<<(bsl::ostream& stream, const mqbs::DataHeader& dataHeader) { - mwcu::OutStreamFormatSaver fmtSaver(stream); + bmqu::OutStreamFormatSaver fmtSaver(stream); stream << " HeaderWords: " << dataHeader.headerWords() << '\n'; stream << " OptionsWords: " << dataHeader.optionsWords() << '\n'; @@ -98,10 +97,10 @@ bsl::ostream& operator<<(bsl::ostream& stream, stream << "Data File Header: \n"; - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << header.fileKey(); - mwcu::AlignedPrinter printer(stream, &fields); + bmqu::AlignedPrinter printer(stream, &fields); printer << static_cast(header.headerWords()) << os.str(); stream << '\n'; @@ -116,7 +115,7 @@ bsl::ostream& operator<<(bsl::ostream& stream, stream << "Qlist File Header: \n"; - mwcu::AlignedPrinter printer(stream, &fields); + bmqu::AlignedPrinter printer(stream, &fields); printer << static_cast(header.headerWords()); stream << '\n'; @@ -136,7 +135,7 @@ bsl::ostream& operator<<(bsl::ostream& stream, const mqbs::FileHeader& fh = mqbs::FileStoreProtocolUtil::bmqHeader(mfd); stream << "BlazingMQ File Header" << '\n'; - mwcu::AlignedPrinter printer(stream, &fields); + bmqu::AlignedPrinter printer(stream, &fields); printer << static_cast(fh.protocolVersion()) << fh.bitness() << fh.fileType() << static_cast(fh.headerWords()) << fh.partitionId(); @@ -174,7 +173,7 @@ bsl::ostream& operator<<(bsl::ostream& stream, bsl::string queueUri(uri, uriLen); - mwcu::MemOutStream queueKeyStr; + bmqu::MemOutStream queueKeyStr; bdlb::Print::singleLineHexDump(queueKeyStr, queueKey, k_KEY_LEN); stream << '\n' @@ -201,7 +200,7 @@ bsl::ostream& operator<<(bsl::ostream& stream, const size_t k_MIN_LENGTH = 128; // Save stream flags - mwcu::OutStreamFormatSaver fmtSaver(stream); + bmqu::OutStreamFormatSaver fmtSaver(stream); switch (iterator.type()) { case bmqt::PropertyType::e_UNDEFINED: { @@ -286,7 +285,7 @@ void printHeader(bsl::ostream& stream, bsls::Types::Uint64 offsetW = header.firstSyncPointOffsetWords(); - mwcu::AlignedPrinter printer(stream, &fields); + bmqu::AlignedPrinter printer(stream, &fields); printer << static_cast(header.headerWords()) << static_cast(header.recordWords()) << offsetW; @@ -339,7 +338,7 @@ void printRecord(bsl::ostream& stream, const mqbs::MessageRecord& rec) fields.push_back("GUID"); fields.push_back("Crc32c"); - mwcu::AlignedPrinter printer(stream, &fields); + bmqu::AlignedPrinter printer(stream, &fields); printer << rec.header().primaryLeaseId() << rec.header().sequenceNumber(); bsls::Types::Uint64 epochValue = rec.header().timestamp(); @@ -352,7 +351,7 @@ void printRecord(bsl::ostream& stream, const mqbs::MessageRecord& rec) printer << datetime; } - mwcu::MemOutStream fileKeyStr, queueKeyStr; + bmqu::MemOutStream fileKeyStr, queueKeyStr; fileKeyStr << rec.fileKey(); queueKeyStr << rec.queueKey(); @@ -374,7 +373,7 @@ void printRecord(bsl::ostream& stream, const mqbs::ConfirmRecord& rec) fields.push_back("AppKey"); fields.push_back("GUID"); - mwcu::MemOutStream queueKeyStr, appKeyStr; + bmqu::MemOutStream queueKeyStr, appKeyStr; queueKeyStr << rec.queueKey(); if (rec.appKey().isNull()) { @@ -384,7 +383,7 @@ void printRecord(bsl::ostream& stream, const mqbs::ConfirmRecord& rec) appKeyStr << rec.appKey(); } - mwcu::AlignedPrinter printer(stream, &fields); + bmqu::AlignedPrinter printer(stream, &fields); printer << rec.header().primaryLeaseId() << rec.header().sequenceNumber(); bsls::Types::Uint64 epochValue = rec.header().timestamp(); @@ -412,10 +411,10 @@ void printRecord(bsl::ostream& stream, const mqbs::DeletionRecord& rec) fields.push_back("DeletionFlag"); fields.push_back("GUID"); - mwcu::MemOutStream queueKeyStr; + bmqu::MemOutStream queueKeyStr; queueKeyStr << rec.queueKey(); - mwcu::AlignedPrinter printer(stream, &fields); + bmqu::AlignedPrinter printer(stream, &fields); printer << rec.header().primaryLeaseId() << rec.header().sequenceNumber(); bsls::Types::Uint64 epochValue = rec.header().timestamp(); @@ -447,7 +446,7 @@ void printRecord(bsl::ostream& stream, const mqbs::QueueOpRecord& rec) fields.push_back("QLIST OffsetWords"); } - mwcu::MemOutStream queueKeyStr, appKeyStr; + bmqu::MemOutStream queueKeyStr, appKeyStr; queueKeyStr << rec.queueKey(); if (rec.appKey().isNull()) { @@ -457,7 +456,7 @@ void printRecord(bsl::ostream& stream, const mqbs::QueueOpRecord& rec) appKeyStr << rec.appKey(); } - mwcu::AlignedPrinter printer(stream, &fields); + bmqu::AlignedPrinter printer(stream, &fields); printer << rec.header().primaryLeaseId() << rec.header().sequenceNumber(); bsls::Types::Uint64 epochValue = rec.header().timestamp(); @@ -494,7 +493,7 @@ void printRecord(bsl::ostream& stream, const mqbs::JournalOpRecord& rec) fields.push_back("PrimaryNodeId"); fields.push_back("DataFileOffsetDwords"); - mwcu::AlignedPrinter printer(stream, &fields); + bmqu::AlignedPrinter printer(stream, &fields); printer << rec.header().primaryLeaseId() << rec.header().sequenceNumber(); bsls::Types::Uint64 epochValue = rec.header().timestamp(); @@ -550,7 +549,7 @@ void printOptions(bsl::ostream& stream, const char* options, unsigned int len) optionsBlob.appendDataBuffer(optionsBuffer); bmqp::OptionsView optionsView(&optionsBlob, - mwcu::BlobPosition(0, 0), + bmqu::BlobPosition(0, 0), len, bslma::Default::allocator(0)); @@ -613,9 +612,9 @@ int printMessageProperties(unsigned int* propertiesAreaLen, void printIterator(mqbs::DataFileIterator& it) { - mwcu::MemOutStream dataHeaderOsstr; - mwcu::MemOutStream optionsOsstr; - mwcu::MemOutStream propsOsstr; + bmqu::MemOutStream dataHeaderOsstr; + bmqu::MemOutStream optionsOsstr; + bmqu::MemOutStream propsOsstr; dataHeaderOsstr << it.dataHeader(); @@ -647,7 +646,7 @@ void printIterator(mqbs::DataFileIterator& it) } // Payload - mwcu::MemOutStream payloadOsstr; + bmqu::MemOutStream payloadOsstr; printPayload(payloadOsstr, appData, appDataLen); BALL_LOG_INFO_BLOCK @@ -699,7 +698,7 @@ void printIterator(mqbs::QlistFileIterator& it) << ", offset: " << it.recordOffset() << '\n' << "QueueUriRecord:" << '\n'; - mwcu::AlignedPrinter printer(BALL_LOG_OUTPUT_STREAM, &fields); + bmqu::AlignedPrinter printer(BALL_LOG_OUTPUT_STREAM, &fields); printer << bsl::string(uri, uriLen) << mqbu::StorageKey(mqbu::StorageKey::BinaryRepresentation(), queueKey) @@ -712,7 +711,7 @@ void printIterator(mqbs::QlistFileIterator& it) appIdsInfo.push_back("AppKey"); } - mwcu::AlignedPrinter p(BALL_LOG_OUTPUT_STREAM, &appIdsInfo); + bmqu::AlignedPrinter p(BALL_LOG_OUTPUT_STREAM, &appIdsInfo); for (size_t n = 0; n < numAppIds; ++n) { p << bsl::string(appIdLenPairs[n].first, appIdLenPairs[n].second) @@ -726,7 +725,7 @@ void printIterator(mqbs::QlistFileIterator& it) void printIterator(mqbs::JournalFileIterator& it) { mqbs::RecordType::Enum recordType = it.recordType(); - mwcu::MemOutStream oss; + bmqu::MemOutStream oss; switch (recordType) { case mqbs::RecordType::e_MESSAGE: { diff --git a/src/groups/mqb/mqbs/mqbs_filestoreprotocolutil.cpp b/src/groups/mqb/mqbs/mqbs_filestoreprotocolutil.cpp index 42e3c1b7c..9a5856ea9 100644 --- a/src/groups/mqb/mqbs/mqbs_filestoreprotocolutil.cpp +++ b/src/groups/mqb/mqbs/mqbs_filestoreprotocolutil.cpp @@ -298,26 +298,26 @@ bsls::Types::Uint64 FileStoreProtocolUtil::lastJournalRecord( int FileStoreProtocolUtil::calculateMd5Digest( bdlde::Md5::Md5Digest* buffer, const bdlbb::Blob& blob, - const mwcu::BlobPosition& startPos, + const bmqu::BlobPosition& startPos, unsigned int length) { BSLS_ASSERT_SAFE(buffer); BSLS_ASSERT_SAFE(0 < length); - BSLS_ASSERT_SAFE(mwcu::BlobUtil::isValidPos(blob, startPos)); + BSLS_ASSERT_SAFE(bmqu::BlobUtil::isValidPos(blob, startPos)); - mwcu::BlobPosition endPos; + bmqu::BlobPosition endPos; int rc = - mwcu::BlobUtil::findOffsetSafe(&endPos, blob, startPos, length - 1); + bmqu::BlobUtil::findOffsetSafe(&endPos, blob, startPos, length - 1); if (0 != rc) { return rc; // RETURN } bdlde::Md5 hasher; - mwcu::BlobPosition pos(startPos); + bmqu::BlobPosition pos(startPos); while (length) { unsigned int len = bsl::min( static_cast(length), - mwcu::BlobUtil::bufferSize(blob, pos.buffer()) - pos.byte()); + bmqu::BlobUtil::bufferSize(blob, pos.buffer()) - pos.byte()); hasher.update(blob.buffer(pos.buffer()).data() + pos.byte(), len); diff --git a/src/groups/mqb/mqbs/mqbs_filestoreprotocolutil.h b/src/groups/mqb/mqbs/mqbs_filestoreprotocolutil.h index 15f71d71d..9fbd417a0 100644 --- a/src/groups/mqb/mqbs/mqbs_filestoreprotocolutil.h +++ b/src/groups/mqb/mqbs/mqbs_filestoreprotocolutil.h @@ -34,8 +34,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -105,7 +104,7 @@ struct FileStoreProtocolUtil { /// position in the `blob` and `length` is non-zero. static int calculateMd5Digest(bdlde::Md5::Md5Digest* buffer, const bdlbb::Blob& blob, - const mwcu::BlobPosition& startPos, + const bmqu::BlobPosition& startPos, unsigned int length); static void loadAppIdKeyPairs( diff --git a/src/groups/mqb/mqbs/mqbs_filestoreprotocolutil.t.cpp b/src/groups/mqb/mqbs/mqbs_filestoreprotocolutil.t.cpp index b5db9e7c6..5948826f7 100644 --- a/src/groups/mqb/mqbs/mqbs_filestoreprotocolutil.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_filestoreprotocolutil.t.cpp @@ -32,7 +32,7 @@ #include // TEST DRIVER -#include +#include // BDE #include @@ -51,7 +51,7 @@ static void test1_hasBmqHeader() // static int hasBmqHeader(const MemoryBlock& block); // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HAS BlazingMQ HEADER"); + bmqtst::TestHelper::printTestName("HAS BlazingMQ HEADER"); using namespace mqbs; @@ -702,7 +702,7 @@ static void jobForThreadPool(const Results* testData, bslmt::Barrier* barrier) // ------------------------------------------------------------------------ { bdlbb::PooledBlobBufferFactory factory(1024, s_allocator_p); - mwcu::BlobPosition startPos; + bmqu::BlobPosition startPos; barrier->wait(); for (int i = 0; i < 1000; ++i) { @@ -742,14 +742,14 @@ static void test5_calculateMd5Digest() // calculateMd5Digest() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CALCULATE MD5 DIGEST"); + bmqtst::TestHelper::printTestName("CALCULATE MD5 DIGEST"); bsl::string data("12345678901234567890", s_allocator_p); bsl::string md5("fd85e62d9beb45428771ec688418b271", s_allocator_p); bsl::string md5b(s_allocator_p); bytesFromHex(&md5b, md5); - mwcu::BlobPosition startPos; + bmqu::BlobPosition startPos; bdlbb::PooledBlobBufferFactory myFactory(1024, s_allocator_p); bdlbb::Blob blob(&myFactory, s_allocator_p); blob.setLength(data.size()); @@ -782,12 +782,12 @@ static void test5_calculateMd5Digest() ASSERT_FAIL(mqbs::FileStoreProtocolUtil::calculateMd5Digest( &buffer, blob, - mwcu::BlobPosition(0, data.size() + 1), + bmqu::BlobPosition(0, data.size() + 1), data.size())); ASSERT_FAIL(mqbs::FileStoreProtocolUtil::calculateMd5Digest( &buffer, blob, - mwcu::BlobPosition(1, 1), + bmqu::BlobPosition(1, 1), data.size())); } @@ -903,7 +903,7 @@ static void test5_calculateMd5Digest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); // One time app initialization. bsls::TimeUtil::initialize(); @@ -921,5 +921,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_ALLOC); } diff --git a/src/groups/mqb/mqbs/mqbs_filestoreset.cpp b/src/groups/mqb/mqbs/mqbs_filestoreset.cpp index a17388f52..f239d6b85 100644 --- a/src/groups/mqb/mqbs/mqbs_filestoreset.cpp +++ b/src/groups/mqb/mqbs/mqbs_filestoreset.cpp @@ -17,8 +17,8 @@ #include #include -// MWC -#include + +#include // BDE #include @@ -36,7 +36,7 @@ static bsl::ostream& prettyPrintSize(bsl::ostream& stream, BSLS_ANNOTATION_UNUSED int level = 0, int spacesPerLevel = 4) { - stream << mwcu::PrintUtil::prettyNumber( + stream << bmqu::PrintUtil::prettyNumber( static_cast(size)); if (spacesPerLevel >= 0) { stream << "\n"; diff --git a/src/groups/mqb/mqbs/mqbs_filestoreset.t.cpp b/src/groups/mqb/mqbs/mqbs_filestoreset.t.cpp index bfd745f90..063554d01 100644 --- a/src/groups/mqb/mqbs/mqbs_filestoreset.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_filestoreset.t.cpp @@ -16,15 +16,14 @@ // mqbs_filestoreset.t.cpp -*-C++-*- #include -// MWC -#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -45,7 +44,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); const bsl::string k_DATA_FILE = "data"; const bsls::Types::Int64 k_DATA_FILE_SIZE = 1 * 1024 * 1024; @@ -117,21 +116,21 @@ static void test1_breathingTest() " journalFileSize = 2,048 ]"; { PVV("Print (print function)"); - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); obj2.print(out, 0, -1); ASSERT_EQ(out.str(), expected); } { PVV("Print (stream operator)"); - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); out << obj2; ASSERT_EQ(out.str(), expected); } { PVV("Print (bad stream)"); - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); out.setstate(bsl::ios_base::badbit); obj2.print(out, 0, -1); ASSERT_EQ(out.str(), ""); @@ -144,7 +143,7 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -155,5 +154,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbs/mqbs_filestoreutil.cpp b/src/groups/mqb/mqbs/mqbs_filestoreutil.cpp index 79db6261c..f48117db6 100644 --- a/src/groups/mqb/mqbs/mqbs_filestoreutil.cpp +++ b/src/groups/mqb/mqbs/mqbs_filestoreutil.cpp @@ -28,10 +28,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -95,7 +94,7 @@ void createFileName(bsl::string* filename, } filename->append(FileStoreProtocol::k_COMMON_FILE_PREFIX); - mwcu::MemOutStream osstr; + bmqu::MemOutStream osstr; osstr << partitionId; filename->append(osstr.str().data(), osstr.str().length()); filename->append("."); @@ -408,21 +407,21 @@ void FileStoreUtil::createQlistFileName(bsl::string* filename, bool FileStoreUtil::hasDataFileExtension(const bsl::string& filename) { - return mwcu::StringUtil::endsWith( + return bmqu::StringUtil::endsWith( filename, FileStoreProtocol::k_DATA_FILE_EXTENSION); } bool FileStoreUtil::hasJournalFileExtension(const bsl::string& filename) { - return mwcu::StringUtil::endsWith( + return bmqu::StringUtil::endsWith( filename, FileStoreProtocol::k_JOURNAL_FILE_EXTENSION); } bool FileStoreUtil::hasQlistFileExtension(const bsl::string& filename) { - return mwcu::StringUtil::endsWith( + return bmqu::StringUtil::endsWith( filename, FileStoreProtocol::k_QLIST_FILE_EXTENSION); } @@ -454,7 +453,7 @@ int FileStoreUtil::createFilePattern(bsl::string* pattern, p.append(1, '/'); } - mwcu::MemOutStream osstr; + bmqu::MemOutStream osstr; osstr << partitionId; p.append(FileStoreProtocol::k_COMMON_FILE_PREFIX); @@ -556,7 +555,7 @@ int FileStoreUtil::create(bsl::ostream& errorDescription, .setQlistFileSize(dataStoreConfig.maxQlistFileSize()); } - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; int rc = openFileSetWriteMode(errorDesc, fs, dataStoreConfig.hasPreallocate(), @@ -854,11 +853,11 @@ void FileStoreUtil::deleteArchiveFiles(int partitionId, for (unsigned int i = 0; i < numFilesToDelete; ++i) { rc = bdls::FilesystemUtil::remove(archivedFiles[i]); if (0 != rc) { - MWCTSK_ALARMLOG_ALARM("FILE_IO") + BMQTSK_ALARMLOG_ALARM("FILE_IO") << cluster << ": Failed to remove [" << archivedFiles[i] << "] file during archived storage cleanup for " << "Partition [" << partitionId << "], rc: " << rc - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; continue; // CONTINUE } @@ -876,16 +875,16 @@ void FileStoreUtil::deleteArchiveFiles( BSLS_ASSERT_SAFE(!archiveLocation.empty()); if (!bdls::FilesystemUtil::exists(archiveLocation)) { - MWCTSK_ALARMLOG_ALARM("MISSING_FILE_OR_DIRECTORY") + BMQTSK_ALARMLOG_ALARM("MISSING_FILE_OR_DIRECTORY") << cluster << ": Archive storage location [" << archiveLocation - << "] no longer exists." << MWCTSK_ALARMLOG_END; + << "] no longer exists." << BMQTSK_ALARMLOG_END; return; // RETURN } if (!bdls::FilesystemUtil::isDirectory(archiveLocation)) { - MWCTSK_ALARMLOG_ALARM("MISSING_FILE_OR_DIRECTORY") + BMQTSK_ALARMLOG_ALARM("MISSING_FILE_OR_DIRECTORY") << cluster << ": Archive storage location [" << archiveLocation - << "] is not a directory." << MWCTSK_ALARMLOG_END; + << "] is not a directory." << BMQTSK_ALARMLOG_END; return; // RETURN } @@ -959,7 +958,7 @@ int FileStoreUtil::openFileSetWriteMode(bsl::ostream& errorDescription, } // Grow the files, pre-allocating if requested. - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; if (journalFd) { rc = FileSystemUtil::grow(journalFd, preallocate, errorDesc); if (0 != rc) { @@ -1106,7 +1105,7 @@ int FileStoreUtil::openRecoveryFileSet(bsl::ostream& errorDescription, BALL_LOG_INFO << "Partition [" << partitionId << "]" << ": Checking file set: " << fs; - mwcu::MemOutStream errorDesc; + bmqu::MemOutStream errorDesc; if (readOnly) { rc = openFileSetReadMode(errorDesc, fs, journalFd, dataFd, qlistFd); diff --git a/src/groups/mqb/mqbs/mqbs_inmemorystorage.cpp b/src/groups/mqb/mqbs/mqbs_inmemorystorage.cpp index 75b3f6a57..9a77288d9 100644 --- a/src/groups/mqb/mqbs/mqbs_inmemorystorage.cpp +++ b/src/groups/mqb/mqbs/mqbs_inmemorystorage.cpp @@ -22,10 +22,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -55,15 +54,20 @@ InMemoryStorage::InMemoryStorage(const bmqt::Uri& uri, const mqbconfm::Domain& config, mqbu::CapacityMeter* parentCapacityMeter, bslma::Allocator* allocator, - mwcma::CountingAllocatorStore* allocatorStore) + bmqma::CountingAllocatorStore* allocatorStore) : d_allocator_p(allocator) , d_key(queueKey) , d_uri(uri, allocator) , d_partitionId(partitionId) , d_config() -, d_capacityMeter("queue [" + uri.asString() + "]", - parentCapacityMeter, - allocator) +, d_capacityMeter( + "queue [" + uri.asString() + "]", + parentCapacityMeter, + allocator, + bdlf::BindUtil::bind(&InMemoryStorage::logAppsSubscriptionInfoCb, + this, + bdlf::PlaceHolders::_1) // stream + ) , d_items(bsls::TimeInterval() .addMilliseconds(config.deduplicationTimeMs()) .totalNanoseconds(), @@ -123,9 +127,9 @@ void InMemoryStorage::setQueue(mqbi::Queue* queue) BALL_LOG_INFO << "Associated queue [" << queue->uri() << "] with key [" << queueKey() << "] and Partition [" << queue->partitionId() << "] with its storage having [" - << mwcu::PrintUtil::prettyNumber(numMessage) + << bmqu::PrintUtil::prettyNumber(numMessage) << " messages and " - << mwcu::PrintUtil::prettyNumber(numByte) + << bmqu::PrintUtil::prettyNumber(numByte) << " bytes of outstanding."; } } @@ -256,8 +260,8 @@ InMemoryStorage::confirm(const bmqt::MessageGUID& msgGUID, } if (!appKey.isNull()) { - mqbi::StorageResult::Enum rc = d_virtualStorageCatalog.confirm(msgGUID, - appKey); + const mqbi::StorageResult::Enum rc = + d_virtualStorageCatalog.confirm(msgGUID, appKey); if (mqbi::StorageResult::e_SUCCESS != rc) { return rc; // RETURN } @@ -310,6 +314,12 @@ InMemoryStorage::releaseRef(const bmqt::MessageGUID& guid) d_items.erase(it); + if (queue()) { + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_UPDATE_HISTORY, + d_items.historySize()); + } + return mqbi::StorageResult::e_ZERO_REFERENCES; // RETURN } @@ -337,6 +347,9 @@ InMemoryStorage::remove(const bmqt::MessageGUID& msgGUID, int* msgSize) queue()->stats()->onEvent( mqbstat::QueueStatsDomain::EventType::e_DEL_MESSAGE, msgLen); + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_UPDATE_HISTORY, + d_items.historySize()); } if (msgSize) { @@ -390,6 +403,12 @@ InMemoryStorage::removeAll(const mqbu::StorageKey& appKey) d_isEmpty.storeRelaxed(1); } + if (queue()) { + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_UPDATE_HISTORY, + d_items.historySize()); + } + return mqbi::StorageResult::e_SUCCESS; } @@ -406,7 +425,7 @@ int InMemoryStorage::gcExpiredMessages( *configuredTtlValue = d_ttlSeconds; int numMsgsDeleted = 0; - const bsls::Types::Int64 now = mwcsys::Time::highResolutionTimer(); + const bsls::Types::Int64 now = bmqsys::Time::highResolutionTimer(); int limit = k_GC_MESSAGES_BATCH_SIZE; for (ItemsMapIter next = d_items.begin(), cit; @@ -442,6 +461,9 @@ int InMemoryStorage::gcExpiredMessages( queue()->stats()->onEvent( mqbstat::QueueStatsDomain::EventType::e_GC_MESSAGE, numMsgsDeleted); + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_UPDATE_HISTORY, + d_items.historySize()); } if (d_items.empty()) { @@ -453,8 +475,16 @@ int InMemoryStorage::gcExpiredMessages( bool InMemoryStorage::gcHistory() { - return d_items.gc(mwcsys::Time::highResolutionTimer(), - k_GC_MESSAGES_BATCH_SIZE); + bool hasMoreToGc = d_items.gc(bmqsys::Time::highResolutionTimer(), + k_GC_MESSAGES_BATCH_SIZE); + + if (queue()) { + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_UPDATE_HISTORY, + d_items.historySize()); + } + + return hasMoreToGc; } void InMemoryStorage::selectForAutoConfirming(const bmqt::MessageGUID& msgGUID) @@ -576,5 +606,24 @@ bool InMemoryStorage::isStrongConsistency() const return false; } +bsl::ostream& +InMemoryStorage::logAppsSubscriptionInfoCb(bsl::ostream& stream) const +{ + if (queue()) { + mqbi::Storage::AppIdKeyPairs appIdKeyPairs; + loadVirtualStorageDetails(&appIdKeyPairs); + + for (mqbi::Storage::AppIdKeyPairs::const_iterator cit = + appIdKeyPairs.begin(); + cit != appIdKeyPairs.end(); + ++cit) { + queue()->queueEngine()->logAppSubscriptionInfo(stream, + cit->second); + } + } + + return stream; +} + } // close package namespace } // close enterprise namespace diff --git a/src/groups/mqb/mqbs/mqbs_inmemorystorage.h b/src/groups/mqb/mqbs/mqbs_inmemorystorage.h index e48ea3b21..c2a408bf8 100644 --- a/src/groups/mqb/mqbs/mqbs_inmemorystorage.h +++ b/src/groups/mqb/mqbs/mqbs_inmemorystorage.h @@ -42,8 +42,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -67,7 +66,7 @@ namespace BloombergLP { namespace mqbi { class Queue; } -namespace mwcma { +namespace bmqma { class CountingAllocatorStore; } @@ -136,7 +135,7 @@ class InMemoryStorage BSLS_KEYWORD_FINAL : public ReplicatedStorage { /// Must be a container in which iteration order is same as insertion /// order. - typedef mwcc::OrderedHashMapWithHistory< + typedef bmqc::OrderedHashMapWithHistory< bmqt::MessageGUID, Item, bslh::Hash > @@ -230,6 +229,12 @@ class InMemoryStorage BSLS_KEYWORD_FINAL : public ReplicatedStorage { /// Not implemented InMemoryStorage& operator=(const InMemoryStorage&) BSLS_KEYWORD_DELETED; + // PRIVATE ACCESSORS + + /// Callback function called by `d_capacityMeter` to log appllications + /// subscription info into the specified `stream`. + bsl::ostream& logAppsSubscriptionInfoCb(bsl::ostream& stream) const; + public: // TRAITS BSLMF_NESTED_TRAIT_DECLARATION(InMemoryStorage, bslma::UsesBslmaAllocator) @@ -246,7 +251,7 @@ class InMemoryStorage BSLS_KEYWORD_FINAL : public ReplicatedStorage { const mqbconfm::Domain& config, mqbu::CapacityMeter* parentCapacityMeter, bslma::Allocator* allocator, - mwcma::CountingAllocatorStore* allocatorStore = 0); + bmqma::CountingAllocatorStore* allocatorStore = 0); /// Destructor virtual ~InMemoryStorage() BSLS_KEYWORD_OVERRIDE; @@ -799,7 +804,7 @@ inline bool InMemoryStorage::isProxy() const } // close package namespace -namespace mwcc { +namespace bmqc { template <> inline void diff --git a/src/groups/mqb/mqbs/mqbs_inmemorystorage.t.cpp b/src/groups/mqb/mqbs/mqbs_inmemorystorage.t.cpp index f4c7788d7..9b91b67c4 100644 --- a/src/groups/mqb/mqbs/mqbs_inmemorystorage.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_inmemorystorage.t.cpp @@ -36,8 +36,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -57,7 +56,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -97,9 +96,9 @@ using namespace bsl; namespace { // CONSTANTS -const int k_PARTITION_ID = 1; -const int k_PROXY_PARTITION_ID = mqbs::DataStore::k_INVALID_PARTITION_ID; -const char k_HEX_QUEUE[] = "ABCDEF1234"; +const int k_PARTITION_ID = 1; +const int k_PROXY_PARTITION_ID = mqbs::DataStore::k_INVALID_PARTITION_ID; +const char k_HEX_QUEUE[] = "ABCDEF1234"; const bsls::Types::Int64 k_DEFAULT_MSG = 20; const bsls::Types::Int64 k_DEFAULT_BYTES = 2048; const char k_URI_STR[] = "bmq://mydomain/testqueue"; @@ -240,7 +239,7 @@ struct Tester { limits.bytes() = byteCapacity; limits.bytesWatermarkRatio() = byteWatermarkRatio; - mwcu::MemOutStream errDescription(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); return d_inMemoryStorage_mp->configure(errDescription, config, limits, @@ -327,7 +326,7 @@ struct Tester { /// Fixture instantiating a tester of `mqbs::InMemoryStorage` having not yet /// configured the storage with a storage configuration. -struct BasicTest : mwctst::Test { +struct BasicTest : bmqtst::Test { // PUBLIC DATA Tester d_tester; @@ -363,7 +362,7 @@ BasicTest::~BasicTest() /// Fixture instantiating a tester of `mqbs::InMemoryStorage` having already /// configured the storage with an InMemoryStorage configuration. -struct Test : mwctst::Test { +struct Test : bmqtst::Test { // PUBLIC DATA Tester d_tester; @@ -399,7 +398,7 @@ Test::~Test() /// Fixture instantiating a tester of `mqbs::InMemoryStorage` instantiated /// with parameterized `TTL` and having already configured the storage with /// an InMemoryStorage configuration. -struct GCTest : mwctst::Test { +struct GCTest : bmqtst::Test { // PUBLIC DATA bsls::ObjectBuffer d_testerBuffer; @@ -463,7 +462,7 @@ TEST_F(BasicTest, breathingTest) // - setQueue(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); ASSERT_EQ(d_tester.storage().queueUri().asString(), k_URI_STR); ASSERT_EQ(d_tester.storage().queueKey(), k_QUEUE_KEY); @@ -496,7 +495,7 @@ TEST_F(BasicTest, configure) // - configure(...) + config() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CONFIGURE"); + bmqtst::TestHelper::printTestName("CONFIGURE"); ASSERT_EQ(d_tester.configure(k_DEFAULT_MSG, k_DEFAULT_BYTES), 0); @@ -531,7 +530,7 @@ TEST_F(Test, unsupportedOperations) // purge(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("UNSUPPORTED OPRATIONS"); + bmqtst::TestHelper::printTestName("UNSUPPORTED OPRATIONS"); bmqt::MessageGUID guid; mqbu::StorageKey appKey; @@ -561,10 +560,10 @@ TEST_F(Test, put_noVirtualStorage) // in a 'mqbs::InMemoryStorage'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PUT - WITH NO VIRTUAL STORAGES"); + bmqtst::TestHelper::printTestName("PUT - WITH NO VIRTUAL STORAGES"); - mwcu::MemOutStream errDescription(s_allocator_p); - bsl::vector guids(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); + bsl::vector guids(s_allocator_p); const int k_MSG_COUNT = 10; @@ -598,10 +597,10 @@ TEST_F(Test, getMessageSize) // - 'getMessageSize(...)' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GET MESSAGE SIZE"); + bmqtst::TestHelper::printTestName("GET MESSAGE SIZE"); - mwcu::MemOutStream errDescription(s_allocator_p); - bsl::vector guids(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); + bsl::vector guids(s_allocator_p); const int k_MSG_COUNT = 10; @@ -635,10 +634,10 @@ TEST_F(Test, get_noVirtualStorages) // in a 'mqbs::InMemoryStorage'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GET - WITH NO VIRTUAL STORAGES"); + bmqtst::TestHelper::printTestName("GET - WITH NO VIRTUAL STORAGES"); - mwcu::MemOutStream errDescription(s_allocator_p); - bsl::vector guids(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); + bsl::vector guids(s_allocator_p); const int k_MSG_COUNT = 5; @@ -700,7 +699,7 @@ TEST_F(Test, test8_remove_messageNotFound) // in storage as well as GUID not in storage // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("REMOVE - MESSAGE NOT FOUND"); + bmqtst::TestHelper::printTestName("REMOVE - MESSAGE NOT FOUND"); // 'remove' one random message bmqt::MessageGUID randomGUID = generateRandomGUID(); @@ -720,12 +719,12 @@ TEST_F(Test, removeMessage) // in storage as well as GUID not in storage // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("REMOVE MESSAGE"); + bmqtst::TestHelper::printTestName("REMOVE MESSAGE"); const int k_MSG_COUNT = 10; - mwcu::MemOutStream errDescription(s_allocator_p); - bsl::vector guids(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); + bsl::vector guids(s_allocator_p); // Check 'put' - To physical storage (StorageKeys = NULL) BSLS_ASSERT_OPT(d_tester.addMessages(&guids, k_MSG_COUNT) == @@ -757,9 +756,9 @@ TEST_F(Test, addVirtualStorage) // 'mqbs::InMemoryStorage'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ADD VIRTUAL STORAGE"); + bmqtst::TestHelper::printTestName("ADD VIRTUAL STORAGE"); - mwcu::MemOutStream errDescription(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); bsl::string dummyAppId(s_allocator_p); mqbu::StorageKey dummyAppKey; @@ -786,9 +785,9 @@ TEST_F(Test, hasVirtualStorage) // successfully added // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HAS VIRTUAL STORAGE"); + bmqtst::TestHelper::printTestName("HAS VIRTUAL STORAGE"); - mwcu::MemOutStream errDescription(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); bsl::string dummyAppId(s_allocator_p); mqbu::StorageKey dummyAppKey; @@ -826,9 +825,9 @@ TEST_F(Test, removeVirtualStorage) // in a 'mqbs::InMemoryStorage'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("REMOVE VIRTUAL STORAGE"); + bmqtst::TestHelper::printTestName("REMOVE VIRTUAL STORAGE"); - mwcu::MemOutStream errDescription(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); bsl::string dummyAppId(s_allocator_p); // Virtual Storage - Add @@ -861,13 +860,13 @@ TEST_F(Test, put_withVirtualStorages) // in a 'mqbs::InMemoryStorage'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PUT - WITH VIRTUAL STORAGES"); + bmqtst::TestHelper::printTestName("PUT - WITH VIRTUAL STORAGES"); // CONSTANTS const bsls::Types::Int64 k_MSG_LIMIT = 80; const bsls::Types::Int64 k_BYTES_LIMIT = 2048; - mwcu::MemOutStream errDescription(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); int rc = d_tester.configure(k_MSG_LIMIT, k_BYTES_LIMIT); BSLS_ASSERT_OPT(rc == 0); @@ -932,10 +931,10 @@ TEST_F(Test, removeAllMessages_appKeyNotFound) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("REMOVE ALL MESSAGES " + bmqtst::TestHelper::printTestName("REMOVE ALL MESSAGES " "- APPKEY NOT FOUND"); - mwcu::MemOutStream errDescription(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); const bsls::Types::Int64 k_MSG_LIMIT = 80; const bsls::Types::Int64 k_BYTES_LIMIT = 2048; @@ -982,9 +981,9 @@ TEST_F(BasicTest, removeAllMessages) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Remove All Messages Test"); + bmqtst::TestHelper::printTestName("Remove All Messages Test"); - mwcu::MemOutStream errDescription(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); const bsls::Types::Int64 k_MSG_LIMIT = 80; const bsls::Types::Int64 k_BYTES_LIMIT = 2048; @@ -1045,9 +1044,9 @@ TEST_F(BasicTest, get_withVirtualStorages) // in a 'mqbs::InMemoryStorage'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Get- with Virtual Storage Test"); + bmqtst::TestHelper::printTestName("Get- with Virtual Storage Test"); - mwcu::MemOutStream errDescription(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); const bsls::Types::Int64 k_MSG_LIMIT = 80; const bsls::Types::Int64 k_BYTES_LIMIT = 2048; @@ -1106,12 +1105,12 @@ TEST_F(BasicTest, confirm) // in a 'mqbs::InMemoryStorage'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("RELEASE REF"); + bmqtst::TestHelper::printTestName("RELEASE REF"); const bsls::Types::Int64 k_MSG_LIMIT = 80; const bsls::Types::Int64 k_BYTES_LIMIT = 2048; - mwcu::MemOutStream errDescription(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); BSLS_ASSERT_OPT(d_tester.configure(k_MSG_LIMIT, k_BYTES_LIMIT) == 0); @@ -1184,13 +1183,13 @@ TEST_F(Test, getIterator_noVirtualStorages) // in a 'mqbs::InMemoryStorage'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Iterator- No virtual storages Test"); + bmqtst::TestHelper::printTestName("Iterator- No virtual storages Test"); - mwcu::MemOutStream errDescription(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); const int k_MSG_COUNT = 10; - bsl::vector guids(s_allocator_p); + bsl::vector guids(s_allocator_p); // Put to physical storage: StorageKeys NULL ASSERT_EQ(d_tester.addMessages(&guids, k_MSG_COUNT), @@ -1256,9 +1255,9 @@ TEST_F(BasicTest, getIterator_withVirtualStorages) // in a 'mqbs::InMemoryStorage'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Iterator Test- In presence of Virtual"); + bmqtst::TestHelper::printTestName("Iterator Test- In presence of Virtual"); - mwcu::MemOutStream errDescription(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); const bsls::Types::Int64 k_MSG_LIMIT = 80; const bsls::Types::Int64 k_BYTES_LIMIT = 2048; @@ -1359,11 +1358,11 @@ TEST_F(Test, capacityMeter_limitMessages) // limits on messages in a 'mqbs::InMemoryStorage'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Capacity Meter- Limit Messages"); + bmqtst::TestHelper::printTestName("Capacity Meter- Limit Messages"); - mwcu::MemOutStream errDescription(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); - bsl::vector guids(s_allocator_p); + bsl::vector guids(s_allocator_p); // Put to physical storage: StorageKeys NULL ASSERT_EQ(d_tester.addMessages(&guids, k_DEFAULT_MSG), @@ -1404,16 +1403,16 @@ TEST_F(Test, capacityMeter_limitBytes) // limits on bytes in a 'mqbs::InMemoryStorage'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Capacity Meter - Limit Bytes"); + bmqtst::TestHelper::printTestName("Capacity Meter - Limit Bytes"); - mwcu::MemOutStream errDescription(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); const bsls::Types::Int64 k_MSG_LIMIT = 30; const bsls::Types::Int64 k_BYTES_LIMIT = 80; BSLS_ASSERT_OPT(d_tester.configure(k_MSG_LIMIT, k_BYTES_LIMIT) == 0); - bsl::vector guids(s_allocator_p); + bsl::vector guids(s_allocator_p); // Insert Max messages possible in 80bytes const int k_MSG_COUNT = 20; @@ -1444,7 +1443,7 @@ TEST_F(GCTest, garbageCollect) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GARBAGE COLLECT"); + bmqtst::TestHelper::printTestName("GARBAGE COLLECT"); // Set with TTL of 20: control GC test by manipulating secondsFromEpoch // input @@ -1452,8 +1451,8 @@ TEST_F(GCTest, garbageCollect) configure(k_TTL); - mwcu::MemOutStream errDescription(s_allocator_p); - bsl::vector guids(s_allocator_p); + bmqu::MemOutStream errDescription(s_allocator_p); + bsl::vector guids(s_allocator_p); int k_MSG_COUNT = 10; @@ -1523,23 +1522,23 @@ int main(int argc, char* argv[]) { BALL_LOG_SET_CATEGORY("MAIN"); - TEST_PROLOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_PROLOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); bmqt::UriParser::initialize(s_allocator_p); - mwcsys::Time::initialize(s_allocator_p); + bmqsys::Time::initialize(s_allocator_p); { mqbcfg::AppConfig brokerConfig(s_allocator_p); mqbcfg::BrokerConfig::set(brokerConfig); - bsl::shared_ptr statContext = + bsl::shared_ptr statContext = mqbstat::BrokerStatsUtil::initializeStatContext(30, s_allocator_p); - mwctst::runTest(_testCase); + bmqtst::runTest(_testCase); } - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbs/mqbs_journalfileiterator.t.cpp b/src/groups/mqb/mqbs/mqbs_journalfileiterator.t.cpp index f889a6548..6e35b65cb 100644 --- a/src/groups/mqb/mqbs/mqbs_journalfileiterator.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_journalfileiterator.t.cpp @@ -35,7 +35,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -393,7 +393,7 @@ static void test1_breathingTest() // Basic functionality. // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { PV("Default object"); @@ -436,7 +436,7 @@ static void test2_forwardIteration() // Forward iteration with non-zero journal records. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("FORWARD ITERATION"); + bmqtst::TestHelper::printTestName("FORWARD ITERATION"); unsigned int numRecords = 5000; @@ -500,7 +500,7 @@ static void test3_forwardIterationWithZeroJournalRecords() // Forward iteration with zero journal records. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("FORWARD ITERATION WITH ZERO JOURNAL" + bmqtst::TestHelper::printTestName("FORWARD ITERATION WITH ZERO JOURNAL" " RECORDS"); bsls::Types::Uint64 totalSize = sizeof(FileHeader) + @@ -605,7 +605,7 @@ static void test4_backwardIteration() // Backward iteration with non-zero journal record // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BACKWARD ITERATION"); + bmqtst::TestHelper::printTestName("BACKWARD ITERATION"); const unsigned int k_NUM_RECORDS = 5000; @@ -669,7 +669,7 @@ static void test5_backwardIterationWithZeroJournalEntries() // Backward iteration with zero journal records. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BACKWARD ITERATION WITH ZERO JOURNAL" + bmqtst::TestHelper::printTestName("BACKWARD ITERATION WITH ZERO JOURNAL" " RECORDS"); bsls::Types::Uint64 totalSize = sizeof(FileHeader) + @@ -775,7 +775,7 @@ static void test6_forwardIterationOfSparseJournalFileNoRecords() // the journal. // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("FORWARD ITERATION OF SPARSE JOURNAL" + bmqtst::TestHelper::printTestName("FORWARD ITERATION OF SPARSE JOURNAL" " FILE WITH NO RECORDS"); bsls::Types::Uint64 totalSize = 1024 * 1024 * 10; // 10MB sparse file @@ -896,7 +896,7 @@ static void test7_backwardIterationOfSparseJournalFileNoRecords() // the journal. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BACKWARD ITERATION OF SPARSE JOURNAL" + bmqtst::TestHelper::printTestName("BACKWARD ITERATION OF SPARSE JOURNAL" " FILE WITH NO RECORDS"); bsls::Types::Uint64 totalSize = 1024 * 1024 * 10; // 10MB sparse file @@ -1013,7 +1013,7 @@ static void test8_forwardIterationOfSparseJournalFileWithRecords() // to the journal. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("FORWARD ITERATION OF SPARSE JOURNAL" + bmqtst::TestHelper::printTestName("FORWARD ITERATION OF SPARSE JOURNAL" " FILE WITH RECORDS"); const unsigned int k_NUM_RECORDS = 5432; @@ -1088,7 +1088,7 @@ static void test9_backwardIterationOfSparseJournalFileWithRecords() // to the journal. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BACKWARD ITERATION OF SPARSE JOURNAL" + bmqtst::TestHelper::printTestName("BACKWARD ITERATION OF SPARSE JOURNAL" " FILE WITH RECORDS"); const unsigned int k_NUM_RECORDS = 5432; @@ -1159,7 +1159,7 @@ static void test10_bidirectionalIteration() // Bi-directional iteration. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BIDIRECTIONAL ITERATION"); + bmqtst::TestHelper::printTestName("BIDIRECTIONAL ITERATION"); unsigned int k_NUM_RECORDS = 5000; @@ -1269,7 +1269,7 @@ static void test11_forwardAdvance() // Advance. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("FORWARD ADVANCE"); + bmqtst::TestHelper::printTestName("FORWARD ADVANCE"); unsigned int k_NUM_RECORDS = 5001; @@ -1339,7 +1339,7 @@ static void test12_backwardAdvance() // Advance. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BACKWARD ADVANCE"); + bmqtst::TestHelper::printTestName("BACKWARD ADVANCE"); unsigned int k_NUM_RECORDS = 5001; @@ -1407,7 +1407,7 @@ static void test12_backwardAdvance() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); mqbu::MessageGUIDUtil::initialize(); @@ -1431,7 +1431,7 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); // NOTE: for some reason the default allcoator verification never // succeeds. } diff --git a/src/groups/mqb/mqbs/mqbs_mappedfiledescriptor.t.cpp b/src/groups/mqb/mqbs/mqbs_mappedfiledescriptor.t.cpp index ee60c9a4c..0701317fa 100644 --- a/src/groups/mqb/mqbs/mqbs_mappedfiledescriptor.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_mappedfiledescriptor.t.cpp @@ -25,7 +25,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -43,7 +43,7 @@ static void test1_breathingTest() // Verifies the default constructor of 'mqbs::MappedFileDescriptor'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Breathing Test"); + bmqtst::TestHelper::printTestName("Breathing Test"); // Default constructor mqbs::MappedFileDescriptor obj; @@ -65,7 +65,7 @@ static void test2_operations() // in a 'mqbs::MappedFileDescriptor'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Operations Test"); + bmqtst::TestHelper::printTestName("Operations Test"); const bsl::size_t bufferLength = 64; char buffer[bufferLength] = {0}; @@ -100,7 +100,7 @@ static void test3_reset() // Verifies the manupulator 'clear()' of a 'mqbs::MappedFileDescriptor'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Reset Test"); + bmqtst::TestHelper::printTestName("Reset Test"); const bsl::size_t bufferLength = 32; char buffer[bufferLength] = {0}; @@ -137,7 +137,7 @@ static void test3_reset() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -150,5 +150,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbs/mqbs_memoryblock.t.cpp b/src/groups/mqb/mqbs/mqbs_memoryblock.t.cpp index f82a661aa..fbc451e71 100644 --- a/src/groups/mqb/mqbs/mqbs_memoryblock.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_memoryblock.t.cpp @@ -20,7 +20,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -39,7 +39,7 @@ static void test1_breathingTest() // 'mqbs::MemoryBlock'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Breathing Test"); + bmqtst::TestHelper::printTestName("Breathing Test"); { PV("DefaultContructor"); @@ -72,7 +72,7 @@ static void test2_operations() // attributes. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("size operations"); + bmqtst::TestHelper::printTestName("size operations"); char base = 1; char newBase = 2; @@ -103,7 +103,7 @@ static void test3_reset() // 'mqbs::MemoryBlock'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("reset operation"); + bmqtst::TestHelper::printTestName("reset operation"); mqbs::MemoryBlock obj; ASSERT_EQ(obj.base(), static_cast(0U)); @@ -125,7 +125,7 @@ static void test3_reset() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -138,5 +138,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbs/mqbs_memoryblockiterator.t.cpp b/src/groups/mqb/mqbs/mqbs_memoryblockiterator.t.cpp index 5b10946aa..0c890913b 100644 --- a/src/groups/mqb/mqbs/mqbs_memoryblockiterator.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_memoryblockiterator.t.cpp @@ -23,7 +23,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -40,7 +40,7 @@ static void test1_breathingTest() // Basic functionality of protocol structs. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("breathingTest"); + bmqtst::TestHelper::printTestName("breathingTest"); mqbs::MemoryBlockIterator obj; @@ -90,7 +90,7 @@ static void test1_breathingTest() static void test2_reverseIteration() { - mwctst::TestHelper::printTestName("reverseIteration"); + bmqtst::TestHelper::printTestName("reverseIteration"); char dummy = 1; bsls::Types::Uint64 size = 10000; @@ -127,7 +127,7 @@ static void test2_reverseIteration() static void test3_bidirectionalIteration() { - mwctst::TestHelper::printTestName("bi-directional Iteration"); + bmqtst::TestHelper::printTestName("bi-directional Iteration"); char dummy = 1; bsls::Types::Uint64 size = 10000; // 1MB @@ -195,7 +195,7 @@ static void test3_bidirectionalIteration() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -208,5 +208,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbs/mqbs_offsetptr.t.cpp b/src/groups/mqb/mqbs/mqbs_offsetptr.t.cpp index defd51dd5..cfb20b43f 100644 --- a/src/groups/mqb/mqbs/mqbs_offsetptr.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_offsetptr.t.cpp @@ -25,7 +25,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -54,7 +54,7 @@ static void test1_breathingTest() // Verifies the parameterized constructor of 'mqbs::OffsetPtr'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Breathing Test"); + bmqtst::TestHelper::printTestName("Breathing Test"); char base[5] = {0}; bsl::size_t offset = 3; @@ -73,7 +73,7 @@ static void test2_operations() // Verifies the accessors of 'mqbs::OffsetPtr' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Operations Test"); + bmqtst::TestHelper::printTestName("Operations Test"); bsl::size_t offset = 0; const int value = 3; @@ -100,7 +100,7 @@ static void test3_reset() // Verifies the manipulator 'reset()' of a 'mqbs::OffsetPtr'. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Reset Test"); + bmqtst::TestHelper::printTestName("Reset Test"); char base[64] = {0}; bsl::size_t offset = 3; @@ -121,7 +121,7 @@ static void test3_reset() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -134,5 +134,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbs/mqbs_qlistfileiterator.t.cpp b/src/groups/mqb/mqbs/mqbs_qlistfileiterator.t.cpp index 43762eca9..b38b16a73 100644 --- a/src/groups/mqb/mqbs/mqbs_qlistfileiterator.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_qlistfileiterator.t.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include // BDE #include @@ -38,7 +38,7 @@ #include // TEST DRIVER -#include +#include // CONVINIENCE using namespace BloombergLP; @@ -264,7 +264,7 @@ static void test1_breathingTest() // Basic functionality. // -------------------------------------------------------------------- { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { // Default object @@ -299,7 +299,7 @@ static void test2_backwardIteration() // Backward iteration with non-zero qlist records. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BACKWARD ITERATION"); + bmqtst::TestHelper::printTestName("BACKWARD ITERATION"); MappedFileDescriptor mfd; FileHeader fh; @@ -330,7 +330,7 @@ static void test2_backwardIteration() // The 1st queue uri (ie, 'i == 0') will have no appIds associated // with it. - mwcu::MemOutStream osstr(s_allocator_p); + bmqu::MemOutStream osstr(s_allocator_p); osstr << "AppId" << i << "_" << j << bsl::ends; appIds.push_back(osstr.str()); } @@ -343,7 +343,7 @@ static void test2_backwardIteration() bsl::vector& appKeys = appKeysVec[i]; for (size_t j = 0; j < i; ++j) { - mwcu::MemOutStream osstr(s_allocator_p); + bmqu::MemOutStream osstr(s_allocator_p); osstr << j << j << j << j << j; osstr << j << j << j << j << j; osstr << bsl::ends; @@ -488,7 +488,7 @@ static void test3_iteratorWithNoRecords() // Iterator with no records. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ITERATOR WITH NO RECORDS"); + bmqtst::TestHelper::printTestName("ITERATOR WITH NO RECORDS"); MappedFileDescriptor mfd; FileHeader fh; @@ -537,7 +537,7 @@ static void test4_iteratorAppKeys() // Iterator with records both having and not having appKeys. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ITERATOR APPKEYS"); + bmqtst::TestHelper::printTestName("ITERATOR APPKEYS"); MappedFileDescriptor mfd; FileHeader fh; @@ -568,7 +568,7 @@ static void test4_iteratorAppKeys() // The 1st queue uri (ie, 'i == 0') will have no appIds // associated with it. - mwcu::MemOutStream osstr(s_allocator_p); + bmqu::MemOutStream osstr(s_allocator_p); osstr << "AppId" << i << "_" << j << bsl::ends; appIds.push_back(osstr.str()); } @@ -581,7 +581,7 @@ static void test4_iteratorAppKeys() bsl::vector& appKeys = appKeysVec[i]; for (size_t j = 0; j < i; ++j) { - mwcu::MemOutStream osstr(s_allocator_p); + bmqu::MemOutStream osstr(s_allocator_p); osstr << j << j << j << j << j; osstr << j << j << j << j << j; osstr << bsl::ends; @@ -688,7 +688,7 @@ static void test4_iteratorAppKeys() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); @@ -706,7 +706,7 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); // NOTE: for some reason the default allcoator verification never // succeeds. } diff --git a/src/groups/mqb/mqbs/mqbs_storageprintutil.cpp b/src/groups/mqb/mqbs/mqbs_storageprintutil.cpp index 1d268a495..53519711a 100644 --- a/src/groups/mqb/mqbs/mqbs_storageprintutil.cpp +++ b/src/groups/mqb/mqbs/mqbs_storageprintutil.cpp @@ -25,10 +25,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BMQ #include @@ -72,7 +71,7 @@ int StoragePrintUtil::listMessage(mqbcmd::Message* message, int msgSize = -1; storage->getMessageSize(&msgSize, storageIter.guid()); - mwcu::MemOutStream guid; + bmqu::MemOutStream guid; guid << storageIter.guid(); message->guid() = guid.str(); message->arrivalTimestamp() = bdlt::DatetimeTz(arrivalDatetime, 0); @@ -156,8 +155,8 @@ void StoragePrintUtil::printRecoveredStorages( out << clusterDescription << ": Partition [" << partitionId << "]: Number of recovered storages: " << storageMap.size() << ". Time taken for recovery: " - << mwcu::PrintUtil::prettyTimeInterval( - (mwcsys::Time::highResolutionTimer() - recoveryStartTime)) + << bmqu::PrintUtil::prettyTimeInterval( + (bmqsys::Time::highResolutionTimer() - recoveryStartTime)) << ". Summary: \n(format: [QueueUri] [QueueKey] " << "[Num Msgs] [Num Virtual Storages] " << "[Virtual Storages Details])"; diff --git a/src/groups/mqb/mqbs/mqbs_storageprintutil.t.cpp b/src/groups/mqb/mqbs/mqbs_storageprintutil.t.cpp index 3ee3a92f4..e1b041f33 100644 --- a/src/groups/mqb/mqbs/mqbs_storageprintutil.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_storageprintutil.t.cpp @@ -24,8 +24,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -38,7 +37,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -79,7 +78,7 @@ void verifyMessageConstruction(const mqbcmd::Message& output, const mqbi::Storage* storage) { mqbcmd::Message expected; - mwcu::MemOutStream guidStr; + bmqu::MemOutStream guidStr; int msgSize = -1; guidStr << guid; @@ -148,7 +147,7 @@ struct Tester { s_allocator_p), s_allocator_p); - mwcu::MemOutStream errorDescription(s_allocator_p); + bmqu::MemOutStream errorDescription(s_allocator_p); d_storage_mp->addVirtualStorage(errorDescription, k_APP_ID1, k_APP_KEY1); @@ -222,7 +221,7 @@ static void test1_listMessage() // listMessage(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LIST MESSAGE"); + bmqtst::TestHelper::printTestName("LIST MESSAGE"); Tester tester; tester.populateMessages(); @@ -263,7 +262,7 @@ static void test2_listMessages() // listMessages(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LIST MESSAGES"); + bmqtst::TestHelper::printTestName("LIST MESSAGES"); Tester tester; tester.populateMessages(); @@ -303,7 +302,7 @@ static void test2_listMessages() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); @@ -319,5 +318,5 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbs/mqbs_storageutil.cpp b/src/groups/mqb/mqbs/mqbs_storageutil.cpp index 1e7cdc5e8..ce8c1cc02 100644 --- a/src/groups/mqb/mqbs/mqbs_storageutil.cpp +++ b/src/groups/mqb/mqbs/mqbs_storageutil.cpp @@ -20,9 +20,8 @@ // BMQ #include -// MWC -#include -#include +#include +#include // BDE #include @@ -57,7 +56,7 @@ void StorageUtil::generateStorageKey( bdlde::Md5::Md5Digest digest; bdlde::Md5 md5(value.data(), value.length()); - bsls::Types::Int64 time = mwcsys::Time::highResolutionTimer(); + bsls::Types::Int64 time = bmqsys::Time::highResolutionTimer(); md5.update(&time, sizeof(time)); md5.loadDigestAndReset(&digest); @@ -70,7 +69,7 @@ void StorageUtil::generateStorageKey( // has a deterministic value). md5.update(digest.buffer(), mqbs::FileStoreProtocol::k_HASH_LENGTH); - time = mwcsys::Time::highResolutionTimer(); + time = bmqsys::Time::highResolutionTimer(); md5.update(&time, sizeof(time)); md5.loadDigestAndReset(&digest); key->fromBinary(digest.buffer()); @@ -145,7 +144,7 @@ void StorageUtil::loadArrivalTime( if (BSLS_PERFORMANCEHINT_PREDICT_LIKELY(0 != attributes.arrivalTimepoint())) { const bsls::Types::Int64 timeDeltaNs = - mwcsys::Time::highResolutionTimer() - + bmqsys::Time::highResolutionTimer() - attributes.arrivalTimepoint(); const bsls::Types::Int64 currentTimeNs = @@ -191,7 +190,7 @@ void StorageUtil::loadArrivalTimeDelta( if (BSLS_PERFORMANCEHINT_PREDICT_LIKELY(0 != attributes.arrivalTimepoint())) { - *out = mwcsys::Time::highResolutionTimer() - + *out = bmqsys::Time::highResolutionTimer() - attributes.arrivalTimepoint(); } else { @@ -205,8 +204,8 @@ void StorageUtil::loadArrivalTimeDelta( } int StorageUtil::loadRecordHeaderAndPos( - mwcu::BlobObjectProxy* recordHeader, - mwcu::BlobPosition* recordPosition, + bmqu::BlobObjectProxy* recordHeader, + bmqu::BlobPosition* recordPosition, const bmqp::StorageMessageIterator& storageIter, const bsl::shared_ptr& stroageEvent, const bslstl::StringRef& partitionDesc) @@ -230,14 +229,14 @@ int StorageUtil::loadRecordHeaderAndPos( header.storageProtocolVersion() != FileStoreProtocol::k_VERSION)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc << "Storage protocol version mismatch. Self: " << FileStoreProtocol::k_VERSION << ", received: " << header.storageProtocolVersion() << ", for type: " << header.messageType() << ", with journal offset (in words): " << header.journalOffsetWords() << ". Ignoring entire event." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_PROTO_VER_MISMATCH; // RETURN } @@ -245,11 +244,11 @@ int StorageUtil::loadRecordHeaderAndPos( bmqp::StorageMessageType::e_UNDEFINED == header.messageType())) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc << "Received an unexpected storage message type: " << header.messageType() << " with journal offset (in words): " << header.journalOffsetWords() << ". Ignoring entire event." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_MSG_TYPE; // RETURN } @@ -257,12 +256,12 @@ int StorageUtil::loadRecordHeaderAndPos( if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(0 != rc)) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc << "Failed to load record position for storage msg " << header.messageType() << ", with journal offset (in words): " << header.journalOffsetWords() << ", rc: " << rc - << ". Ignoring entire event." << MWCTSK_ALARMLOG_END; + << ". Ignoring entire event." << BMQTSK_ALARMLOG_END; return rc_INVALID_RECORD_POS; // RETURN } @@ -273,11 +272,11 @@ int StorageUtil::loadRecordHeaderAndPos( if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(!recordHeader->isSet())) { BSLS_PERFORMANCEHINT_UNLIKELY_HINT; - MWCTSK_ALARMLOG_ALARM("REPLICATION") + BMQTSK_ALARMLOG_ALARM("REPLICATION") << partitionDesc << "Failed to read RecordHeader for storage msg " << header.messageType() << ", with journal offset (in words): " << header.journalOffsetWords() << ". Ignoring entire event." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; return rc_INVALID_RECORD_HDR; // RETURN } diff --git a/src/groups/mqb/mqbs/mqbs_storageutil.h b/src/groups/mqb/mqbs/mqbs_storageutil.h index f230f93b7..4447c7223 100644 --- a/src/groups/mqb/mqbs/mqbs_storageutil.h +++ b/src/groups/mqb/mqbs/mqbs_storageutil.h @@ -38,9 +38,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -137,8 +136,8 @@ struct StorageUtil { /// the specified `stroageEvent`. Return 0 on success and non-zero code /// on error. Use the specified `partitionDesc` for logging. static int loadRecordHeaderAndPos( - mwcu::BlobObjectProxy* recordHeader, - mwcu::BlobPosition* recordPosition, + bmqu::BlobObjectProxy* recordHeader, + bmqu::BlobPosition* recordPosition, const bmqp::StorageMessageIterator& storageIter, const bsl::shared_ptr& stroageEvent, const bslstl::StringRef& partitionDesc); diff --git a/src/groups/mqb/mqbs/mqbs_storageutil.t.cpp b/src/groups/mqb/mqbs/mqbs_storageutil.t.cpp index 820ce1f3c..5f5c1bc50 100644 --- a/src/groups/mqb/mqbs/mqbs_storageutil.t.cpp +++ b/src/groups/mqb/mqbs/mqbs_storageutil.t.cpp @@ -19,8 +19,7 @@ // MQB #include -// MWC -#include +#include // BDE #include @@ -32,7 +31,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -96,7 +95,7 @@ static void test1_queueMessagesCountComparator() // queueMessagesCountComparator(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("QUEUE MESSAGES COMPARATOR"); + bmqtst::TestHelper::printTestName("QUEUE MESSAGES COMPARATOR"); Tester tester; @@ -124,7 +123,7 @@ static void test2_mergeQueueMessagesCountMap() // mergeQueueMessagesCountMap(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("MERGE QUEUE MESSAGES"); + bmqtst::TestHelper::printTestName("MERGE QUEUE MESSAGES"); Tester tester; @@ -158,7 +157,7 @@ static void test3_mergeDomainQueueMessagesCountMap() // mergeDomainQueueMessagesCountMap(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("MERGE DOMAIN QUEUE MESSAGES MAP"); + bmqtst::TestHelper::printTestName("MERGE DOMAIN QUEUE MESSAGES MAP"); Tester tester; @@ -227,12 +226,12 @@ static void test4_loadArrivalTime() // loadArrivalTime(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LOAD ARRIVAL TIME"); + bmqtst::TestHelper::printTestName("LOAD ARRIVAL TIME"); // Use timepoint if set { const bsls::Types::Int64 arrivalTimepointNs = - mwcsys::Time::highResolutionTimer(); + bmqsys::Time::highResolutionTimer(); mqbi::StorageMessageAttributes attributes; attributes @@ -248,7 +247,7 @@ static void test4_loadArrivalTime() const bsls::Types::Int64 expectedArrivalTimeNs = bdlt::EpochUtil::convertToTimeInterval(bdlt::CurrentTime::utc()) .totalNanoseconds() - - (mwcsys::Time::highResolutionTimer() - arrivalTimepointNs); + (bmqsys::Time::highResolutionTimer() - arrivalTimepointNs); ASSERT_LE(expectedArrivalTimeNs - arrivalTimeNs, 1 * bdlt::TimeUnitRatio::k_NANOSECONDS_PER_MILLISECOND); @@ -308,12 +307,12 @@ static void test5_loadArrivalTimeDelta() // loadArrivalTimeDelta(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LOAD ARRIVAL TIME DELTA"); + bmqtst::TestHelper::printTestName("LOAD ARRIVAL TIME DELTA"); // Use timepoint if set { const bsls::Types::Int64 arrivalTimepointNs = - mwcsys::Time::highResolutionTimer(); + bmqsys::Time::highResolutionTimer(); mqbi::StorageMessageAttributes attributes; attributes @@ -328,7 +327,7 @@ static void test5_loadArrivalTimeDelta() // calculation of 'arrivalTimeDeltaNs' and // 'expectedArrivalTimeDeltaNs'. const bsls::Types::Int64 expectedArrivalTimeDeltaNs = - mwcsys::Time::highResolutionTimer() - arrivalTimepointNs; + bmqsys::Time::highResolutionTimer() - arrivalTimepointNs; ASSERT_LE(expectedArrivalTimeDeltaNs - arrivalTimeDeltaNs, 1 * bdlt::TimeUnitRatio::k_NANOSECONDS_PER_MILLISECOND); } @@ -363,10 +362,10 @@ static void test5_loadArrivalTimeDelta() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); - mwcsys::Time::initialize(); + bmqsys::Time::initialize(); switch (_testCase) { case 0: @@ -381,8 +380,8 @@ int main(int argc, char* argv[]) } break; } - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbs/mqbs_virtualstorage.h b/src/groups/mqb/mqbs/mqbs_virtualstorage.h index ef4dded4c..c8eb10cf6 100644 --- a/src/groups/mqb/mqbs/mqbs_virtualstorage.h +++ b/src/groups/mqb/mqbs/mqbs_virtualstorage.h @@ -44,8 +44,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -93,7 +92,7 @@ class VirtualStorage { /// msgGUID -> MessageContext /// Must be a container in which iteration order is same as insertion /// order. - typedef mwcc::OrderedHashMap > DataStream; diff --git a/src/groups/mqb/mqbs/mqbs_virtualstoragecatalog.cpp b/src/groups/mqb/mqbs/mqbs_virtualstoragecatalog.cpp index 61971c72b..6ff76dc84 100644 --- a/src/groups/mqb/mqbs/mqbs_virtualstoragecatalog.cpp +++ b/src/groups/mqb/mqbs/mqbs_virtualstoragecatalog.cpp @@ -17,10 +17,12 @@ #include #include + // MQB #include +#include -#include +#include // BDE #include @@ -115,7 +117,6 @@ VirtualStorageCatalog::~VirtualStorageCatalog() } // MANIPULATORS - VirtualStorageCatalog::DataStreamIterator VirtualStorageCatalog::begin(const bmqt::MessageGUID& where) { @@ -270,8 +271,15 @@ VirtualStorageCatalog::confirm(const bmqt::MessageGUID& msgGUID, BSLS_ASSERT_SAFE(it != d_virtualStorages.end()); setup(&data->second); + const mqbi::StorageResult::Enum rc = it->value()->confirm(&data->second); + if (queue() && mqbi::StorageResult::e_SUCCESS == rc) { + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_DEL_MESSAGE, + data->second.d_size, + it->key1()); + } - return it->value()->confirm(&data->second); + return rc; } mqbi::StorageResult::Enum @@ -351,7 +359,7 @@ VirtualStorageCatalog::removeAll(const mqbu::StorageKey& appKey) else if (result == mqbi::StorageResult::e_SUCCESS) { } else { - MWCTSK_ALARMLOG_ALARM("STORAGE_PURGE_ERROR") + BMQTSK_ALARMLOG_ALARM("STORAGE_PURGE_ERROR") << "PartitionId [" << d_storage_p->partitionId() << "]" << ": Attempting to purge GUID '" << itData->first << "' from virtual storage with appId '" @@ -360,11 +368,18 @@ VirtualStorageCatalog::removeAll(const mqbu::StorageKey& appKey) << "' & queueKey '" << d_storage_p->queueKey() << "', with invalid context (refCount is already " "zero)." - << MWCTSK_ALARMLOG_END; + << BMQTSK_ALARMLOG_END; } ++itData; } } + + if (queue()) { + queue()->stats()->onEvent( + mqbstat::QueueStatsDomain::EventType::e_PURGE, + 0, + itVs->key1()); + } } else { for (VirtualStoragesIter it = d_virtualStorages.begin(); diff --git a/src/groups/mqb/mqbs/mqbs_virtualstoragecatalog.h b/src/groups/mqb/mqbs/mqbs_virtualstoragecatalog.h index 0a2642b8b..767887890 100644 --- a/src/groups/mqb/mqbs/mqbs_virtualstoragecatalog.h +++ b/src/groups/mqb/mqbs/mqbs_virtualstoragecatalog.h @@ -26,13 +26,11 @@ // storages associated with a queue. // MQB - #include #include #include -// MWC -#include +#include // BMQ #include @@ -91,7 +89,7 @@ class VirtualStorageCatalog { typedef bsl::list AvailableOrdinals; /// appKey -> virtualStorage - typedef mwcc:: + typedef bmqc:: TwoKeyHashMap VirtualStorages; @@ -107,37 +105,36 @@ class VirtualStorageCatalog { private: // DATA - mqbi::Storage* d_storage_p; // Physical storage underlying all - // virtual storages known to this - // object + /// Physical storage underlying all virtual storages known to this object + mqbi::Storage* d_storage_p; + /// Map of appKey to corresponding virtual storage VirtualStorages d_virtualStorages; - // Map of appKey to corresponding - // virtual storage + /// Available ordinal values for virtual storages. AvailableOrdinals d_availableOrdinals; - // available ordinal values for Virtual Storages. + /// Monotonically increasing value to generate new ordinal. Ordinal d_nextOrdinal; - // Monotonically increasing value to generate new ordinal. + /// The DataStream tracking all Apps states. VirtualStorage::DataStream d_dataStream; - // The DataStream tracking all Apps states. + /// Cumulative count of all bytes. bsls::Types::Int64 d_totalBytes; - // Cumulative count of all bytes. + /// Cumulative count of all messages. bsls::Types::Int64 d_numMessages; - // Cumulative count of all messages. + /// The default App state mqbi::AppMessage d_defaultAppMessage; - // The default App state + /// This could be null if a local or remote + /// queue instance has not been created. mqbi::Queue* d_queue_p; - // This could be null if a local or remote - // queue instance has not been created. - bslma::Allocator* d_allocator_p; // Allocator to use + /// Allocator to use + bslma::Allocator* d_allocator_p; private: // NOT IMPLEMENTED @@ -161,7 +158,6 @@ class VirtualStorageCatalog { ~VirtualStorageCatalog(); // MANIPULATORS - /// If the specified 'where' is unset, return reference to the beginning of /// the DataStream. Otherwise, return reference to the corresponding item /// in the DataStream. diff --git a/src/groups/mqb/mqbscm/mqbscm_versiontag.h b/src/groups/mqb/mqbscm/mqbscm_versiontag.h index 51fca266b..51f32418e 100644 --- a/src/groups/mqb/mqbscm/mqbscm_versiontag.h +++ b/src/groups/mqb/mqbscm/mqbscm_versiontag.h @@ -56,7 +56,7 @@ #define MQB_VERSION_PATCH 99 // MQB patch level -#define MQB_MAKE_VERSION(major, minor) ((major)*10000 + (minor)*100) +#define MQB_MAKE_VERSION(major, minor) ((major) * 10000 + (minor) * 100) // Construct a composite version number in the range [ 0 .. 999900 ] from // the specified 'major' and 'minor' version numbers. The resulting value, // when expressed as a 6-digit decimal string, has "00" as the two @@ -72,7 +72,7 @@ // and 'minor' are integral values in the range '[ 0 .. 99 ]'. #define MQB_MAKE_EXT_VERSION(major, minor, patch) \ - ((major)*10000 + (minor)*100 + (patch)) + ((major) * 10000 + (minor) * 100 + (patch)) // Similar to MQB_MAKE_VERSION(), but include the patch number as well. #define MQB_VERSION MQB_MAKE_VERSION(MQB_VERSION_MAJOR, MQB_VERSION_MINOR) diff --git a/src/groups/mqb/mqbsi/mqbsi_ledger.h b/src/groups/mqb/mqbsi/mqbsi_ledger.h index 10f3018e5..dd564d7d9 100644 --- a/src/groups/mqb/mqbsi/mqbsi_ledger.h +++ b/src/groups/mqb/mqbsi/mqbsi_ledger.h @@ -39,8 +39,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -450,8 +449,8 @@ class Ledger { int length) = 0; virtual int writeRecord(LedgerRecordId* recordId, const bdlbb::Blob& record, - const mwcu::BlobPosition& offset, - int length) = 0; + const bmqu::BlobPosition& offset, + int length) = 0; /// Write the specified `section` of the specified `record` into this /// ledger and load into `recordId` an identifier which can be used to @@ -460,7 +459,7 @@ class Ledger { /// adjust the total outstanding number of bytes if successful. virtual int writeRecord(LedgerRecordId* recordId, const bdlbb::Blob& record, - const mwcu::BlobSection& section) = 0; + const bmqu::BlobSection& section) = 0; /// Flush any cached data in this ledger to the underlying storage /// mechanism, and return 0 on success, or a non-zero value on error. diff --git a/src/groups/mqb/mqbsi/mqbsi_ledger.t.cpp b/src/groups/mqb/mqbsi/mqbsi_ledger.t.cpp index d4005cf80..061b5c7ce 100644 --- a/src/groups/mqb/mqbsi/mqbsi_ledger.t.cpp +++ b/src/groups/mqb/mqbsi/mqbsi_ledger.t.cpp @@ -19,8 +19,7 @@ // BMQ #include -// MWC -#include +#include // BDE #include @@ -30,7 +29,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -91,7 +90,7 @@ struct LedgerTestImp : bsls::ProtocolTestImp { int writeRecord(LedgerRecordId* recordId, const bdlbb::Blob& record, - const mwcu::BlobPosition& offset, + const bmqu::BlobPosition& offset, int length) BSLS_KEYWORD_OVERRIDE { return markDone(); @@ -99,7 +98,7 @@ struct LedgerTestImp : bsls::ProtocolTestImp { int writeRecord(LedgerRecordId* recordId, const bdlbb::Blob& record, - const mwcu::BlobSection& section) BSLS_KEYWORD_OVERRIDE + const bmqu::BlobSection& section) BSLS_KEYWORD_OVERRIDE { return markDone(); } @@ -204,7 +203,7 @@ static void test1_ledger_protocol() // PROTOCOL TEST // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LEDGER"); + bmqtst::TestHelper::printTestName("LEDGER"); PV("Creating a test object"); bsls::ProtocolTest testObj(s_verbosityLevel > 2); @@ -225,7 +224,7 @@ static void test1_ledger_protocol() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -236,7 +235,7 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } #if defined(BSLS_PLATFORM_CMP_CLANG) diff --git a/src/groups/mqb/mqbsi/mqbsi_log.h b/src/groups/mqb/mqbsi/mqbsi_log.h index 76a0ba52e..ff9a659e4 100644 --- a/src/groups/mqb/mqbsi/mqbsi_log.h +++ b/src/groups/mqb/mqbsi/mqbsi_log.h @@ -39,8 +39,7 @@ #include -// MWC -#include +#include // BDE #include @@ -405,7 +404,7 @@ class Log { /// record. virtual Offset write(const void* entry, int offset, int length) = 0; virtual Offset write(const bdlbb::Blob& entry, - const mwcu::BlobPosition& offset, + const bmqu::BlobPosition& offset, int length) = 0; /// Write the specified `section` of the specified `entry` into the @@ -417,7 +416,7 @@ class Log { /// it is the onus of the user to invoke `updateOutstandingNumBytes` /// properly before overwriting an existing record. virtual Offset write(const bdlbb::Blob& entry, - const mwcu::BlobSection& section) = 0; + const bmqu::BlobSection& section) = 0; /// Flush any cached data up to the optionally specified `offset` to the /// underlying storing mechanism, and return 0 on success, or a negative diff --git a/src/groups/mqb/mqbsi/mqbsi_log.t.cpp b/src/groups/mqb/mqbsi/mqbsi_log.t.cpp index 9ad622d2c..df2c2e2ab 100644 --- a/src/groups/mqb/mqbsi/mqbsi_log.t.cpp +++ b/src/groups/mqb/mqbsi/mqbsi_log.t.cpp @@ -25,7 +25,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -101,14 +101,14 @@ struct LogTestImp : bsls::ProtocolTestImp { } Offset write(const bdlbb::Blob& entry, - const mwcu::BlobPosition& offset, + const bmqu::BlobPosition& offset, int length) BSLS_KEYWORD_OVERRIDE { return markDone(); } Offset write(const bdlbb::Blob& entry, - const mwcu::BlobSection& section) BSLS_KEYWORD_OVERRIDE + const bmqu::BlobSection& section) BSLS_KEYWORD_OVERRIDE { return markDone(); } @@ -202,7 +202,7 @@ static void test1_log_protocol() // PROTOCOL TEST // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LOG"); + bmqtst::TestHelper::printTestName("LOG"); PV("Creating a test object"); bsls::ProtocolTest testObj(s_verbosityLevel > 2); @@ -223,7 +223,7 @@ static void test1_log_protocol() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -234,7 +234,7 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } #if defined(BSLS_PLATFORM_CMP_CLANG) diff --git a/src/groups/mqb/mqbsl/mqbsl_inmemorylog.cpp b/src/groups/mqb/mqbsl/mqbsl_inmemorylog.cpp index 873eba6a2..4ff9d0aed 100644 --- a/src/groups/mqb/mqbsl/mqbsl_inmemorylog.cpp +++ b/src/groups/mqb/mqbsl/mqbsl_inmemorylog.cpp @@ -204,14 +204,14 @@ InMemoryLog::write(const void* entry, int offset, int length) } mqbsi::Log::Offset InMemoryLog::write(const bdlbb::Blob& entry, - const mwcu::BlobPosition& offset, + const bmqu::BlobPosition& offset, int length) { // PRECONDITIONS BSLS_ASSERT_SAFE(length >= 0); bdlbb::Blob blob(d_blobBufferFactory_p, d_allocator_p); - mwcu::BlobUtil::appendBlobFromIndex(&blob, + bmqu::BlobUtil::appendBlobFromIndex(&blob, entry, offset.buffer(), offset.byte(), @@ -221,10 +221,10 @@ mqbsi::Log::Offset InMemoryLog::write(const bdlbb::Blob& entry, } mqbsi::Log::Offset InMemoryLog::write(const bdlbb::Blob& entry, - const mwcu::BlobSection& section) + const bmqu::BlobSection& section) { int length; - int rc = mwcu::BlobUtil::sectionSize(&length, entry, section); + int rc = bmqu::BlobUtil::sectionSize(&length, entry, section); if (rc != 0) { return LogOpResult::e_INVALID_BLOB_SECTION; // RETURN } @@ -247,9 +247,9 @@ int InMemoryLog::read(void* entry, int length, Offset offset) const return rc; // RETURN } - mwcu::BlobUtil::readNBytes(static_cast(entry), + bmqu::BlobUtil::readNBytes(static_cast(entry), d_records[offset], - mwcu::BlobPosition(), + bmqu::BlobPosition(), length); return LogOpResult::e_SUCCESS; diff --git a/src/groups/mqb/mqbsl/mqbsl_inmemorylog.h b/src/groups/mqb/mqbsl/mqbsl_inmemorylog.h index 97dcab011..be7fd84c5 100644 --- a/src/groups/mqb/mqbsl/mqbsl_inmemorylog.h +++ b/src/groups/mqb/mqbsl/mqbsl_inmemorylog.h @@ -41,8 +41,7 @@ #include -// MWC -#include +#include // BDE #include @@ -244,7 +243,7 @@ class InMemoryLog BSLS_KEYWORD_FINAL : public mqbsi::Log { /// `updateOutstandingNumBytes` properly before overwriting an existing /// record. virtual Offset write(const bdlbb::Blob& entry, - const mwcu::BlobPosition& offset, + const bmqu::BlobPosition& offset, int length) BSLS_KEYWORD_OVERRIDE; /// Write the specified `section` of the specified `entry` into the @@ -257,7 +256,7 @@ class InMemoryLog BSLS_KEYWORD_FINAL : public mqbsi::Log { /// properly before overwriting an existing record. virtual Offset write(const bdlbb::Blob& entry, - const mwcu::BlobSection& section) BSLS_KEYWORD_OVERRIDE; + const bmqu::BlobSection& section) BSLS_KEYWORD_OVERRIDE; /// Flush any cached data up to the optionally specified `offset` to the /// underlying storing mechanism, and return 0 on success, or a negative diff --git a/src/groups/mqb/mqbsl/mqbsl_inmemorylog.t.cpp b/src/groups/mqb/mqbsl/mqbsl_inmemorylog.t.cpp index e603490f6..070813608 100644 --- a/src/groups/mqb/mqbsl/mqbsl_inmemorylog.t.cpp +++ b/src/groups/mqb/mqbsl/mqbsl_inmemorylog.t.cpp @@ -28,7 +28,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -114,7 +114,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); const mqbsi::LogConfig k_CONFIG(k_LOG_MAX_SIZE, k_LOG_KEY, s_allocator_p); InMemoryLog log(k_CONFIG, g_bufferFactory_p, s_allocator_p); @@ -144,7 +144,7 @@ static void test2_doubleOpen() // open(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("DOUBLE OPEN"); + bmqtst::TestHelper::printTestName("DOUBLE OPEN"); const mqbsi::LogConfig k_CONFIG(k_LOG_MAX_SIZE, k_LOG_KEY, s_allocator_p); InMemoryLog log(k_CONFIG, g_bufferFactory_p, s_allocator_p); @@ -165,7 +165,7 @@ static void test3_doubleClose() // close(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("DOUBLE CLOSE"); + bmqtst::TestHelper::printTestName("DOUBLE CLOSE"); const mqbsi::LogConfig k_CONFIG(k_LOG_MAX_SIZE, k_LOG_KEY, s_allocator_p); InMemoryLog log(k_CONFIG, g_bufferFactory_p, s_allocator_p); @@ -186,7 +186,7 @@ static void test4_updateOutstandingNumBytes() // updateOutstandingNumBytes(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("UPDATE OUTSTANDING NUM BYTES"); + bmqtst::TestHelper::printTestName("UPDATE OUTSTANDING NUM BYTES"); const mqbsi::LogConfig k_CONFIG(k_LOG_MAX_SIZE, k_LOG_KEY, s_allocator_p); InMemoryLog log(k_CONFIG, g_bufferFactory_p, s_allocator_p); @@ -221,7 +221,7 @@ static void test5_setOutstandingNumBytes() // setOutstandingNumBytes(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SET OUTSTANDING NUM BYTES"); + bmqtst::TestHelper::printTestName("SET OUTSTANDING NUM BYTES"); const mqbsi::LogConfig k_CONFIG(k_LOG_MAX_SIZE, k_LOG_KEY, s_allocator_p); InMemoryLog log(k_CONFIG, g_bufferFactory_p, s_allocator_p); @@ -257,7 +257,7 @@ static void test6_writeRaw() // write(const void *entry, int offset, int length) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRITE RAW"); + bmqtst::TestHelper::printTestName("WRITE RAW"); const bsls::Types::Int64 maxSize = k_NUM_ENTRIES * k_ENTRY_LENGTH + k_LONG_ENTRY_LENGTH + 10; @@ -319,11 +319,11 @@ static void test7_writeBlob() // // Testing: // write(const bdlbb::Blob& entry, -// const mwcu::BlobPosition& offset, +// const bmqu::BlobPosition& offset, // int length) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRITE BLOB"); + bmqtst::TestHelper::printTestName("WRITE BLOB"); const bsls::Types::Int64 maxSize = k_NUM_ENTRIES * k_ENTRY_LENGTH + k_LONG_ENTRY_LENGTH + 10; @@ -337,7 +337,7 @@ static void test7_writeBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { bdlbb::BlobUtil::append(&blob, k_ENTRIES[i], k_ENTRY_LENGTH); - mwcu::BlobPosition pos(i, 0); + bmqu::BlobPosition pos(i, 0); ASSERT_EQ(log.write(blob, pos, k_ENTRY_LENGTH), static_cast(i)); ASSERT_EQ(log.totalNumBytes(), (i + 1) * k_ENTRY_LENGTH); @@ -357,7 +357,7 @@ static void test7_writeBlob() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); ASSERT_EQ(log.write(blob2, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH), static_cast(k_NUM_ENTRIES)); currNumBytes += k_LONG_ENTRY_LENGTH; @@ -367,7 +367,7 @@ static void test7_writeBlob() // 4. Write another long entry. This should fail due to exceeding max size. ASSERT_EQ(log.write(blob2, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH), LogOpResult::e_REACHED_END_OF_LOG); @@ -395,10 +395,10 @@ static void test8_writeBlobSection() // 'write'. // // Testing: -// write(const bdlbb::Blob& entry, const mwcu::BlobSection& section) +// write(const bdlbb::Blob& entry, const bmqu::BlobSection& section) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRITE BLOB SECTION"); + bmqtst::TestHelper::printTestName("WRITE BLOB SECTION"); const bsls::Types::Int64 maxSize = k_NUM_ENTRIES * k_ENTRY_LENGTH + k_LONG_ENTRY_LENGTH + 10; @@ -412,9 +412,9 @@ static void test8_writeBlobSection() for (int i = 0; i < k_NUM_ENTRIES; ++i) { bdlbb::BlobUtil::append(&blob, k_ENTRIES[i], k_ENTRY_LENGTH); - mwcu::BlobPosition start(i, 0); - mwcu::BlobPosition end(i + 1, 0); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(i, 0); + bmqu::BlobPosition end(i + 1, 0); + bmqu::BlobSection section(start, end); ASSERT_EQ(log.write(blob, section), static_cast(i)); ASSERT_EQ(log.totalNumBytes(), (i + 1) * k_ENTRY_LENGTH); ASSERT_EQ(log.outstandingNumBytes(), (i + 1) * k_ENTRY_LENGTH); @@ -433,9 +433,9 @@ static void test8_writeBlobSection() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); - mwcu::BlobPosition start(0, k_LONG_ENTRY_OFFSET); - mwcu::BlobPosition end(0, k_LONG_ENTRY_OFFSET + k_LONG_ENTRY_LENGTH); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(0, k_LONG_ENTRY_OFFSET); + bmqu::BlobPosition end(0, k_LONG_ENTRY_OFFSET + k_LONG_ENTRY_LENGTH); + bmqu::BlobSection section(start, end); ASSERT_EQ(log.write(blob2, section), static_cast(k_NUM_ENTRIES)); currNumBytes += k_LONG_ENTRY_LENGTH; ASSERT_EQ(log.totalNumBytes(), currNumBytes); @@ -470,7 +470,7 @@ static void test9_readRaw() // read(void *entry, int length, Offset offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("READ RAW"); + bmqtst::TestHelper::printTestName("READ RAW"); const mqbsi::LogConfig k_CONFIG(k_LOG_MAX_SIZE, k_LOG_KEY, s_allocator_p); InMemoryLog log(k_CONFIG, g_miniBufferFactory_p, s_allocator_p); @@ -500,7 +500,7 @@ static void test9_readRaw() bdlbb::Blob blob(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); BSLS_ASSERT_OPT(log.write(blob, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH) == static_cast(k_NUM_ENTRIES)); @@ -523,9 +523,9 @@ static void test9_readRaw() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY2, k_LONG_ENTRY2_FULL_LENGTH); - mwcu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); - mwcu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); + bmqu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); + bmqu::BlobSection section(start, end); BSLS_ASSERT_OPT(log.write(blob2, section) == currOffset); // 7. Read the other long entry @@ -557,7 +557,7 @@ static void test10_readBlob() // read(bdlbb::Blob *entry, int length, Offset offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("READ BLOB"); + bmqtst::TestHelper::printTestName("READ BLOB"); const mqbsi::LogConfig k_CONFIG(k_LOG_MAX_SIZE, k_LOG_KEY, s_allocator_p); InMemoryLog log(k_CONFIG, g_miniBufferFactory_p, s_allocator_p); @@ -577,9 +577,9 @@ static void test10_readBlob() char entry[k_LONG_ENTRY_LENGTH]; for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(log.read(&blob, k_ENTRY_LENGTH, i), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LENGTH), 0); } @@ -593,25 +593,25 @@ static void test10_readBlob() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); BSLS_ASSERT_OPT(log.write(blob2, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH) == static_cast(k_NUM_ENTRIES)); // 5. Re-read the list of entries, then read the long entry for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(log.read(&blob, k_ENTRY_LENGTH, i), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LENGTH), 0); } ASSERT_EQ(log.read(&blob, k_LONG_ENTRY_LENGTH, k_NUM_ENTRIES), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_LONG_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_LONG_ENTRY_MEAT, k_LONG_ENTRY_LENGTH), 0); @@ -621,17 +621,17 @@ static void test10_readBlob() bdlbb::Blob blob3(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob3, k_LONG_ENTRY2, k_LONG_ENTRY2_FULL_LENGTH); - mwcu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); - mwcu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); + bmqu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); + bmqu::BlobSection section(start, end); BSLS_ASSERT_OPT(log.write(blob3, section) == currOffset); // 7. Read the other long entry ASSERT_EQ(log.read(&blob, k_LONG_ENTRY2_LENGTH, currOffset), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_LONG_ENTRY2_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_LONG_ENTRY2_MEAT, k_LONG_ENTRY2_LENGTH), 0); @@ -657,7 +657,7 @@ static void test11_aliasRaw() // alias(void **entry, int length, Offset offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ALIAS RAW"); + bmqtst::TestHelper::printTestName("ALIAS RAW"); const mqbsi::LogConfig k_CONFIG(k_LOG_MAX_SIZE, k_LOG_KEY, s_allocator_p); InMemoryLog log(k_CONFIG, g_bufferFactory_p, s_allocator_p); @@ -683,7 +683,7 @@ static void test12_aliasBlob() // alias(bdlbb::Blob *entry, int length, Offset offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ALIAS BLOB"); + bmqtst::TestHelper::printTestName("ALIAS BLOB"); const mqbsi::LogConfig k_CONFIG(k_LOG_MAX_SIZE, k_LOG_KEY, s_allocator_p); InMemoryLog log(k_CONFIG, g_miniBufferFactory_p, s_allocator_p); @@ -702,9 +702,9 @@ static void test12_aliasBlob() char entry[k_LONG_ENTRY_LENGTH]; for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(log.alias(&blob, k_ENTRY_LENGTH, i), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LENGTH), 0); @@ -720,16 +720,16 @@ static void test12_aliasBlob() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); BSLS_ASSERT_OPT(log.write(blob2, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH) == static_cast(k_NUM_ENTRIES)); // 5. Re-alias the list of entries, then alias the long entry for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(log.alias(&blob, k_ENTRY_LENGTH, i), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LENGTH), 0); @@ -738,9 +738,9 @@ static void test12_aliasBlob() ASSERT_EQ(log.alias(&blob, k_LONG_ENTRY_LENGTH, k_NUM_ENTRIES), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_LONG_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_LONG_ENTRY_MEAT, k_LONG_ENTRY_LENGTH), 0); blob.removeAll(); @@ -751,17 +751,17 @@ static void test12_aliasBlob() bdlbb::Blob blob3(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob3, k_LONG_ENTRY2, k_LONG_ENTRY2_FULL_LENGTH); - mwcu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); - mwcu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); + bmqu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); + bmqu::BlobSection section(start, end); BSLS_ASSERT_OPT(log.write(blob3, section) == currOffset); // 7. Alias the other entry ASSERT_EQ(log.alias(&blob, k_LONG_ENTRY2_LENGTH, currOffset), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_LONG_ENTRY2_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_LONG_ENTRY2_MEAT, k_LONG_ENTRY2_LENGTH), 0); blob.removeAll(); @@ -789,7 +789,7 @@ static void test13_seek() // seek(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SEEK"); + bmqtst::TestHelper::printTestName("SEEK"); const mqbsi::LogConfig k_CONFIG(k_LOG_MAX_SIZE, k_LOG_KEY, s_allocator_p); InMemoryLog log(k_CONFIG, g_bufferFactory_p, s_allocator_p); @@ -886,7 +886,7 @@ static void test13_seek() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); { bdlbb::PooledBlobBufferFactory bufferFactory(k_LONG_ENTRY_LENGTH * 2, @@ -918,5 +918,5 @@ int main(int argc, char* argv[]) } } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbsl/mqbsl_ledger.cpp b/src/groups/mqb/mqbsl/mqbsl_ledger.cpp index 659e5c7c8..b4596a317 100644 --- a/src/groups/mqb/mqbsl/mqbsl_ledger.cpp +++ b/src/groups/mqb/mqbsl/mqbsl_ledger.cpp @@ -570,7 +570,7 @@ int Ledger::writeRecord(LedgerRecordId* recordId, int Ledger::writeRecord(LedgerRecordId* recordId, const bdlbb::Blob& record, - const mwcu::BlobPosition& offset, + const bmqu::BlobPosition& offset, int length) { // PRECONDITIONS @@ -586,7 +586,7 @@ int Ledger::writeRecord(LedgerRecordId* recordId, int Ledger::writeRecord(LedgerRecordId* recordId, const bdlbb::Blob& record, - const mwcu::BlobSection& section) + const bmqu::BlobSection& section) { // PRECONDITIONS BSLS_ASSERT_SAFE(d_state == LedgerState::e_OPENED); @@ -594,7 +594,7 @@ int Ledger::writeRecord(LedgerRecordId* recordId, BSLS_ASSERT_SAFE(!d_logs.empty()); int length; - int rc = mwcu::BlobUtil::sectionSize(&length, record, section); + int rc = bmqu::BlobUtil::sectionSize(&length, record, section); if (rc != 0) { return LedgerOpResult::e_INVALID_BLOB_SECTION; // RETURN } diff --git a/src/groups/mqb/mqbsl/mqbsl_ledger.h b/src/groups/mqb/mqbsl/mqbsl_ledger.h index 9a66a5776..15c8401f7 100644 --- a/src/groups/mqb/mqbsl/mqbsl_ledger.h +++ b/src/groups/mqb/mqbsl/mqbsl_ledger.h @@ -36,9 +36,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -77,7 +76,7 @@ class Ledger BSLS_KEYWORD_FINAL : public mqbsi::Ledger { typedef mqbsi::Log Log; typedef Log::Offset Offset; - typedef mwcc::OrderedHashMap LogsMap; + typedef bmqc::OrderedHashMap LogsMap; typedef LogsMap::iterator LogsMapIt; typedef LogsMap::const_iterator LogsMapCIt; @@ -257,7 +256,7 @@ class Ledger BSLS_KEYWORD_FINAL : public mqbsi::Ledger { /// corresponding log. virtual int writeRecord(LedgerRecordId* recordId, const bdlbb::Blob& record, - const mwcu::BlobPosition& offset, + const bmqu::BlobPosition& offset, int length) BSLS_KEYWORD_OVERRIDE; /// Write the specified `section` of the specified `record` into this @@ -268,7 +267,7 @@ class Ledger BSLS_KEYWORD_FINAL : public mqbsi::Ledger { virtual int writeRecord(LedgerRecordId* recordId, const bdlbb::Blob& record, - const mwcu::BlobSection& section) BSLS_KEYWORD_OVERRIDE; + const bmqu::BlobSection& section) BSLS_KEYWORD_OVERRIDE; /// Flush any cached data in this ledger to the underlying storing /// mechanism, and return 0 on success, or a non-zero value on error. diff --git a/src/groups/mqb/mqbsl/mqbsl_ledger.t.cpp b/src/groups/mqb/mqbsl/mqbsl_ledger.t.cpp index ae9700c84..bba4f71c3 100644 --- a/src/groups/mqb/mqbsl/mqbsl_ledger.t.cpp +++ b/src/groups/mqb/mqbsl/mqbsl_ledger.t.cpp @@ -45,9 +45,9 @@ #include // TEST DRIVER -#include -#include -#include +#include +#include +#include // CONVENIENCE using namespace BloombergLP; @@ -156,7 +156,7 @@ struct Tester { bsl::shared_ptr d_logFactory_sp; mqbsi::LedgerConfig d_config; bslma::ManagedPtr d_ledger_mp; - mwcu::TempDirectory d_tempDir; + bmqu::TempDirectory d_tempDir; bdlbb::PooledBlobBufferFactory d_bufferFactory; bdlbb::PooledBlobBufferFactory d_miniBufferFactory; bslma::Allocator* d_allocator_p; @@ -292,7 +292,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); Tester tester; mqbsi::Ledger* ledger = tester.ledger(); @@ -329,7 +329,7 @@ static void test2_openMultipleLogs() // open() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("OPEN MULTIPLE LOGS"); + bmqtst::TestHelper::printTestName("OPEN MULTIPLE LOGS"); Tester tester; tester.generateOldLogs(3); @@ -368,7 +368,7 @@ static void test3_openMultipleLogsNoKeep() // open() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("OPEN MULTIPLE LOGS NO KEEP"); + bmqtst::TestHelper::printTestName("OPEN MULTIPLE LOGS NO KEEP"); Tester tester(false); tester.generateOldLogs(3); @@ -442,7 +442,7 @@ static void test4_updateOutstandingNumBytes() // updateOutstandingNumBytes(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("UPDATE OUTSTANDING NUM BYTES"); + bmqtst::TestHelper::printTestName("UPDATE OUTSTANDING NUM BYTES"); Tester tester; tester.generateOldLogs(2); @@ -503,7 +503,7 @@ static void test5_setOutstandingNumBytes() // setOutstandingNumBytes(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SET OUTSTANDING NUM BYTES"); + bmqtst::TestHelper::printTestName("SET OUTSTANDING NUM BYTES"); Tester tester; tester.generateOldLogs(2); @@ -686,7 +686,7 @@ static void test6_writeRecordRaw() // int length) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRITE RECORD RAW"); + bmqtst::TestHelper::printTestName("WRITE RECORD RAW"); Tester tester(true, Tester::k_OLD_LOG_LEN + k_ENTRY_LEN * k_NUM_ENTRIES + @@ -709,11 +709,11 @@ static void test7_writeRecordBlob() // Testing: // writeRecord(LedgerRecordId *recordId, // const bdlbb::Blob& record, -// const mwcu::BlobPosition& offset, +// const bmqu::BlobPosition& offset, // int length) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRITE RECORD BLOB"); + bmqtst::TestHelper::printTestName("WRITE RECORD BLOB"); Tester tester(true, Tester::k_OLD_LOG_LEN + k_ENTRY_LEN * k_NUM_ENTRIES + @@ -742,7 +742,7 @@ static void test7_writeRecordBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { bdlbb::BlobUtil::append(&blob, k_ENTRIES[i], k_ENTRY_LEN); - mwcu::BlobPosition pos(i, 0); + bmqu::BlobPosition pos(i, 0); ASSERT_EQ(ledger->writeRecord(&recordId, blob, pos, k_ENTRY_LEN), LedgerOpResult::e_SUCCESS); ASSERT_EQ(recordId.logId(), oldLogId); @@ -768,7 +768,7 @@ static void test7_writeRecordBlob() bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LEN); ASSERT_EQ(ledger->writeRecord(&recordId, blob2, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LEN), LedgerOpResult::e_SUCCESS); ASSERT_EQ(recordId.logId(), oldLogId); @@ -787,7 +787,7 @@ static void test7_writeRecordBlob() bdlbb::BlobUtil::append(&blob3, k_EXTRA_ENTRY_1, k_EXTRA_ENTRY_LEN); ASSERT_EQ(ledger->writeRecord(&recordId, blob3, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_EXTRA_ENTRY_LEN), LedgerOpResult::e_SUCCESS); @@ -817,7 +817,7 @@ static void test7_writeRecordBlob() bdlbb::BlobUtil::append(&blob4, k_EXTRA_ENTRY_2, k_EXTRA_ENTRY_LEN); ASSERT_EQ(ledger->writeRecord(&recordId, blob4, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_EXTRA_ENTRY_LEN), LedgerOpResult::e_SUCCESS); ASSERT_EQ(recordId.logId(), newLogId); @@ -866,10 +866,10 @@ static void test8_writeRecordBlobSection() // Testing: // writeRecord(LedgerRecordId *recordId, // const bdlbb::Blob& record, -// const mwcu::BlobSection& section) +// const bmqu::BlobSection& section) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRITE RECORD BLOB SECTION"); + bmqtst::TestHelper::printTestName("WRITE RECORD BLOB SECTION"); Tester tester(true, Tester::k_OLD_LOG_LEN + k_ENTRY_LEN * k_NUM_ENTRIES + @@ -898,9 +898,9 @@ static void test8_writeRecordBlobSection() for (int i = 0; i < k_NUM_ENTRIES; ++i) { bdlbb::BlobUtil::append(&blob, k_ENTRIES[i], k_ENTRY_LEN); - mwcu::BlobPosition start(i, 0); - mwcu::BlobPosition end(i + 1, 0); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(i, 0); + bmqu::BlobPosition end(i + 1, 0); + bmqu::BlobSection section(start, end); ASSERT_EQ(ledger->writeRecord(&recordId, blob, section), LedgerOpResult::e_SUCCESS); ASSERT_EQ(recordId.logId(), oldLogId); @@ -925,9 +925,9 @@ static void test8_writeRecordBlobSection() bdlbb::Blob blob2(tester.bufferFactory(), s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LEN); - mwcu::BlobPosition start2(0, k_LONG_ENTRY_OFFSET); - mwcu::BlobPosition end2(0, k_LONG_ENTRY_OFFSET + k_LONG_ENTRY_LEN); - mwcu::BlobSection section2(start2, end2); + bmqu::BlobPosition start2(0, k_LONG_ENTRY_OFFSET); + bmqu::BlobPosition end2(0, k_LONG_ENTRY_OFFSET + k_LONG_ENTRY_LEN); + bmqu::BlobSection section2(start2, end2); ASSERT_EQ(ledger->writeRecord(&recordId, blob2, section2), LedgerOpResult::e_SUCCESS); ASSERT_EQ(recordId.logId(), oldLogId); @@ -945,9 +945,9 @@ static void test8_writeRecordBlobSection() bdlbb::Blob blob3(tester.bufferFactory(), s_allocator_p); bdlbb::BlobUtil::append(&blob3, k_EXTRA_ENTRY_1, k_EXTRA_ENTRY_LEN); - mwcu::BlobPosition start3; - mwcu::BlobPosition end3(1, 0); - mwcu::BlobSection section3(start3, end3); + bmqu::BlobPosition start3; + bmqu::BlobPosition end3(1, 0); + bmqu::BlobSection section3(start3, end3); ASSERT_EQ(ledger->writeRecord(&recordId, blob3, section3), LedgerOpResult::e_SUCCESS); @@ -976,9 +976,9 @@ static void test8_writeRecordBlobSection() bdlbb::Blob blob4(tester.bufferFactory(), s_allocator_p); bdlbb::BlobUtil::append(&blob4, k_EXTRA_ENTRY_2, k_EXTRA_ENTRY_LEN); - mwcu::BlobPosition start4; - mwcu::BlobPosition end4(1, 0); - mwcu::BlobSection section4(start4, end4); + bmqu::BlobPosition start4; + bmqu::BlobPosition end4(1, 0); + bmqu::BlobSection section4(start4, end4); ASSERT_EQ(ledger->writeRecord(&recordId, blob4, section4), LedgerOpResult::e_SUCCESS); ASSERT_EQ(recordId.logId(), newLogId); @@ -1029,7 +1029,7 @@ static void test9_readRecordRaw() // const LedgerRecordId& recordId) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("READ RECORD RAW"); + bmqtst::TestHelper::printTestName("READ RECORD RAW"); Tester tester(true, Tester::k_OLD_LOG_LEN + k_ENTRY_LEN * k_NUM_ENTRIES + @@ -1163,7 +1163,7 @@ static void test10_readRecordBlob() // const LedgerRecordId& recordId) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("READ RECORD BLOB"); + bmqtst::TestHelper::printTestName("READ RECORD BLOB"); Tester tester(true, Tester::k_OLD_LOG_LEN + k_ENTRY_LEN * k_NUM_ENTRIES + @@ -1201,9 +1201,9 @@ static void test10_readRecordBlob() LedgerRecordId recordId(logId1, mqbu::StorageKey::e_KEY_LENGTH_BINARY); ASSERT_EQ(ledger->readRecord(&blob, k_DUMMY_LOG_MESSAGE_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_DUMMY_LOG_MESSAGE_LEN); ASSERT_EQ(bsl::memcmp(entry, k_DUMMY_LOG_MESSAGE, k_DUMMY_LOG_MESSAGE_LEN), 0); @@ -1214,9 +1214,9 @@ static void test10_readRecordBlob() // Again, skip the log ID written at the beginning of the log ASSERT_EQ(ledger->readRecord(&blob, k_DUMMY_LOG_MESSAGE_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_DUMMY_LOG_MESSAGE_LEN); ASSERT_EQ(bsl::memcmp(entry, k_DUMMY_LOG_MESSAGE, k_DUMMY_LOG_MESSAGE_LEN), 0); @@ -1226,9 +1226,9 @@ static void test10_readRecordBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(ledger->readRecord(&blob, k_ENTRY_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LEN); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LEN), 0); recordId.setOffset(recordId.offset() + k_ENTRY_LEN); @@ -1237,9 +1237,9 @@ static void test10_readRecordBlob() ASSERT_EQ(ledger->readRecord(&blob, k_LONG_ENTRY_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_LONG_ENTRY_LEN); ASSERT_EQ(bsl::memcmp(entry, k_LONG_ENTRY_MEAT, k_LONG_ENTRY_LEN), 0); blob.removeBuffer(0); @@ -1248,9 +1248,9 @@ static void test10_readRecordBlob() recordId.setLogId(logId3).setOffset(0); ASSERT_EQ(ledger->readRecord(&blob, k_EXTRA_ENTRY_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_EXTRA_ENTRY_LEN); ASSERT_EQ(bsl::memcmp(entry, k_EXTRA_ENTRY_1, k_EXTRA_ENTRY_LEN), 0); recordId.setOffset(recordId.offset() + k_EXTRA_ENTRY_LEN); @@ -1258,9 +1258,9 @@ static void test10_readRecordBlob() ASSERT_EQ(ledger->readRecord(&blob, k_EXTRA_ENTRY_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_EXTRA_ENTRY_LEN); ASSERT_EQ(bsl::memcmp(entry, k_EXTRA_ENTRY_2, k_EXTRA_ENTRY_LEN), 0); blob.removeBuffer(0); @@ -1286,9 +1286,9 @@ static void test10_readRecordBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(ledger->readRecord(&blob, k_ENTRY_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LEN); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LEN), 0); recordId.setOffset(recordId.offset() + k_ENTRY_LEN); @@ -1297,9 +1297,9 @@ static void test10_readRecordBlob() ASSERT_EQ(ledger->readRecord(&blob, k_EXTRA_ENTRY_LEN, extraRecordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_EXTRA_ENTRY_LEN); ASSERT_EQ(bsl::memcmp(entry, k_EXTRA_ENTRY_3, k_EXTRA_ENTRY_LEN), 0); blob.removeBuffer(0); @@ -1338,7 +1338,7 @@ static void test11_aliasRecordRaw() // const LedgerRecordId& recordId) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ALIAS RECORD RAW"); + bmqtst::TestHelper::printTestName("ALIAS RECORD RAW"); Tester tester(true, Tester::k_OLD_LOG_LEN + k_ENTRY_LEN * k_NUM_ENTRIES + @@ -1492,7 +1492,7 @@ static void test12_aliasRecordBlob() // const LedgerRecordId& recordId) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ALIAS RECORD BLOB"); + bmqtst::TestHelper::printTestName("ALIAS RECORD BLOB"); Tester tester(true, Tester::k_OLD_LOG_LEN + k_ENTRY_LEN * k_NUM_ENTRIES + @@ -1530,9 +1530,9 @@ static void test12_aliasRecordBlob() LedgerRecordId recordId(logId1, mqbu::StorageKey::e_KEY_LENGTH_BINARY); ASSERT_EQ(ledger->aliasRecord(&blob, k_DUMMY_LOG_MESSAGE_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_DUMMY_LOG_MESSAGE_LEN); ASSERT_EQ(bsl::memcmp(entry, k_DUMMY_LOG_MESSAGE, k_DUMMY_LOG_MESSAGE_LEN), 0); @@ -1543,9 +1543,9 @@ static void test12_aliasRecordBlob() // Again, skip the log ID written at the beginning of the log ASSERT_EQ(ledger->aliasRecord(&blob, k_DUMMY_LOG_MESSAGE_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_DUMMY_LOG_MESSAGE_LEN); ASSERT_EQ(bsl::memcmp(entry, k_DUMMY_LOG_MESSAGE, k_DUMMY_LOG_MESSAGE_LEN), 0); @@ -1555,9 +1555,9 @@ static void test12_aliasRecordBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(ledger->aliasRecord(&blob, k_ENTRY_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LEN); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LEN), 0); recordId.setOffset(recordId.offset() + k_ENTRY_LEN); @@ -1566,9 +1566,9 @@ static void test12_aliasRecordBlob() ASSERT_EQ(ledger->aliasRecord(&blob, k_LONG_ENTRY_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_LONG_ENTRY_LEN); ASSERT_EQ(bsl::memcmp(entry, k_LONG_ENTRY_MEAT, k_LONG_ENTRY_LEN), 0); blob.removeBuffer(0); @@ -1577,9 +1577,9 @@ static void test12_aliasRecordBlob() recordId.setLogId(logId3).setOffset(0); ASSERT_EQ(ledger->aliasRecord(&blob, k_EXTRA_ENTRY_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_EXTRA_ENTRY_LEN); ASSERT_EQ(bsl::memcmp(entry, k_EXTRA_ENTRY_1, k_EXTRA_ENTRY_LEN), 0); recordId.setOffset(recordId.offset() + k_EXTRA_ENTRY_LEN); @@ -1587,9 +1587,9 @@ static void test12_aliasRecordBlob() ASSERT_EQ(ledger->aliasRecord(&blob, k_EXTRA_ENTRY_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_EXTRA_ENTRY_LEN); ASSERT_EQ(bsl::memcmp(entry, k_EXTRA_ENTRY_2, k_EXTRA_ENTRY_LEN), 0); blob.removeBuffer(0); @@ -1615,9 +1615,9 @@ static void test12_aliasRecordBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(ledger->aliasRecord(&blob, k_ENTRY_LEN, recordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LEN); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LEN), 0); recordId.setOffset(recordId.offset() + k_ENTRY_LEN); @@ -1626,9 +1626,9 @@ static void test12_aliasRecordBlob() ASSERT_EQ(ledger->aliasRecord(&blob, k_EXTRA_ENTRY_LEN, extraRecordId), LedgerOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_EXTRA_ENTRY_LEN); ASSERT_EQ(bsl::memcmp(entry, k_EXTRA_ENTRY_3, k_EXTRA_ENTRY_LEN), 0); blob.removeBuffer(0); @@ -1660,9 +1660,9 @@ static void test12_aliasRecordBlob() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); - mwcsys::Time::initialize(s_allocator_p); + bmqsys::Time::initialize(s_allocator_p); { switch (_testCase) { @@ -1686,7 +1686,7 @@ int main(int argc, char* argv[]) } } - mwcsys::Time::shutdown(); + bmqsys::Time::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbsl/mqbsl_memorymappedondisklog.cpp b/src/groups/mqb/mqbsl/mqbsl_memorymappedondisklog.cpp index b476a6fb9..dfdfa2ee4 100644 --- a/src/groups/mqb/mqbsl/mqbsl_memorymappedondisklog.cpp +++ b/src/groups/mqb/mqbsl/mqbsl_memorymappedondisklog.cpp @@ -20,8 +20,7 @@ // MQB #include -// MWC -#include +#include // BDE #include @@ -145,7 +144,7 @@ int MemoryMappedOnDiskLog::open(int flags) return LogOpResult::e_FILE_NOT_EXIST; // RETURN } - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; const bool openReadOnly = flags & e_READ_ONLY; int rc = mqbs::FileSystemUtil::open(&d_mfd, logConfig().location().c_str(), @@ -197,7 +196,7 @@ int MemoryMappedOnDiskLog::close() int rc = LogOpResult::e_UNKNOWN; if (!d_isReadOnly) { - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; rc = mqbs::FileSystemUtil::truncate(&d_mfd, d_totalNumBytes, errorDescription); @@ -261,7 +260,7 @@ MemoryMappedOnDiskLog::write(const void* entry, int offset, int length) mqbsi::Log::Offset MemoryMappedOnDiskLog::write(const bdlbb::Blob& entry, - const mwcu::BlobPosition& offset, + const bmqu::BlobPosition& offset, int length) { // PRECONDITIONS @@ -276,7 +275,7 @@ MemoryMappedOnDiskLog::write(const bdlbb::Blob& entry, return LogOpResult::e_REACHED_END_OF_LOG; // RETURN } - int rc = mwcu::BlobUtil::readNBytes(d_mfd.mapping() + oldOffset, + int rc = bmqu::BlobUtil::readNBytes(d_mfd.mapping() + oldOffset, entry, offset, length); @@ -291,10 +290,10 @@ MemoryMappedOnDiskLog::write(const bdlbb::Blob& entry, mqbsi::Log::Offset MemoryMappedOnDiskLog::write(const bdlbb::Blob& entry, - const mwcu::BlobSection& section) + const bmqu::BlobSection& section) { int length; - int rc = mwcu::BlobUtil::sectionSize(&length, entry, section); + int rc = bmqu::BlobUtil::sectionSize(&length, entry, section); if (rc != 0) { return LogOpResult::e_INVALID_BLOB_SECTION; // RETURN } diff --git a/src/groups/mqb/mqbsl/mqbsl_memorymappedondisklog.h b/src/groups/mqb/mqbsl/mqbsl_memorymappedondisklog.h index ce12c6cf9..217ca8c4f 100644 --- a/src/groups/mqb/mqbsl/mqbsl_memorymappedondisklog.h +++ b/src/groups/mqb/mqbsl/mqbsl_memorymappedondisklog.h @@ -43,8 +43,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -214,7 +213,7 @@ class MemoryMappedOnDiskLog BSLS_KEYWORD_FINAL : public OnDiskLog { /// `updateOutstandingNumBytes` properly before overwriting an existing /// record. virtual Offset write(const bdlbb::Blob& entry, - const mwcu::BlobPosition& offset, + const bmqu::BlobPosition& offset, int length) BSLS_KEYWORD_OVERRIDE; /// Write the specified `section` of the specified `entry` into the @@ -227,7 +226,7 @@ class MemoryMappedOnDiskLog BSLS_KEYWORD_FINAL : public OnDiskLog { /// properly before overwriting an existing record. virtual Offset write(const bdlbb::Blob& entry, - const mwcu::BlobSection& section) BSLS_KEYWORD_OVERRIDE; + const bmqu::BlobSection& section) BSLS_KEYWORD_OVERRIDE; /// Flush any cached data up to the optionally specified `offset` to the /// underlying storing mechanism, and return 0 on success, or a negative diff --git a/src/groups/mqb/mqbsl/mqbsl_memorymappedondisklog.t.cpp b/src/groups/mqb/mqbsl/mqbsl_memorymappedondisklog.t.cpp index df4fcbd98..af3264119 100644 --- a/src/groups/mqb/mqbsl/mqbsl_memorymappedondisklog.t.cpp +++ b/src/groups/mqb/mqbsl/mqbsl_memorymappedondisklog.t.cpp @@ -29,8 +29,8 @@ #include // TEST DRIVER -#include -#include +#include +#include // CONVENIENCE using namespace BloombergLP; @@ -108,7 +108,7 @@ static bdlbb::PooledBlobBufferFactory* g_miniBufferFactory_p = 0; struct Tester { private: // DATA - mwcu::TempDirectory d_tempDirectory; + bmqu::TempDirectory d_tempDirectory; const mqbsi::LogConfig d_config; MemoryMappedOnDiskLog d_log; @@ -149,7 +149,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); Tester tester; MemoryMappedOnDiskLog& log = tester.log(); @@ -181,7 +181,7 @@ static void test2_fileNotExist() // open(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("FILE NOT EXIST"); + bmqtst::TestHelper::printTestName("FILE NOT EXIST"); Tester tester; MemoryMappedOnDiskLog& log = tester.log(); @@ -201,7 +201,7 @@ static void test3_updateOutstandingNumBytes() // updateOutstandingNumBytes(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("UPDATE OUTSTANDING NUM BYTES"); + bmqtst::TestHelper::printTestName("UPDATE OUTSTANDING NUM BYTES"); Tester tester; MemoryMappedOnDiskLog& log = tester.log(); @@ -236,7 +236,7 @@ static void test4_setOutstandingNumBytes() // setOutstandingNumBytes(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SET OUTSTANDING NUM BYTES"); + bmqtst::TestHelper::printTestName("SET OUTSTANDING NUM BYTES"); Tester tester; MemoryMappedOnDiskLog& log = tester.log(); @@ -272,7 +272,7 @@ static void test5_writeRaw() // write(const void *entry, int offset, int length) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRITE RAW"); + bmqtst::TestHelper::printTestName("WRITE RAW"); const bsls::Types::Int64 logMaxSize = k_NUM_ENTRIES * k_ENTRY_LENGTH + k_LONG_ENTRY_LENGTH + 10; @@ -336,11 +336,11 @@ static void test6_writeBlob() // // Testing: // write(const bdlbb::Blob& entry, -// const mwcu::BlobPosition& offset, +// const bmqu::BlobPosition& offset, // int length) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRITE BLOB"); + bmqtst::TestHelper::printTestName("WRITE BLOB"); const bsls::Types::Int64 logMaxSize = k_NUM_ENTRIES * k_ENTRY_LENGTH + k_LONG_ENTRY_LENGTH + 10; @@ -354,7 +354,7 @@ static void test6_writeBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { bdlbb::BlobUtil::append(&blob, k_ENTRIES[i], k_ENTRY_LENGTH); - mwcu::BlobPosition pos(i, 0); + bmqu::BlobPosition pos(i, 0); ASSERT_EQ(log.write(blob, pos, k_ENTRY_LENGTH), static_cast(i * k_ENTRY_LENGTH)); ASSERT_EQ(log.totalNumBytes(), (i + 1) * k_ENTRY_LENGTH); @@ -375,7 +375,7 @@ static void test6_writeBlob() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); ASSERT_EQ(log.write(blob2, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH), static_cast(currNumBytes)); currNumBytes += k_LONG_ENTRY_LENGTH; @@ -385,7 +385,7 @@ static void test6_writeBlob() // 4. Write another long entry. This should fail due to exceeding max size. ASSERT_EQ(log.write(blob2, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH), LogOpResult::e_REACHED_END_OF_LOG); @@ -413,10 +413,10 @@ static void test7_writeBlobSection() // 'write'. // // Testing: -// write(const bdlbb::Blob& entry, const mwcu::BlobSection& section) +// write(const bdlbb::Blob& entry, const bmqu::BlobSection& section) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRITE BLOB SECTION"); + bmqtst::TestHelper::printTestName("WRITE BLOB SECTION"); const bsls::Types::Int64 logMaxSize = k_NUM_ENTRIES * k_ENTRY_LENGTH + k_LONG_ENTRY_LENGTH + 10; @@ -430,9 +430,9 @@ static void test7_writeBlobSection() for (int i = 0; i < k_NUM_ENTRIES; ++i) { bdlbb::BlobUtil::append(&blob, k_ENTRIES[i], k_ENTRY_LENGTH); - mwcu::BlobPosition start(i, 0); - mwcu::BlobPosition end(i + 1, 0); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(i, 0); + bmqu::BlobPosition end(i + 1, 0); + bmqu::BlobSection section(start, end); ASSERT_EQ(log.write(blob, section), static_cast(i * k_ENTRY_LENGTH)); ASSERT_EQ(log.totalNumBytes(), (i + 1) * k_ENTRY_LENGTH); @@ -453,9 +453,9 @@ static void test7_writeBlobSection() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); - mwcu::BlobPosition start(0, k_LONG_ENTRY_OFFSET); - mwcu::BlobPosition end(0, k_LONG_ENTRY_OFFSET + k_LONG_ENTRY_LENGTH); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(0, k_LONG_ENTRY_OFFSET); + bmqu::BlobPosition end(0, k_LONG_ENTRY_OFFSET + k_LONG_ENTRY_LENGTH); + bmqu::BlobSection section(start, end); ASSERT_EQ(log.write(blob2, section), static_cast(currNumBytes)); currNumBytes += k_LONG_ENTRY_LENGTH; ASSERT_EQ(log.totalNumBytes(), currNumBytes); @@ -490,7 +490,7 @@ static void test8_readRaw() // read(void *entry, int length, Offset offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("READ RAW"); + bmqtst::TestHelper::printTestName("READ RAW"); Tester tester; MemoryMappedOnDiskLog& log = tester.log(); @@ -522,7 +522,7 @@ static void test8_readRaw() bdlbb::Blob blob(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); BSLS_ASSERT_OPT(log.write(blob, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH) == static_cast(k_NUM_ENTRIES * k_ENTRY_LENGTH)); @@ -548,9 +548,9 @@ static void test8_readRaw() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY2, k_LONG_ENTRY2_FULL_LENGTH); - mwcu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); - mwcu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); + bmqu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); + bmqu::BlobSection section(start, end); BSLS_ASSERT_OPT(log.write(blob2, section) == currOffset); // 7. Read the other long entry @@ -582,7 +582,7 @@ static void test9_readBlob() // read(bdlbb::Blob *entry, int length, Offset offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("READ BLOB"); + bmqtst::TestHelper::printTestName("READ BLOB"); Tester tester; MemoryMappedOnDiskLog& log = tester.log(); @@ -602,9 +602,9 @@ static void test9_readBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(log.read(&blob, k_ENTRY_LENGTH, i * k_ENTRY_LENGTH), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LENGTH), 0); @@ -620,7 +620,7 @@ static void test9_readBlob() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); BSLS_ASSERT_OPT(log.write(blob2, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH) == static_cast(k_NUM_ENTRIES * k_ENTRY_LENGTH)); @@ -628,9 +628,9 @@ static void test9_readBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(log.read(&blob, k_ENTRY_LENGTH, i * k_ENTRY_LENGTH), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LENGTH), 0); @@ -640,9 +640,9 @@ static void test9_readBlob() ASSERT_EQ( log.read(&blob, k_LONG_ENTRY_LENGTH, k_NUM_ENTRIES * k_ENTRY_LENGTH), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_LONG_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_LONG_ENTRY_MEAT, k_LONG_ENTRY_LENGTH), 0); blob.removeAll(); @@ -654,17 +654,17 @@ static void test9_readBlob() bdlbb::Blob blob3(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob3, k_LONG_ENTRY2, k_LONG_ENTRY2_FULL_LENGTH); - mwcu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); - mwcu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); + bmqu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); + bmqu::BlobSection section(start, end); BSLS_ASSERT_OPT(log.write(blob3, section) == currOffset); // 7. Read the other long entry ASSERT_EQ(log.read(&blob, k_LONG_ENTRY2_LENGTH, currOffset), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_LONG_ENTRY2_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_LONG_ENTRY2_MEAT, k_LONG_ENTRY2_LENGTH), 0); blob.removeAll(); @@ -691,7 +691,7 @@ static void test10_aliasRaw() // alias(void **entry, int length, Offset offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ALIAS RAW"); + bmqtst::TestHelper::printTestName("ALIAS RAW"); Tester tester; MemoryMappedOnDiskLog& log = tester.log(); @@ -723,7 +723,7 @@ static void test10_aliasRaw() bdlbb::Blob blob(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); BSLS_ASSERT_OPT(log.write(blob, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH) == static_cast(k_NUM_ENTRIES * k_ENTRY_LENGTH)); @@ -749,9 +749,9 @@ static void test10_aliasRaw() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY2, k_LONG_ENTRY2_FULL_LENGTH); - mwcu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); - mwcu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); + bmqu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); + bmqu::BlobSection section(start, end); BSLS_ASSERT_OPT(log.write(blob2, section) == currOffset); // 7. Alias the other entry @@ -785,7 +785,7 @@ static void test11_aliasBlob() // alias(bdlbb::Blob *entry, int length, Offset offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ALIAS BLOB"); + bmqtst::TestHelper::printTestName("ALIAS BLOB"); Tester tester; MemoryMappedOnDiskLog& log = tester.log(); @@ -805,9 +805,9 @@ static void test11_aliasBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(log.alias(&blob, k_ENTRY_LENGTH, i * k_ENTRY_LENGTH), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LENGTH), 0); @@ -823,7 +823,7 @@ static void test11_aliasBlob() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); BSLS_ASSERT_OPT(log.write(blob2, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH) == static_cast(k_NUM_ENTRIES * k_ENTRY_LENGTH)); @@ -831,9 +831,9 @@ static void test11_aliasBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(log.alias(&blob, k_ENTRY_LENGTH, i * k_ENTRY_LENGTH), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LENGTH), 0); @@ -843,9 +843,9 @@ static void test11_aliasBlob() ASSERT_EQ( log.alias(&blob, k_LONG_ENTRY_LENGTH, k_NUM_ENTRIES * k_ENTRY_LENGTH), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_LONG_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_LONG_ENTRY_MEAT, k_LONG_ENTRY_LENGTH), 0); blob.removeBuffer(0); @@ -857,17 +857,17 @@ static void test11_aliasBlob() bdlbb::Blob blob3(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob3, k_LONG_ENTRY2, k_LONG_ENTRY2_FULL_LENGTH); - mwcu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); - mwcu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); + bmqu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); + bmqu::BlobSection section(start, end); BSLS_ASSERT_OPT(log.write(blob3, section) == currOffset); // 7. Alias the other entry ASSERT_EQ(log.alias(&blob, k_LONG_ENTRY2_LENGTH, currOffset), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_LONG_ENTRY2_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_LONG_ENTRY2_MEAT, k_LONG_ENTRY2_LENGTH), 0); blob.removeBuffer(0); @@ -895,7 +895,7 @@ static void test12_seek() // seek(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SEEK"); + bmqtst::TestHelper::printTestName("SEEK"); Tester tester; MemoryMappedOnDiskLog& log = tester.log(); @@ -1006,7 +1006,7 @@ static void test12_seek() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); { bdlbb::PooledBlobBufferFactory bufferFactory(k_LONG_ENTRY_LENGTH * 2, @@ -1037,5 +1037,5 @@ int main(int argc, char* argv[]) } } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbsl/mqbsl_readwriteondisklog.cpp b/src/groups/mqb/mqbsl/mqbsl_readwriteondisklog.cpp index 0e83f13f3..2dd5d7394 100644 --- a/src/groups/mqb/mqbsl/mqbsl_readwriteondisklog.cpp +++ b/src/groups/mqb/mqbsl/mqbsl_readwriteondisklog.cpp @@ -20,8 +20,7 @@ // MQB #include -// MWC -#include +#include // BDE #include @@ -134,7 +133,7 @@ void ReadWriteOnDiskLog::updateInternalState(int writeLength) void ReadWriteOnDiskLog::populateIoVectors(struct iovec* ioVectors, int* iovecCount, const bdlbb::Blob& entry, - const mwcu::BlobPosition& offset, + const bmqu::BlobPosition& offset, int length) { int iovecCnt = 0; @@ -146,7 +145,7 @@ void ReadWriteOnDiskLog::populateIoVectors(struct iovec* ioVectors, BSLS_ASSERT_SAFE(bufIndex < entry.numDataBuffers()); const bdlbb::BlobBuffer& buf = entry.buffer(bufIndex); - const int bufSize = mwcu::BlobUtil::bufferSize(entry, bufIndex); + const int bufSize = bmqu::BlobUtil::bufferSize(entry, bufIndex); const int nbytes = bsl::min(remainingLength, bufSize - bufOffset); ioVectors[iovecCnt].iov_base = buf.data() + bufOffset; ioVectors[iovecCnt].iov_len = nbytes; @@ -204,7 +203,7 @@ int ReadWriteOnDiskLog::open(int flags) // If log is writable int rc = 0; - mwcu::MemOutStream errorDescription; + bmqu::MemOutStream errorDescription; if (!openReadOnly) { rc = mqbs::FileSystemUtil::grow(d_fd, logConfig().maxSize(), @@ -315,7 +314,7 @@ ReadWriteOnDiskLog::write(const void* entry, int offset, int length) } mqbsi::Log::Offset ReadWriteOnDiskLog::write(const bdlbb::Blob& entry, - const mwcu::BlobPosition& offset, + const bmqu::BlobPosition& offset, int length) { // PRECONDITIONS @@ -334,8 +333,8 @@ mqbsi::Log::Offset ReadWriteOnDiskLog::write(const bdlbb::Blob& entry, struct iovec ioVectors[IOV_MAX]; int remainingLength = length; - mwcu::BlobPosition currOffset = offset; - mwcu::BlobPosition nextCurrOffset; + bmqu::BlobPosition currOffset = offset; + bmqu::BlobPosition nextCurrOffset; do { int iovecCount = 0; populateIoVectors(ioVectors, @@ -350,7 +349,7 @@ mqbsi::Log::Offset ReadWriteOnDiskLog::write(const bdlbb::Blob& entry, return LogOpResult::e_BYTE_WRITE_FAILURE; // RETURN } - BSLA_MAYBE_UNUSED const int rc = mwcu::BlobUtil::findOffset( + BSLA_MAYBE_UNUSED const int rc = bmqu::BlobUtil::findOffset( &nextCurrOffset, entry, currOffset, @@ -370,10 +369,10 @@ mqbsi::Log::Offset ReadWriteOnDiskLog::write(const bdlbb::Blob& entry, } mqbsi::Log::Offset ReadWriteOnDiskLog::write(const bdlbb::Blob& entry, - const mwcu::BlobSection& section) + const bmqu::BlobSection& section) { int length; - int rc = mwcu::BlobUtil::sectionSize(&length, entry, section); + int rc = bmqu::BlobUtil::sectionSize(&length, entry, section); if (rc != 0) { return LogOpResult::e_INVALID_BLOB_SECTION; // RETURN } @@ -451,15 +450,15 @@ int ReadWriteOnDiskLog::read(bdlbb::Blob* entry, } // Ensure blob has enough space for the intended length - mwcu::BlobUtil::reserve(entry, length); + bmqu::BlobUtil::reserve(entry, length); // Read Scatter/Gather IO. readv() supports up to IOV_MAX iovecs, so batch // it up. struct iovec ioVectors[IOV_MAX]; const int numDataBuffers = entry->numDataBuffers(); int remainingLength = length; - mwcu::BlobPosition currOffset(0, 0); - mwcu::BlobPosition nextCurrOffset; + bmqu::BlobPosition currOffset(0, 0); + bmqu::BlobPosition nextCurrOffset; while (remainingLength > 0) { const int currBufIdx = currOffset.buffer(); @@ -468,14 +467,14 @@ int ReadWriteOnDiskLog::read(bdlbb::Blob* entry, // i.e. Case j == 0 const bdlbb::BlobBuffer& buf0 = entry->buffer(currBufIdx); ioVectors[0].iov_base = buf0.data() + currBufOffset; - ioVectors[0].iov_len = mwcu::BlobUtil::bufferSize(*entry, currBufIdx) - + ioVectors[0].iov_len = bmqu::BlobUtil::bufferSize(*entry, currBufIdx) - currBufOffset; const int iovecCount = bsl::min(numDataBuffers - currBufIdx, IOV_MAX); for (int j = 1; j < iovecCount; ++j) { const bdlbb::BlobBuffer& buf = entry->buffer(currBufIdx + j); ioVectors[j].iov_base = buf.data(); - ioVectors[j].iov_len = mwcu::BlobUtil::bufferSize(*entry, + ioVectors[j].iov_len = bmqu::BlobUtil::bufferSize(*entry, currBufIdx + j); } @@ -484,7 +483,7 @@ int ReadWriteOnDiskLog::read(bdlbb::Blob* entry, return LogOpResult::e_BYTE_READ_FAILURE; // RETURN } - rc = mwcu::BlobUtil::findOffset(&nextCurrOffset, + rc = bmqu::BlobUtil::findOffset(&nextCurrOffset, *entry, currOffset, numRead); diff --git a/src/groups/mqb/mqbsl/mqbsl_readwriteondisklog.h b/src/groups/mqb/mqbsl/mqbsl_readwriteondisklog.h index d0f9e9642..9a313ff5c 100644 --- a/src/groups/mqb/mqbsl/mqbsl_readwriteondisklog.h +++ b/src/groups/mqb/mqbsl/mqbsl_readwriteondisklog.h @@ -43,8 +43,7 @@ #include #include -// MWC -#include +#include // BDE #include @@ -176,7 +175,7 @@ class ReadWriteOnDiskLog BSLS_KEYWORD_FINAL : public OnDiskLog { void populateIoVectors(struct iovec* ioVectors, int* iovecCount, const bdlbb::Blob& entry, - const mwcu::BlobPosition& offset, + const bmqu::BlobPosition& offset, int length); public: @@ -241,7 +240,7 @@ class ReadWriteOnDiskLog BSLS_KEYWORD_FINAL : public OnDiskLog { /// `updateOutstandingNumBytes` properly before overwriting an existing /// record. virtual Offset write(const bdlbb::Blob& entry, - const mwcu::BlobPosition& offset, + const bmqu::BlobPosition& offset, int length) BSLS_KEYWORD_OVERRIDE; /// Write the specified `section` of the specified `entry` into the @@ -254,7 +253,7 @@ class ReadWriteOnDiskLog BSLS_KEYWORD_FINAL : public OnDiskLog { /// properly before overwriting an existing record. virtual Offset write(const bdlbb::Blob& entry, - const mwcu::BlobSection& section) BSLS_KEYWORD_OVERRIDE; + const bmqu::BlobSection& section) BSLS_KEYWORD_OVERRIDE; /// Flush any cached data up to the optionally specified `offset` to the /// underlying storing mechanism, and return 0 on success, or a negative diff --git a/src/groups/mqb/mqbsl/mqbsl_readwriteondisklog.t.cpp b/src/groups/mqb/mqbsl/mqbsl_readwriteondisklog.t.cpp index 177f73780..0987278eb 100644 --- a/src/groups/mqb/mqbsl/mqbsl_readwriteondisklog.t.cpp +++ b/src/groups/mqb/mqbsl/mqbsl_readwriteondisklog.t.cpp @@ -32,8 +32,8 @@ #include // TEST DRIVER -#include -#include +#include +#include // CONVENIENCE using namespace BloombergLP; @@ -124,7 +124,7 @@ void generateRandomString(char* s, const int len) struct Tester { private: // DATA - mwcu::TempDirectory d_tempDirectory; + bmqu::TempDirectory d_tempDirectory; const mqbsi::LogConfig d_config; ReadWriteOnDiskLog d_log; @@ -165,7 +165,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); Tester tester; ReadWriteOnDiskLog& log = tester.log(); @@ -197,7 +197,7 @@ static void test2_fileNotExist() // open(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("FILE NOT EXIST"); + bmqtst::TestHelper::printTestName("FILE NOT EXIST"); Tester tester; ReadWriteOnDiskLog& log = tester.log(); @@ -217,7 +217,7 @@ static void test3_updateOutstandingNumBytes() // updateOutstandingNumBytes(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("UPDATE OUTSTANDING NUM BYTES"); + bmqtst::TestHelper::printTestName("UPDATE OUTSTANDING NUM BYTES"); Tester tester; ReadWriteOnDiskLog& log = tester.log(); @@ -252,7 +252,7 @@ static void test4_setOutstandingNumBytes() // setOutstandingNumBytes(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SET OUTSTANDING NUM BYTES"); + bmqtst::TestHelper::printTestName("SET OUTSTANDING NUM BYTES"); Tester tester; ReadWriteOnDiskLog& log = tester.log(); @@ -288,7 +288,7 @@ static void test5_writeRaw() // write(const void *entry, int offset, int length) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRITE RAW"); + bmqtst::TestHelper::printTestName("WRITE RAW"); const bsls::Types::Int64 logMaxSize = k_NUM_ENTRIES * k_ENTRY_LENGTH + k_LONG_ENTRY_LENGTH + 10; @@ -351,11 +351,11 @@ static void test6_writeBlob() // // Testing: // write(const bdlbb::Blob& entry, -// const mwcu::BlobPosition& offset, +// const bmqu::BlobPosition& offset, // int length) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRITE BLOB"); + bmqtst::TestHelper::printTestName("WRITE BLOB"); const bsls::Types::Int64 logMaxSize = k_NUM_ENTRIES * k_ENTRY_LENGTH + k_LONG_ENTRY_LENGTH + 10; @@ -369,7 +369,7 @@ static void test6_writeBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { bdlbb::BlobUtil::append(&blob, k_ENTRIES[i], k_ENTRY_LENGTH); - mwcu::BlobPosition pos(i, 0); + bmqu::BlobPosition pos(i, 0); ASSERT_EQ(log.write(blob, pos, k_ENTRY_LENGTH), static_cast(i * k_ENTRY_LENGTH)); ASSERT_EQ(log.totalNumBytes(), (i + 1) * k_ENTRY_LENGTH); @@ -390,7 +390,7 @@ static void test6_writeBlob() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); ASSERT_EQ(log.write(blob2, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH), static_cast(currNumBytes)); currNumBytes += k_LONG_ENTRY_LENGTH; @@ -400,7 +400,7 @@ static void test6_writeBlob() // 4. Write another long entry. This should fail due to exceeding max size. ASSERT_EQ(log.write(blob2, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH), LogOpResult::e_REACHED_END_OF_LOG); @@ -428,10 +428,10 @@ static void test7_writeBlobSection() // 'write'. // // Testing: -// write(const bdlbb::Blob& entry, const mwcu::BlobSection& section) +// write(const bdlbb::Blob& entry, const bmqu::BlobSection& section) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRITE BLOB SECTION"); + bmqtst::TestHelper::printTestName("WRITE BLOB SECTION"); const bsls::Types::Int64 logMaxSize = k_NUM_ENTRIES * k_ENTRY_LENGTH + k_LONG_ENTRY_LENGTH + 10; @@ -445,9 +445,9 @@ static void test7_writeBlobSection() for (int i = 0; i < k_NUM_ENTRIES; ++i) { bdlbb::BlobUtil::append(&blob, k_ENTRIES[i], k_ENTRY_LENGTH); - mwcu::BlobPosition start(i, 0); - mwcu::BlobPosition end(i + 1, 0); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(i, 0); + bmqu::BlobPosition end(i + 1, 0); + bmqu::BlobSection section(start, end); ASSERT_EQ(log.write(blob, section), static_cast(i * k_ENTRY_LENGTH)); ASSERT_EQ(log.totalNumBytes(), (i + 1) * k_ENTRY_LENGTH); @@ -468,9 +468,9 @@ static void test7_writeBlobSection() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); - mwcu::BlobPosition start(0, k_LONG_ENTRY_OFFSET); - mwcu::BlobPosition end(0, k_LONG_ENTRY_OFFSET + k_LONG_ENTRY_LENGTH); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(0, k_LONG_ENTRY_OFFSET); + bmqu::BlobPosition end(0, k_LONG_ENTRY_OFFSET + k_LONG_ENTRY_LENGTH); + bmqu::BlobSection section(start, end); ASSERT_EQ(log.write(blob2, section), static_cast(currNumBytes)); currNumBytes += k_LONG_ENTRY_LENGTH; ASSERT_EQ(log.totalNumBytes(), currNumBytes); @@ -505,7 +505,7 @@ static void test8_readRaw() // read(void **entry, int length, Offset offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("READ RAW"); + bmqtst::TestHelper::printTestName("READ RAW"); Tester tester; ReadWriteOnDiskLog& log = tester.log(); @@ -537,7 +537,7 @@ static void test8_readRaw() bdlbb::Blob blob(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); BSLS_ASSERT_OPT(log.write(blob, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH) == static_cast(k_NUM_ENTRIES * k_ENTRY_LENGTH)); @@ -563,9 +563,9 @@ static void test8_readRaw() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY2, k_LONG_ENTRY2_FULL_LENGTH); - mwcu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); - mwcu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); + bmqu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); + bmqu::BlobSection section(start, end); BSLS_ASSERT_OPT(log.write(blob2, section) == currOffset); // 7. Read the other long entry @@ -597,7 +597,7 @@ static void test9_readBlob() // read(bdlbb::Blob *entry, int length, Offset offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("READ BLOB"); + bmqtst::TestHelper::printTestName("READ BLOB"); Tester tester; ReadWriteOnDiskLog& log = tester.log(); @@ -617,9 +617,9 @@ static void test9_readBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(log.read(&blob, k_ENTRY_LENGTH, i * k_ENTRY_LENGTH), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LENGTH), 0); blob.removeBuffer(0); @@ -634,7 +634,7 @@ static void test9_readBlob() bdlbb::Blob blob2(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob2, k_LONG_ENTRY, k_LONG_ENTRY_FULL_LENGTH); BSLS_ASSERT_OPT(log.write(blob2, - mwcu::BlobPosition(0, k_LONG_ENTRY_OFFSET), + bmqu::BlobPosition(0, k_LONG_ENTRY_OFFSET), k_LONG_ENTRY_LENGTH) == static_cast(k_NUM_ENTRIES * k_ENTRY_LENGTH)); @@ -642,9 +642,9 @@ static void test9_readBlob() for (int i = 0; i < k_NUM_ENTRIES; ++i) { ASSERT_EQ(log.read(&blob, k_ENTRY_LENGTH, i * k_ENTRY_LENGTH), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_ENTRIES[i], k_ENTRY_LENGTH), 0); blob.removeBuffer(0); @@ -653,9 +653,9 @@ static void test9_readBlob() ASSERT_EQ( log.read(&blob, k_LONG_ENTRY_LENGTH, k_NUM_ENTRIES * k_ENTRY_LENGTH), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_LONG_ENTRY_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_LONG_ENTRY_MEAT, k_LONG_ENTRY_LENGTH), 0); blob.removeAll(); @@ -667,17 +667,17 @@ static void test9_readBlob() bdlbb::Blob blob3(g_bufferFactory_p, s_allocator_p); bdlbb::BlobUtil::append(&blob3, k_LONG_ENTRY2, k_LONG_ENTRY2_FULL_LENGTH); - mwcu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); - mwcu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); - mwcu::BlobSection section(start, end); + bmqu::BlobPosition start(0, k_LONG_ENTRY2_OFFSET); + bmqu::BlobPosition end(0, k_LONG_ENTRY2_OFFSET + k_LONG_ENTRY2_LENGTH); + bmqu::BlobSection section(start, end); BSLS_ASSERT_OPT(log.write(blob3, section) == currOffset); // 7. Read the other long entry ASSERT_EQ(log.read(&blob, k_LONG_ENTRY2_LENGTH, currOffset), LogOpResult::e_SUCCESS); - mwcu::BlobUtil::readNBytes(entry, + bmqu::BlobUtil::readNBytes(entry, blob, - mwcu::BlobPosition(), + bmqu::BlobPosition(), k_LONG_ENTRY2_LENGTH); ASSERT_EQ(bsl::memcmp(entry, k_LONG_ENTRY2_MEAT, k_LONG_ENTRY2_LENGTH), 0); blob.removeAll(); @@ -704,7 +704,7 @@ static void test10_aliasRaw() // alias(void **entry, int length, Offset offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ALIAS RAW"); + bmqtst::TestHelper::printTestName("ALIAS RAW"); Tester tester; ReadWriteOnDiskLog& log = tester.log(); @@ -730,7 +730,7 @@ static void test11_aliasBlob() // alias(bdlbb::Blob *entry, int length, Offset offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ALIAS BLOB"); + bmqtst::TestHelper::printTestName("ALIAS BLOB"); Tester tester; ReadWriteOnDiskLog& log = tester.log(); @@ -756,7 +756,7 @@ static void test12_seek() // seek(...) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("SEEK"); + bmqtst::TestHelper::printTestName("SEEK"); Tester tester; ReadWriteOnDiskLog& log = tester.log(); @@ -870,12 +870,12 @@ static void test13_readWriteHugeBlob() // // Testing: // write(const bdlbb::Blob& entry, -// const mwcu::BlobPosition& offset, +// const bmqu::BlobPosition& offset, // int length) // read(bdlbb::Blob *entry, int length, Offset offset) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("WRITE HUGE BLOB"); + bmqtst::TestHelper::printTestName("WRITE HUGE BLOB"); static const int k_BLOB_MAX_SIZE = 500 * 1024 * 1024; // 500 MiB @@ -901,7 +901,7 @@ static void test13_readWriteHugeBlob() BSLS_ASSERT_OPT(hugeBlob.numDataBuffers() > IOV_MAX); // 2. Write the huge blob entry - mwcu::BlobPosition recordPos(1, 42); + bmqu::BlobPosition recordPos(1, 42); const int recordSize = k_HUGE_BLOB_SIZE - hugeBlob.buffer(0).size() - recordPos.byte(); @@ -917,7 +917,7 @@ static void test13_readWriteHugeBlob() BSLS_ASSERT_OPT(outBlob.numDataBuffers() > IOV_MAX); bdlbb::Blob expectedRecord(&hugeBufferFactory, s_allocator_p); - mwcu::BlobUtil::appendToBlob(&expectedRecord, + bmqu::BlobUtil::appendToBlob(&expectedRecord, hugeBlob, recordPos, recordSize); @@ -935,7 +935,7 @@ static void test13_readWriteHugeBlob() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); { bdlbb::PooledBlobBufferFactory bufferFactory(k_LONG_ENTRY_LENGTH * 2, @@ -967,5 +967,5 @@ int main(int argc, char* argv[]) } } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbstat/mqbstat_brokerstats.cpp b/src/groups/mqb/mqbstat/mqbstat_brokerstats.cpp index f6bc0a08e..ad1fbb04c 100644 --- a/src/groups/mqb/mqbstat/mqbstat_brokerstats.cpp +++ b/src/groups/mqb/mqbstat/mqbstat_brokerstats.cpp @@ -22,10 +22,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -64,19 +63,19 @@ BrokerStats& BrokerStats::instance() return s_instance; } -bsls::Types::Int64 BrokerStats::getValue(const mwcst::StatContext& context, +bsls::Types::Int64 BrokerStats::getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat) { // invoked from the SNAPSHOT thread - const mwcst::StatValue::SnapshotLocation latestSnapshot(0, 0); - const mwcst::StatValue::SnapshotLocation oldestSnapshot(0, snapshotId); + const bmqst::StatValue::SnapshotLocation latestSnapshot(0, 0); + const bmqst::StatValue::SnapshotLocation oldestSnapshot(0, snapshotId); #define STAT_RANGE(OPERATION, STAT) \ - mwcst::StatUtil::OPERATION( \ - context.value(mwcst::StatContext::e_DIRECT_VALUE, STAT), \ + bmqst::StatUtil::OPERATION( \ + context.value(bmqst::StatContext::e_DIRECT_VALUE, STAT), \ latestSnapshot, \ oldestSnapshot) @@ -103,7 +102,7 @@ BrokerStats::BrokerStats() // NOTHING } -void BrokerStats::initialize(mwcst::StatContext* brokerStatContext) +void BrokerStats::initialize(bmqst::StatContext* brokerStatContext) { // PRECONDITIONS BSLS_ASSERT_SAFE(!d_statContext_p && "initialize was already called"); @@ -139,13 +138,13 @@ void BrokerStats::onEvent(EventType::Enum type) // class BrokerStatsUtil // --------------------- -bsl::shared_ptr +bsl::shared_ptr BrokerStatsUtil::initializeStatContext(int historySize, bslma::Allocator* allocator) { bdlma::LocalSequentialAllocator<2048> localAllocator(allocator); - mwcst::StatContextConfiguration config(k_BROKER_STAT_NAME, + bmqst::StatContextConfiguration config(k_BROKER_STAT_NAME, &localAllocator); config.isTable(true) .defaultHistorySize(historySize) @@ -154,9 +153,9 @@ BrokerStatsUtil::initializeStatContext(int historySize, .value("queue_count") .value("client_count"); - bsl::shared_ptr statContext = - bsl::shared_ptr( - new (*allocator) mwcst::StatContext(config, allocator), + bsl::shared_ptr statContext = + bsl::shared_ptr( + new (*allocator) bmqst::StatContext(config, allocator), allocator); BrokerStats::instance().initialize(statContext.get()); diff --git a/src/groups/mqb/mqbstat/mqbstat_brokerstats.h b/src/groups/mqb/mqbstat/mqbstat_brokerstats.h index fbce62739..c803f66bf 100644 --- a/src/groups/mqb/mqbstat/mqbstat_brokerstats.h +++ b/src/groups/mqb/mqbstat/mqbstat_brokerstats.h @@ -43,7 +43,7 @@ namespace BloombergLP { // FORWARD DECLARATION -namespace mwcst { +namespace bmqst { class StatContext; } @@ -82,7 +82,7 @@ class BrokerStats { static BrokerStats s_instance; // DATA - mwcst::StatContext* d_statContext_p; // StatContext + bmqst::StatContext* d_statContext_p; // StatContext private: // NOT IMPLEMENTED @@ -109,7 +109,7 @@ class BrokerStats { /// ago. /// /// THREAD: This method can only be invoked from the `snapshot` thread. - static bsls::Types::Int64 getValue(const mwcst::StatContext& context, + static bsls::Types::Int64 getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat); @@ -119,7 +119,7 @@ class BrokerStats { /// this class, as returned by the `instance()` class method. Register /// a subcontext of the specified `brokerStatContext`. This method /// ought to be called exactly once. - void initialize(mwcst::StatContext* brokerStatContext); + void initialize(bmqst::StatContext* brokerStatContext); /// Update statistics for the event of the specified `type` and with the /// specified `value` (depending on the `type`, `value` can represent @@ -127,7 +127,7 @@ class BrokerStats { void onEvent(EventType::Enum type); /// Return a pointer to the statcontext. - mwcst::StatContext* statContext(); + bmqst::StatContext* statContext(); }; // ====================== @@ -142,7 +142,7 @@ struct BrokerStatsUtil { /// specified `historySize` of history. Return the created top level /// stat context to use for all broker level statistics. Use the /// specified `allocator` for all stat context and stat values. - static bsl::shared_ptr + static bsl::shared_ptr initializeStatContext(int historySize, bslma::Allocator* allocator); }; @@ -154,7 +154,7 @@ struct BrokerStatsUtil { // class BrokerStats // ----------------- -inline mwcst::StatContext* BrokerStats::statContext() +inline bmqst::StatContext* BrokerStats::statContext() { return d_statContext_p; } diff --git a/src/groups/mqb/mqbstat/mqbstat_clusterstats.cpp b/src/groups/mqb/mqbstat/mqbstat_clusterstats.cpp index 38452d8d2..3550d813a 100644 --- a/src/groups/mqb/mqbstat/mqbstat_clusterstats.cpp +++ b/src/groups/mqb/mqbstat/mqbstat_clusterstats.cpp @@ -21,10 +21,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -131,25 +130,25 @@ struct ClusterStatus { // class ClusterStats // ------------------ -bsls::Types::Int64 ClusterStats::getValue(const mwcst::StatContext& context, +bsls::Types::Int64 ClusterStats::getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat) { // invoked from the SNAPSHOT thread - const mwcst::StatValue::SnapshotLocation latestSnapshot(0, 0); - const mwcst::StatValue::SnapshotLocation oldestSnapshot(0, snapshotId); + const bmqst::StatValue::SnapshotLocation latestSnapshot(0, 0); + const bmqst::StatValue::SnapshotLocation oldestSnapshot(0, snapshotId); #define STAT_SINGLE(OPERATION, STAT) \ - mwcst::StatUtil::OPERATION( \ - context.value(mwcst::StatContext::e_DIRECT_VALUE, \ + bmqst::StatUtil::OPERATION( \ + context.value(bmqst::StatContext::e_DIRECT_VALUE, \ ClusterStatsIndex::STAT), \ latestSnapshot) #define STAT_RANGE(OPERATION, STAT) \ - mwcst::StatUtil::OPERATION( \ - context.value(mwcst::StatContext::e_DIRECT_VALUE, \ + bmqst::StatUtil::OPERATION( \ + context.value(bmqst::StatContext::e_DIRECT_VALUE, \ ClusterStatsIndex::STAT), \ latestSnapshot, \ oldestSnapshot) @@ -225,7 +224,7 @@ ClusterStats::ClusterStats(bslma::Allocator* allocator) void ClusterStats::initialize(const bsl::string& name, int partitionsCount, - mwcst::StatContext* clusterStatContext, + bmqst::StatContext* clusterStatContext, bslma::Allocator* allocator) { // PRECONDITIONS @@ -237,7 +236,7 @@ void ClusterStats::initialize(const bsl::string& name, // level components. bdlma::LocalSequentialAllocator<2048> localAllocator(allocator); d_statContext_mp = clusterStatContext->addSubcontext( - mwcst::StatContextConfiguration(name, &localAllocator)); + bmqst::StatContextConfiguration(name, &localAllocator)); bslma::ManagedPtr datum = d_statContext_mp->datum(); bslma::Allocator* alloc = d_statContext_mp->datumAllocator(); @@ -252,9 +251,9 @@ void ClusterStats::initialize(const bsl::string& name, for (int pId = 0; pId < partitionsCount; ++pId) { const bsl::string partitionName = "partition" + bsl::to_string(pId); d_partitionsStatContexts.emplace_back( - bsl::shared_ptr( + bsl::shared_ptr( d_statContext_mp->addSubcontext( - mwcst::StatContextConfiguration(partitionName, + bmqst::StatContextConfiguration(partitionName, &localAllocator)))); setNodeRoleForPartition(pId, PrimaryStatus::e_UNKNOWN); } @@ -271,7 +270,7 @@ void ClusterStats::onPartitionEvent(PartitionEventType::Enum type, BSLS_ASSERT_SAFE(d_partitionsStatContexts[partitionId] && "initialize was not called"); - mwcst::StatContext* sc = d_partitionsStatContexts[partitionId].get(); + bmqst::StatContext* sc = d_partitionsStatContexts[partitionId].get(); switch (type) { case PartitionEventType::e_PARTITION_ROLLOVER: { @@ -425,24 +424,24 @@ const char* ClusterStats::Role::toAscii(Enum value) // ---------------------- bsls::Types::Int64 -ClusterNodeStats::getValue(const mwcst::StatContext& context, +ClusterNodeStats::getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat) { // invoked from the SNAPSHOT thread - const mwcst::StatValue::SnapshotLocation latestSnapshot(0, 0); - const mwcst::StatValue::SnapshotLocation oldestSnapshot(0, snapshotId); + const bmqst::StatValue::SnapshotLocation latestSnapshot(0, 0); + const bmqst::StatValue::SnapshotLocation oldestSnapshot(0, snapshotId); #define STAT_SINGLE(OPERATION, STAT) \ - mwcst::StatUtil::OPERATION( \ - context.value(mwcst::StatContext::e_DIRECT_VALUE, STAT), \ + bmqst::StatUtil::OPERATION( \ + context.value(bmqst::StatContext::e_DIRECT_VALUE, STAT), \ latestSnapshot) #define STAT_RANGE(OPERATION, STAT) \ - mwcst::StatUtil::OPERATION( \ - context.value(mwcst::StatContext::e_DIRECT_VALUE, STAT), \ + bmqst::StatUtil::OPERATION( \ + context.value(bmqst::StatContext::e_DIRECT_VALUE, STAT), \ latestSnapshot, \ oldestSnapshot) @@ -505,7 +504,7 @@ ClusterNodeStats::ClusterNodeStats() } void ClusterNodeStats::initialize(const bmqt::Uri& uri, - mwcst::StatContext* clientStatContext, + bmqst::StatContext* clientStatContext, bslma::Allocator* allocator) { // PRECONDITIONS @@ -515,7 +514,7 @@ void ClusterNodeStats::initialize(const bmqt::Uri& uri, bdlma::LocalSequentialAllocator<2048> localAllocator(allocator); d_statContext_mp = clientStatContext->addSubcontext( - mwcst::StatContextConfiguration(uri.asString(), &localAllocator)); + bmqst::StatContextConfiguration(uri.asString(), &localAllocator)); } void ClusterNodeStats::onEvent(EventType::Enum type, bsls::Types::Int64 value) @@ -550,13 +549,13 @@ void ClusterNodeStats::onEvent(EventType::Enum type, bsls::Types::Int64 value) // class ClusterStatsUtil // ---------------------- -bsl::shared_ptr +bsl::shared_ptr ClusterStatsUtil::initializeStatContextCluster(int historySize, bslma::Allocator* allocator) { bdlma::LocalSequentialAllocator<2048> localAllocator(allocator); - mwcst::StatContextConfiguration config(k_CLUSTER_STAT_NAME, + bmqst::StatContextConfiguration config(k_CLUSTER_STAT_NAME, &localAllocator); config.isTable(true) .defaultHistorySize(historySize) @@ -567,9 +566,9 @@ ClusterStatsUtil::initializeStatContextCluster(int historySize, .value("cluster.partition.cfg_journal_bytes") .value("cluster.partition.cfg_data_bytes") .value("partition_status") - .value("partition.rollover_time", mwcst::StatValue::e_DISCRETE) - .value("partition.data_bytes", mwcst::StatValue::e_DISCRETE) - .value("partition.journal_bytes", mwcst::StatValue::e_DISCRETE); + .value("partition.rollover_time", bmqst::StatValue::e_DISCRETE) + .value("partition.data_bytes", bmqst::StatValue::e_DISCRETE) + .value("partition.journal_bytes", bmqst::StatValue::e_DISCRETE); // NOTE: For the clusters, the stat context will have two levels of // children, first level is per cluster, and second level is per @@ -579,19 +578,19 @@ ClusterStatsUtil::initializeStatContextCluster(int historySize, // memory - which is acceptable here since a broker will not have // thousands of clusters and partitions. - return bsl::shared_ptr( - new (*allocator) mwcst::StatContext(config, allocator), + return bsl::shared_ptr( + new (*allocator) bmqst::StatContext(config, allocator), allocator); } -bsl::shared_ptr +bsl::shared_ptr ClusterStatsUtil::initializeStatContextClusterNodes( int historySize, bslma::Allocator* allocator) { bdlma::LocalSequentialAllocator<2048> localAllocator(allocator); - mwcst::StatContextConfiguration config(k_CLUSTER_NODES_STAT_NAME, + bmqst::StatContextConfiguration config(k_CLUSTER_NODES_STAT_NAME, &localAllocator); config.isTable(true) .defaultHistorySize(historySize) @@ -604,8 +603,8 @@ ClusterStatsUtil::initializeStatContextClusterNodes( // NOTE: If the stats are using too much memory, we could reconsider // in_event and out_event to be using atomic int and not stat value. - return bsl::shared_ptr( - new (*allocator) mwcst::StatContext(config, allocator), + return bsl::shared_ptr( + new (*allocator) bmqst::StatContext(config, allocator), allocator); } diff --git a/src/groups/mqb/mqbstat/mqbstat_clusterstats.h b/src/groups/mqb/mqbstat/mqbstat_clusterstats.h index 056e8bea1..3016166a2 100644 --- a/src/groups/mqb/mqbstat/mqbstat_clusterstats.h +++ b/src/groups/mqb/mqbstat/mqbstat_clusterstats.h @@ -48,7 +48,7 @@ namespace BloombergLP { // FORWARD DECLARATION -namespace mwcst { +namespace bmqst { class StatContext; } @@ -163,10 +163,10 @@ class ClusterStats { private: // DATA - bslma::ManagedPtr d_statContext_mp; + bslma::ManagedPtr d_statContext_mp; // StatContext for the cluster - bsl::vector > d_partitionsStatContexts; + bsl::vector > d_partitionsStatContexts; // StatContext for each partition in // the cluster, indexed by the // partition id. Those statContext @@ -193,7 +193,7 @@ class ClusterStats { /// ago. /// /// THREAD: This method can only be invoked from the `snapshot` thread. - static bsls::Types::Int64 getValue(const mwcst::StatContext& context, + static bsls::Types::Int64 getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat); @@ -210,7 +210,7 @@ class ClusterStats { /// specified `allocator`. void initialize(const bsl::string& name, int partitionsCount, - mwcst::StatContext* clusterStatContext, + bmqst::StatContext* clusterStatContext, bslma::Allocator* allocator); /// Update statistics for the event of the specified `type` for the @@ -258,7 +258,7 @@ class ClusterStats { bsls::Types::Int64 journalBytes); /// Return a pointer to the statcontext. - mwcst::StatContext* statContext(); + bmqst::StatContext* statContext(); }; // ====================== @@ -300,7 +300,7 @@ class ClusterNodeStats { private: // DATA - bslma::ManagedPtr d_statContext_mp; + bslma::ManagedPtr d_statContext_mp; // StatContext private: @@ -320,7 +320,7 @@ class ClusterNodeStats { /// ago. /// /// THREAD: This method can only be invoked from the `snapshot` thread. - static bsls::Types::Int64 getValue(const mwcst::StatContext& context, + static bsls::Types::Int64 getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat); @@ -335,7 +335,7 @@ class ClusterNodeStats { /// register it as a subcontext of the specified /// `clusterNodesStatContext`, using the specified `allocator`. void initialize(const bmqt::Uri& uri, - mwcst::StatContext* clusterNodesStatContext, + bmqst::StatContext* clusterNodesStatContext, bslma::Allocator* allocator); /// Update statistics for the event of the specified `type` and with the @@ -344,7 +344,7 @@ class ClusterNodeStats { void onEvent(EventType::Enum type, bsls::Types::Int64 value); /// Return a pointer to the statcontext. - mwcst::StatContext* statContext(); + bmqst::StatContext* statContext(); }; // ======================= @@ -359,14 +359,14 @@ struct ClusterStatsUtil { /// specified `historySize` of history. Return the created top level /// stat context to use for all cluster level statistics. Use the /// specified `allocator` for all stat context and stat values. - static bsl::shared_ptr + static bsl::shared_ptr initializeStatContextCluster(int historySize, bslma::Allocator* allocator); /// Initialize the statistics for the cluster nodes keeping the /// specified `historySize` of history: return the created top level /// stat context to use as parent of all domains statistics. Use the /// specified `allocator` for all stat context and stat values. - static bsl::shared_ptr + static bsl::shared_ptr initializeStatContextClusterNodes(int historySize, bslma::Allocator* allocator); }; @@ -379,7 +379,7 @@ struct ClusterStatsUtil { // class ClusterStats // ------------------ -inline mwcst::StatContext* ClusterStats::statContext() +inline bmqst::StatContext* ClusterStats::statContext() { return d_statContext_mp.get(); } @@ -388,7 +388,7 @@ inline mwcst::StatContext* ClusterStats::statContext() // class ClusterNodeStats // ---------------------- -inline mwcst::StatContext* ClusterNodeStats::statContext() +inline bmqst::StatContext* ClusterNodeStats::statContext() { return d_statContext_mp.get(); } diff --git a/src/groups/mqb/mqbstat/mqbstat_domainstats.cpp b/src/groups/mqb/mqbstat/mqbstat_domainstats.cpp index 5871ba50b..afbd25e88 100644 --- a/src/groups/mqb/mqbstat/mqbstat_domainstats.cpp +++ b/src/groups/mqb/mqbstat/mqbstat_domainstats.cpp @@ -24,10 +24,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -59,24 +58,24 @@ struct DomainStatsIndex { // class DomainStats // ------------------ -bsls::Types::Int64 DomainStats::getValue(const mwcst::StatContext& context, +bsls::Types::Int64 DomainStats::getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat) { // invoked from the SNAPSHOT thread - const mwcst::StatValue::SnapshotLocation latestSnapshot(0, 0); - const mwcst::StatValue::SnapshotLocation oldestSnapshot(0, snapshotId); + const bmqst::StatValue::SnapshotLocation latestSnapshot(0, 0); + const bmqst::StatValue::SnapshotLocation oldestSnapshot(0, snapshotId); #define STAT_SINGLE(OPERATION, STAT) \ - mwcst::StatUtil::OPERATION( \ - context.value(mwcst::StatContext::e_DIRECT_VALUE, STAT), \ + bmqst::StatUtil::OPERATION( \ + context.value(bmqst::StatContext::e_DIRECT_VALUE, STAT), \ latestSnapshot) #define STAT_RANGE(OPERATION, STAT) \ - mwcst::StatUtil::OPERATION( \ - context.value(mwcst::StatContext::e_DIRECT_VALUE, STAT), \ + bmqst::StatUtil::OPERATION( \ + context.value(bmqst::StatContext::e_DIRECT_VALUE, STAT), \ latestSnapshot, \ oldestSnapshot) @@ -108,7 +107,7 @@ DomainStats::DomainStats() } void DomainStats::initialize(mqbi::Domain* domain, - mwcst::StatContext* domainStatContext, + bmqst::StatContext* domainStatContext, bslma::Allocator* allocator) { // PRECONDITIONS @@ -116,7 +115,7 @@ void DomainStats::initialize(mqbi::Domain* domain, bdlma::LocalSequentialAllocator<2048> localAllocator(allocator); d_statContext_mp = domainStatContext->addSubcontext( - mwcst::StatContextConfiguration(domain->name(), &localAllocator)); + bmqst::StatContextConfiguration(domain->name(), &localAllocator)); // Build a dummy queue URI so we can use 'bmqt::Uri' to extract the // qualified domain without resorting on implementation details. @@ -136,7 +135,10 @@ void DomainStats::initialize(mqbi::Domain* domain, bdld::Datum::copyString(domain->cluster()->name(), alloc)); builder.pushBack("domain", bdld::Datum::copyString(uri.domain(), alloc)); - builder.pushBack("tier", bdld::Datum::copyString(uri.tier(), alloc)); + builder.pushBack("tier", + bdld::Datum::copyString(uri.tier().isEmpty() ? "" + : uri.tier(), + alloc)); datum->adopt(builder.commit()); } @@ -166,13 +168,13 @@ void DomainStats::onEvent(EventType::Enum type, bsls::Types::Int64 value) // class DomainStatsUtil // --------------------- -bsl::shared_ptr +bsl::shared_ptr DomainStatsUtil::initializeStatContext(int historySize, bslma::Allocator* allocator) { bdlma::LocalSequentialAllocator<2048> localAllocator(allocator); - mwcst::StatContextConfiguration config(k_DOMAIN_STAT_NAME, + bmqst::StatContextConfiguration config(k_DOMAIN_STAT_NAME, &localAllocator); config.isTable(true) .defaultHistorySize(historySize) @@ -182,8 +184,8 @@ DomainStatsUtil::initializeStatContext(int historySize, .value("cfg_bytes") .value("queue_count"); - return bsl::shared_ptr( - new (*allocator) mwcst::StatContext(config, allocator), + return bsl::shared_ptr( + new (*allocator) bmqst::StatContext(config, allocator), allocator); } diff --git a/src/groups/mqb/mqbstat/mqbstat_domainstats.h b/src/groups/mqb/mqbstat/mqbstat_domainstats.h index 79cf4e495..91c7e96fa 100644 --- a/src/groups/mqb/mqbstat/mqbstat_domainstats.h +++ b/src/groups/mqb/mqbstat/mqbstat_domainstats.h @@ -43,7 +43,7 @@ namespace BloombergLP { namespace mqbi { class Domain; } -namespace mwcst { +namespace bmqst { class StatContext; } @@ -74,7 +74,7 @@ class DomainStats { private: // DATA - bslma::ManagedPtr d_statContext_mp; + bslma::ManagedPtr d_statContext_mp; // StatContext private: @@ -94,7 +94,7 @@ class DomainStats { /// ago. /// /// THREAD: This method can only be invoked from the `snapshot` thread. - static bsls::Types::Int64 getValue(const mwcst::StatContext& context, + static bsls::Types::Int64 getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat); @@ -109,7 +109,7 @@ class DomainStats { /// register it as a subcontext of the specified `domainStatContext` and /// using the specified `allocator`. void initialize(mqbi::Domain* domain, - mwcst::StatContext* domainStatContext, + bmqst::StatContext* domainStatContext, bslma::Allocator* allocator); /// Update statistics for the event of the specified `type` and with the @@ -118,7 +118,7 @@ class DomainStats { void onEvent(EventType::Enum type, bsls::Types::Int64 value); /// Return a pointer to the statcontext. - mwcst::StatContext* statContext(); + bmqst::StatContext* statContext(); }; // ====================== @@ -133,7 +133,7 @@ struct DomainStatsUtil { /// specified `historySize` of history. Return the created top level /// stat context to use for all domain level statistics. Use the /// specified `allocator` for all stat context and stat values. - static bsl::shared_ptr + static bsl::shared_ptr initializeStatContext(int historySize, bslma::Allocator* allocator); }; @@ -145,7 +145,7 @@ struct DomainStatsUtil { // class DomainStats // ------------------ -inline mwcst::StatContext* DomainStats::statContext() +inline bmqst::StatContext* DomainStats::statContext() { return d_statContext_mp.get(); } diff --git a/src/groups/mqb/mqbstat/mqbstat_jsonprinter.cpp b/src/groups/mqb/mqbstat/mqbstat_jsonprinter.cpp index 0a4bd591b..d5301bb57 100644 --- a/src/groups/mqb/mqbstat/mqbstat_jsonprinter.cpp +++ b/src/groups/mqb/mqbstat/mqbstat_jsonprinter.cpp @@ -21,8 +21,7 @@ // MQB #include -// MWC -#include +#include // BDE #include @@ -44,7 +43,7 @@ struct ConversionUtils { inline static void populateMetric(bdljsn::JsonObject* metricsObject, - const mwcst::StatContext& ctx, + const bmqst::StatContext& ctx, mqbstat::QueueStatsDomain::Stat::Enum metric) { // PRECONDITIONS @@ -58,7 +57,7 @@ struct ConversionUtils { } inline static void populateQueueStats(bdljsn::JsonObject* queueObject, - const mwcst::StatContext& ctx) + const bmqst::StatContext& ctx) { // PRECONDITIONS BSLS_ASSERT_SAFE(queueObject); @@ -74,26 +73,62 @@ struct ConversionUtils { populateMetric(&values, ctx, Stat::e_NB_PRODUCER); populateMetric(&values, ctx, Stat::e_NB_CONSUMER); + + populateMetric(&values, ctx, Stat::e_MESSAGES_CURRENT); + populateMetric(&values, ctx, Stat::e_MESSAGES_MAX); + populateMetric(&values, ctx, Stat::e_BYTES_CURRENT); + populateMetric(&values, ctx, Stat::e_BYTES_MAX); + populateMetric(&values, ctx, Stat::e_PUT_MESSAGES_DELTA); populateMetric(&values, ctx, Stat::e_PUT_BYTES_DELTA); + populateMetric(&values, ctx, Stat::e_PUT_MESSAGES_ABS); + populateMetric(&values, ctx, Stat::e_PUT_BYTES_ABS); + populateMetric(&values, ctx, Stat::e_PUSH_MESSAGES_DELTA); populateMetric(&values, ctx, Stat::e_PUSH_BYTES_DELTA); + populateMetric(&values, ctx, Stat::e_PUSH_MESSAGES_ABS); + populateMetric(&values, ctx, Stat::e_PUSH_BYTES_ABS); + populateMetric(&values, ctx, Stat::e_ACK_DELTA); + populateMetric(&values, ctx, Stat::e_ACK_ABS); populateMetric(&values, ctx, Stat::e_ACK_TIME_AVG); populateMetric(&values, ctx, Stat::e_ACK_TIME_MAX); + populateMetric(&values, ctx, Stat::e_NACK_DELTA); + populateMetric(&values, ctx, Stat::e_NACK_ABS); + populateMetric(&values, ctx, Stat::e_CONFIRM_DELTA); + populateMetric(&values, ctx, Stat::e_CONFIRM_ABS); populateMetric(&values, ctx, Stat::e_CONFIRM_TIME_AVG); populateMetric(&values, ctx, Stat::e_CONFIRM_TIME_MAX); + + populateMetric(&values, ctx, Stat::e_REJECT_ABS); + populateMetric(&values, ctx, Stat::e_REJECT_DELTA); + + populateMetric(&values, ctx, Stat::e_QUEUE_TIME_AVG); + populateMetric(&values, ctx, Stat::e_QUEUE_TIME_MAX); + + populateMetric(&values, ctx, Stat::e_GC_MSGS_DELTA); + populateMetric(&values, ctx, Stat::e_GC_MSGS_ABS); + + populateMetric(&values, ctx, Stat::e_ROLE); + + populateMetric(&values, ctx, Stat::e_CFG_MSGS); + populateMetric(&values, ctx, Stat::e_CFG_BYTES); + + populateMetric(&values, ctx, Stat::e_NO_SC_MSGS_DELTA); + populateMetric(&values, ctx, Stat::e_NO_SC_MSGS_ABS); + + populateMetric(&values, ctx, Stat::e_HISTORY_ABS); } inline static void populateOneDomainStats(bdljsn::JsonObject* domainObject, - const mwcst::StatContext& ctx) + const bmqst::StatContext& ctx) { // PRECONDITIONS BSLS_ASSERT_SAFE(domainObject); - for (mwcst::StatContextIterator queueIt = ctx.subcontextIterator(); + for (bmqst::StatContextIterator queueIt = ctx.subcontextIterator(); queueIt; ++queueIt) { bdljsn::JsonObject& queueObj = @@ -105,7 +140,7 @@ struct ConversionUtils { queueObj["appIds"].makeObject(); // Add metrics per appId, if any - for (mwcst::StatContextIterator appIdIt = + for (bmqst::StatContextIterator appIdIt = queueIt->subcontextIterator(); appIdIt; ++appIdIt) { @@ -121,13 +156,13 @@ struct ConversionUtils { } inline static void populateAllDomainsStats(bdljsn::JsonObject* parent, - const mwcst::StatContext& ctx) + const bmqst::StatContext& ctx) { // PRECONDITIONS BSLS_ASSERT_SAFE(parent); bdljsn::JsonObject& nodes = (*parent)["domains"].makeObject(); - for (mwcst::StatContextIterator domainIt = ctx.subcontextIterator(); + for (bmqst::StatContextIterator domainIt = ctx.subcontextIterator(); domainIt; ++domainIt) { populateOneDomainStats(&nodes[domainIt->name()].makeObject(), @@ -196,10 +231,14 @@ class JsonPrinter::JsonPrinterImpl { inline JsonPrinter::JsonPrinterImpl::JsonPrinterImpl( const StatContextsMap& statContextsMap, bslma::Allocator* allocator) -: d_opsCompact(bdljsn::WriteOptions().setSpacesPerLevel(0).setStyle( - bdljsn::WriteStyle::e_COMPACT)) -, d_opsPretty(bdljsn::WriteOptions().setSpacesPerLevel(4).setStyle( - bdljsn::WriteStyle::e_PRETTY)) +: d_opsCompact(bdljsn::WriteOptions() + .setSpacesPerLevel(0) + .setStyle(bdljsn::WriteStyle::e_COMPACT) + .setSortMembers(true)) +, d_opsPretty(bdljsn::WriteOptions() + .setSpacesPerLevel(4) + .setStyle(bdljsn::WriteStyle::e_PRETTY) + .setSortMembers(true)) , d_contexts(statContextsMap, allocator) { // NOTHING @@ -217,7 +256,7 @@ inline int JsonPrinter::JsonPrinterImpl::printStats(bsl::string* out, bdljsn::JsonObject& obj = json.makeObject(); { - const mwcst::StatContext& ctx = + const bmqst::StatContext& ctx = *d_contexts.find("domainQueues")->second; bdljsn::JsonObject& domainQueuesObj = obj["domainQueues"].makeObject(); @@ -226,7 +265,7 @@ inline int JsonPrinter::JsonPrinterImpl::printStats(bsl::string* out, const bdljsn::WriteOptions& ops = compact ? d_opsCompact : d_opsPretty; - mwcu::MemOutStream os; + bmqu::MemOutStream os; const int rc = bdljsn::JsonUtil::write(os, json, ops); if (0 != rc) { BALL_LOG_ERROR << "Failed to encode stats JSON, rc = " << rc; diff --git a/src/groups/mqb/mqbstat/mqbstat_jsonprinter.h b/src/groups/mqb/mqbstat/mqbstat_jsonprinter.h index 2d7a56715..022b8bfe2 100644 --- a/src/groups/mqb/mqbstat/mqbstat_jsonprinter.h +++ b/src/groups/mqb/mqbstat/mqbstat_jsonprinter.h @@ -27,8 +27,7 @@ // statistics updates (e.g. making a new snapshot of the used StatContexts) // must be done before calling to this component. -// MWC -#include +#include // BDE #include @@ -60,7 +59,7 @@ class JsonPrinter { public: // PUBLIC TYPES - typedef bsl::unordered_map + typedef bsl::unordered_map StatContextsMap; // CREATORS diff --git a/src/groups/mqb/mqbstat/mqbstat_printer.cpp b/src/groups/mqb/mqbstat/mqbstat_printer.cpp index 62fbf33ac..d6d21c00a 100644 --- a/src/groups/mqb/mqbstat/mqbstat_printer.cpp +++ b/src/groups/mqb/mqbstat/mqbstat_printer.cpp @@ -20,13 +20,12 @@ // MQB #include -// MWC -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -75,11 +74,11 @@ void Printer::initializeTablesAndTips() ContextsMap::iterator it = d_contexts.find("allocators"); if (it != d_contexts.end()) { Context* context = it->second.get(); - mwcma::CountingAllocator::configureStatContextTableInfoProvider( + bmqma::CountingAllocator::configureStatContextTableInfoProvider( &context->d_table, &context->d_tip, - mwcst::StatValue::SnapshotLocation(0, 0), - mwcst::StatValue::SnapshotLocation(0, 1)); + bmqst::StatValue::SnapshotLocation(0, 0), + bmqst::StatValue::SnapshotLocation(0, 1)); context->d_table.records().setContext( context->d_statContext_p->getSubcontext(k_SUBCONTEXT_ALLOCATORS)); } @@ -103,9 +102,9 @@ void Printer::initializeTablesAndTips() context->d_statContext_p); context = d_contexts["channels"].get(); - mwcst::StatValue::SnapshotLocation start(0, 0); - mwcst::StatValue::SnapshotLocation end(0, historySize - 1); - mwcio::StatChannelFactoryUtil::initializeStatsTable( + bmqst::StatValue::SnapshotLocation start(0, 0); + bmqst::StatValue::SnapshotLocation end(0, historySize - 1); + bmqio::StatChannelFactoryUtil::initializeStatsTable( &context->d_table, &context->d_tip, context->d_statContext_p, @@ -220,28 +219,28 @@ void Printer::printStats(bsl::ostream& stream) << ":::::::::: :::::::::: DOMAINQUEUES >>"; Context* context = d_contexts["domainQueues"].get(); context->d_table.records().update(); - mwcst::TableUtil::printTable(stream, context->d_tip); + bmqst::TableUtil::printTable(stream, context->d_tip); // CLIENTS stream << "\n" << ":::::::::: :::::::::: CLIENTS >>"; context = d_contexts["clients"].get(); context->d_table.records().update(); - mwcst::TableUtil::printTable(stream, context->d_tip); + bmqst::TableUtil::printTable(stream, context->d_tip); // CLUSTERS stream << "\n" << ":::::::::: :::::::::: CLUSTERS >>"; context = d_contexts["clusterNodes"].get(); context->d_table.records().update(); - mwcst::TableUtil::printTable(stream, context->d_tip); + bmqst::TableUtil::printTable(stream, context->d_tip); // CHANNELS stream << "\n" << ":::::::::: :::::::::: TCP CHANNELS >>"; context = d_contexts["channels"].get(); context->d_table.records().update(); - mwcst::TableUtil::printTable(stream, context->d_tip); + bmqst::TableUtil::printTable(stream, context->d_tip); // ALLOCATORS stream << "\n" @@ -256,7 +255,7 @@ void Printer::printStats(bsl::ostream& stream) // prior to this method. if (d_lastAllocatorSnapshot != 0) { stream << " Last snapshot was " - << mwcu::PrintUtil::prettyTimeInterval( + << bmqu::PrintUtil::prettyTimeInterval( bsls::TimeUtil::getTimer() - d_lastAllocatorSnapshot) << " ago."; } @@ -264,7 +263,7 @@ void Printer::printStats(bsl::ostream& stream) context = it->second.get(); context->d_table.records().update(); - mwcst::TableUtil::printTable(stream, context->d_tip); + bmqst::TableUtil::printTable(stream, context->d_tip); } void Printer::logStats() diff --git a/src/groups/mqb/mqbstat/mqbstat_printer.h b/src/groups/mqb/mqbstat/mqbstat_printer.h index 36f90be58..70d20b1ee 100644 --- a/src/groups/mqb/mqbstat/mqbstat_printer.h +++ b/src/groups/mqb/mqbstat/mqbstat_printer.h @@ -28,11 +28,10 @@ // MQB #include -// MWC -#include -#include -#include -#include +#include +#include +#include +#include // BDE #include @@ -68,19 +67,19 @@ class Printer { /// Context including table and tip for printing and statcontext for /// stats. struct Context { - mwcst::StatContext* d_statContext_p; + bmqst::StatContext* d_statContext_p; // Stat Context pointer - mwcst::Table d_table; + bmqst::Table d_table; // Table - mwcst::BasicTableInfoProvider d_tip; + bmqst::BasicTableInfoProvider d_tip; // tip }; typedef bsl::shared_ptr ContextSp; typedef bsl::unordered_map ContextsMap; - typedef bsl::unordered_map + typedef bsl::unordered_map StatContextsMap; private: @@ -107,7 +106,7 @@ class Printer { ContextsMap d_contexts; // Contexts map - mwctsk::LogCleaner d_statLogCleaner; + bmqtsk::LogCleaner d_statLogCleaner; // Mechanism to clean up old stat logs. private: diff --git a/src/groups/mqb/mqbstat/mqbstat_queuestats.cpp b/src/groups/mqb/mqbstat/mqbstat_queuestats.cpp index 9c5445d42..2fa99dd62 100644 --- a/src/groups/mqb/mqbstat/mqbstat_queuestats.cpp +++ b/src/groups/mqb/mqbstat/mqbstat_queuestats.cpp @@ -26,10 +26,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -77,82 +76,88 @@ struct DomainQueueStats { e_STAT_NB_PRODUCER , + /// Value: Current number of clients who opened the queue with + /// the 'READ' flag e_STAT_NB_CONSUMER - // Value: Current number of clients who opened the queue with - // the 'READ' flag , + /// Value: Current number of messages in the queue e_STAT_MESSAGES - // Value: Current number of messages in the queue , + /// Value: Accumulated bytes of all messages currently in the + /// queue e_STAT_BYTES - // Value: Accumulated bytes of all messages currently in the - // queue , + /// Value: Number of ack messages delivered by this queue e_STAT_ACK - // Value: Number of ack messages delivered by this queue , + /// Value: The time between PUT and ACK (in nanoseconds). e_STAT_ACK_TIME - // Value: The time between PUT and ACK (in nanoseconds). , + /// Value: Number of NACK messages generated for this queue e_STAT_NACK - // Value: Number of NACK messages generated for this queue , + /// Value: Number of CONFIRM messages received by this queue e_STAT_CONFIRM - // Value: Number of CONFIRM messages received by this queue , + /// Value: The time between PUSH and CONFIRM (in nanoseconds). e_STAT_CONFIRM_TIME - // Value: The time between PUSH and CONFIRM (in nanoseconds). , + /// Value: Number of messages rejected by this queue (RDA + /// reaching zero) e_STAT_REJECT - // Value: Number of messages rejected by this queue (RDA - // reaching zero) , + /// Value: The time spent by the message in the queue (in + /// nanoseconds). e_STAT_QUEUE_TIME - // Value: The time spent by the message in the queue (in - // nanoseconds). , + /// Value: Accumulated bytes of all messages ever pushed from + /// the queue + /// Increment: Number of messages ever pushed from the queue e_STAT_PUSH - // Value: Accumulated bytes of all messages ever pushed from - // the queue - // Increment: Number of messages ever pushed from the queue , + /// Value: Accumulated bytes of all messages ever put in the + /// queue + /// Increment: Number of messages ever put in the queue e_STAT_PUT - // Value: Accumulated bytes of all messages ever put in the - // queue - // Increment: Number of messages ever put in the queue , + /// Value: Accumulated number of messages ever GC'ed in the + /// queue e_STAT_GC_MSGS - // Value: Accumulated number of messages ever GC'ed in the - // queue , + /// Value: Role (Unknown, Primary, Replica, Proxy) e_STAT_ROLE - // Value: Role (Unknown, Primary, Replica, Proxy) , + /// Value: The configured queue messages capacity e_CFG_MSGS - // Value: The configured queue messages capacity , + /// Value: The configured queue bytes capacity e_CFG_BYTES - // Value: The configured queue bytes capacity + , + /// Value: Accumulated number of messages in the strong + /// consistency queue expired before receiving quorum + /// Receipts e_STAT_NO_SC_MSGS - // Value: Accumulated number of messages in the strong - // consistency queue expired before receiving quorum - // Receipts + + , + // Value: Current number of GUIDs stored in queue's history + // (does not include messages in the queue) + e_STAT_HISTORY }; }; @@ -168,29 +173,29 @@ struct ClientStats { e_STAT_ACK , + /// Value: Number of confirm messages delivered to the client e_STAT_CONFIRM - // Value: Number of confirm messages delivered to the client , + /// Value: Accumulated bytes of all messages ever pushed to + /// the client + /// Increments: Number of messages ever pushed to the client e_STAT_PUSH - // Value: Accumulated bytes of all messages ever pushed to - // the client - // Increments: Number of messages ever pushed to the client , + /// Value: Accumulated bytes of all messages ever received from + /// the client + /// Increments: Number of messages ever received from the client e_STAT_PUT - // Value: Accumulated bytes of all messages ever received from - // the client - // Increments: Number of messages ever received from the client }; }; /// Functor method returning `true`, i.e., filter out, if the specified /// `record` represents a `*direct*` stat (used when printing to filter them /// out). -bool filterDirect(const mwcst::TableRecords::Record& record) +bool filterDirect(const bmqst::TableRecords::Record& record) { - return record.type() == mwcst::StatContext::e_TOTAL_VALUE; + return record.type() == bmqst::StatContext::e_TOTAL_VALUE; } } // close unnamed namespace @@ -242,6 +247,7 @@ const char* QueueStatsDomain::Stat::toString(Stat::Enum value) MQBSTAT_CASE(e_CFG_BYTES, "queue_cfg_bytes") MQBSTAT_CASE(e_NO_SC_MSGS_DELTA, "queue_nack_noquorum_msgs") MQBSTAT_CASE(e_NO_SC_MSGS_ABS, "queue_nack_noquorum_msgs_abs") + MQBSTAT_CASE(e_HISTORY_ABS, "queue_history_abs") } BSLS_ASSERT(!"invalid enumerator"); @@ -255,7 +261,7 @@ const char* QueueStatsDomain::Stat::toString(Stat::Enum value) // ---------------------- bsls::Types::Int64 -QueueStatsDomain::getValue(const mwcst::StatContext& context, +QueueStatsDomain::getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat) { @@ -264,25 +270,25 @@ QueueStatsDomain::getValue(const mwcst::StatContext& context, // PRECONDITIONS BSLS_ASSERT_SAFE(snapshotId >= -1); // do not support other negatives yet - const mwcst::StatValue::SnapshotLocation latestSnapshot(0, 0); + const bmqst::StatValue::SnapshotLocation latestSnapshot(0, 0); #define OLDEST_SNAPSHOT(STAT) \ - (mwcst::StatValue::SnapshotLocation( \ + (bmqst::StatValue::SnapshotLocation( \ 0, \ (snapshotId >= 0) \ ? snapshotId \ - : (context.value(mwcst::StatContext::e_DIRECT_VALUE, (STAT)) \ + : (context.value(bmqst::StatContext::e_DIRECT_VALUE, (STAT)) \ .historySize(0) - \ 1))) #define STAT_SINGLE(OPERATION, STAT) \ - mwcst::StatUtil::OPERATION( \ - context.value(mwcst::StatContext::e_DIRECT_VALUE, STAT), \ + bmqst::StatUtil::OPERATION( \ + context.value(bmqst::StatContext::e_DIRECT_VALUE, STAT), \ latestSnapshot) #define STAT_RANGE(OPERATION, STAT) \ - mwcst::StatUtil::OPERATION( \ - context.value(mwcst::StatContext::e_DIRECT_VALUE, STAT), \ + bmqst::StatUtil::OPERATION( \ + context.value(bmqst::StatContext::e_DIRECT_VALUE, STAT), \ latestSnapshot, \ OLDEST_SNAPSHOT(STAT)) @@ -405,6 +411,9 @@ QueueStatsDomain::getValue(const mwcst::StatContext& context, return STAT_RANGE(valueDifference, DomainQueueStats::e_STAT_NO_SC_MSGS); } + case QueueStatsDomain::Stat::e_HISTORY_ABS: { + return STAT_SINGLE(value, DomainQueueStats::e_STAT_HISTORY); + } default: { BSLS_ASSERT_SAFE(false && "Attempting to access an unknown stat"); } @@ -433,7 +442,7 @@ void QueueStatsDomain::initialize(const bmqt::Uri& uri, mqbi::Domain* domain) bdlma::LocalSequentialAllocator<2048> localAllocator(d_allocator_p); d_statContext_mp = domain->queueStatContext()->addSubcontext( - mwcst::StatContextConfiguration(uri.canonical(), &localAllocator)); + bmqst::StatContextConfiguration(uri.canonical(), &localAllocator)); // Initialize the role to 'unknown'; once the 'mqbblp::Queue' is // configured, the role will be accordingly set @@ -474,7 +483,7 @@ void QueueStatsDomain::initialize(const bmqt::Uri& uri, mqbi::Domain* domain) cit != appIDs.end(); ++cit) { StatSubContextMp subContext = d_statContext_mp->addSubcontext( - mwcst::StatContextConfiguration(*cit, &localAllocator)); + bmqst::StatContextConfiguration(*cit, &localAllocator)); d_subContextsLookup.insert(bsl::make_pair(*cit, subContext.get())); d_subContextsHolder.emplace_back( @@ -544,6 +553,15 @@ void QueueStatsDomain::onEvent(EventType::Enum type, bsls::Types::Int64 value) case EventType::e_ADD_MESSAGE: { d_statContext_mp->adjustValue(DomainQueueStats::e_STAT_BYTES, value); d_statContext_mp->adjustValue(DomainQueueStats::e_STAT_MESSAGES, 1); + if (!d_subContextsHolder.empty()) { + bsl::list::iterator it = + d_subContextsHolder.begin(); + while (it != d_subContextsHolder.end()) { + it->get()->adjustValue(DomainQueueStats::e_STAT_BYTES, value); + it->get()->adjustValue(DomainQueueStats::e_STAT_MESSAGES, 1); + ++it; + } + } } break; case EventType::e_DEL_MESSAGE: { d_statContext_mp->adjustValue(DomainQueueStats::e_STAT_BYTES, -value); @@ -557,6 +575,15 @@ void QueueStatsDomain::onEvent(EventType::Enum type, bsls::Types::Int64 value) // the stat to get rates d_statContext_mp->setValue(DomainQueueStats::e_STAT_BYTES, 0); d_statContext_mp->setValue(DomainQueueStats::e_STAT_MESSAGES, 0); + if (!d_subContextsHolder.empty()) { + bsl::list::iterator it = + d_subContextsHolder.begin(); + while (it != d_subContextsHolder.end()) { + it->get()->setValue(DomainQueueStats::e_STAT_BYTES, 0); + it->get()->setValue(DomainQueueStats::e_STAT_MESSAGES, 0); + ++it; + } + } } break; case EventType::e_CHANGE_ROLE: { d_statContext_mp->setValue(DomainQueueStats::e_STAT_ROLE, value); @@ -571,6 +598,9 @@ void QueueStatsDomain::onEvent(EventType::Enum type, bsls::Types::Int64 value) d_statContext_mp->adjustValue(DomainQueueStats::e_STAT_NO_SC_MSGS, value); } break; + case EventType::e_UPDATE_HISTORY: { + d_statContext_mp->setValue(DomainQueueStats::e_STAT_HISTORY, value); + } break; default: { BSLS_ASSERT_SAFE(false && "Unknown event type"); } break; @@ -592,7 +622,7 @@ void QueueStatsDomain::onEvent(EventType::Enum type, return; // RETURN } - bsl::unordered_map::iterator it = + bsl::unordered_map::iterator it = d_subContextsLookup.find(appId); if (BSLS_PERFORMANCEHINT_PREDICT_UNLIKELY(it == @@ -605,7 +635,7 @@ void QueueStatsDomain::onEvent(EventType::Enum type, return; // RETURN } - mwcst::StatContext* appIdContext = it->second; + bmqst::StatContext* appIdContext = it->second; BSLS_ASSERT_SAFE(appIdContext); switch (type) { @@ -613,10 +643,23 @@ void QueueStatsDomain::onEvent(EventType::Enum type, appIdContext->reportValue(DomainQueueStats::e_STAT_CONFIRM_TIME, value); } break; - case EventType::e_QUEUE_TIME: { appIdContext->reportValue(DomainQueueStats::e_STAT_QUEUE_TIME, value); } break; + case EventType::e_ADD_MESSAGE: { + appIdContext->adjustValue(DomainQueueStats::e_STAT_BYTES, value); + appIdContext->adjustValue(DomainQueueStats::e_STAT_MESSAGES, 1); + } break; + case EventType::e_DEL_MESSAGE: { + appIdContext->adjustValue(DomainQueueStats::e_STAT_BYTES, -value); + appIdContext->adjustValue(DomainQueueStats::e_STAT_MESSAGES, -1); + } break; + case EventType::e_PURGE: { + // NOTE: Setting the value like that will cause weird results if using + // the stat to get rates + appIdContext->setValue(DomainQueueStats::e_STAT_BYTES, 0); + appIdContext->setValue(DomainQueueStats::e_STAT_MESSAGES, 0); + } break; // Some of these event types make no sense per appId and should be reported // per entire queue instead @@ -627,14 +670,12 @@ void QueueStatsDomain::onEvent(EventType::Enum type, case EventType::e_REJECT: BSLS_ANNOTATION_FALLTHROUGH; case EventType::e_PUSH: BSLS_ANNOTATION_FALLTHROUGH; case EventType::e_PUT: BSLS_ANNOTATION_FALLTHROUGH; - case EventType::e_ADD_MESSAGE: BSLS_ANNOTATION_FALLTHROUGH; - case EventType::e_DEL_MESSAGE: BSLS_ANNOTATION_FALLTHROUGH; case EventType::e_GC_MESSAGE: BSLS_ANNOTATION_FALLTHROUGH; - case EventType::e_PURGE: BSLS_ANNOTATION_FALLTHROUGH; case EventType::e_CHANGE_ROLE: BSLS_ANNOTATION_FALLTHROUGH; case EventType::e_CFG_MSGS: BSLS_ANNOTATION_FALLTHROUGH; case EventType::e_CFG_BYTES: BSLS_ANNOTATION_FALLTHROUGH; - case EventType::e_NO_SC_MESSAGE: { + case EventType::e_NO_SC_MESSAGE: BSLS_ANNOTATION_FALLTHROUGH; + case EventType::e_UPDATE_HISTORY: { BSLS_ASSERT_SAFE(false && "Unexpected event type for appId metric"); } break; @@ -698,7 +739,7 @@ void QueueStatsDomain::updateDomainAppIds( sIt != remainingAppIds.end(); sIt++) { StatSubContextMp subContext = d_statContext_mp->addSubcontext( - mwcst::StatContextConfiguration(*sIt, &localAllocator)); + bmqst::StatContextConfiguration(*sIt, &localAllocator)); d_subContextsLookup.insert(bsl::make_pair(*sIt, subContext.get())); d_subContextsHolder.emplace_back( @@ -747,24 +788,24 @@ const char* QueueStatsDomain::Role::toAscii(Role::Enum value) // ---------------------- bsls::Types::Int64 -QueueStatsClient::getValue(const mwcst::StatContext& context, +QueueStatsClient::getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat) { // invoked from the SNAPSHOT thread - const mwcst::StatValue::SnapshotLocation latestSnapshot(0, 0); - const mwcst::StatValue::SnapshotLocation oldestSnapshot(0, snapshotId); + const bmqst::StatValue::SnapshotLocation latestSnapshot(0, 0); + const bmqst::StatValue::SnapshotLocation oldestSnapshot(0, snapshotId); #define STAT_SINGLE(OPERATION, STAT) \ - mwcst::StatUtil::OPERATION( \ - context.value(mwcst::StatContext::e_DIRECT_VALUE, STAT), \ + bmqst::StatUtil::OPERATION( \ + context.value(bmqst::StatContext::e_DIRECT_VALUE, STAT), \ latestSnapshot) #define STAT_RANGE(OPERATION, STAT) \ - mwcst::StatUtil::OPERATION( \ - context.value(mwcst::StatContext::e_DIRECT_VALUE, STAT), \ + bmqst::StatUtil::OPERATION( \ + context.value(bmqst::StatContext::e_DIRECT_VALUE, STAT), \ latestSnapshot, \ oldestSnapshot) @@ -823,7 +864,7 @@ QueueStatsClient::QueueStatsClient() } void QueueStatsClient::initialize(const bmqt::Uri& uri, - mwcst::StatContext* clientStatContext, + bmqst::StatContext* clientStatContext, bslma::Allocator* allocator) { // PRECONDITIONS @@ -833,7 +874,7 @@ void QueueStatsClient::initialize(const bmqt::Uri& uri, bdlma::LocalSequentialAllocator<2048> localAllocator(allocator); d_statContext_mp = clientStatContext->addSubcontext( - mwcst::StatContextConfiguration(uri.asString(), &localAllocator)); + bmqst::StatContextConfiguration(uri.asString(), &localAllocator)); } void QueueStatsClient::onEvent(EventType::Enum type, bsls::Types::Int64 value) @@ -865,13 +906,13 @@ void QueueStatsClient::onEvent(EventType::Enum type, bsls::Types::Int64 value) // struct QueueStatsUtil // --------------------- -bsl::shared_ptr +bsl::shared_ptr QueueStatsUtil::initializeStatContextDomains(int historySize, bslma::Allocator* allocator) { bdlma::LocalSequentialAllocator<2048> localAllocator(allocator); - mwcst::StatContextConfiguration config(k_DOMAIN_STAT_NAME, + bmqst::StatContextConfiguration config(k_DOMAIN_STAT_NAME, &localAllocator); config.isTable(true) @@ -883,12 +924,12 @@ QueueStatsUtil::initializeStatContextDomains(int historySize, .value("messages") .value("bytes") .value("ack") - .value("ack_time", mwcst::StatValue::e_DISCRETE) + .value("ack_time", bmqst::StatValue::e_DISCRETE) .value("nack") .value("confirm") - .value("confirm_time", mwcst::StatValue::e_DISCRETE) + .value("confirm_time", bmqst::StatValue::e_DISCRETE) .value("reject") - .value("queue_time", mwcst::StatValue::e_DISCRETE) + .value("queue_time", bmqst::StatValue::e_DISCRETE) .value("gc") .value("push") .value("put") @@ -896,23 +937,24 @@ QueueStatsUtil::initializeStatContextDomains(int historySize, .value("cfg_msgs") .value("cfg_bytes") .value("content_msgs") - .value("content_bytes"); + .value("content_bytes") + .value("history_size"); // NOTE: If the stats are using too much memory, we could reconsider // nb_producer, nb_consumer, messages and bytes to be using atomic // int and not stat value. - return bsl::shared_ptr( - new (*allocator) mwcst::StatContext(config, allocator), + return bsl::shared_ptr( + new (*allocator) bmqst::StatContext(config, allocator), allocator); } -bsl::shared_ptr +bsl::shared_ptr QueueStatsUtil::initializeStatContextClients(int historySize, bslma::Allocator* allocator) { bdlma::LocalSequentialAllocator<2048> localAllocator(allocator); - mwcst::StatContextConfiguration config(k_CLIENT_STAT_NAME, + bmqst::StatContextConfiguration config(k_CLIENT_STAT_NAME, &localAllocator); config.isTable(true) .defaultHistorySize(historySize) @@ -925,167 +967,171 @@ QueueStatsUtil::initializeStatContextClients(int historySize, // NOTE: If the stats are using too much memory, we could reconsider // in_event and out_event to be using atomic int and not stat value. - return bsl::shared_ptr( - new (*allocator) mwcst::StatContext(config, allocator), + return bsl::shared_ptr( + new (*allocator) bmqst::StatContext(config, allocator), allocator); } void QueueStatsUtil::initializeTableAndTipDomains( - mwcst::Table* table, - mwcst::BasicTableInfoProvider* tip, + bmqst::Table* table, + bmqst::BasicTableInfoProvider* tip, int historySize, - mwcst::StatContext* statContext) + bmqst::StatContext* statContext) { // Use only one level for now ... - mwcst::StatValue::SnapshotLocation start(0, 0); - mwcst::StatValue::SnapshotLocation end(0, historySize - 1); + bmqst::StatValue::SnapshotLocation start(0, 0); + bmqst::StatValue::SnapshotLocation end(0, historySize - 1); // Create table - mwcst::TableSchema& schema = table->schema(); + bmqst::TableSchema& schema = table->schema(); schema.addDefaultIdColumn("id"); schema.addColumn("nb_producer", DomainQueueStats::e_STAT_NB_PRODUCER, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("nb_consumer", DomainQueueStats::e_STAT_NB_CONSUMER, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("messages", DomainQueueStats::e_STAT_MESSAGES, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("bytes", DomainQueueStats::e_STAT_BYTES, - mwcst::StatUtil::value, + bmqst::StatUtil::value, + start); + schema.addColumn("history_size", + DomainQueueStats::e_STAT_HISTORY, + bmqst::StatUtil::value, start); schema.addColumn("put_msgs_delta", DomainQueueStats::e_STAT_PUT, - mwcst::StatUtil::incrementsDifference, + bmqst::StatUtil::incrementsDifference, start, end); schema.addColumn("put_bytes_delta", DomainQueueStats::e_STAT_PUT, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("put_msgs_abs", DomainQueueStats::e_STAT_PUT, - mwcst::StatUtil::increments, + bmqst::StatUtil::increments, start); schema.addColumn("put_bytes_abs", DomainQueueStats::e_STAT_PUT, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("push_msgs_delta", DomainQueueStats::e_STAT_PUSH, - mwcst::StatUtil::incrementsDifference, + bmqst::StatUtil::incrementsDifference, start, end); schema.addColumn("push_bytes_delta", DomainQueueStats::e_STAT_PUSH, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("push_msgs_abs", DomainQueueStats::e_STAT_PUSH, - mwcst::StatUtil::increments, + bmqst::StatUtil::increments, start); schema.addColumn("push_bytes_abs", DomainQueueStats::e_STAT_PUSH, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("ack_delta", DomainQueueStats::e_STAT_ACK, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("ack_abs", DomainQueueStats::e_STAT_ACK, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("ack_time_avg", DomainQueueStats::e_STAT_ACK_TIME, - mwcst::StatUtil::averagePerEvent, + bmqst::StatUtil::averagePerEvent, start, end); schema.addColumn("ack_time_max", DomainQueueStats::e_STAT_ACK_TIME, - mwcst::StatUtil::rangeMax, + bmqst::StatUtil::rangeMax, start, end); schema.addColumn("nack_delta", DomainQueueStats::e_STAT_NACK, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("nack_abs", DomainQueueStats::e_STAT_NACK, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("confirm_delta", DomainQueueStats::e_STAT_CONFIRM, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("confirm_abs", DomainQueueStats::e_STAT_CONFIRM, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("confirm_time_avg", DomainQueueStats::e_STAT_CONFIRM_TIME, - mwcst::StatUtil::averagePerEvent, + bmqst::StatUtil::averagePerEvent, start, end); schema.addColumn("confirm_time_max", DomainQueueStats::e_STAT_CONFIRM_TIME, - mwcst::StatUtil::rangeMax, + bmqst::StatUtil::rangeMax, start, end); schema.addColumn("reject_delta", DomainQueueStats::e_STAT_REJECT, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("reject_abs", DomainQueueStats::e_STAT_REJECT, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("queue_time_avg", DomainQueueStats::e_STAT_QUEUE_TIME, - mwcst::StatUtil::averagePerEvent, + bmqst::StatUtil::averagePerEvent, start, end); schema.addColumn("queue_time_max", DomainQueueStats::e_STAT_QUEUE_TIME, - mwcst::StatUtil::rangeMax, + bmqst::StatUtil::rangeMax, start, end); schema.addColumn("gc_msgs_delta", DomainQueueStats::e_STAT_GC_MSGS, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("gc_msgs_abs", DomainQueueStats::e_STAT_GC_MSGS, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("no_sc_msgs_delta", DomainQueueStats::e_STAT_NO_SC_MSGS, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("no_sc_msgs_abs", DomainQueueStats::e_STAT_NO_SC_MSGS, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); // Configure records - mwcst::TableRecords& records = table->records(); + bmqst::TableRecords& records = table->records(); records.setContext(statContext); records.setFilter(&filterDirect); @@ -1161,83 +1207,86 @@ void QueueStatsUtil::initializeTableAndTipDomains( tip->setColumnGroup("GC"); tip->addColumn("gc_msgs_delta", "delta").zeroString(""); tip->addColumn("gc_msgs_abs", "abs").zeroString(""); + + tip->setColumnGroup("History"); + tip->addColumn("history_size", "# GUIDs").zeroString(""); } void QueueStatsUtil::initializeTableAndTipClients( - mwcst::Table* table, - mwcst::BasicTableInfoProvider* tip, + bmqst::Table* table, + bmqst::BasicTableInfoProvider* tip, int historySize, - mwcst::StatContext* statContext) + bmqst::StatContext* statContext) { // Use only one level for now ... - mwcst::StatValue::SnapshotLocation start(0, 0); - mwcst::StatValue::SnapshotLocation end(0, historySize - 1); + bmqst::StatValue::SnapshotLocation start(0, 0); + bmqst::StatValue::SnapshotLocation end(0, historySize - 1); // Create table - mwcst::TableSchema& schema = table->schema(); + bmqst::TableSchema& schema = table->schema(); schema.addDefaultIdColumn("id"); schema.addColumn("push_messages_delta", ClientStats::e_STAT_PUSH, - mwcst::StatUtil::incrementsDifference, + bmqst::StatUtil::incrementsDifference, start, end); schema.addColumn("push_bytes_delta", ClientStats::e_STAT_PUSH, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("push_messages_abs", ClientStats::e_STAT_PUSH, - mwcst::StatUtil::increments, + bmqst::StatUtil::increments, start); schema.addColumn("push_bytes_abs", ClientStats::e_STAT_PUSH, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("put_messages_delta", ClientStats::e_STAT_PUT, - mwcst::StatUtil::incrementsDifference, + bmqst::StatUtil::incrementsDifference, start, end); schema.addColumn("put_bytes_delta", ClientStats::e_STAT_PUT, - mwcst::StatUtil::valueDifference, + bmqst::StatUtil::valueDifference, start, end); schema.addColumn("put_messages_abs", ClientStats::e_STAT_PUT, - mwcst::StatUtil::increments, + bmqst::StatUtil::increments, start); schema.addColumn("put_bytes_abs", ClientStats::e_STAT_PUT, - mwcst::StatUtil::value, + bmqst::StatUtil::value, start); schema.addColumn("ack_delta", ClientStats::e_STAT_ACK, - mwcst::StatUtil::incrementsDifference, + bmqst::StatUtil::incrementsDifference, start, end); schema.addColumn("ack_abs", ClientStats::e_STAT_ACK, - mwcst::StatUtil::increments, + bmqst::StatUtil::increments, start); schema.addColumn("confirm_delta", ClientStats::e_STAT_CONFIRM, - mwcst::StatUtil::incrementsDifference, + bmqst::StatUtil::incrementsDifference, start, end); schema.addColumn("confirm_abs", ClientStats::e_STAT_CONFIRM, - mwcst::StatUtil::increments, + bmqst::StatUtil::increments, start); // Configure records - mwcst::TableRecords& records = table->records(); + bmqst::TableRecords& records = table->records(); records.setContext(statContext); records.setFilter(&filterDirect); diff --git a/src/groups/mqb/mqbstat/mqbstat_queuestats.h b/src/groups/mqb/mqbstat/mqbstat_queuestats.h index 75a4c6ab6..20043568a 100644 --- a/src/groups/mqb/mqbstat/mqbstat_queuestats.h +++ b/src/groups/mqb/mqbstat/mqbstat_queuestats.h @@ -31,15 +31,12 @@ // 'mqbstat::QueueStatsUtil' is a utility namespace exposing methods to // initialize the stat contexts and associated objects. -// MQB - // BMQ #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -56,7 +53,7 @@ namespace BloombergLP { // FORWARD DECLARATION -namespace mwcst { +namespace bmqst { class StatContext; } namespace mqbi { @@ -99,7 +96,8 @@ class QueueStatsDomain { e_CHANGE_ROLE, e_CFG_MSGS, e_CFG_BYTES, - e_NO_SC_MESSAGE + e_NO_SC_MESSAGE, + e_UPDATE_HISTORY }; }; @@ -142,7 +140,8 @@ class QueueStatsDomain { e_CFG_MSGS, e_CFG_BYTES, e_NO_SC_MSGS_DELTA, - e_NO_SC_MSGS_ABS + e_NO_SC_MSGS_ABS, + e_HISTORY_ABS }; /// Return the non-modifiable string description corresponding to @@ -185,17 +184,17 @@ class QueueStatsDomain { private: // PRIVATE TYPE - typedef bslma::ManagedPtr StatSubContextMp; + typedef bslma::ManagedPtr StatSubContextMp; // PRIVATE DATA /// Allocator to use bslma::Allocator* d_allocator_p; /// StatContext - bslma::ManagedPtr d_statContext_mp; + bslma::ManagedPtr d_statContext_mp; /// List of per-appId subcontexts stored as managed pointers. - /// Note: `mwcst::StatContext` interface allocates subcontexts as + /// Note: `bmqst::StatContext` interface allocates subcontexts as /// managed pointers. We are not able to store managed pointers /// in a collection that might reallocate and copy its elements, /// since ManagedPtr implementation on Solaris is constraining. @@ -210,7 +209,7 @@ class QueueStatsDomain { /// Lookup table for per-appId subcontexts. Managed pointers to these /// subcontexts must be held in `d_subContextsHolder`. - bsl::unordered_map d_subContextsLookup; + bsl::unordered_map d_subContextsLookup; private: // NOT IMPLEMENTED @@ -230,7 +229,7 @@ class QueueStatsDomain { /// snapshot should be used, while other negative values are not supported. /// /// THREAD: This method can only be invoked from the `snapshot` thread. - static bsls::Types::Int64 getValue(const mwcst::StatContext& context, + static bsls::Types::Int64 getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat); @@ -278,7 +277,7 @@ class QueueStatsDomain { void updateDomainAppIds(const bsl::vector& appIds); /// Return a pointer to the statcontext. - mwcst::StatContext* statContext(); + bmqst::StatContext* statContext(); }; // FREE OPERATORS @@ -333,7 +332,7 @@ class QueueStatsClient { private: // DATA - bslma::ManagedPtr d_statContext_mp; + bslma::ManagedPtr d_statContext_mp; // StatContext private: @@ -353,7 +352,7 @@ class QueueStatsClient { /// ago. /// /// THREAD: This method can only be invoked from the `snapshot` thread. - static bsls::Types::Int64 getValue(const mwcst::StatContext& context, + static bsls::Types::Int64 getValue(const bmqst::StatContext& context, int snapshotId, const Stat::Enum& stat); @@ -369,7 +368,7 @@ class QueueStatsClient { /// (which correspond to the client-level stat context this queue is /// part of), using the specified `allocator`. void initialize(const bmqt::Uri& uri, - mwcst::StatContext* clientStatContext, + bmqst::StatContext* clientStatContext, bslma::Allocator* allocator); /// Update statistics for the event of the specified `type` and with the @@ -378,7 +377,7 @@ class QueueStatsClient { void onEvent(EventType::Enum type, bsls::Types::Int64 value); /// Return a pointer to the statcontext. - mwcst::StatContext* statContext(); + bmqst::StatContext* statContext(); }; // ===================== @@ -393,31 +392,31 @@ struct QueueStatsUtil { /// specified `historySize` of history: return the created top level /// stat context to use as parent of all domains statistics. Use the /// specified `allocator` for all stat context and stat values. - static bsl::shared_ptr + static bsl::shared_ptr initializeStatContextDomains(int historySize, bslma::Allocator* allocator); /// Initialize the statistics for the queues (client level) keeping the /// specified `historySize` of history: return the created top level /// stat context to use as parent of all domains statistics. Use the /// specified `allocator` for all stat context and stat values. - static bsl::shared_ptr + static bsl::shared_ptr initializeStatContextClients(int historySize, bslma::Allocator* allocator); /// Load in the specified `table` and `tip` the objects to print the /// specified `statContext` for the specified `historySize`. static void - initializeTableAndTipDomains(mwcst::Table* table, - mwcst::BasicTableInfoProvider* tip, + initializeTableAndTipDomains(bmqst::Table* table, + bmqst::BasicTableInfoProvider* tip, int historySize, - mwcst::StatContext* statContext); + bmqst::StatContext* statContext); /// Load in the specified `table` and `tip` the objects to print the /// specified `statContext` for the specified `historySize`. static void - initializeTableAndTipClients(mwcst::Table* table, - mwcst::BasicTableInfoProvider* tip, + initializeTableAndTipClients(bmqst::Table* table, + bmqst::BasicTableInfoProvider* tip, int historySize, - mwcst::StatContext* statContext); + bmqst::StatContext* statContext); }; // ============================================================================ @@ -428,7 +427,7 @@ struct QueueStatsUtil { // class QueueStatsDomain // ---------------------- -inline mwcst::StatContext* QueueStatsDomain::statContext() +inline bmqst::StatContext* QueueStatsDomain::statContext() { return d_statContext_mp.get(); } @@ -447,7 +446,7 @@ inline bsl::ostream& operator<<(bsl::ostream& stream, // class QueueStatsClient // ---------------------- -inline mwcst::StatContext* QueueStatsClient::statContext() +inline bmqst::StatContext* QueueStatsClient::statContext() { return d_statContext_mp.get(); } diff --git a/src/groups/mqb/mqbstat/mqbstat_queuestats.t.cpp b/src/groups/mqb/mqbstat/mqbstat_queuestats.t.cpp index bc7974e2c..adadd0c0e 100644 --- a/src/groups/mqb/mqbstat/mqbstat_queuestats.t.cpp +++ b/src/groups/mqb/mqbstat/mqbstat_queuestats.t.cpp @@ -28,16 +28,15 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -61,7 +60,7 @@ static void test1_breathingTest() // Stat Context initialization // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("Breathing Test"); + bmqtst::TestHelper::printTestName("Breathing Test"); bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); mqbmock::Cluster mockCluster(&bufferFactory, s_allocator_p); @@ -70,10 +69,10 @@ static void test1_breathingTest() // Create statcontexts const int k_HISTORY_SIZE = 2; - bsl::shared_ptr client = + bsl::shared_ptr client = mqbstat::QueueStatsUtil::initializeStatContextClients(k_HISTORY_SIZE, s_allocator_p); - mwcst::StatContext* domain = mockDomain.queueStatContext(); + bmqst::StatContext* domain = mockDomain.queueStatContext(); using namespace mqbstat; typedef QueueStatsClient::Stat ClientStat; @@ -162,11 +161,11 @@ static void test2_queueStatsClient() // QueueStatsClient manipulation // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("QueueStatsClient"); + bmqtst::TestHelper::printTestName("QueueStatsClient"); // Create statcontexts const int k_HISTORY_SIZE = 3; - bsl::shared_ptr client = + bsl::shared_ptr client = mqbstat::QueueStatsUtil::initializeStatContextClients(k_HISTORY_SIZE, s_allocator_p); @@ -261,14 +260,14 @@ static void test3_queueStatsDomain() // QueueStatsDomain manipulation // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("QueueStatsDomain"); + bmqtst::TestHelper::printTestName("QueueStatsDomain"); // Create statcontext bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); mqbmock::Cluster mockCluster(&bufferFactory, s_allocator_p); mqbmock::Domain mockDomain(&mockCluster, s_allocator_p); - mwcst::StatContext* domain = mockDomain.queueStatContext(); + bmqst::StatContext* domain = mockDomain.queueStatContext(); domain->snapshot(); @@ -311,6 +310,9 @@ static void test3_queueStatsDomain() // 1 add message : 15 bytes queueStatsDomain.onEvent(QueueStatsDomain::EventType::e_ADD_MESSAGE, 15); + + // 1 GUID in history + queueStatsDomain.onEvent(QueueStatsDomain::EventType::e_UPDATE_HISTORY, 1); domain->snapshot(); // The following stats are not range based, and therefore always return the @@ -325,6 +327,7 @@ static void test3_queueStatsDomain() ASSERT_EQ_DOMAINSTAT(e_PUSH_BYTES_ABS, 0, 9); ASSERT_EQ_DOMAINSTAT(e_PUT_MESSAGES_ABS, 0, 3); ASSERT_EQ_DOMAINSTAT(e_PUT_BYTES_ABS, 0, 33); + ASSERT_EQ_DOMAINSTAT(e_HISTORY_ABS, 0, 1); ASSERT_EQ_DOMAINSTAT(e_ACK_DELTA, 1, 2); ASSERT_EQ_DOMAINSTAT(e_CONFIRM_DELTA, 1, 1); @@ -359,6 +362,10 @@ static void test3_queueStatsDomain() // del 1 message queueStatsDomain.onEvent(QueueStatsDomain::EventType::e_DEL_MESSAGE, 15); + + // 3 GUIDs in history (first 5, then gc results in 3) + queueStatsDomain.onEvent(QueueStatsDomain::EventType::e_UPDATE_HISTORY, 5); + queueStatsDomain.onEvent(QueueStatsDomain::EventType::e_UPDATE_HISTORY, 3); domain->snapshot(); // The following stats are not range based, and therefore always return the @@ -373,6 +380,7 @@ static void test3_queueStatsDomain() ASSERT_EQ_DOMAINSTAT(e_PUSH_BYTES_ABS, 0, 20); ASSERT_EQ_DOMAINSTAT(e_PUT_MESSAGES_ABS, 0, 5); ASSERT_EQ_DOMAINSTAT(e_PUT_BYTES_ABS, 0, 55); + ASSERT_EQ_DOMAINSTAT(e_HISTORY_ABS, 0, 3); // Compare now and previous snapshot ASSERT_EQ_DOMAINSTAT(e_ACK_DELTA, 1, 4); @@ -411,7 +419,7 @@ static void test4_queueStatsDomainContent() // QueueStatsDomain manipulation // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("QueueStatsDomainContent"); + bmqtst::TestHelper::printTestName("QueueStatsDomainContent"); #define ASSERT_EQ_DOMAINSTAT(PARAM, SNAPSHOT, VALUE) \ ASSERT_EQ(VALUE, \ @@ -424,7 +432,7 @@ static void test4_queueStatsDomainContent() bdlbb::PooledBlobBufferFactory bufferFactory(1024, s_allocator_p); mqbmock::Cluster mockCluster(&bufferFactory, s_allocator_p); mqbmock::Domain mockDomain(&mockCluster, s_allocator_p); - mwcst::StatContext* sc = mockDomain.queueStatContext(); + bmqst::StatContext* sc = mockDomain.queueStatContext(); mqbstat::QueueStatsDomain obj(s_allocator_p); obj.initialize(bmqt::Uri(s_allocator_p), &mockDomain); @@ -516,7 +524,7 @@ static void test5_appIdMetrics() // QueueStatsDomain manipulation with per-appId metrics // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("AppIdMetrics"); + bmqtst::TestHelper::printTestName("AppIdMetrics"); // Create a mock cluster/domain const bool isClusterMember = true; @@ -573,7 +581,7 @@ static void test5_appIdMetrics() mode.publishAppIdMetrics() = true; mode.appIDs().push_back(k_APPID_FOO); - mwcu::MemOutStream errorDesc(s_allocator_p); + bmqu::MemOutStream errorDesc(s_allocator_p); mockDomain.configure(errorDesc, domainConfig); // Do not use stat context (`mockDomain.queueStatContext()`) declared @@ -583,7 +591,7 @@ static void test5_appIdMetrics() stats.initialize(bmqt::Uri("bmq://mock-domain/abc", s_allocator_p), &mockDomain); - mwcst::StatContext* sc = stats.statContext(); + bmqst::StatContext* sc = stats.statContext(); // Make a snapshot to get a recent update with a newly initialized // subcontext for "foo" @@ -591,7 +599,7 @@ static void test5_appIdMetrics() sc->snapshot(); ASSERT_EQ(1, sc->numSubcontexts()); - const mwcst::StatContext* fooSc = sc->getSubcontext(k_APPID_FOO); + const bmqst::StatContext* fooSc = sc->getSubcontext(k_APPID_FOO); ASSERT(fooSc); } @@ -615,11 +623,11 @@ static void test5_appIdMetrics() ASSERT_EQ(2, sc->numSubcontexts()); - const mwcst::StatContext* fooSc = sc->getSubcontext(k_APPID_FOO); + const bmqst::StatContext* fooSc = sc->getSubcontext(k_APPID_FOO); ASSERT(!fooSc); - const mwcst::StatContext* barSc = sc->getSubcontext(k_APPID_BAR); - const mwcst::StatContext* bazSc = sc->getSubcontext(k_APPID_BAZ); + const bmqst::StatContext* barSc = sc->getSubcontext(k_APPID_BAR); + const bmqst::StatContext* bazSc = sc->getSubcontext(k_APPID_BAZ); ASSERT(barSc); ASSERT(bazSc); } @@ -642,8 +650,8 @@ static void test5_appIdMetrics() sc->snapshot(); - const mwcst::StatContext* barSc = sc->getSubcontext(k_APPID_BAR); - const mwcst::StatContext* bazSc = sc->getSubcontext(k_APPID_BAZ); + const bmqst::StatContext* barSc = sc->getSubcontext(k_APPID_BAR); + const bmqst::StatContext* bazSc = sc->getSubcontext(k_APPID_BAZ); ASSERT(barSc); ASSERT(bazSc); @@ -666,7 +674,7 @@ static void test5_appIdMetrics() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); bmqt::UriParser::initialize(s_allocator_p); @@ -674,7 +682,7 @@ int main(int argc, char* argv[]) mqbcfg::AppConfig brokerConfig(s_allocator_p); mqbcfg::BrokerConfig::set(brokerConfig); - bsl::shared_ptr statContext = + bsl::shared_ptr statContext = mqbstat::BrokerStatsUtil::initializeStatContext(30, s_allocator_p); switch (_testCase) { case 0: @@ -692,6 +700,6 @@ int main(int argc, char* argv[]) bmqt::UriParser::shutdown(); - TEST_EPILOG(mwctst::TestHelper::e_DEFAULT); + TEST_EPILOG(bmqtst::TestHelper::e_DEFAULT); // Do not check fro default/global allocator usage. } diff --git a/src/groups/mqb/mqbstat/mqbstat_statcontroller.cpp b/src/groups/mqb/mqbstat/mqbstat_statcontroller.cpp index aa499e8e9..97677494b 100644 --- a/src/groups/mqb/mqbstat/mqbstat_statcontroller.cpp +++ b/src/groups/mqb/mqbstat/mqbstat_statcontroller.cpp @@ -31,16 +31,15 @@ #include #include -// MWC -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // BDE #include @@ -155,7 +154,7 @@ void StatController::initializeStats() // -------- // Channels StatContextSp channels( - mwcio::StatChannelFactoryUtil::createStatContext("channels", + bmqio::StatChannelFactoryUtil::createStatContext("channels", historySize, d_allocator_p), d_allocator_p); @@ -163,10 +162,10 @@ void StatController::initializeStats() bsl::make_pair(bsl::string("channels"), StatContextDetails(channels, false))); d_statContextChannelsLocal_mp = channels->addSubcontext( - mwcst::StatContextConfiguration("local").storeExpiredSubcontextValues( + bmqst::StatContextConfiguration("local").storeExpiredSubcontextValues( true)); d_statContextChannelsRemote_mp = channels->addSubcontext( - mwcst::StatContextConfiguration("remote").storeExpiredSubcontextValues( + bmqst::StatContextConfiguration("remote").storeExpiredSubcontextValues( true)); // ------ @@ -255,7 +254,7 @@ void StatController::captureStatsAndSemaphorePost( switch (encoding) { case mqbcmd::EncodingFormat::TEXT: { - mwcu::MemOutStream os; + bmqu::MemOutStream os; d_printer_mp->printStats(os); result->makeStats() = os.str(); } break; // BREAK @@ -332,7 +331,7 @@ void StatController::setTunable(mqbcmd::StatResult* result, } } if (!targetConsumerCfg) { - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "No configuration found for StatConsumer '" << consumerName << "'"; result->makeError(); @@ -354,7 +353,7 @@ void StatController::setTunable(mqbcmd::StatResult* result, } } if (!targetConsumer) { - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "StatConsumer '" << consumerName << "' does not exist"; result->makeError(); result->error().message() = output.str(); @@ -367,7 +366,7 @@ void StatController::setTunable(mqbcmd::StatResult* result, (tunable.value().theInteger() < snapshotInterval || (tunable.value().theInteger() % snapshotInterval) != 0 || tunable.value().theInteger() > maxPublishInterval))) { - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "StatConsumer PUBLISHINTERVAL tunables must be " "multiples of snapshot interval (" << snapshotInterval @@ -396,7 +395,7 @@ void StatController::setTunable(mqbcmd::StatResult* result, << consumerName << "']"; } - mwcu::MemOutStream tunableConfirmationName; + bmqu::MemOutStream tunableConfirmationName; { bsl::string consumerNameLower(consumerName, d_allocator_p); bdlb::String::toLower(&consumerNameLower); @@ -412,7 +411,7 @@ void StatController::setTunable(mqbcmd::StatResult* result, return; // RETURN } - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "Unsupported tunable '" << tunable << "': Issue the " << "LIST_TUNABLES command for the list of supported tunables."; result->makeError(); @@ -450,14 +449,14 @@ void StatController::getTunable(mqbcmd::StatResult* result, } } if (!targetConsumer) { - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "StatConsumer '" << consumerName << "' does not exist"; result->makeError(); result->error().message() = output.str(); return; // RETURN } - mwcu::MemOutStream tunableConfirmationName; + bmqu::MemOutStream tunableConfirmationName; { bsl::string consumerNameLower(consumerName, d_allocator_p); bdlb::String::toLower(&consumerNameLower); @@ -470,7 +469,7 @@ void StatController::getTunable(mqbcmd::StatResult* result, return; // RETURN } - mwcu::MemOutStream output; + bmqu::MemOutStream output; output << "Unsupported tunable '" << tunable << "': Issue the " << "LIST_TUNABLES command for the list of supported tunables."; result->makeError(); @@ -497,7 +496,7 @@ void StatController::listTunables(mqbcmd::StatResult* result, for (; it != d_statConsumers.end(); ++it) { mqbcmd::Tunable& tunable = tunables.tunables().emplace_back(); - mwcu::MemOutStream tunableConfirmationName; + bmqu::MemOutStream tunableConfirmationName; { bsl::string consumerNameUpper((*it)->name(), d_allocator_p); bdlb::String::toUpper(&consumerNameUpper); @@ -506,7 +505,7 @@ void StatController::listTunables(mqbcmd::StatResult* result, tunable.name() = tunableConfirmationName.str(); tunable.value().makeTheInteger((*it)->publishInterval().seconds()); - mwcu::MemOutStream description; + bmqu::MemOutStream description; description << "non-negative integer value of the publish interval for the '" << (*it)->name() @@ -521,14 +520,14 @@ void StatController::listTunables(mqbcmd::StatResult* result, bool StatController::snapshot() { // executed by the *SCHEDULER* thread - const bsls::Types::Int64 now = mwcsys::Time::highResolutionTimer(); + const bsls::Types::Int64 now = bmqsys::Time::highResolutionTimer(); // Safeguard against too frequent invocation from the scheduler. if (!d_snapshotThrottle.requestPermission()) { const bsls::Types::Int64 nsDelta = now - d_lastSnapshotTime; BALL_LOGTHROTTLE_WARN(k_MAX_INSTANT_MESSAGES, k_NS_PER_MESSAGE) << "[THROTTLED] Snapshot invoked too frequently (delta = " - << mwcu::PrintUtil::prettyTimeInterval(nsDelta) + << bmqu::PrintUtil::prettyTimeInterval(nsDelta) << "), skipping snapshot"; return false; // RETURN @@ -576,7 +575,12 @@ void StatController::snapshotAndNotify() // StatConsumers will report all stats bsl::vector::iterator it = d_statConsumers.begin(); for (; it != d_statConsumers.end(); ++it) { - (*it)->onSnapshot(); + try { + (*it)->onSnapshot(); + } + catch (const bsl::exception& e) { + BALL_LOG_ERROR << "#PLUGIN_ERROR " << e.what(); + } } const bool willPrint = d_printer_mp->nextSnapshotWillPrint(); @@ -653,7 +657,7 @@ int StatController::validateConfig(bsl::ostream& errorDescription) const StatController::StatController(const CommandProcessorFn& commandProcessor, mqbplug::PluginManager* pluginManager, bdlbb::BlobBufferFactory* bufferFactory, - mwcst::StatContext* allocatorsStatContext, + bmqst::StatContext* allocatorsStatContext, bdlmt::EventScheduler* eventScheduler, bslma::Allocator* allocator) : d_allocators(allocator) @@ -721,10 +725,10 @@ int StatController::start(bsl::ostream& errorDescription) return -2; // RETURN } - if (mwcsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { + if (bmqsys::ThreadUtil::k_SUPPORT_THREAD_NAME) { d_scheduler_mp->scheduleEvent( bsls::TimeInterval(0), // execute as soon as possible - bdlf::BindUtil::bind(&mwcsys::ThreadUtil::setCurrentThreadName, + bdlf::BindUtil::bind(&bmqsys::ThreadUtil::setCurrentThreadName, "bmqSchedStat")); } @@ -738,20 +742,20 @@ int StatController::start(bsl::ostream& errorDescription) maxInterval = bsl::max(maxInterval, consumerIt->publishInterval()); } d_systemStatMonitor_mp.load( - new (*d_allocator_p) mwcsys::StatMonitor(maxInterval, d_allocator_p), + new (*d_allocator_p) bmqsys::StatMonitor(maxInterval, d_allocator_p), d_allocator_p); // Failing to start some subsystems of StatController should not result in // a broker shutdown, but rather be intercepted here and printed as an // error, therefore use a local 'errorDescription' stream and not the // supplied one. - mwcu::MemOutStream errorStream(d_allocator_p); + bmqu::MemOutStream errorStream(d_allocator_p); rc = d_systemStatMonitor_mp->start(errorStream); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("#STATS") + BMQTSK_ALARMLOG_ALARM("#STATS") << "Failed to start SystemStatMonitor [rc: " << rc << "," - << " error: '" << errorStream.str() << "']" << MWCTSK_ALARMLOG_END; + << " error: '" << errorStream.str() << "']" << BMQTSK_ALARMLOG_END; rc = 0; errorStream.reset(); } @@ -761,7 +765,7 @@ int StatController::start(bsl::ostream& errorDescription) initializeStats(); // Build Map to be passed to all lower level components - bsl::unordered_map ctxPtrMap( + bsl::unordered_map ctxPtrMap( d_allocator_p); for (StatContextDetailsMap::iterator ctxIt = d_statContextsMap.begin(); ctxIt != d_statContextsMap.end(); @@ -786,10 +790,10 @@ int StatController::start(bsl::ostream& errorDescription) d_allocator_p); if (int status = consumer->start(errorStream)) { - MWCTSK_ALARMLOG_ALARM("#STATS") + BMQTSK_ALARMLOG_ALARM("#STATS") << "Failed to start StatConsumer '" << consumer->name() << "' [rc: " << status << ", error: '" << errorStream.str() - << "']" << MWCTSK_ALARMLOG_END; + << "']" << BMQTSK_ALARMLOG_END; errorStream.reset(); continue; // CONTINUE } @@ -835,9 +839,9 @@ int StatController::start(bsl::ostream& errorDescription) // initializeStats() and creation of d_printer. rc = d_printer_mp->start(errorStream); if (rc != 0) { - MWCTSK_ALARMLOG_ALARM("#STATS") + BMQTSK_ALARMLOG_ALARM("#STATS") << "Failed to start Printer [rc: " << rc << ", error: '" - << errorStream.str() << "']" << MWCTSK_ALARMLOG_END; + << errorStream.str() << "']" << BMQTSK_ALARMLOG_END; rc = 0; errorStream.reset(); } @@ -851,7 +855,7 @@ int StatController::start(bsl::ostream& errorDescription) // of all stat contexts. d_statConsumerMaxPublishInterval = bsl::min(maxInterval, brkrCfg.stats().printer().printInterval()); - d_lastSnapshotTime = mwcsys::Time::highResolutionTimer(); + d_lastSnapshotTime = bmqsys::Time::highResolutionTimer(); // Start the clock d_scheduler_mp->startClock( @@ -976,7 +980,7 @@ int StatController::processCommand( return 0; // RETURN } - mwcu::MemOutStream os; + bmqu::MemOutStream os; os << "Unknown command '" << command << "'"; result->makeError(); result->error().message() = os.str(); diff --git a/src/groups/mqb/mqbstat/mqbstat_statcontroller.h b/src/groups/mqb/mqbstat/mqbstat_statcontroller.h index 14a7fb60a..ec0922b62 100644 --- a/src/groups/mqb/mqbstat/mqbstat_statcontroller.h +++ b/src/groups/mqb/mqbstat/mqbstat_statcontroller.h @@ -33,10 +33,9 @@ #include #include -// MWC -#include -#include -#include +#include +#include +#include // BDE #include @@ -81,13 +80,13 @@ class StatPublisher; namespace mqbplug { class StatConsumer; } -namespace mwcst { +namespace bmqst { class StatContext; } -namespace mwcst { +namespace bmqst { class Table; } -namespace mwcu { +namespace bmqu { class BasicTableInfoProvider; } @@ -117,7 +116,7 @@ class StatController { CommandProcessorFn; /// Map of StatContext names to StatContext pointers - typedef bsl::unordered_map StatContexts; + typedef bsl::unordered_map StatContexts; private: // CLASS-SCOPE CATEGORY @@ -126,9 +125,9 @@ class StatController { private: // PRIVATE TYPES typedef bslma::ManagedPtr SchedulerMp; - typedef bslma::ManagedPtr StatContextMp; - typedef bsl::shared_ptr StatContextSp; - typedef bslma::ManagedPtr SystemStatMonitorMp; + typedef bslma::ManagedPtr StatContextMp; + typedef bsl::shared_ptr StatContextSp; + typedef bslma::ManagedPtr SystemStatMonitorMp; typedef bslma::ManagedPtr PrinterMp; typedef bslma::ManagedPtr JsonPrinterMp; typedef bslma::ManagedPtr StatPublisherMp; @@ -158,7 +157,7 @@ class StatController { // DATA /// Allocator store to spawn new allocators /// for sub-components. - mwcma::CountingAllocatorStore d_allocators; + bmqma::CountingAllocatorStore d_allocators; /// This component should use it's own /// scheduler to not have stats interfere @@ -176,7 +175,7 @@ class StatController { /// Stat context of the counting allocators, /// if used. - mwcst::StatContext* d_allocatorsStatContext_p; + bmqst::StatContext* d_allocatorsStatContext_p; /// Map holding all the stat contexts StatContextDetailsMap d_statContextsMap; @@ -295,7 +294,7 @@ class StatController { StatController(const CommandProcessorFn& commandProcessor, mqbplug::PluginManager* pluginManager, bdlbb::BlobBufferFactory* bufferFactory, - mwcst::StatContext* allocatorsStatContext, + bmqst::StatContext* allocatorsStatContext, bdlmt::EventScheduler* eventScheduler, bslma::Allocator* allocator); @@ -322,23 +321,23 @@ class StatController { const mqbcmd::EncodingFormat::Value& encoding); /// Retrieve the domains top-level stat context. - mwcst::StatContext* domainsStatContext(); + bmqst::StatContext* domainsStatContext(); /// Retrieve the domainQueues top-level stat context. - mwcst::StatContext* domainQueuesStatContext(); + bmqst::StatContext* domainQueuesStatContext(); /// Retrieve the clients top-level stat context. - mwcst::StatContext* clientsStatContext(); + bmqst::StatContext* clientsStatContext(); /// Retrieve the clusterNodes top-level stat context. - mwcst::StatContext* clusterNodesStatContext(); + bmqst::StatContext* clusterNodesStatContext(); /// Retrieve the clusters top-level stat context. - mwcst::StatContext* clustersStatContext(); + bmqst::StatContext* clustersStatContext(); /// Retrieve the channels stat context corresponding to the specified /// `selector`. - mwcst::StatContext* channelsStatContext(ChannelSelector::Enum selector); + bmqst::StatContext* channelsStatContext(ChannelSelector::Enum selector); }; // ============================================================================ @@ -349,32 +348,32 @@ class StatController { // class StatController // -------------------- -inline mwcst::StatContext* StatController::domainsStatContext() +inline bmqst::StatContext* StatController::domainsStatContext() { return d_statContextsMap["domains"].d_statContext_sp.get(); } -inline mwcst::StatContext* StatController::domainQueuesStatContext() +inline bmqst::StatContext* StatController::domainQueuesStatContext() { return d_statContextsMap["domainQueues"].d_statContext_sp.get(); } -inline mwcst::StatContext* StatController::clientsStatContext() +inline bmqst::StatContext* StatController::clientsStatContext() { return d_statContextsMap["clients"].d_statContext_sp.get(); } -inline mwcst::StatContext* StatController::clusterNodesStatContext() +inline bmqst::StatContext* StatController::clusterNodesStatContext() { return d_statContextsMap["clusterNodes"].d_statContext_sp.get(); } -inline mwcst::StatContext* StatController::clustersStatContext() +inline bmqst::StatContext* StatController::clustersStatContext() { return d_statContextsMap["clusters"].d_statContext_sp.get(); } -inline mwcst::StatContext* +inline bmqst::StatContext* StatController::channelsStatContext(ChannelSelector::Enum selector) { switch (selector) { diff --git a/src/groups/mqb/mqbstat/mqbstat_statcontroller.t.cpp b/src/groups/mqb/mqbstat/mqbstat_statcontroller.t.cpp index c96c4190c..93dfa8309 100644 --- a/src/groups/mqb/mqbstat/mqbstat_statcontroller.t.cpp +++ b/src/groups/mqb/mqbstat/mqbstat_statcontroller.t.cpp @@ -21,9 +21,8 @@ #include #include -// MWC -#include -#include +#include +#include // BDE #include @@ -32,7 +31,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -75,7 +74,7 @@ static void test1_breathingTest() // Breathing test of the component // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("breathing test"); + bmqtst::TestHelper::printTestName("breathing test"); // Create a default StatController, make sure it can start/stop mqbcfg::AppConfig cfg(s_allocator_p); // empty default config @@ -98,7 +97,7 @@ static void test1_breathingTest() &scheduler, s_allocator_p); - mwcu::MemOutStream errStream(s_allocator_p); + bmqu::MemOutStream errStream(s_allocator_p); int rc = obj.start(errStream); ASSERT_EQ(rc, 0); obj.stop(); @@ -111,9 +110,9 @@ static void test1_breathingTest() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); - mwcsys::Time::initialize(); + bmqsys::Time::initialize(); switch (_testCase) { case 0: @@ -124,6 +123,6 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_DEFAULT); + TEST_EPILOG(bmqtst::TestHelper::e_DEFAULT); // Do not check fro default/global allocator usage. } diff --git a/src/groups/mqb/mqbu/mqbu_capacitymeter.cpp b/src/groups/mqb/mqbu/mqbu_capacitymeter.cpp index aee15cdad..1d15b9c3d 100644 --- a/src/groups/mqb/mqbu/mqbu_capacitymeter.cpp +++ b/src/groups/mqb/mqbu/mqbu_capacitymeter.cpp @@ -17,10 +17,10 @@ #include #include -// MWC -#include -#include -#include + +#include +#include +#include // BDE #include @@ -54,37 +54,41 @@ void CapacityMeter::logOnMonitorStateTransition( { const size_t k_INITIAL_BUFFER_SIZE = 256; - mwcu::MemOutStream categoryStream(k_INITIAL_BUFFER_SIZE); - mwcu::MemOutStream stream(k_INITIAL_BUFFER_SIZE); + bmqu::MemOutStream categoryStream(k_INITIAL_BUFFER_SIZE); + bmqu::MemOutStream stream(k_INITIAL_BUFFER_SIZE); categoryStream << "CAPACITY_" << d_monitor.state(); stream << "for '" << name() << "':"; stream << " [Messages (" << d_monitor.messageState() - << "): " << mwcu::PrintUtil::prettyNumber(d_monitor.messages()) + << "): " << bmqu::PrintUtil::prettyNumber(d_monitor.messages()) << " (limit: " - << mwcu::PrintUtil::prettyNumber(d_monitor.messageCapacity()); + << bmqu::PrintUtil::prettyNumber(d_monitor.messageCapacity()); if (d_nbMessagesReserved > 0) { stream << ", reserved: " - << mwcu::PrintUtil::prettyNumber(d_nbMessagesReserved); + << bmqu::PrintUtil::prettyNumber(d_nbMessagesReserved); } stream << "), Bytes (" << d_monitor.byteState() - << "): " << mwcu::PrintUtil::prettyBytes(d_monitor.bytes()) + << "): " << bmqu::PrintUtil::prettyBytes(d_monitor.bytes()) << " (limit: " - << mwcu::PrintUtil::prettyBytes(d_monitor.byteCapacity()); + << bmqu::PrintUtil::prettyBytes(d_monitor.byteCapacity()); if (d_nbBytesReserved > 0) { stream << ", reserved: " - << mwcu::PrintUtil::prettyBytes(d_nbBytesReserved); + << bmqu::PrintUtil::prettyBytes(d_nbBytesReserved); } stream << ")]"; switch (stateTransition) { case ResourceUsageMonitorStateTransition::e_HIGH_WATERMARK: case ResourceUsageMonitorStateTransition::e_FULL: { - MWCTSK_ALARMLOG_RAW_ALARM(categoryStream.str()) - << stream.str() << MWCTSK_ALARMLOG_END; + if (d_logAppsSubscriptionInfoCb) { + d_logAppsSubscriptionInfoCb(stream); + } + + BMQTSK_ALARMLOG_RAW_ALARM(categoryStream.str()) + << stream.str() << BMQTSK_ALARMLOG_END; } break; case ResourceUsageMonitorStateTransition::e_LOW_WATERMARK: { BALL_LOG_INFO << "[" << categoryStream.str() << "] " << stream.str(); @@ -100,8 +104,10 @@ void CapacityMeter::logOnMonitorStateTransition( } } -CapacityMeter::CapacityMeter(const bsl::string& name, - bslma::Allocator* allocator) +CapacityMeter::CapacityMeter( + const bsl::string& name, + bslma::Allocator* allocator, + LogAppsSubscriptionInfoCb logAppsSubscriptionInfoCb) : d_name(name, allocator) , d_isDisabled(false) , d_parent_p(0) @@ -115,13 +121,16 @@ CapacityMeter::CapacityMeter(const bsl::string& name, , d_nbMessagesReserved(0) , d_nbBytesReserved(0) , d_lock(bsls::SpinLock::s_unlocked) +, d_logAppsSubscriptionInfoCb(logAppsSubscriptionInfoCb) { // NOTHING } -CapacityMeter::CapacityMeter(const bsl::string& name, - CapacityMeter* parent, - bslma::Allocator* allocator) +CapacityMeter::CapacityMeter( + const bsl::string& name, + CapacityMeter* parent, + bslma::Allocator* allocator, + LogAppsSubscriptionInfoCb logAppsSubscriptionInfoCb) : d_name(name, allocator) , d_isDisabled(false) , d_parent_p(parent) @@ -135,6 +144,7 @@ CapacityMeter::CapacityMeter(const bsl::string& name, , d_nbMessagesReserved(0) , d_nbBytesReserved(0) , d_lock() +, d_logAppsSubscriptionInfoCb(logAppsSubscriptionInfoCb) { // NOTHING } @@ -404,24 +414,24 @@ CapacityMeter::print(bsl::ostream& stream, int level, int spacesPerLevel) const bsls::SpinLockGuard guard(&d_lock); // d_lock LOCK stream << name() << ":" - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Messages: [current: " - << mwcu::PrintUtil::prettyNumber(d_monitor.messages()) + << bmqu::PrintUtil::prettyNumber(d_monitor.messages()) << ", limit: " - << mwcu::PrintUtil::prettyNumber(d_monitor.messageCapacity()); + << bmqu::PrintUtil::prettyNumber(d_monitor.messageCapacity()); if (d_nbMessagesReserved != 0) { stream << ", reserved: " - << mwcu::PrintUtil::prettyNumber(d_nbMessagesReserved); + << bmqu::PrintUtil::prettyNumber(d_nbMessagesReserved); } stream << "]" - << mwcu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) + << bmqu::PrintUtil::newlineAndIndent(level + 1, spacesPerLevel) << "Bytes : [current: " - << mwcu::PrintUtil::prettyBytes(d_monitor.bytes()) + << bmqu::PrintUtil::prettyBytes(d_monitor.bytes()) << ", limit: " - << mwcu::PrintUtil::prettyBytes(d_monitor.byteCapacity()); + << bmqu::PrintUtil::prettyBytes(d_monitor.byteCapacity()); if (d_nbBytesReserved != 0) { stream << ", reserved: " - << mwcu::PrintUtil::prettyBytes(d_nbBytesReserved); + << bmqu::PrintUtil::prettyBytes(d_nbBytesReserved); } stream << "]"; } @@ -443,11 +453,11 @@ bsl::ostream& CapacityMeter::printShortSummary(bsl::ostream& stream) const { bsls::SpinLockGuard guard(&d_lock); // d_lock LOCK stream << "Messages [current: " - << mwcu::PrintUtil::prettyNumber(d_monitor.messages()) << " / " - << mwcu::PrintUtil::prettyNumber(d_monitor.messageCapacity()) + << bmqu::PrintUtil::prettyNumber(d_monitor.messages()) << " / " + << bmqu::PrintUtil::prettyNumber(d_monitor.messageCapacity()) << "], Bytes [current: " - << mwcu::PrintUtil::prettyBytes(d_monitor.bytes()) << " / " - << mwcu::PrintUtil::prettyBytes(d_monitor.byteCapacity()) + << bmqu::PrintUtil::prettyBytes(d_monitor.bytes()) << " / " + << bmqu::PrintUtil::prettyBytes(d_monitor.byteCapacity()) << "]"; } diff --git a/src/groups/mqb/mqbu/mqbu_capacitymeter.h b/src/groups/mqb/mqbu/mqbu_capacitymeter.h index 0da20f1cb..df4c03c36 100644 --- a/src/groups/mqb/mqbu/mqbu_capacitymeter.h +++ b/src/groups/mqb/mqbu/mqbu_capacitymeter.h @@ -151,6 +151,7 @@ #include #include +#include // BDE #include @@ -189,6 +190,11 @@ class CapacityMeter { e_LIMIT_BYTES = 2 // bytes limit was hit }; + // Callback function to log appllications subscription info into the + // specified `stream`. + typedef bsl::function + LogAppsSubscriptionInfoCb; + private: // DATA bsl::string d_name; @@ -218,6 +224,10 @@ class CapacityMeter { // SpinLock for synchronization of this // component + LogAppsSubscriptionInfoCb d_logAppsSubscriptionInfoCb; + // Callback function to log appllications subscription info into the + // specified `stream`. + // FRIENDS friend struct CapacityMeterUtil; @@ -243,16 +253,20 @@ class CapacityMeter { // CREATORS - /// Create a new un-configured object having the specified `name` and - /// using the specified `allocator`. - CapacityMeter(const bsl::string& name, bslma::Allocator* allocator); + /// Create a new un-configured object having the specified `name`, + /// using the specified `allocator` and optionally specified + /// `logAppsSubscriptionInfoCb`. + CapacityMeter(const bsl::string& name, + bslma::Allocator* allocator, + LogAppsSubscriptionInfoCb logAppsSubscriptionInfoCb = 0); /// Create a new un-configured object having the specified `name`, being /// a child of the specified `parent` meter and using the specified - /// `allocator`. - CapacityMeter(const bsl::string& name, - CapacityMeter* parent, - bslma::Allocator* allocator); + /// `allocator` and optionally specified `logAppsSubscriptionInfoCb`. + CapacityMeter(const bsl::string& name, + CapacityMeter* parent, + bslma::Allocator* allocator, + LogAppsSubscriptionInfoCb logAppsSubscriptionInfoCb = 0); // MANIPULATORS diff --git a/src/groups/mqb/mqbu/mqbu_capacitymeter.t.cpp b/src/groups/mqb/mqbu/mqbu_capacitymeter.t.cpp index 0370ab469..70c04b462 100644 --- a/src/groups/mqb/mqbu/mqbu_capacitymeter.t.cpp +++ b/src/groups/mqb/mqbu/mqbu_capacitymeter.t.cpp @@ -16,9 +16,8 @@ // mqbu_capacitymeter.t.cpp -*-C++-*- #include -// MWC -#include -#include +#include +#include // BDE #include @@ -27,12 +26,22 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; using namespace bsl; +// ============================================================================ +// HELPERS +// ---------------------------------------------------------------------------- + +bsl::ostream& logAppsSubscriptionInfoCb(bsl::ostream& stream) +{ + stream << "Test app subscription Info"; + return stream; +} + // ============================================================================ // TESTS // ---------------------------------------------------------------------------- @@ -50,7 +59,7 @@ static void test1_breathingTest() // Testing: // Basic functionality { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); const char* k_NAME = "dummy"; @@ -84,7 +93,7 @@ static void test2_logStateChange() // logging // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("LOG STATE CHANGE"); + bmqtst::TestHelper::printTestName("LOG STATE CHANGE"); s_ignoreCheckDefAlloc = true; // Logging infrastructure allocates using the default allocator, and @@ -103,7 +112,7 @@ static void test2_logStateChange() { PV("STATE - NORMAL"); - mwctst::ScopedLogObserver observer(ball::Severity::WARN, + bmqtst::ScopedLogObserver observer(ball::Severity::WARN, s_allocator_p); mqbu::CapacityMeter capacityMeter("dummy", s_allocator_p); capacityMeter.setLimits(k_MSGS_LIMIT, k_BYTES_LIMIT); @@ -120,7 +129,7 @@ static void test2_logStateChange() { PV("STATE - HIGH WATERMARK"); - mwctst::ScopedLogObserver observer(ball::Severity::WARN, + bmqtst::ScopedLogObserver observer(ball::Severity::WARN, s_allocator_p); mqbu::CapacityMeter capacityMeter("dummy", s_allocator_p); capacityMeter.setLimits(k_MSGS_LIMIT, k_BYTES_LIMIT); @@ -145,12 +154,12 @@ static void test2_logStateChange() const ball::Record& record = observer.records()[0]; ASSERT_EQ(record.fixedFields().severity(), ball::Severity::ERROR); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( record, "ALARM \\[CAPACITY_STATE_HIGH_WATERMARK\\]", s_allocator_p)); // This pattern is looked for to generate an alarm - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( record, "dummy.*Messages.*HIGH_WATERMARK", s_allocator_p)); @@ -160,7 +169,7 @@ static void test2_logStateChange() { PV("STATE - FULL"); - mwctst::ScopedLogObserver observer(ball::Severity::WARN, + bmqtst::ScopedLogObserver observer(ball::Severity::WARN, s_allocator_p); mqbu::CapacityMeter capacityMeter("dummy", s_allocator_p); capacityMeter.setLimits(k_MSGS_LIMIT, k_BYTES_LIMIT); @@ -173,12 +182,12 @@ static void test2_logStateChange() ASSERT_EQ(observer.records()[0].fixedFields().severity(), ball::Severity::ERROR); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( observer.records()[0], "ALARM \\[CAPACITY_STATE_FULL\\]", s_allocator_p)); // This pattern is looked for to generate an alarm - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( observer.records()[0], "dummy.*Messages.*FULL", s_allocator_p)); @@ -189,7 +198,7 @@ static void test2_logStateChange() { PV("STATE - HIGH WATERMARK TO FULL"); - mwctst::ScopedLogObserver observer(ball::Severity::WARN, + bmqtst::ScopedLogObserver observer(ball::Severity::WARN, s_allocator_p); mqbu::CapacityMeter capacityMeter("dummy", s_allocator_p); capacityMeter.setLimits(k_MSGS_LIMIT, k_BYTES_LIMIT); @@ -201,12 +210,12 @@ static void test2_logStateChange() ASSERT_EQ(observer.records().size(), 1U); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( observer.records()[0], "ALARM \\[CAPACITY_STATE_HIGH_WATERMARK\\]", s_allocator_p)); // This pattern is looked for to generate an alarm - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( observer.records()[0], "dummy.*Messages.*HIGH_WATERMARK", s_allocator_p)); @@ -218,35 +227,109 @@ static void test2_logStateChange() k_MSGS_HIGH_WATERMARK_VALUE, 10); ASSERT_EQ(observer.records().size(), 2U); - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( observer.records()[1], "ALARM \\[CAPACITY_STATE_FULL\\]", s_allocator_p)); // This pattern is looked for to generate an alarm - ASSERT(mwctst::ScopedLogObserverUtil::recordMessageMatch( + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( observer.records()[1], "dummy.*Messages.*FULL", s_allocator_p)); } } +static void test3_enhancedLog() +// ------------------------------------------------------------------------ +// ENHANCED ALARM LOG +// +// Concerns: +// Ensure that enhanced alarm log is printed if callback is passed. +// +// Plan: +// 1. Pass LogAppsSubscriptionInfoCb callback during initialization +// 2. Set resources to the high watermark and ensure the enhanced +// error message was logged. +// +// Testing: +// logging +// ------------------------------------------------------------------------ +{ + bmqtst::TestHelper::printTestName("ENHANCED ALARM LOG"); + + // Set resource to the high watermark, it should log one + PV("STATE - HIGH WATERMARK"); + + s_ignoreCheckDefAlloc = true; + // Logging infrastructure allocates using the default allocator, and + // that logging is beyond the control of this function. + + const bsls::Types::Int64 k_MSGS_LIMIT = 10; + const double k_MSGS_THRESHOLD = 0.5; + const bsls::Types::Int64 k_MSGS_HIGH_WATERMARK_VALUE = k_MSGS_LIMIT * + k_MSGS_THRESHOLD; + const bsls::Types::Int64 k_BYTES_LIMIT = 1024; + const double k_BYTES_THRESHOLD = 0.8; + const bsls::Types::Int64 k_BYTES_HIGH_WATERMARK_VALUE = k_BYTES_LIMIT * + k_BYTES_THRESHOLD; + + bmqtst::ScopedLogObserver observer(ball::Severity::WARN, s_allocator_p); + mqbu::CapacityMeter capacityMeter( + "dummy", + s_allocator_p, + bdlf::BindUtil::bind(&logAppsSubscriptionInfoCb, + bdlf::PlaceHolders::_1) // stream + ); + capacityMeter.setLimits(k_MSGS_LIMIT, k_BYTES_LIMIT); + capacityMeter.setWatermarkThresholds(k_MSGS_THRESHOLD, k_BYTES_THRESHOLD); + + bsls::Types::Int64 nbMessagesAvailable; + bsls::Types::Int64 nbBytesAvailable; + capacityMeter.reserve(&nbMessagesAvailable, + &nbBytesAvailable, + k_MSGS_HIGH_WATERMARK_VALUE, + 10); + BSLS_ASSERT_OPT(nbMessagesAvailable == k_MSGS_HIGH_WATERMARK_VALUE); + BSLS_ASSERT_OPT(nbBytesAvailable == 10); + + ASSERT(observer.records().empty()); + + capacityMeter.commit(k_MSGS_HIGH_WATERMARK_VALUE, 10); + + ASSERT_EQ(observer.records().size(), 1U); + + const ball::Record& record = observer.records()[0]; + ASSERT_EQ(record.fixedFields().severity(), ball::Severity::ERROR); + + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( + record, + "ALARM \\[CAPACITY_STATE_HIGH_WATERMARK\\]", + s_allocator_p)); + // Check log from callback + ASSERT(bmqtst::ScopedLogObserverUtil::recordMessageMatch( + record, + "Test app subscription Info", + s_allocator_p)); +} + // ============================================================================ // MAIN PROGRAM // ---------------------------------------------------------------------------- int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: case 2: test2_logStateChange(); break; case 1: test1_breathingTest(); break; + case 3: test3_enhancedLog(); break; default: { cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; s_testStatus = -1; } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbu/mqbu_exit.t.cpp b/src/groups/mqb/mqbu/mqbu_exit.t.cpp index 0903accd4..6029195ba 100644 --- a/src/groups/mqb/mqbu/mqbu_exit.t.cpp +++ b/src/groups/mqb/mqbu/mqbu_exit.t.cpp @@ -16,8 +16,7 @@ // mqbu_exit.t.cpp -*-C++-*- #include -// MWC -#include +#include // SYS #include @@ -42,7 +41,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -100,7 +99,7 @@ static void test1_exitCode_toAscii() // 'ExitCode::toAscii' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("EXIT CODE - TO ASCII"); + bmqtst::TestHelper::printTestName("EXIT CODE - TO ASCII"); struct Test { int d_line; @@ -154,7 +153,7 @@ static void test2_exitCode_fromAscii() // 'ExitCode::fromAscii' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("EXIT CODE - FROM ASCII"); + bmqtst::TestHelper::printTestName("EXIT CODE - FROM ASCII"); struct Test { int d_line; @@ -214,7 +213,7 @@ static void test3_exitCode_print() // 'ExitCode::print' // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("EXIT CODE - PRINT"); + bmqtst::TestHelper::printTestName("EXIT CODE - PRINT"); // 1. struct Test { @@ -246,7 +245,7 @@ static void test3_exitCode_print() << ") == " << test.d_expected); // 1. - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); mqbu::ExitCode::Enum obj( static_cast(test.d_value)); @@ -303,7 +302,7 @@ static void test4_exit_terminate(int argc, char* argv[]) static_cast(terminateReason)); // EXIT } - mwctst::TestHelper::printTestName("EXIT UTIL - TERMINATE"); + bmqtst::TestHelper::printTestName("EXIT UTIL - TERMINATE"); struct Test { int d_line; @@ -394,7 +393,7 @@ static void test5_exit_shutdown() // Ignore global allocation because we create a thread, which allocates // from global. - mwctst::TestHelper::printTestName("EXIT UTIL - SHUTDOWN"); + bmqtst::TestHelper::printTestName("EXIT UTIL - SHUTDOWN"); const int k_MAX_WAIT_SECONDS_AT_SHUTDOWN = 3; @@ -470,7 +469,7 @@ static void test5_exit_shutdown() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -485,5 +484,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbu/mqbu_loadbalancer.t.cpp b/src/groups/mqb/mqbu/mqbu_loadbalancer.t.cpp index b12f3fb39..b5b01d730 100644 --- a/src/groups/mqb/mqbu/mqbu_loadbalancer.t.cpp +++ b/src/groups/mqb/mqbu/mqbu_loadbalancer.t.cpp @@ -19,7 +19,7 @@ #include // TEST DRIVER -#include +#include // CONVENIENCE using namespace BloombergLP; @@ -58,7 +58,7 @@ static void ensureIsBalanced(const mqbu::LoadBalancer& obj) // ---------------------------------------------------------------------------- static void test1_breathingTest() { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); const int k_NUM_PROCESSORS = 3; const int k_NUM_CLIENTS = 13; @@ -118,7 +118,7 @@ static void test1_breathingTest() static void test2_singleProcessorLoadBalancer() { - mwctst::TestHelper::printTestName("SINGLE PROCESSOR LOAD BALANCER"); + bmqtst::TestHelper::printTestName("SINGLE PROCESSOR LOAD BALANCER"); const int k_NUM_PROCESSORS = 1; const int k_NUM_CLIENTS = 10; @@ -147,7 +147,7 @@ static void test2_singleProcessorLoadBalancer() static void test3_loadBalancing() { - mwctst::TestHelper::printTestName("LOAD BALANCING"); + bmqtst::TestHelper::printTestName("LOAD BALANCING"); const int k_INITIAL_CLIENTS_COUNT = 137; mqbu::LoadBalancer obj(5, s_allocator_p); @@ -191,7 +191,7 @@ static void test3_loadBalancing() static void test4_forceAssociate() { - mwctst::TestHelper::printTestName("FORCE_ASSOCIATE"); + bmqtst::TestHelper::printTestName("FORCE_ASSOCIATE"); const int k_NUM_PROCESSORS = 3; mqbu::LoadBalancer obj(k_NUM_PROCESSORS, s_allocator_p); @@ -233,7 +233,7 @@ static void test4_forceAssociate() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -247,5 +247,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbu/mqbu_messageguidutil.cpp b/src/groups/mqb/mqbu/mqbu_messageguidutil.cpp index ce34c558f..960f8991a 100644 --- a/src/groups/mqb/mqbu/mqbu_messageguidutil.cpp +++ b/src/groups/mqb/mqbu/mqbu_messageguidutil.cpp @@ -43,8 +43,8 @@ // The brokerId is the first 5 bytes of the MD5 of {IP + timestamp + PID}. // BMQ -#include -#include +#include +#include // BDE #include @@ -117,7 +117,7 @@ void MessageGUIDUtil::initialize() // Get hostname bsl::string hostname; - ntsa::Error error = mwcio::ResolveUtil::getHostname(&hostname); + ntsa::Error error = bmqio::ResolveUtil::getHostname(&hostname); if (error.code() != ntsa::Error::e_OK) { BALL_LOG_ERROR << "Failed to get local hostname, error: " << error; @@ -127,7 +127,7 @@ void MessageGUIDUtil::initialize() // Get IP ntsa::Ipv4Address defaultIP; - error = mwcio::ResolveUtil::getIpAddress(&defaultIP, hostname); + error = bmqio::ResolveUtil::getIpAddress(&defaultIP, hostname); if (error.code() != ntsa::Error::e_OK) { BALL_LOG_ERROR << "Failed to get IP address of the host '" << hostname << "' error: " << error; @@ -165,7 +165,7 @@ void MessageGUIDUtil::initialize() // NOTE: since we know the size, the `defaultAllocator` will never be // used here bdlma::LocalSequentialAllocator localAllocator(0); - mwcu::MemOutStream os(&localAllocator); + bmqu::MemOutStream os(&localAllocator); bdlb::Print::singleLineHexDump(os, g_brokerId, k_BROKER_ID_LEN_BINARY); bsl::memcpy(g_brokerIdHex, os.str().data(), os.str().length()); @@ -266,7 +266,7 @@ void MessageGUIDUtil::extractFields(int* version, // BrokerId bdlma::LocalSequentialAllocator localAlloc(0); - mwcu::MemOutStream os(&localAlloc); + bmqu::MemOutStream os(&localAlloc); bdlb::Print::singleLineHexDump(os, buffer + k_GUID_VERSION_AND_COUNTER_LEN + sizeof(bdlb::BigEndianInt64), diff --git a/src/groups/mqb/mqbu/mqbu_messageguidutil.t.cpp b/src/groups/mqb/mqbu/mqbu_messageguidutil.t.cpp index 7fca903b6..86c575187 100644 --- a/src/groups/mqb/mqbu/mqbu_messageguidutil.t.cpp +++ b/src/groups/mqb/mqbu/mqbu_messageguidutil.t.cpp @@ -18,11 +18,10 @@ // BMQ #include -#include +#include -// MWC -#include -#include +#include +#include // BDE #include @@ -43,7 +42,7 @@ #include // TEST DRIVER -#include +#include // BENCHMARKING LIBRARY #ifdef BSLS_PLATFORM_OS_LINUX @@ -98,7 +97,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); { // Create a GUID @@ -178,7 +177,7 @@ static void test2_multithread() // 'bslmt::ThreadUtil::create()' uses the global allocator to allocate // memory. - mwctst::TestHelper::printTestName("MULTITHREAD"); + bmqtst::TestHelper::printTestName("MULTITHREAD"); const int k_NUM_THREADS = 10; @@ -194,7 +193,7 @@ static void test2_multithread() // GCC-supported macros for checking MSAN const int k_NUM_GUIDS = 500000; // 500k #else - const int k_NUM_GUIDS = 1000000; // 1M + const int k_NUM_GUIDS = 1000000; // 1M #endif bslmt::ThreadGroup threadGroup(s_allocator_p); @@ -246,14 +245,14 @@ static void test3_print() { s_ignoreCheckDefAlloc = true; - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); PV("Testing printing an unset GUID"); { bmqt::MessageGUID guid; ASSERT_EQ(guid.isUnset(), true); - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); mqbu::MessageGUIDUtil::print(out, guid); ASSERT_EQ(out.str(), "** UNSET **"); } @@ -274,7 +273,7 @@ static void test3_print() // Print and compare const char k_EXPECTED[] = "[version: 1, counter: 5, timerTick: " "297593876864458, brokerId: CE04742D2E]"; - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); mqbu::MessageGUIDUtil::print(out, guid); ASSERT_EQ(out.str(), k_EXPECTED); } @@ -284,7 +283,7 @@ static void test3_print() bmqt::MessageGUID guid; mqbu::MessageGUIDUtil::generateGUID(&guid); - mwcu::MemOutStream out(s_allocator_p); + bmqu::MemOutStream out(s_allocator_p); mqbu::MessageGUIDUtil::print(out, guid); // Extract the BrokerId from the printed string, that is the 10 @@ -316,7 +315,7 @@ static void test4_defaultHashUniqueness() // created upon insertion of objects in the map uses the default // allocator. - mwctst::TestHelper::printTestName("DEFAULT HASH UNIQUENESS"); + bmqtst::TestHelper::printTestName("DEFAULT HASH UNIQUENESS"); #if defined(__has_feature) // Avoid timeout under MemorySanitizer @@ -402,7 +401,7 @@ static void test5_customHashUniqueness() // created upon insertion of objects in the map uses the default // allocator. - mwctst::TestHelper::printTestName("CUSTOM HASH UNIQUENESS"); + bmqtst::TestHelper::printTestName("CUSTOM HASH UNIQUENESS"); #if defined(__has_feature) // Avoid timeout under MemorySanitizer @@ -494,7 +493,7 @@ static void testN1_decode() { s_ignoreCheckDefAlloc = true; // istringstream allocates - mwctst::TestHelper::printTestName("DECODE"); + bmqtst::TestHelper::printTestName("DECODE"); cout << "Please enter the hex representation of a GUID, followed by\n" << " when done (optionally, specify the currentTimerTick as\n" @@ -588,7 +587,7 @@ static void testN2_bdlbPerformance() // Performance of bdlb::Guid generation. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PERFORMANCE"); + bmqtst::TestHelper::printTestName("PERFORMANCE"); const bsls::Types::Int64 k_NUM_GUIDS = 1000000; // 1 million @@ -614,11 +613,11 @@ static void testN2_bdlbPerformance() bsls::Types::Int64 end = bsls::TimeUtil::getTimer(); cout << "Calculated " << k_NUM_GUIDS << " bdlb::Guids in " - << mwcu::PrintUtil::prettyTimeInterval(end - start) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - start) << ".\n" << "Above implies that 1 bdlb::Guid was calculated in " << (end - start) / k_NUM_GUIDS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber((k_NUM_GUIDS * 1000000000) / + << bmqu::PrintUtil::prettyNumber((k_NUM_GUIDS * 1000000000) / (end - start)) << " bdlb::Guids per second." << endl; } @@ -639,7 +638,7 @@ static void testN2_mqbuPerformance() // Performance of the bmqt::MessageGUID generation // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PERFORMANCE"); + bmqtst::TestHelper::printTestName("PERFORMANCE"); const bsls::Types::Int64 k_NUM_GUIDS = 1000000; // 1 million @@ -664,11 +663,11 @@ static void testN2_mqbuPerformance() bsls::Types::Int64 end = bsls::TimeUtil::getTimer(); cout << "Calculated " << k_NUM_GUIDS << " bdlb::Guids in " - << mwcu::PrintUtil::prettyTimeInterval(end - start) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - start) << ".\n" << "Above implies that 1 bdlb::Guid was calculated in " << (end - start) / k_NUM_GUIDS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber((k_NUM_GUIDS * 1000000000) / + << bmqu::PrintUtil::prettyNumber((k_NUM_GUIDS * 1000000000) / (end - start)) << " bdlb::Guids per second." << endl; } @@ -687,7 +686,7 @@ BSLA_MAYBE_UNUSED static void testN3_defaultHashBenchmark() // NA // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("DEFAULT HASH BENCHMARK"); const size_t k_NUM_ITERATIONS = 10000000; // 10M bsl::hash hasher; // same as: bslh::Hash<> hasher; @@ -701,11 +700,11 @@ BSLA_MAYBE_UNUSED static void testN3_defaultHashBenchmark() bsls::Types::Int64 end = bsls::TimeUtil::getTimer(); cout << "Calculated " << k_NUM_ITERATIONS << " default hashes of the GUID" - << " in " << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << " in " << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 hash of the GUID was calculated in " << (end - begin) / k_NUM_ITERATIONS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ITERATIONS * 1000000000) / (end - begin))) << " hashes per second." << endl; } @@ -725,7 +724,7 @@ static void testN4_customHashBenchmark() // NA // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CUSTOM HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("CUSTOM HASH BENCHMARK"); const size_t k_NUM_ITERATIONS = 10000000; // 10M bslh::Hash hasher; @@ -739,11 +738,11 @@ static void testN4_customHashBenchmark() bsls::Types::Int64 end = bsls::TimeUtil::getTimer(); cout << "Calculated " << k_NUM_ITERATIONS << " custom hashes of the GUID" - << "in " << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << "in " << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 hash of the GUID was calculated in " << (end - begin) / k_NUM_ITERATIONS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ITERATIONS * 1000000000) / (end - begin))) << " hashes per second." << endl; } @@ -758,7 +757,7 @@ BSLA_MAYBE_UNUSED static void testN5_hashTableWithDefaultHashBenchmark() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HASH TABLE w/ DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("HASH TABLE w/ DEFAULT HASH BENCHMARK"); const size_t k_NUM_ELEMS = 10000000; // 10M bmqt::MessageGUID guid; @@ -782,11 +781,11 @@ BSLA_MAYBE_UNUSED static void testN5_hashTableWithDefaultHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in hashtable using " << "default hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second." << endl; } @@ -801,7 +800,7 @@ BSLA_MAYBE_UNUSED static void testN6_hashTableWithCustomHashBenchmark() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HASH TABLE w/ CUSTOM HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("HASH TABLE w/ CUSTOM HASH BENCHMARK"); const size_t k_NUM_ELEMS = 10000000; // 10M bmqt::MessageGUID guid; @@ -829,11 +828,11 @@ BSLA_MAYBE_UNUSED static void testN6_hashTableWithCustomHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in hashtable using " << "custom hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second." << endl; } @@ -848,12 +847,12 @@ BSLA_MAYBE_UNUSED static void testN7_orderedMapWithDefaultHashBenchmark() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ORDERED MAP DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("ORDERED MAP DEFAULT HASH BENCHMARK"); const size_t k_NUM_ELEMS = 10000000; // 10M bmqt::MessageGUID guid; - mwcc::OrderedHashMap ht(k_NUM_ELEMS, + bmqc::OrderedHashMap ht(k_NUM_ELEMS, s_allocator_p); // Warmup for (size_t i = 1; i <= 1000; ++i) { @@ -872,11 +871,11 @@ BSLA_MAYBE_UNUSED static void testN7_orderedMapWithDefaultHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in ordered map using " << "default hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second." << endl; } @@ -891,12 +890,12 @@ BSLA_MAYBE_UNUSED static void testN8_orderedMapWithCustomHashBenchmark() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ORDERED MAP CUSTOM HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("ORDERED MAP CUSTOM HASH BENCHMARK"); const size_t k_NUM_ELEMS = 10000000; // 10M bmqt::MessageGUID guid; - mwcc::OrderedHashMap > ht(k_NUM_ELEMS, s_allocator_p); @@ -918,11 +917,11 @@ BSLA_MAYBE_UNUSED static void testN8_orderedMapWithCustomHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in ordered map using " << "custom hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second." << endl; } @@ -952,7 +951,7 @@ static void testN1_decode_GoogleBenchmark(benchmark::State& state) state.PauseTiming(); s_ignoreCheckDefAlloc = true; // istringstream allocates - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK DECODE"); + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK DECODE"); cout << "Please enter the hex representation of a GUID, followed by\n" << " when done (optionally, specify the currentTimerTick " @@ -1051,7 +1050,7 @@ static void testN2_mqbuPerformance_GoogleBenchmark(benchmark::State& state) // Performance of the bmqt::MessageGUID generation // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE"); + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE"); // ---------------------------- // bmqt::MessageGUID generation @@ -1088,7 +1087,7 @@ static void testN2_bdlbPerformance_GoogleBenchmark(benchmark::State& state) // Performance of the bdlb::GUID generation // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE"); + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK PERFORMANCE"); // Warm the cache for (int i = 0; i < 1000; ++i) { bdlb::Guid guid; @@ -1120,7 +1119,7 @@ testN3_defaultHashBenchmark_GoogleBenchmark(benchmark::State& state) // NA // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "GOOGLE BENCHMARK DEFAULT HASH BENCHMARK"); bsl::hash hasher; // same as: bslh::Hash<> hasher; @@ -1147,7 +1146,7 @@ static void testN4_customHashBenchmark_GoogleBenchmark(benchmark::State& state) // NA // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName( + bmqtst::TestHelper::printTestName( "GOOGLE BENCHMARK CUSTOM HASH BENCHMARK"); bslh::Hash hasher; @@ -1171,7 +1170,7 @@ static void testN5_hashTableWithDefaultHashBenchmark_GoogleBenchmark( // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK HASH TABLE " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK HASH TABLE " "w/ DEFAULT HASH BENCHMARK"); bmqt::MessageGUID guid; @@ -1204,7 +1203,7 @@ static void testN6_hashTableWithCustomHashBenchmark_GoogleBenchmark( // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK HASH TABLE " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK HASH TABLE " "w/ CUSTOM HASH BENCHMARK"); bmqt::MessageGUID guid; @@ -1242,12 +1241,12 @@ static void testN7_orderedMapWithDefaultHashBenchmark_GoogleBenchmark( // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK ORDERED MAP " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK ORDERED MAP " "DEFAULT HASH BENCHMARK"); bmqt::MessageGUID guid; - mwcc::OrderedHashMap ht(state.range(0), + bmqc::OrderedHashMap ht(state.range(0), s_allocator_p); // Warmup for (size_t i = 1; i <= 1000; ++i) { @@ -1276,12 +1275,12 @@ static void testN8_orderedMapWithCustomHashBenchmark_GoogleBenchmark( // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("GOOGLE BENCHMARK ORDERED MAP " + bmqtst::TestHelper::printTestName("GOOGLE BENCHMARK ORDERED MAP " "CUSTOM HASH BENCHMARK"); bmqt::MessageGUID guid; - mwcc::OrderedHashMap > ht(state.range(0), s_allocator_p); @@ -1315,7 +1314,7 @@ int main(int argc, char* argv[]) bsls::TimeUtil::initialize(); mqbu::MessageGUIDUtil::initialize(); - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -1326,50 +1325,50 @@ int main(int argc, char* argv[]) case 1: test1_breathingTest(); break; case -1: testN1_decode(); break; case -2: - MWC_BENCHMARK_WITH_ARGS(testN2_bdlbPerformance, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); - MWC_BENCHMARK_WITH_ARGS(testN2_mqbuPerformance, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN2_bdlbPerformance, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN2_mqbuPerformance, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -3: - MWC_BENCHMARK_WITH_ARGS(testN3_defaultHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN3_defaultHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -4: - MWC_BENCHMARK_WITH_ARGS(testN4_customHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN4_customHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -5: - MWC_BENCHMARK_WITH_ARGS(testN5_hashTableWithDefaultHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN5_hashTableWithDefaultHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -6: - MWC_BENCHMARK_WITH_ARGS(testN6_hashTableWithCustomHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN6_hashTableWithCustomHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -7: - MWC_BENCHMARK_WITH_ARGS(testN7_orderedMapWithDefaultHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN7_orderedMapWithDefaultHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -8: - MWC_BENCHMARK_WITH_ARGS(testN8_orderedMapWithCustomHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN8_orderedMapWithCustomHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; default: { cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; @@ -1383,7 +1382,7 @@ int main(int argc, char* argv[]) } #endif - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } // ---------------------------------------------------------------------------- diff --git a/src/groups/mqb/mqbu/mqbu_resourceusagemonitor.cpp b/src/groups/mqb/mqbu/mqbu_resourceusagemonitor.cpp index 31d5105a9..82901c5f9 100644 --- a/src/groups/mqb/mqbu/mqbu_resourceusagemonitor.cpp +++ b/src/groups/mqb/mqbu/mqbu_resourceusagemonitor.cpp @@ -17,8 +17,8 @@ #include #include -// MWC -#include + +#include // BDE #include @@ -497,27 +497,25 @@ bsl::ostream& ResourceUsageMonitor::print(bsl::ostream& stream, int level, int spacesPerLevel) const { - stream << mwcu::PrintUtil::newlineAndIndent(level, spacesPerLevel) - << state() << " " - << "[Messages (" << messageState() - << "): " << mwcu::PrintUtil::prettyNumber(messages()) << " (" - << mwcu::PrintUtil::prettyNumber(static_cast( + stream << bmqu::PrintUtil::newlineAndIndent(level, spacesPerLevel) + << state() << " " << "[Messages (" << messageState() + << "): " << bmqu::PrintUtil::prettyNumber(messages()) << " (" + << bmqu::PrintUtil::prettyNumber(static_cast( d_messages.lowWatermarkRatio() * d_messages.capacity())) << " - " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( d_messages.highWatermarkRatio() * d_messages.capacity())) - << " - " << mwcu::PrintUtil::prettyNumber(d_messages.capacity()) - << "), " - << "Bytes (" << byteState() - << "): " << mwcu::PrintUtil::prettyBytes(bytes()) << " (" - << mwcu::PrintUtil::prettyBytes(d_bytes.lowWatermarkRatio() * + << " - " << bmqu::PrintUtil::prettyNumber(d_messages.capacity()) + << "), " << "Bytes (" << byteState() + << "): " << bmqu::PrintUtil::prettyBytes(bytes()) << " (" + << bmqu::PrintUtil::prettyBytes(d_bytes.lowWatermarkRatio() * d_bytes.capacity(), 2) << " - " - << mwcu::PrintUtil::prettyBytes(d_bytes.highWatermarkRatio() * + << bmqu::PrintUtil::prettyBytes(d_bytes.highWatermarkRatio() * d_bytes.capacity(), 2) - << " - " << mwcu::PrintUtil::prettyBytes(d_bytes.capacity()) + << " - " << bmqu::PrintUtil::prettyBytes(d_bytes.capacity()) << ")] "; return stream; diff --git a/src/groups/mqb/mqbu/mqbu_resourceusagemonitor.t.cpp b/src/groups/mqb/mqbu/mqbu_resourceusagemonitor.t.cpp index a9ff607e4..a9c67dfd3 100644 --- a/src/groups/mqb/mqbu/mqbu_resourceusagemonitor.t.cpp +++ b/src/groups/mqb/mqbu/mqbu_resourceusagemonitor.t.cpp @@ -17,10 +17,10 @@ #include // TEST DRIVER -#include +#include // BMQ -#include +#include // BDE #include @@ -312,7 +312,7 @@ static void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); // 1 ASSERT_LT(mqbu::ResourceUsageMonitorState::e_STATE_NORMAL, @@ -519,7 +519,7 @@ static void test2_zeroCapacity() // messageCapacity or byteCapacity is zero. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("UPDATE ONE RESOURCE"); + bmqtst::TestHelper::printTestName("UPDATE ONE RESOURCE"); // 1 Create an instance with zero messageCapacity and zero byteCapacity mqbu::ResourceUsageMonitor obj(0, 0, 0, 0, 0, 0); @@ -585,7 +585,7 @@ static void test3_updateOneResource() // - updateMessages(bsls::Types::Int64 delta) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("UPDATE ONE RESOURCE"); + bmqtst::TestHelper::printTestName("UPDATE ONE RESOURCE"); // TYPES typedef mqbu::ResourceUsageMonitorStateTransition RUMStateTransition; @@ -904,7 +904,7 @@ static void test4_updateBothResources() // bsls::Types::Int64 deltaMessages) // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("UPDATE BOTH RESOURCES"); + bmqtst::TestHelper::printTestName("UPDATE BOTH RESOURCES"); // TYPES typedef mqbu::ResourceUsageMonitorStateTransition RUMStateTransition; @@ -1378,7 +1378,7 @@ static void test5_stateOneResource() // - messageState() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("STATE ONE RESOURCE"); + bmqtst::TestHelper::printTestName("STATE ONE RESOURCE"); // TYPES typedef mqbu::ResourceUsageMonitorState RUMState; @@ -1806,7 +1806,7 @@ static void test6_stateBothResources() // - state() // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("STATE BOTH RESOURCES"); + bmqtst::TestHelper::printTestName("STATE BOTH RESOURCES"); // TYPES typedef mqbu::ResourceUsageMonitorState RUMState; @@ -2148,7 +2148,7 @@ static void test6_stateBothResources() static void test7_jumpingStates() { - mwctst::TestHelper::printTestName("JUMPING STATES"); + bmqtst::TestHelper::printTestName("JUMPING STATES"); // LOW_WATERMARK < HIGH_WATERMARK and HIGH_WATERMARK < CAPACITY bsls::Types::Int64 k_BYTE_LOW_WATERMARK = 5; @@ -2276,7 +2276,7 @@ static void test8_zeroWatermarksUpdate() // 'update' with low, high, and capacity watermark values all equal to 0. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("EQUAL WATERMARKS UPDATE"); + bmqtst::TestHelper::printTestName("EQUAL WATERMARKS UPDATE"); // 1. Instantiate a ResourceUsageMonitor with equal low, high, and capacity // watermarks. @@ -2375,7 +2375,7 @@ static void test9_print() // int spacesPerLevel = 4) const; // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("PRINT"); + bmqtst::TestHelper::printTestName("PRINT"); // 1 { @@ -2468,7 +2468,7 @@ static void test9_print() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; bsl::string ascii(s_allocator_p); - mwcu::MemOutStream ss(s_allocator_p); + bmqu::MemOutStream ss(s_allocator_p); PVV(test.d_line << ": checking 'RUMState::print(ostream, " << "RUMState::e_" << test.d_expected @@ -2517,7 +2517,7 @@ static void test9_print() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; - mwcu::MemOutStream ss(s_allocator_p); + bmqu::MemOutStream ss(s_allocator_p); PVV(test.d_line << ": checking 'RUMStateTransition::print(ostream" << ", RUMStateTransition::e_" << test.d_expected @@ -2638,7 +2638,7 @@ static void test9_print() for (size_t idx = 0; idx < k_NUM_DATA; ++idx) { const Test& test = k_DATA[idx]; - mwcu::MemOutStream ss(s_allocator_p); + bmqu::MemOutStream ss(s_allocator_p); PVV(test.d_line << ": checking 'monitor.print(ostream)'"); @@ -2721,7 +2721,7 @@ static void test10_usageExample() // Usage example // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("USAGE EXAMPLE"); + bmqtst::TestHelper::printTestName("USAGE EXAMPLE"); // First, create the monitor. @@ -2791,7 +2791,7 @@ static void test10_usageExample() int main(int argc, char* argv[]) { - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -2811,5 +2811,5 @@ int main(int argc, char* argv[]) } break; } - TEST_EPILOG(mwctst::TestHelper::e_CHECK_DEF_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_DEF_GBL_ALLOC); } diff --git a/src/groups/mqb/mqbu/mqbu_storagekey.h b/src/groups/mqb/mqbu/mqbu_storagekey.h index 3307cfdb3..7c0f0bf26 100644 --- a/src/groups/mqb/mqbu/mqbu_storagekey.h +++ b/src/groups/mqb/mqbu/mqbu_storagekey.h @@ -387,7 +387,7 @@ StorageKeyHashAlgo::operator()(const void* data, { // 10K Keys // -------- - // o With 'mwcc::OrderedHashMap': Average of 17M insertions per second + // o With 'bmqc::OrderedHashMap': Average of 17M insertions per second // (compared to average of 12M insertions // per second using the default hash) diff --git a/src/groups/mqb/mqbu/mqbu_storagekey.t.cpp b/src/groups/mqb/mqbu/mqbu_storagekey.t.cpp index 16dadc4d6..67c6ccb39 100644 --- a/src/groups/mqb/mqbu/mqbu_storagekey.t.cpp +++ b/src/groups/mqb/mqbu/mqbu_storagekey.t.cpp @@ -19,13 +19,12 @@ // MQB #include -// MWC -#include -#include -#include +#include +#include +#include // TEST DRIVER -#include +#include // BDE #include @@ -115,7 +114,7 @@ void test1_breathingTest() // Basic functionality // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("BREATHING TEST"); + bmqtst::TestHelper::printTestName("BREATHING TEST"); PV("Test some invalid StorageKeys"); mqbu::StorageKey s1; ASSERT_EQ(true, s1.isNull()); @@ -238,14 +237,14 @@ void test1_breathingTest() void test2_streamout() { - mwctst::TestHelper::printTestName("STREAM OUT"); + bmqtst::TestHelper::printTestName("STREAM OUT"); // Create StorageKey from valid hex rep const char k_HEX[] = "0123456789"; mqbu::StorageKey s1(mqbu::StorageKey::HexRepresentation(), k_HEX); - mwcu::MemOutStream osstr(s_allocator_p); + bmqu::MemOutStream osstr(s_allocator_p); osstr << s1; bsl::string storageKeyStr(k_HEX, s_allocator_p); @@ -271,7 +270,7 @@ void test3_defaultHashUniqueness() // Hash uniqueness of the generated StorageKeys. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("DEFAULT HASH UNIQUENESS"); + bmqtst::TestHelper::printTestName("DEFAULT HASH UNIQUENESS"); s_ignoreCheckDefAlloc = true; // Because there is no emplace on unordered_map, the temporary list @@ -356,7 +355,7 @@ void test4_customHashUniqueness() // Hash uniqueness of the generated StorageKeys. // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CUSTOM HASH UNIQUENESS"); + bmqtst::TestHelper::printTestName("CUSTOM HASH UNIQUENESS"); s_ignoreCheckDefAlloc = true; // Because there is no emplace on unordered_map, the temporary list @@ -443,7 +442,7 @@ void testN1_defaultHashBenchmark() // NA // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("DEFAULT HASH BENCHMARK"); const size_t k_NUM_ITERATIONS = 10000000; // 10M bsl::hash hasher; // same as: bslh::Hash<> hasher; @@ -463,11 +462,11 @@ void testN1_defaultHashBenchmark() cout << "Calculated " << k_NUM_ITERATIONS << " default hashes of the" << " StorageKey in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 hash of the StorageKey was calculated in " << (end - begin) / k_NUM_ITERATIONS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ITERATIONS * 1000000000) / (end - begin))) << " hashes per second." << endl; } @@ -487,7 +486,7 @@ void testN2_customHashBenchmark() // NA // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CUSTOM HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("CUSTOM HASH BENCHMARK"); const size_t k_NUM_ITERATIONS = 10000000; // 10M bslh::Hash hasher; @@ -507,11 +506,11 @@ void testN2_customHashBenchmark() cout << "Calculated " << k_NUM_ITERATIONS << " custom hashes of the" << " StorageKey in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 hash of the StorageKey was calculated in " << (end - begin) / k_NUM_ITERATIONS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ITERATIONS * 1000000000) / (end - begin))) << " hashes per second." << endl; } @@ -527,7 +526,7 @@ void testN3_hashTableWithDefaultHashBenchmark() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HASH TABLE w/ DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("HASH TABLE w/ DEFAULT HASH BENCHMARK"); typedef bsl::unordered_set::const_iterator CITER; @@ -550,11 +549,11 @@ void testN3_hashTableWithDefaultHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in hashtable using " << "default hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second." << endl; } @@ -570,7 +569,7 @@ void testN4_hashTableWithCustomHashBenchmark() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HASH TABLE w/ CUSTOM HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("HASH TABLE w/ CUSTOM HASH BENCHMARK"); typedef bsl::unordered_set::const_iterator CITER; @@ -596,11 +595,11 @@ void testN4_hashTableWithCustomHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in hashtable using " << "custom hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second." << endl; } @@ -616,7 +615,7 @@ void testN5_orderedMapWithDefaultHashBenchmark() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ORDERED MAP DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("ORDERED MAP DEFAULT HASH BENCHMARK"); typedef bsl::unordered_set::const_iterator CITER; @@ -625,7 +624,7 @@ void testN5_orderedMapWithDefaultHashBenchmark() generateStorageKeys(&keySet, k_NUM_ELEMS); - mwcc::OrderedHashMap ht(16843, s_allocator_p); + bmqc::OrderedHashMap ht(16843, s_allocator_p); int i = 1; // Warmup @@ -647,11 +646,11 @@ void testN5_orderedMapWithDefaultHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in ordered map using " << "default hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second." << endl; } @@ -667,7 +666,7 @@ void testN6_orderedMapWithCustomHashBenchmark() // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ORDERED MAP Custom HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("ORDERED MAP Custom HASH BENCHMARK"); typedef bsl::unordered_set::const_iterator CITER; @@ -676,7 +675,7 @@ void testN6_orderedMapWithCustomHashBenchmark() generateStorageKeys(&keySet, k_NUM_ELEMS); - mwcc::OrderedHashMap > ht(16843, s_allocator_p); @@ -701,11 +700,11 @@ void testN6_orderedMapWithCustomHashBenchmark() cout << "Inserted " << k_NUM_ELEMS << " elements in ordered map using " << "default hash algorithm in " - << mwcu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" + << bmqu::PrintUtil::prettyTimeInterval(end - begin) << ".\n" << "Above implies that 1 element was inserted in " << (end - begin) / k_NUM_ELEMS << " nano seconds.\n" << "In other words: " - << mwcu::PrintUtil::prettyNumber(static_cast( + << bmqu::PrintUtil::prettyNumber(static_cast( (k_NUM_ELEMS * 1000000000) / (end - begin))) << " insertions per second." << endl; } @@ -727,7 +726,7 @@ testN1_defaultHashBenchmark_GoogleBenchmark(benchmark::State& state) // NA // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("DEFAULT HASH BENCHMARK"); const size_t k_NUM_ITERATIONS = state.range(0); // 10M bsl::hash hasher; // same as: bslh::Hash<> hasher; @@ -758,7 +757,7 @@ static void testN2_customHashBenchmark_GoogleBenchmark(benchmark::State& state) // NA // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("CUSTOM HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("CUSTOM HASH BENCHMARK"); const size_t k_NUM_ITERATIONS = state.range(0); bslh::Hash hasher; @@ -788,7 +787,7 @@ static void testN3_hashTableWithDefaultHashBenchmark_GoogleBenchmark( // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HASH TABLE w/ DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("HASH TABLE w/ DEFAULT HASH BENCHMARK"); typedef bsl::unordered_set::const_iterator CITER; @@ -821,7 +820,7 @@ static void testN4_hashTableWithCustomHashBenchmark_GoogleBenchmark( // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("HASH TABLE w/ CUSTOM HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("HASH TABLE w/ CUSTOM HASH BENCHMARK"); typedef bsl::unordered_set::const_iterator CITER; @@ -856,7 +855,7 @@ static void testN5_orderedMapWithDefaultHashBenchmark_GoogleBenchmark( // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ORDERED MAP DEFAULT HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("ORDERED MAP DEFAULT HASH BENCHMARK"); typedef bsl::unordered_set::const_iterator CITER; @@ -865,7 +864,7 @@ static void testN5_orderedMapWithDefaultHashBenchmark_GoogleBenchmark( generateStorageKeys(&keySet, k_NUM_ELEMS); - mwcc::OrderedHashMap ht(16843, s_allocator_p); + bmqc::OrderedHashMap ht(16843, s_allocator_p); int i = 1; // Warmup @@ -896,7 +895,7 @@ static void testN6_orderedMapWithCustomHashBenchmark_GoogleBenchmark( // // ------------------------------------------------------------------------ { - mwctst::TestHelper::printTestName("ORDERED MAP Custom HASH BENCHMARK"); + bmqtst::TestHelper::printTestName("ORDERED MAP Custom HASH BENCHMARK"); typedef bsl::unordered_set::const_iterator CITER; @@ -905,7 +904,7 @@ static void testN6_orderedMapWithCustomHashBenchmark_GoogleBenchmark( generateStorageKeys(&keySet, k_NUM_ELEMS); - mwcc::OrderedHashMap > ht(16843, s_allocator_p); @@ -941,7 +940,7 @@ int main(int argc, char* argv[]) { bsls::TimeUtil::initialize(); - TEST_PROLOG(mwctst::TestHelper::e_DEFAULT); + TEST_PROLOG(bmqtst::TestHelper::e_DEFAULT); switch (_testCase) { case 0: @@ -950,36 +949,36 @@ int main(int argc, char* argv[]) case 2: test2_streamout(); break; case 1: test1_breathingTest(); break; case -1: - MWC_BENCHMARK_WITH_ARGS(testN1_defaultHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN1_defaultHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -2: - MWC_BENCHMARK_WITH_ARGS(testN2_customHashBenchmark, - RangeMultiplier(10) - ->Range(10, 10000000) - ->Unit(benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN2_customHashBenchmark, + RangeMultiplier(10) + ->Range(10, 10000000) + ->Unit(benchmark::kMillisecond)); break; case -3: - MWC_BENCHMARK_WITH_ARGS(testN3_hashTableWithDefaultHashBenchmark, - RangeMultiplier(10)->Range(10, 10000)->Unit( - benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN3_hashTableWithDefaultHashBenchmark, + RangeMultiplier(10)->Range(10, 10000)->Unit( + benchmark::kMillisecond)); break; case -4: - MWC_BENCHMARK_WITH_ARGS(testN4_hashTableWithCustomHashBenchmark, - RangeMultiplier(10)->Range(10, 10000)->Unit( - benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN4_hashTableWithCustomHashBenchmark, + RangeMultiplier(10)->Range(10, 10000)->Unit( + benchmark::kMillisecond)); break; case -5: - MWC_BENCHMARK_WITH_ARGS(testN5_orderedMapWithDefaultHashBenchmark, - RangeMultiplier(10)->Range(10, 10000)->Unit( - benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN5_orderedMapWithDefaultHashBenchmark, + RangeMultiplier(10)->Range(10, 10000)->Unit( + benchmark::kMillisecond)); break; case -6: - MWC_BENCHMARK_WITH_ARGS(testN6_orderedMapWithCustomHashBenchmark, - RangeMultiplier(10)->Range(10, 10000)->Unit( - benchmark::kMillisecond)); + BMQTST_BENCHMARK_WITH_ARGS(testN6_orderedMapWithCustomHashBenchmark, + RangeMultiplier(10)->Range(10, 10000)->Unit( + benchmark::kMillisecond)); break; default: { cerr << "WARNING: CASE '" << _testCase << "' NOT FOUND." << endl; @@ -993,7 +992,7 @@ int main(int argc, char* argv[]) } #endif - TEST_EPILOG(mwctst::TestHelper::e_CHECK_GBL_ALLOC); + TEST_EPILOG(bmqtst::TestHelper::e_CHECK_GBL_ALLOC); } // ---------------------------------------------------------------------------- diff --git a/src/groups/mwc/CMakeLists.txt b/src/groups/mwc/CMakeLists.txt deleted file mode 100644 index 48cbe20c9..000000000 --- a/src/groups/mwc/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -# mwc -# --- - -if(NOT BMQ_TARGET_MWC_NEEDED) - return() -endif() - -add_library(mwc) - -if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU|(Apple)?Clang") - # NOTE: The followings are using the 'deprecated' COMPILE_FLAGS property and - # not COMPILE_OPTIONS because the later doesn't seem to work for a - # 'SOURCE' target. - set_property(SOURCE "mwcc/test/mwcc_array.t.cpp" - APPEND - PROPERTY COMPILE_FLAGS "-Wno-self-assign-overloaded") - set_property(SOURCE "mwcc/mwcc_monitoredqueue.cpp" - APPEND - PROPERTY COMPILE_FLAGS "-Wno-unused-macros") - set_property(SOURCE "mwcu/test/mwcu_weakmemfn.t.cpp" - APPEND - PROPERTY COMPILE_FLAGS "-Wno-ignored-qualifiers") -endif() - -target_bmq_style_uor(mwc) diff --git a/src/groups/mwc/doc/mwc.txt b/src/groups/mwc/doc/mwc.txt deleted file mode 100644 index c67768dd9..000000000 --- a/src/groups/mwc/doc/mwc.txt +++ /dev/null @@ -1,61 +0,0 @@ - mwc.txt - -@PURPOSE: Low level generic components. - -@MNEMONIC: MiddleWare Core (mwc) - -@DESCRIPTION: MiddleWare Core (package group 'mwc') is a library containing low -level generic components to be reused through various applications. - -/Hierarchical Synopsis -/--------------------- -The 'mwc' group library currently has 10 packages forming 5 levels of physical -dependency. -.. - 5. mwcio - mwctsk - - 4. mwcex - - 3. mwcc - mwcsys - - 2. mwcma - mwct - mwctst - mwcu - - 1. mwcscm -.. - -/Package Synopsis -/------------------ -: 'mwcc': -: Provide container vocabulary types. -: -: 'mwcex': -: Provide executors and other async programming utilities and mechanisms. -: -: 'mwcio': -: Provide network related components for input/output. -: -: 'mwcma': -: Provide allocators and other memory-management utilities. -: -: 'mwcscm': -: Provide versioning information for library components in 'mwc'. -: -: 'mwcsys': -: Provide systems utilities and mechanisms. -: -: 'mwctst': -: Provide macros and utilities to assist writing test drivers. -: -: 'mwctsk': -: Provide application level mechanisms. -: -: 'mwct': -: Provide value-semantic vocabulary types. -: -: 'mwcu': -: Provide utility components and mechanisms. diff --git a/src/groups/mwc/group/mwc.dep b/src/groups/mwc/group/mwc.dep deleted file mode 100644 index c532c05ae..000000000 --- a/src/groups/mwc/group/mwc.dep +++ /dev/null @@ -1,4 +0,0 @@ -bal -bdl -bsl -ntc diff --git a/src/groups/mwc/group/mwc.mem b/src/groups/mwc/group/mwc.mem deleted file mode 100644 index 8db8cc676..000000000 --- a/src/groups/mwc/group/mwc.mem +++ /dev/null @@ -1,12 +0,0 @@ -mwcc -mwcex -mwcio -mwcma -mwcscm -mwcst -mwcstm -mwcsys -mwct -mwctsk -mwctst -mwcu diff --git a/src/groups/mwc/group/mwc.t.dep b/src/groups/mwc/group/mwc.t.dep deleted file mode 100644 index 2f1f34bb8..000000000 --- a/src/groups/mwc/group/mwc.t.dep +++ /dev/null @@ -1,2 +0,0 @@ -benchmark -mwc diff --git a/src/groups/mwc/mwcc/package/mwcc.dep b/src/groups/mwc/mwcc/package/mwcc.dep deleted file mode 100644 index 6b4ca90e8..000000000 --- a/src/groups/mwc/mwcc/package/mwcc.dep +++ /dev/null @@ -1,2 +0,0 @@ -mwcscm -mwcu diff --git a/src/groups/mwc/mwcc/package/mwcc.mem b/src/groups/mwc/mwcc/package/mwcc.mem deleted file mode 100644 index 078ebf30e..000000000 --- a/src/groups/mwc/mwcc/package/mwcc.mem +++ /dev/null @@ -1,10 +0,0 @@ -mwcc_array -mwcc_monitoredqueue -mwcc_monitoredqueue_bdlccfixedqueue -mwcc_monitoredqueue_bdlccsingleconsumerqueue -mwcc_monitoredqueue_bdlccsingleproducerqueue -mwcc_multiqueuethreadpool -mwcc_orderedhashmap -mwcc_orderedhashmapwithhistory -mwcc_orderedhashset -mwcc_twokeyhashmap diff --git a/src/groups/mwc/mwcex/mwcex_promise_cpp03.cpp b/src/groups/mwc/mwcex/mwcex_promise_cpp03.cpp deleted file mode 100644 index a1caa9b2e..000000000 --- a/src/groups/mwc/mwcex/mwcex_promise_cpp03.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2022-2023 Bloomberg Finance L.P. -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// mwcex_promise_cpp03.cpp -*-C++-*- - -// Automatically generated file. **DO NOT EDIT** - -// Generated on Thu Jul 14 05:52:21 2022 -// Command line: sim_cpp11_features.pl mwcex_promise.cpp - -#define INCLUDED_MWCEX_PROMISE_CPP03 // Disable inclusion -#include // Pro-forma #include - -// Empty file except when compiling mwcex_promise.cpp -#ifdef COMPILING_MWCEX_PROMISE_CPP - -// No C++03 Expansion - -#endif // defined(COMPILING_MWCEX_PROMISE_CPP) - -// ---------------------------------------------------------------------------- -// Copyright 2022-2023 Bloomberg Finance L.P. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ----------------------------- END-OF-FILE ---------------------------------- diff --git a/src/groups/mwc/mwcex/package/mwcex.dep b/src/groups/mwc/mwcex/package/mwcex.dep deleted file mode 100644 index b9ccfd729..000000000 --- a/src/groups/mwc/mwcex/package/mwcex.dep +++ /dev/null @@ -1,3 +0,0 @@ -mwcscm -mwcsys -mwcu diff --git a/src/groups/mwc/mwcex/package/mwcex.mem b/src/groups/mwc/mwcex/package/mwcex.mem deleted file mode 100644 index faf5f25e9..000000000 --- a/src/groups/mwc/mwcex/package/mwcex.mem +++ /dev/null @@ -1,20 +0,0 @@ -mwcex_bdlmteventschedulerexecutor -mwcex_bdlmtfixedthreadpoolexecutor -mwcex_bdlmtmultiprioritythreadpoolexecutor -mwcex_bdlmtmultiqueuethreadpoolexecutor -mwcex_bdlmtthreadpoolexecutor -mwcex_bindutil -mwcex_bindutil_cpp03 -mwcex_executionpolicy -mwcex_executionproperty -mwcex_executionutil -mwcex_executor -mwcex_executortraits -mwcex_future -mwcex_future_cpp03 -mwcex_job -mwcex_promise -mwcex_promise_cpp03 -mwcex_sequentialcontext -mwcex_strand -mwcex_systemexecutor diff --git a/src/groups/mwc/mwcio/doc/mwcio.txt b/src/groups/mwc/mwcio/doc/mwcio.txt deleted file mode 100644 index 5cbfc9506..000000000 --- a/src/groups/mwc/mwcio/doc/mwcio.txt +++ /dev/null @@ -1,84 +0,0 @@ - mwcio.txt - -@PURPOSE: Provide network related components.. - -@MNEMONIC: MiddleWare Core IO (mwcio) - -@DESCRIPTION: This package provides interfaces and concrete implementations related to TCP communication. - -/Hierarchical Synopsis -/--------------------- -The 'mwcio' package currently has 13 components having 5 levels of physical -dependency. The list below shows the hierarchal ordering of the components. -.. - 5. mwcio_tcpchannelfactory - - 4. mwcio_resolvingchannelfactory - mwcio_tcpchannel - - 3. mwcio_basechannelpartialimp - mwcio_decoratingchannelpartialimp - mwcio_reconnectingchannelfactory - mwcio_testchannel - mwcio_testchannelfactory - - 2. mwcio_channel - mwcio_channelfactory - - 1. mwcio_connectoptions - mwcio_listenoptions - mwcio_status -.. - -/Component Synopsis -/------------------ -: 'mwcio_basechannelpartialimp': -: Provide a partial 'Channel' imp for a 'base' channel -: -: 'mwcio_channel': -: Provide a pure protocol for a bi-directional async channel. -: -: 'mwcio_channelfactory': -: Provide a protocol for a 'mwcio::Channel' factory. -: -: 'mwcio_channelutil': -: Provide utility functions related to channel manipulation. -: -: 'mwcio_connectoptions': -: Provide a type encapsulating options for 'ChannelFactory::connect'. -: -: 'mwcio_decoratingchannelpartialimp': -: Provide a partial imp of 'mwcio::Channel' for decorating channels. -: -: 'mwcio_listenoptions': -: Provide a type encapsulating options for 'ChannelFactory::listen'. -: -: 'mwcio_reconnectingchannelfactory': -: Provide an auto-reconnecting ChannelFactory decorator. -: -: 'mwcio_resolvingchannelfactory': -: Provide a 'ChannelFactory' that resolves the URIs of its channels. -: -: 'mwcio_statchannel': -: Provide a 'mwcio::Channel' that collects stats. -: -: 'mwcio_statchannelfactory': -: Provide a ChannelFactory decorator for channels collecting stats. -: -: 'mwcio_status': -: Provide an object representing the result of an I/O operation. -: -: 'mwcio_tcpchannel': -: Provide a 'mwcio::Channel' using a 'btemt_ChannelPoolChannel'. -: -: 'mwcio_tcpchannelfactory': -: Provide a 'mwcio::ChannelFactory' using a 'btemt::ChannelPool'. -: -: 'mwcio_tcpendpoint': -: Provide Value-semantic type representing endpoints for 'mwcio' channels. -: -: 'mwcio_testchannel': -: Provide an implementation of the Channel protocol for test drivers. -: -: 'mwcio_testchannelfactory': -: Provide a test imp of the 'ChannelFactory' protocol. diff --git a/src/groups/mwc/mwcio/package/mwcio.dep b/src/groups/mwc/mwcio/package/mwcio.dep deleted file mode 100644 index 48afd3b37..000000000 --- a/src/groups/mwc/mwcio/package/mwcio.dep +++ /dev/null @@ -1,6 +0,0 @@ -mwcex -mwcscm -mwcst -mwcsys -mwct -mwcu \ No newline at end of file diff --git a/src/groups/mwc/mwcio/package/mwcio.mem b/src/groups/mwc/mwcio/package/mwcio.mem deleted file mode 100644 index 2b1d76e12..000000000 --- a/src/groups/mwc/mwcio/package/mwcio.mem +++ /dev/null @@ -1,18 +0,0 @@ -mwcio_basechannelpartialimp -mwcio_channel -mwcio_channelfactory -mwcio_channelutil -mwcio_connectoptions -mwcio_decoratingchannelpartialimp -mwcio_listenoptions -mwcio_ntcchannel -mwcio_ntcchannelfactory -mwcio_reconnectingchannelfactory -mwcio_resolveutil -mwcio_resolvingchannelfactory -mwcio_statchannel -mwcio_statchannelfactory -mwcio_status -mwcio_tcpendpoint -mwcio_testchannel -mwcio_testchannelfactory diff --git a/src/groups/mwc/mwcma/package/mwcma.dep b/src/groups/mwc/mwcma/package/mwcma.dep deleted file mode 100644 index 0761e1187..000000000 --- a/src/groups/mwc/mwcma/package/mwcma.dep +++ /dev/null @@ -1,2 +0,0 @@ -mwcscm -mwcst \ No newline at end of file diff --git a/src/groups/mwc/mwcma/package/mwcma.mem b/src/groups/mwc/mwcma/package/mwcma.mem deleted file mode 100644 index a5de4be4c..000000000 --- a/src/groups/mwc/mwcma/package/mwcma.mem +++ /dev/null @@ -1,3 +0,0 @@ -mwcma_countingallocator -mwcma_countingallocatorstore -mwcma_countingallocatorutil diff --git a/src/groups/mwc/mwcscm/README.md b/src/groups/mwc/mwcscm/README.md deleted file mode 100644 index 450d48372..000000000 --- a/src/groups/mwc/mwcscm/README.md +++ /dev/null @@ -1,51 +0,0 @@ -MWCSCM -====== -> The `MWCSCM` package provides versioning information for library components -> in **mwc**. - - -Description ------------ -The 'mwcscm' package provides versioning information that is incorporated into -every release of the 'mwc' Package Group Library. This versioning information -is in turn available to all clients of 'mwc' both at run time and by inspection -of appropriate .o files. - - -Component Synopsis ------------------- -Component | Provides ... ---------------------|----------------------------------------------------------- -`mwcscm_version` | source control management (versioning) information. -`mwcscm_versiontag` | versioning information for the 'mwc' package group. - - -Version scheme and manipulation -------------------------------- -The version is composed of 3 parts (a major, a minor and a patch) represented as -an aggregated single integer. Each part of the version belongs to the 0..99 -range. Main's version is always `999999`, nightlies versions are `99mmdd` -where 'mm' and 'dd' are the two digits numerical representation of respectively -the month and day at which time this nightly was built. - -The following snippet of code can be used to retrieve the version: - -```c++ -#include - -// Let's assume the current version is {Major: 1, Minor: 23, Path: 45} -int version = mwcscm::Version::versionAsInt(); // 12345 -const char *versionStr = mwcscm::Version::version(); // BLP_LIB_MWC_1.23.45 -``` - -The following snippet of code can be used to build a version for comparison -(for example to enable functionality based on the library version): - -```c++ -#include -#include - -if (mwcscm::Version::versionAsInt() < MWC_MAKE_EXT_VERSION(1, 2, 0)) { - // Using an older version, can't enable the feature -} -``` diff --git a/src/groups/mwc/mwcscm/doc/mwcscm.txt b/src/groups/mwc/mwcscm/doc/mwcscm.txt deleted file mode 100644 index f6d845df6..000000000 --- a/src/groups/mwc/mwcscm/doc/mwcscm.txt +++ /dev/null @@ -1,32 +0,0 @@ - mwcscm.txt - -@PURPOSE: Provide versioning information for library components in 'mwc'. - -@MNEMONIC: MiddleWare Core Source Control Management (mwcscm) - -@DESCRIPTION: The 'mwcscm' package provides versioning information that is - incorporated into every release of the 'mwc' Package Group Library. This - versioning information is in turn available to all clients of 'mwc' both at - run time and by inspection of appropriate .o files. See {BP BDE_SCM } for - a detailed specification of the BDE source control contract that this package - group uses. - -/Hierarchical Synopsis -/--------------------- - The 'mwcscm' package currently has 2 components having 2 levels of physical - dependency. The list below shows the hierarchical ordering of the components. - The order of components within each level is not architecturally significant, - just alphabetical. -.. - 2. mwcscm_version - - 1. mwcscm_versiontag -.. - -/Component Synopsis -/------------------ -: 'mwcscm_version': -: Provide source control management (versioning) information. -: -: 'mwcscm_versiontag': -: Provide versioning information for the 'mwc' package group. diff --git a/src/groups/mwc/mwcscm/mwcscm_version.cpp b/src/groups/mwc/mwcscm/mwcscm_version.cpp deleted file mode 100644 index 207a0877d..000000000 --- a/src/groups/mwc/mwcscm/mwcscm_version.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2017-2023 Bloomberg Finance L.P. -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// mwcscm_version.cpp -*-C++-*- -#include - -namespace BloombergLP { - -#define STRINGIFY2(a) #a -#define STRINGIFY(a) STRINGIFY2(a) - -#define MWCSCM_VERSION_STRING \ - "BLP_LIB_MWC_" STRINGIFY(MWC_VERSION_MAJOR) "." STRINGIFY( \ - MWC_VERSION_MINOR) "." STRINGIFY(MWC_VERSION_PATCH) - -const char* mwcscm::Version::s_ident = "$Id: " MWCSCM_VERSION_STRING " $"; -const char* mwcscm::Version::s_what = "@(#)" MWCSCM_VERSION_STRING; - -const char* mwcscm::Version::MWCSCM_S_VERSION = MWCSCM_VERSION_STRING; -const char* mwcscm::Version::s_dependencies = ""; -const char* mwcscm::Version::s_buildInfo = ""; -const char* mwcscm::Version::s_timestamp = ""; -const char* mwcscm::Version::s_sourceControlInfo = ""; - -} // close enterprise namespace diff --git a/src/groups/mwc/mwcscm/mwcscm_version.h b/src/groups/mwc/mwcscm/mwcscm_version.h deleted file mode 100644 index dbb4cc56f..000000000 --- a/src/groups/mwc/mwcscm/mwcscm_version.h +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2017-2023 Bloomberg Finance L.P. -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// mwcscm_version.h -*-C++-*- -#ifndef INCLUDED_MWCSCM_VERSION -#define INCLUDED_MWCSCM_VERSION - -//@PURPOSE: Provide source control management (versioning) information. -// -//@CLASSES: -// mwcscm::Version: namespace for SCM versioning information for 'mwc' -// -//@DESCRIPTION: This component provides source control management (versioning) -// information for the 'mwc' package group. In particular, this component -// embeds RCS-style and SCCS-style version strings in binary executable files -// that use one or more components from the 'mwc' package group. This version -// information may be extracted from binary files using common UNIX utilities -// (e.g., 'ident' and 'what'). In addition, the 'version' 'static' member -// function in the 'mwcscm::Version' struct can be used to query version -// information for the 'mwc' package group at runtime. The following USAGE -// examples illustrate these two basic capabilities. -// -// Note that unless the 'version' method will be called, it is not necessary to -// "#include" this component header file to get 'mwc' version information -// embedded in an executable. It is only necessary to use one or more 'mwc' -// components (and, hence, link in the 'mwc' library). - -// MWC -#include - -// BDE -#include - -namespace BloombergLP { -namespace mwcscm { - -struct Version { - // PUBLIC CLASS DATA - static const char* s_ident; - static const char* s_what; - -#define MWCSCM_CONCAT2(a, b, c, d, e) a##b##c##d##e -#define MWCSCM_CONCAT(a, b, c, d, e) MWCSCM_CONCAT2(a, b, c, d, e) - -// 'MWCSCM_S_VERSION' is a symbol whose name warns users of version mismatch -// linking errors. Note that the exact string "compiled_this_object" must be -// present in this version coercion symbol. Tools may look for this pattern to -// warn users of mismatches. -#define MWCSCM_S_VERSION \ - MWCSCM_CONCAT(d_version_MWC_, \ - MWC_VERSION_MAJOR, \ - _, \ - MWC_VERSION_MINOR, \ - _compiled_this_object) - - static const char* MWCSCM_S_VERSION; - - static const char* s_dependencies; - static const char* s_buildInfo; - static const char* s_timestamp; - static const char* s_sourceControlInfo; - - // CLASS METHODS - - /// Return the formatted string corresponding to the version. Format is - /// BLP_LIB_MWC_.. - static const char* version(); - - /// Return the int corresponding to the version, using the following - /// formula: `(major) * 10000 + (minor) * 100 + (patch)` - static int versionAsInt(); -}; - -// ============================================================================ -// INLINE DEFINITIONS -// ============================================================================ - -// --------------------- -// class mwcscm::Version -// --------------------- - -inline const char* Version::version() -{ - return MWCSCM_S_VERSION; -} - -inline int Version::versionAsInt() -{ - return MWC_EXT_VERSION; -} - -} // close package namespace - -BSLS_LINKCOERCION_FORCE_SYMBOL_DEPENDENCY(const char*, - mwcscm_version_assertion, - mwcscm::Version::MWCSCM_S_VERSION) - -} // close enterprise namespace - -#endif diff --git a/src/groups/mwc/mwcscm/mwcscm_version.t.cpp b/src/groups/mwc/mwcscm/mwcscm_version.t.cpp deleted file mode 100644 index 540d86967..000000000 --- a/src/groups/mwc/mwcscm/mwcscm_version.t.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2023 Bloomberg Finance L.P. -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// mwcscm_version.t.cpp -*-C++-*- -#include - -// BDE -#include -#include -#include - -// CONVENIENCE -using namespace BloombergLP; -using namespace bsl; - -// ============================================================================ -// MAIN PROGRAM -// ---------------------------------------------------------------------------- -static int s_testStatus = 0; - -static void aSsErT(bool b, const char* s, int i) -{ - if (b) { - printf("Error " __FILE__ "(%d): %s (failed)\n", i, s); - if (s_testStatus >= 0 && s_testStatus <= 100) - ++s_testStatus; - } -} - -int main(int argc, char** argv) -{ - int test = argc > 1 ? atoi(argv[1]) : 0; - bool verbose = argc > 2; - bool veryVerbose = argc > 3; - bool veryVeryVerbose = argc > 4; - bool veryVeryVeryVerbose = argc > 5; - // Prevent potential compiler unused warning - (void)verbose; - (void)veryVerbose; - (void)veryVeryVerbose; - (void)veryVeryVeryVerbose; - - cout << "TEST " << __FILE__ << " CASE " << test << endl; - switch (test) { - case 0: - case 1: { - if (verbose) - cout << "Checking version string" << endl; - bsl::string version(mwcscm::Version::version()); - BSLIM_TESTUTIL_ASSERT(version == "BLP_LIB_MWC_99.99.99"); - - if (verbose) - cout << "Checking version int" << endl; - BSLIM_TESTUTIL_ASSERT(mwcscm::Version::versionAsInt() == 999999); - } break; - - default: { - cerr << "WARNING: CASE '" << test << "' NOT FOUND." << endl; - s_testStatus = -1; - } break; - } - - if (s_testStatus > 0) { - cerr << "Error, non-zero test status = " << s_testStatus << "." - << endl; - } - return s_testStatus; -} diff --git a/src/groups/mwc/mwcscm/mwcscm_versiontag.cpp b/src/groups/mwc/mwcscm/mwcscm_versiontag.cpp deleted file mode 100644 index 7726cdd60..000000000 --- a/src/groups/mwc/mwcscm/mwcscm_versiontag.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017-2023 Bloomberg Finance L.P. -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// mwcscm_versiontag.cpp -*-C++-*- -#include diff --git a/src/groups/mwc/mwcscm/mwcscm_versiontag.h b/src/groups/mwc/mwcscm/mwcscm_versiontag.h deleted file mode 100644 index b2c1f2693..000000000 --- a/src/groups/mwc/mwcscm/mwcscm_versiontag.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2017-2023 Bloomberg Finance L.P. -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// mwcscm_versiontag.h -*-C++-*- -#ifndef INCLUDED_MWCSCM_VERSIONTAG -#define INCLUDED_MWCSCM_VERSIONTAG - -//@PURPOSE: Provide versioning information for the 'mwc' package group. -// -//@SEE_ALSO: mwcscm::Version -// -//@DESCRIPTION: This component provides versioning information for the 'mwc' -// package group. The 'MWC_VERSION' macro that is supplied can be used for -// conditional-compilation based on 'mwc' version information. The following -// usage example illustrates this basic capability. -// -/// Usage -///----- -// At compile time, the version of MWC can be used to select an older or newer -// way to accomplish a task, to enable new functionality, or to accommodate an -// interface change. For example, if the name of a function changes (a rare -// occurrence, but potentially disruptive when it does happen), the impact on -// affected code can be minimized by conditionally calling the function by its -// old or new name using conditional compilation. In the following, the '#if' -// preprocessor directive compares 'MWC_VERSION' (i.e., the latest MWC version, -// excluding the patch version) to a specified major and minor version composed -// using the 'BDE_MAKE_VERSION' macro: -//.. -// #if MWC_VERSION > BDE_MAKE_VERSION(1, 3) -// // Call 'newFunction' for MWC versions later than 1.3. -// int result = newFunction(); -// #else -// // Call 'oldFunction' for MWC version 1.3 or earlier. -// int result = oldFunction(); -// #endif -//.. - -#define MWC_VERSION_MAJOR 99 -// MWC release major version - -#define MWC_VERSION_MINOR 99 -// MWC release minor version - -#define MWC_VERSION_PATCH 99 -// MWC patch level - -#define MWC_MAKE_VERSION(major, minor) ((major)*10000 + (minor)*100) -// Construct a composite version number in the range [ 0 .. 999900 ] from -// the specified 'major' and 'minor' version numbers. The resulting value, -// when expressed as a 6-digit decimal string, has "00" as the two -// lowest-order decimal digits, 'minor' as the next two digits, and 'major' -// as the highest-order digits. The result is unique for each combination -// of 'major' and 'minor', and is sortable such that a value composed from -// a given 'major' version number will compare larger than a value composed -// from a smaller 'major' version number (and similarly for 'minor' version -// numbers). Note that if 'major' and 'minor' are both compile-time -// integral constants, then the resulting expression is also a compile-time -// integral constant. Also note that the patch version number is -// intentionally not included. The behavior is undefined unless 'major' -// and 'minor' are integral values in the range '[ 0 .. 99 ]'. - -#define MWC_MAKE_EXT_VERSION(major, minor, patch) \ - ((major)*10000 + (minor)*100 + (patch)) -// Similar to MWC_MAKE_VERSION(), but include the patch number as well. - -#define MWC_VERSION MWC_MAKE_VERSION(MWC_VERSION_MAJOR, MWC_VERSION_MINOR) -// Construct a composite version number in the range [ 0 .. 999900 ] from -// the specified 'MWC_VERSION_MAJOR' and 'MWC_VERSION_MINOR' numbers -// corresponding to the major and minor version numbers, respectively, of -// the current (latest) MWC release. Note that the patch version number is -// intentionally not included. For example, 'MWC_VERSION' produces 10300 -// (decimal) for MWC version 1.3.1. - -#define MWC_EXT_VERSION \ - MWC_MAKE_EXT_VERSION(MWC_VERSION_MAJOR, \ - MWC_VERSION_MINOR, \ - MWC_VERSION_PATCH) -// Similar to MWC_VERSION, but include the patch number as well - -#endif diff --git a/src/groups/mwc/mwcscm/mwcscm_versiontag.t.cpp b/src/groups/mwc/mwcscm/mwcscm_versiontag.t.cpp deleted file mode 100644 index 57c8c1fff..000000000 --- a/src/groups/mwc/mwcscm/mwcscm_versiontag.t.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2023 Bloomberg Finance L.P. -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// mwcscm_versiontag.t.cpp -*-C++-*- -#include - -// BDE -#include -#include - -// CONVENIENCE -using namespace BloombergLP; -using namespace bsl; - -// ============================================================================ -// MAIN PROGRAM -// ---------------------------------------------------------------------------- -static int s_testStatus = 0; - -static void aSsErT(bool b, const char* s, int i) -{ - if (b) { - printf("Error " __FILE__ "(%d): %s (failed)\n", i, s); - if (s_testStatus >= 0 && s_testStatus <= 100) - ++s_testStatus; - } -} - -int main(int argc, char** argv) -{ - int test = argc > 1 ? atoi(argv[1]) : 0; - bool verbose = argc > 2; - bool veryVerbose = argc > 3; - bool veryVeryVerbose = argc > 4; - bool veryVeryVeryVerbose = argc > 5; - // Prevent potential compiler unused warning - (void)verbose; - (void)veryVerbose; - (void)veryVeryVerbose; - (void)veryVeryVeryVerbose; - - cout << "TEST " << __FILE__ << " CASE " << test << endl; - switch (test) { - case 0: - case 1: { - if (verbose) - cout << "Checking version consistency" << endl; - BSLIM_TESTUTIL_ASSERT(MWC_VERSION_MAJOR == - (MWC_VERSION / 10000) % 100); - BSLIM_TESTUTIL_ASSERT(MWC_VERSION_MINOR == (MWC_VERSION / 100) % 100); - BSLIM_TESTUTIL_ASSERT(0 == MWC_VERSION % 100); - - // Make sure we never commit a specific version in main (999999 is - // the 'test build version') - if (verbose) - cout << "Ensuring version number is 999999" << endl; - BSLIM_TESTUTIL_ASSERT(MWC_EXT_VERSION == 999999); - } break; - - default: { - cerr << "WARNING: CASE '" << test << "' NOT FOUND." << endl; - s_testStatus = -1; - } break; - } - - if (s_testStatus > 0) { - cerr << "Error, non-zero test status = " << s_testStatus << "." - << endl; - } - return s_testStatus; -} diff --git a/src/groups/mwc/mwcscm/package/mwcscm.mem b/src/groups/mwc/mwcscm/package/mwcscm.mem deleted file mode 100644 index fb878cc12..000000000 --- a/src/groups/mwc/mwcscm/package/mwcscm.mem +++ /dev/null @@ -1,2 +0,0 @@ -mwcscm_version -mwcscm_versiontag diff --git a/src/groups/mwc/mwcst/package/mwcst.dep b/src/groups/mwc/mwcst/package/mwcst.dep deleted file mode 100644 index 1583f8422..000000000 --- a/src/groups/mwc/mwcst/package/mwcst.dep +++ /dev/null @@ -1,3 +0,0 @@ -mwcscm -mwcstm -mwcu diff --git a/src/groups/mwc/mwcst/package/mwcst.mem b/src/groups/mwc/mwcst/package/mwcst.mem deleted file mode 100644 index 3810a6467..000000000 --- a/src/groups/mwc/mwcst/package/mwcst.mem +++ /dev/null @@ -1,17 +0,0 @@ -mwcst_basetable -mwcst_basictableinfoprovider -mwcst_printutil -mwcst_statcontext -mwcst_statcontexttableinfoprovider -mwcst_statcontextuserdata -mwcst_statutil -mwcst_statvalue -mwcst_stringkey -mwcst_table -mwcst_tableinfoprovider -mwcst_tablerecords -mwcst_tableschema -mwcst_tableutil -mwcst_testtableinfoprovider -mwcst_testutil -mwcst_value diff --git a/src/groups/mwc/mwcstm/package/mwcstm.dep b/src/groups/mwc/mwcstm/package/mwcstm.dep deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/groups/mwc/mwcstm/package/mwcstm.mem b/src/groups/mwc/mwcstm/package/mwcstm.mem deleted file mode 100644 index c0d623810..000000000 --- a/src/groups/mwc/mwcstm/package/mwcstm.mem +++ /dev/null @@ -1 +0,0 @@ -mwcstm_values diff --git a/src/groups/mwc/mwcsys/package/mwcsys.dep b/src/groups/mwc/mwcsys/package/mwcsys.dep deleted file mode 100644 index 4bd2d5204..000000000 --- a/src/groups/mwc/mwcsys/package/mwcsys.dep +++ /dev/null @@ -1,3 +0,0 @@ -mwcu -mwcscm -mwcst \ No newline at end of file diff --git a/src/groups/mwc/mwcsys/package/mwcsys.mem b/src/groups/mwc/mwcsys/package/mwcsys.mem deleted file mode 100644 index 3baea0cb8..000000000 --- a/src/groups/mwc/mwcsys/package/mwcsys.mem +++ /dev/null @@ -1,6 +0,0 @@ -mwcsys_executil -mwcsys_mocktime -mwcsys_statmonitor -mwcsys_statmonitorsnapshotrecorder -mwcsys_threadutil -mwcsys_time diff --git a/src/groups/mwc/mwct/package/mwct.dep b/src/groups/mwc/mwct/package/mwct.dep deleted file mode 100644 index 0803a74af..000000000 --- a/src/groups/mwc/mwct/package/mwct.dep +++ /dev/null @@ -1 +0,0 @@ -mwcscm diff --git a/src/groups/mwc/mwct/package/mwct.mem b/src/groups/mwc/mwct/package/mwct.mem deleted file mode 100644 index 63858f1d4..000000000 --- a/src/groups/mwc/mwct/package/mwct.mem +++ /dev/null @@ -1,3 +0,0 @@ -mwct_propertybag -mwct_rcdescriptionerror -mwct_valueorerror diff --git a/src/groups/mwc/mwctsk/package/mwctsk.dep b/src/groups/mwc/mwctsk/package/mwctsk.dep deleted file mode 100644 index 7beea2451..000000000 --- a/src/groups/mwc/mwctsk/package/mwctsk.dep +++ /dev/null @@ -1,4 +0,0 @@ -mwcex -mwcscm -mwcsys -mwcu diff --git a/src/groups/mwc/mwctsk/package/mwctsk.mem b/src/groups/mwc/mwctsk/package/mwctsk.mem deleted file mode 100644 index 05abe2df1..000000000 --- a/src/groups/mwc/mwctsk/package/mwctsk.mem +++ /dev/null @@ -1,5 +0,0 @@ -mwctsk_alarmlog -mwctsk_consoleobserver -mwctsk_logcleaner -mwctsk_logcontroller -mwctsk_syslogobserver diff --git a/src/groups/mwc/mwctst/README.md b/src/groups/mwc/mwctst/README.md deleted file mode 100644 index 542cc6543..000000000 --- a/src/groups/mwc/mwctst/README.md +++ /dev/null @@ -1,17 +0,0 @@ -MWCTST -==== -> The `MWCTST` package provides macros and utilities to assist in writting test -> drivers. - -Description ------------ -The mwctst' package provides macros and utilities to assist in writting test -drivers. - -Component Synopsis ------------------- -Component | Provides ... ----------------------------|--------------------------------------------------- -`mwctst_blobtestutil` | blob utilities for use in test drivers. -`mwctst_scopedlogobserver` | a scoped implementation of the log observer protocol. -`mwctst_testhelper` | macros and utilities to assist in writing test drivers. diff --git a/src/groups/mwc/mwctst/package/mwctst.dep b/src/groups/mwc/mwctst/package/mwctst.dep deleted file mode 100644 index 0803a74af..000000000 --- a/src/groups/mwc/mwctst/package/mwctst.dep +++ /dev/null @@ -1 +0,0 @@ -mwcscm diff --git a/src/groups/mwc/mwctst/package/mwctst.mem b/src/groups/mwc/mwctst/package/mwctst.mem deleted file mode 100644 index 79500d333..000000000 --- a/src/groups/mwc/mwctst/package/mwctst.mem +++ /dev/null @@ -1,3 +0,0 @@ -mwctst_blobtestutil -mwctst_scopedlogobserver -mwctst_testhelper diff --git a/src/groups/mwc/mwcu/mwcu_objectplaceholder_cpp03.cpp b/src/groups/mwc/mwcu/mwcu_objectplaceholder_cpp03.cpp deleted file mode 100644 index 735a531c0..000000000 --- a/src/groups/mwc/mwcu/mwcu_objectplaceholder_cpp03.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2022-2023 Bloomberg Finance L.P. -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// mwcu_objectplaceholder_cpp03.cpp -*-C++-*- - -// Automatically generated file. **DO NOT EDIT** - -// Generated on Thu Jul 14 05:53:36 2022 -// Command line: sim_cpp11_features.pl mwcu_objectplaceholder.cpp - -#define INCLUDED_MWCU_OBJECTPLACEHOLDER_CPP03 // Disable inclusion -#include // Pro-forma #include - -// Empty file except when compiling mwcu_objectplaceholder.cpp -#ifdef COMPILING_MWCU_OBJECTPLACEHOLDER_CPP - -// No C++03 Expansion - -#endif // defined(COMPILING_MWCU_OBJECTPLACEHOLDER_CPP) - -// ---------------------------------------------------------------------------- -// Copyright 2022-2023 Bloomberg Finance L.P. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ----------------------------- END-OF-FILE ---------------------------------- diff --git a/src/groups/mwc/mwcu/mwcu_operationchain_cpp03.cpp b/src/groups/mwc/mwcu/mwcu_operationchain_cpp03.cpp deleted file mode 100644 index 9ecb15222..000000000 --- a/src/groups/mwc/mwcu/mwcu_operationchain_cpp03.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2022-2023 Bloomberg Finance L.P. -// SPDX-License-Identifier: Apache-2.0 -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -// mwcu_operationchain_cpp03.cpp -*-C++-*- - -// Automatically generated file. **DO NOT EDIT** - -// Generated on Wed Jun 19 14:58:49 2024 -// Command line: sim_cpp11_features.pl mwcu_operationchain.cpp - -#define INCLUDED_MWCU_OPERATIONCHAIN_CPP03 // Disable inclusion -#include // Pro-forma #include - -// Empty file except when compiling mwcu_operationchain.cpp -#ifdef COMPILING_MWCU_OPERATIONCHAIN_CPP - -// No C++03 Expansion - -#endif // defined(COMPILING_MWCU_OPERATIONCHAIN_CPP) - -// ---------------------------------------------------------------------------- -// Copyright 2024 Bloomberg Finance L.P. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ----------------------------- END-OF-FILE ---------------------------------- diff --git a/src/groups/mwc/mwcu/package/mwcu.dep b/src/groups/mwc/mwcu/package/mwcu.dep deleted file mode 100644 index 0803a74af..000000000 --- a/src/groups/mwc/mwcu/package/mwcu.dep +++ /dev/null @@ -1 +0,0 @@ -mwcscm diff --git a/src/groups/mwc/mwcu/package/mwcu.mem b/src/groups/mwc/mwcu/package/mwcu.mem deleted file mode 100644 index 218e33045..000000000 --- a/src/groups/mwc/mwcu/package/mwcu.mem +++ /dev/null @@ -1,22 +0,0 @@ -mwcu_alignedprinter -mwcu_atomicstate -mwcu_atomicvalidator -mwcu_blob -mwcu_blobiterator -mwcu_blobobjectproxy -mwcu_memoutstream -mwcu_objectplaceholder -mwcu_objectplaceholder_cpp03 -mwcu_operationchain -mwcu_operationchain_cpp03 -mwcu_outstreamformatsaver -mwcu_printutil -mwcu_samethreadchecker -mwcu_sharedresource -mwcu_stringutil -mwcu_tempdirectory -mwcu_tempfile -mwcu_temputil -mwcu_throttledaction -mwcu_tlsbool -mwcu_weakmemfn diff --git a/src/integration-tests/test_admin_client.py b/src/integration-tests/test_admin_client.py index 882fbff5c..67ebe8542 100644 --- a/src/integration-tests/test_admin_client.py +++ b/src/integration-tests/test_admin_client.py @@ -90,6 +90,7 @@ def extract_stats(admin_response: str) -> dict: def expect_same_structure( entry: Union[dict, list, str, int], expected: Union[dict, list, str, int, dt.ValueConstraint], + path: str = "", ) -> None: """ Check if the specified 'entry' has the same structure as the specified 'expected'. @@ -100,14 +101,20 @@ def expect_same_structure( if isinstance(expected, dict): assert isinstance(entry, dict) - assert expected.keys() == entry.keys() + assert expected.keys() == entry.keys(), ( + path, + "Extra expected keys:", + expected.keys() - entry.keys(), + "Missing expected keys:", + entry.keys() - expected.keys(), + ) for key in expected: - expect_same_structure(entry[key], expected[key]) + expect_same_structure(entry[key], expected[key], path + "." + key) elif isinstance(expected, list): assert isinstance(entry, list) assert len(expected) == len(entry) for obj2, expected2 in zip(entry, expected): - expect_same_structure(obj2, expected2) + expect_same_structure(obj2, expected2, path + "." + key) elif isinstance(expected, str): assert isinstance(entry, str) assert expected == entry @@ -117,7 +124,7 @@ def expect_same_structure( assert expected.check(entry) else: assert isinstance(expected, int) - assert entry == expected + assert entry == expected, (path, "expected:", expected, "actual:", entry) def test_breathing(single_node: Cluster) -> None: @@ -174,7 +181,12 @@ def test_queue_stats(single_node: Cluster) -> None: - Confirm a portion of messages for each consumer - Verify stats acquired via admin command with the expected stats - Stage 3: check too-often stats safeguard + Stage 3: check stats after purging an appId + - Purge one appId + - Check that message/byte stats for this appId set to 0, and + the queue stats in general correctly changed + + Stage 4: check too-often stats safeguard - Send several 'stat show' requests - Verify that the admin session complains about too often stat request @@ -205,7 +217,7 @@ def test_queue_stats(single_node: Cluster) -> None: stats = extract_stats(admin.send_admin("encoding json_pretty stat show")) queue_stats = stats["domainQueues"]["domains"][tc.DOMAIN_FANOUT][task.uri] - expect_same_structure(queue_stats, dt.TEST_QUEUE_STATS_AFTER_POST) + expect_same_structure(queue_stats, dt.TEST_QUEUE_STATS_AFTER_POST, "after-post") # Stage 2: check stats after confirming messages consumer_foo: Client = proxy.create_client("consumer_foo") @@ -223,19 +235,32 @@ def test_queue_stats(single_node: Cluster) -> None: stats = extract_stats(admin.send_admin("encoding json_pretty stat show")) queue_stats = stats["domainQueues"]["domains"][tc.DOMAIN_FANOUT][task.uri] - expect_same_structure(queue_stats, dt.TEST_QUEUE_STATS_AFTER_CONFIRM) + expect_same_structure( + queue_stats, dt.TEST_QUEUE_STATS_AFTER_CONFIRM, "after-confirm" + ) + + # Stage 3: check stats after purging an appId + res = admin.send_admin( + f"DOMAINS DOMAIN {task.domain} QUEUE {task.queue_name} PURGE baz" + ) + assert f"Purged 21 message(s)" in res + + stats = extract_stats(admin.send_admin("encoding json_pretty stat show")) + queue_stats = stats["domainQueues"]["domains"][tc.DOMAIN_FANOUT][task.uri] + + expect_same_structure(queue_stats, dt.TEST_QUEUE_STATS_AFTER_PURGE, "after-purge") consumer_foo.close(f"{task.uri}?id=foo") consumer_bar.close(f"{task.uri}?id=bar") consumer_baz.close(f"{task.uri}?id=baz") - # Stage 3: check too-often stats safeguard + # Stage 4: check too-often stats safeguard for i in range(5): admin.send_admin("encoding json_pretty stat show") res = admin.send_admin("encoding json_pretty stat show") obj = json.loads(res) - expect_same_structure(obj, dt.TEST_QUEUE_STATS_TOO_OFTEN_SNAPSHOTS) + expect_same_structure(obj, dt.TEST_QUEUE_STATS_TOO_OFTEN_SNAPSHOTS, "too-often") admin.stop() diff --git a/src/integration-tests/test_alarms.py b/src/integration-tests/test_alarms.py index 7728f99a9..1b80b008f 100644 --- a/src/integration-tests/test_alarms.py +++ b/src/integration-tests/test_alarms.py @@ -56,7 +56,7 @@ def test_no_alarms_for_a_slow_queue(cluster: Cluster): time.sleep(4) # First, test the alarm - assert leader.alarms("QUEUE_CONSUMER_MONITOR", 1) + assert leader.alarms("QUEUE_STUCK", 1) leader.drain() # Then test no alarm while consumer1 slowly confirms @@ -74,4 +74,89 @@ def test_no_alarms_for_a_slow_queue(cluster: Cluster): ) time.sleep(1) - assert not leader.alarms("QUEUE_CONSUMER_MONITOR", 1) + assert not leader.alarms("QUEUE_STUCK", 1) + + +@tweak.cluster.queue_operations.consumption_monitor_period_ms(500) +@tweak.domain.max_idle_time(1) +def test_alarms_subscription_mismatch(cluster: Cluster): + """ + Test broker ALARM log content for producer/consumer subscription expression mismatch (put aside list is not empty). + """ + + leader = cluster.last_known_leader + proxy = next(cluster.proxy_cycle()) + + producer = proxy.create_client("producer") + producer.open(tc.URI_PRIORITY, flags=["write,ack"], succeed=True) + + consumer = proxy.create_client("consumer") + consumer.open( + tc.URI_PRIORITY, + flags=["read"], + succeed=True, + subscriptions=[{"expression": "x == 1"}], + ) + + producer.post( + tc.URI_PRIORITY, + ["msg"], + succeed=True, + wait_ack=True, + messageProperties=[{"name": "x", "value": "0", "type": "E_INT"}], + ) + + time.sleep(2) + + assert leader.alarms("QUEUE_STUCK", 1) + assert leader.capture(r"Put aside list size: 1") + assert leader.capture(r"Redelivery list size: 0") + assert leader.capture(r"Consumer subscription expressions:") + assert leader.capture(r"x == 1") + assert leader.capture(r"Oldest message in the 'Put aside' list:") + assert leader.capture(r"Message Properties: \[ x \(INT32\) = 0 \]") + + +@tweak.domain.storage.queue_limits.messages(2) +def test_capacity_alarm_subscription_mismatch(cluster: Cluster): + """ + Test broker capacity meter ALARM log content for producer/consumer subscription expression mismatch (put aside list is not empty). + """ + + leader = cluster.last_known_leader + proxy = next(cluster.proxy_cycle()) + + producer = proxy.create_client("producer") + producer.open(tc.URI_PRIORITY, flags=["write"], succeed=True) + + consumer = proxy.create_client("consumer") + consumer.open( + tc.URI_PRIORITY, + flags=["read"], + succeed=True, + subscriptions=[{"expression": "x == 1"}], + ) + + producer.post( + tc.URI_PRIORITY, + ["msg"], + succeed=True, + wait_ack=True, + messageProperties=[{"name": "x", "value": "0", "type": "E_INT"}], + ) + + producer.post( + tc.URI_PRIORITY, + ["msg"], + succeed=True, + wait_ack=True, + messageProperties=[{"name": "y", "value": "0", "type": "E_INT"}], + ) + + assert leader.alarms("CAPACITY_STATE_FULL", 1) + assert leader.capture(r"Put aside list size: 1") + assert leader.capture(r"Redelivery list size: 0") + assert leader.capture(r"Consumer subscription expressions:") + assert leader.capture(r"x == 1") + assert leader.capture(r"Oldest message in the 'Put aside' list:") + assert leader.capture(r"Message Properties: \[ x \(INT32\) = 0 \]") diff --git a/src/integration-tests/test_reconfigure_domains.py b/src/integration-tests/test_reconfigure_domains.py index 89aca318a..3f325cba8 100644 --- a/src/integration-tests/test_reconfigure_domains.py +++ b/src/integration-tests/test_reconfigure_domains.py @@ -254,7 +254,7 @@ def test_reconfigure_max_idle_time(self, multi_node: Cluster): # Sleep for long enough to trigger an alarm. time.sleep(1.5) - assert leader.alarms("QUEUE_CONSUMER_MONITOR", 1) + assert leader.alarms("QUEUE_STUCK", 1) # Confirm all messages in the queue. self.reader.confirm(URI_PRIORITY_1, "+2", succeed=True) @@ -277,7 +277,7 @@ def test_reconfigure_max_idle_time(self, multi_node: Cluster): self.reader.confirm(URI_PRIORITY_1, "+2", succeed=True) # Ensure that no alarm was issued. - assert not leader.alarms("QUEUE_CONSUMER_MONITOR", 1) + assert not leader.alarms("QUEUE_STUCK", 1) @tweak.domain.message_ttl(1) def test_reconfigure_message_ttl(self, multi_node: Cluster): diff --git a/src/plugins/bmqprometheus/bmqprometheus_prometheusstatconsumer.cpp b/src/plugins/bmqprometheus/bmqprometheus_prometheusstatconsumer.cpp index b7fa44559..79de0d668 100644 --- a/src/plugins/bmqprometheus/bmqprometheus_prometheusstatconsumer.cpp +++ b/src/plugins/bmqprometheus/bmqprometheus_prometheusstatconsumer.cpp @@ -24,12 +24,12 @@ #include #include -// MWC -#include -#include -#include -#include -#include +// BMQ +#include +#include +#include +#include +#include // BDE #include @@ -264,16 +264,16 @@ void PrometheusStatConsumer::captureQueueStats() { // Lookup the 'domainQueues' stat context // This is guaranteed to work because it was asserted in the ctor. - const mwcst::StatContext& domainsStatContext = + const bmqst::StatContext& domainsStatContext = *d_domainQueuesStatContext_p; typedef mqbstat::QueueStatsDomain::Stat Stat; // Shortcut - for (mwcst::StatContextIterator domainIt = + for (bmqst::StatContextIterator domainIt = domainsStatContext.subcontextIterator(); domainIt; ++domainIt) { - for (mwcst::StatContextIterator queueIt = + for (bmqst::StatContextIterator queueIt = domainIt->subcontextIterator(); queueIt; ++queueIt) { @@ -359,8 +359,8 @@ void PrometheusStatConsumer::captureQueueStats() {"queue_gc_msgs", Stat::e_GC_MSGS_DELTA, true}, {"queue_cfg_msgs", Stat::e_CFG_MSGS, false}, {"queue_cfg_bytes", Stat::e_CFG_BYTES, false}, - {"queue_content_msgs", Stat::e_MESSAGES_MAX, false}, - {"queue_content_bytes", Stat::e_BYTES_MAX, false}, + {"queue_content_msgs_max", Stat::e_MESSAGES_MAX, false}, + {"queue_content_bytes_max", Stat::e_BYTES_MAX, false}, {"queue_queue_time_avg", Stat::e_QUEUE_TIME_AVG, false}, {"queue_queue_time_max", Stat::e_QUEUE_TIME_MAX, false}, {"queue_reject_msgs", Stat::e_REJECT_DELTA, true}, @@ -390,35 +390,53 @@ void PrometheusStatConsumer::captureQueueStats() } } - // Add `appId` tag to `queue_confirm_time_max` and - // `queue_queue_time_max` metrics. - static const DatapointDef confirmTimeDataPoint = { - "queue_confirm_time_max", - Stat::e_CONFIRM_TIME_MAX, - false}; - static const DatapointDef queueTimeDataPoint = { - "queue_queue_time_max", - Stat::e_QUEUE_TIME_MAX, - false}; - for (mwcst::StatContextIterator appIdIt = + // Add `appId` tag to metrics. + + // These per-appId metrics exist for both primary and replica + static const DatapointDef defsCommon[] = { + {"queue_confirm_time_max", Stat::e_CONFIRM_TIME_MAX, false}, + }; + + // These per-appId metrics exist only for primary + static const DatapointDef defsPrimary[] = { + {"queue_queue_time_max", Stat::e_QUEUE_TIME_MAX, false}, + {"queue_content_msgs_max", Stat::e_MESSAGES_MAX, false}, + {"queue_content_bytes_max", Stat::e_BYTES_MAX, false}, + }; + for (bmqst::StatContextIterator appIdIt = queueIt->subcontextIterator(); appIdIt; ++appIdIt) { tagger.setAppId(appIdIt->name()); const auto labels = tagger.getLabels(); - auto value = mqbstat::QueueStatsDomain::getValue( - *appIdIt, - d_snapshotId, - mqbstat::QueueStatsDomain::Stat::e_CONFIRM_TIME_MAX); - updateMetric(&confirmTimeDataPoint, labels, value); + for (DatapointDefCIter dpIt = + bdlb::ArrayUtil::begin(defsCommon); + dpIt != bdlb::ArrayUtil::end(defsCommon); + ++dpIt) { + const bsls::Types::Int64 value = + mqbstat::QueueStatsDomain::getValue( + *appIdIt, + d_snapshotId, + static_cast( + dpIt->d_stat)); + updateMetric(dpIt, labels, value); + } if (role == mqbstat::QueueStatsDomain::Role::e_PRIMARY) { - value = mqbstat::QueueStatsDomain::getValue( - *appIdIt, - d_snapshotId, - mqbstat::QueueStatsDomain::Stat::e_QUEUE_TIME_MAX); - updateMetric(&queueTimeDataPoint, labels, value); + for (DatapointDefCIter dpIt = + bdlb::ArrayUtil::begin(defsPrimary); + dpIt != bdlb::ArrayUtil::end(defsPrimary); + ++dpIt) { + const bsls::Types::Int64 value = + mqbstat::QueueStatsDomain::getValue( + *appIdIt, + d_snapshotId, + static_cast< + mqbstat::QueueStatsDomain::Stat::Enum>( + dpIt->d_stat)); + updateMetric(dpIt, labels, value); + } } } } @@ -435,7 +453,7 @@ void PrometheusStatConsumer::captureSystemStats() #define COPY_METRIC(TAIL, ACCESSOR) \ datapoints.emplace_back( \ "brkr_system_" TAIL, \ - mwcsys::StatMonitorUtil::ACCESSOR(*d_systemStatContext_p, \ + bmqsys::StatMonitorUtil::ACCESSOR(*d_systemStatContext_p, \ d_snapshotId)); COPY_METRIC("cpu_sys", cpuSystem); @@ -475,9 +493,9 @@ void PrometheusStatConsumer::captureNetworkStats() const int k_NUM_NETWORK_STATS = 4; datapoints.reserve(k_NUM_NETWORK_STATS); - const mwcst::StatContext* localContext = + const bmqst::StatContext* localContext = d_channelsStatContext_p->getSubcontext("local"); - const mwcst::StatContext* remoteContext = + const bmqst::StatContext* remoteContext = d_channelsStatContext_p->getSubcontext("remote"); // NOTE: Should be StatController::k_CHANNEL_STAT_*, but can't due to // dependency limitations. @@ -488,10 +506,10 @@ void PrometheusStatConsumer::captureNetworkStats() #define RETRIEVE_METRIC(TAIL, STAT, CONTEXT) \ datapoints.emplace_back("brkr_system_net_" TAIL, \ - mwcio::StatChannelFactoryUtil::getValue( \ + bmqio::StatChannelFactoryUtil::getValue( \ *CONTEXT, \ d_snapshotId, \ - mwcio::StatChannelFactoryUtil::Stat::STAT)); + bmqio::StatChannelFactoryUtil::Stat::STAT)); RETRIEVE_METRIC("local_in_bytes", e_BYTES_IN_DELTA, localContext); RETRIEVE_METRIC("local_out_bytes", e_BYTES_OUT_DELTA, localContext); @@ -510,14 +528,14 @@ void PrometheusStatConsumer::captureNetworkStats() } auto reportConnections = [&](const bsl::string& metricName, - const mwcst::StatContext* context) { + const bmqst::StatContext* context) { // In order to eliminate possible duplication of port contexts // aggregate them before posting bsl::unordered_map > portMap; - mwcst::StatContextIterator it = context->subcontextIterator(); + bmqst::StatContextIterator it = context->subcontextIterator(); for (; it; ++it) { if (it->isDeleted()) { // As we iterate over 'living' sub contexts in the begining and @@ -530,20 +548,20 @@ void PrometheusStatConsumer::captureNetworkStats() .Register(*d_prometheusRegistry_p) .Add(tagger.getLabels()) .Increment(static_cast( - mwcio::StatChannelFactoryUtil::getValue( + bmqio::StatChannelFactoryUtil::getValue( *it, d_snapshotId, - mwcio::StatChannelFactoryUtil::Stat:: + bmqio::StatChannelFactoryUtil::Stat:: e_CONNECTIONS_DELTA))); ::prometheus::BuildGauge() .Name("brkr_system_net_" + metricName) .Register(*d_prometheusRegistry_p) .Add(tagger.getLabels()) .Set(static_cast< - double>(mwcio::StatChannelFactoryUtil::getValue( + double>(bmqio::StatChannelFactoryUtil::getValue( *it, d_snapshotId, - mwcio::StatChannelFactoryUtil::Stat::e_CONNECTIONS_ABS))); + bmqio::StatChannelFactoryUtil::Stat::e_CONNECTIONS_ABS))); } }; @@ -580,7 +598,7 @@ void PrometheusStatConsumer::captureBrokerStats() void PrometheusStatConsumer::collectLeaders(LeaderSet* leaders) { - for (mwcst::StatContextIterator clusterIt = + for (bmqst::StatContextIterator clusterIt = d_clustersStatContext_p->subcontextIterator(); clusterIt; ++clusterIt) { @@ -596,9 +614,9 @@ void PrometheusStatConsumer::collectLeaders(LeaderSet* leaders) void PrometheusStatConsumer::captureClusterStats(const LeaderSet& leaders) { - const mwcst::StatContext& clustersStatContext = *d_clustersStatContext_p; + const bmqst::StatContext& clustersStatContext = *d_clustersStatContext_p; - for (mwcst::StatContextIterator clusterIt = + for (bmqst::StatContextIterator clusterIt = clustersStatContext.subcontextIterator(); clusterIt; ++clusterIt) { @@ -678,12 +696,12 @@ void PrometheusStatConsumer::captureClusterStats(const LeaderSet& leaders) void PrometheusStatConsumer::captureClusterPartitionsStats() { // Iterate over each cluster - for (mwcst::StatContextIterator clusterIt = + for (bmqst::StatContextIterator clusterIt = d_clustersStatContext_p->subcontextIterator(); clusterIt; ++clusterIt) { // Iterate over each partition - for (mwcst::StatContextIterator partitionIt = + for (bmqst::StatContextIterator partitionIt = clusterIt->subcontextIterator(); partitionIt; ++partitionIt) { @@ -742,11 +760,11 @@ void PrometheusStatConsumer::captureClusterPartitionsStats() void PrometheusStatConsumer::captureDomainStats(const LeaderSet& leaders) { - const mwcst::StatContext& domainsStatContext = *d_domainsStatContext_p; + const bmqst::StatContext& domainsStatContext = *d_domainsStatContext_p; typedef mqbstat::DomainStats::Stat Stat; // Shortcut - for (mwcst::StatContextIterator domainIt = + for (bmqst::StatContextIterator domainIt = domainsStatContext.subcontextIterator(); domainIt; ++domainIt) { @@ -826,7 +844,7 @@ void PrometheusStatConsumer::setPublishInterval( setActionCounter(); } -const mwcst::StatContext* +const bmqst::StatContext* PrometheusStatConsumer::getStatContext(const char* name) const { StatContextsMap::const_iterator cIt = d_contextsMap.find(name); @@ -937,7 +955,7 @@ class PrometheusPushStatExporter : public PrometheusStatExporter { void prometheusPushThread() { // executed by the dedicated prometheus push thread - mwcsys::ThreadUtil::setCurrentThreadName(k_THREADNAME); + bmqsys::ThreadUtil::setCurrentThreadName(k_THREADNAME); BALL_LOG_INFO << "Prometheus Push thread has started [id: " << bslmt::ThreadUtil::selfIdAsUint64() << "]"; @@ -995,7 +1013,7 @@ class PrometheusPushStatExporter : public PrometheusStatExporter { // create push thread int rc = bslmt::ThreadUtil::create( &d_prometheusPushThreadHandle, - mwcsys::ThreadUtil::defaultAttributes(), + bmqsys::ThreadUtil::defaultAttributes(), bdlf::BindUtil::bind( &PrometheusPushStatExporter::prometheusPushThread, this)); diff --git a/src/plugins/bmqprometheus/bmqprometheus_prometheusstatconsumer.h b/src/plugins/bmqprometheus/bmqprometheus_prometheusstatconsumer.h index ec6a9ed25..0a0512c15 100644 --- a/src/plugins/bmqprometheus/bmqprometheus_prometheusstatconsumer.h +++ b/src/plugins/bmqprometheus/bmqprometheus_prometheusstatconsumer.h @@ -30,10 +30,10 @@ #include #include -// MWC -#include -#include -#include +// BMQ +#include +#include +#include // BDE #include @@ -56,7 +56,7 @@ namespace BloombergLP { // FORWARD DECLARATION -namespace mwcst { +namespace bmqst { class StatContext; } @@ -104,28 +104,28 @@ class PrometheusStatConsumer : public mqbplug::StatConsumer { using DatapointDefCIter = const DatapointDef*; - const mwcst::StatContext* d_systemStatContext_p; + const bmqst::StatContext* d_systemStatContext_p; // The system stat context - const mwcst::StatContext* d_brokerStatContext_p; + const bmqst::StatContext* d_brokerStatContext_p; // The broker stat context - const mwcst::StatContext* d_clustersStatContext_p; + const bmqst::StatContext* d_clustersStatContext_p; // The cluster stat context - const mwcst::StatContext* d_clusterNodesStatContext_p; + const bmqst::StatContext* d_clusterNodesStatContext_p; // The cluster nodes stat context - const mwcst::StatContext* d_domainsStatContext_p; + const bmqst::StatContext* d_domainsStatContext_p; // The domain stat context - const mwcst::StatContext* d_domainQueuesStatContext_p; + const bmqst::StatContext* d_domainQueuesStatContext_p; // The domain queues stat context - const mwcst::StatContext* d_clientStatContext_p; + const bmqst::StatContext* d_clientStatContext_p; // The client stat context - const mwcst::StatContext* d_channelsStatContext_p; + const bmqst::StatContext* d_channelsStatContext_p; // The channels stat context StatContextsMap d_contextsMap; @@ -163,7 +163,7 @@ class PrometheusStatConsumer : public mqbplug::StatConsumer { /// Return a pointer to the statContext with the specified 'name' from /// 'd_contextsMap', asserting that it exists. - const mwcst::StatContext* getStatContext(const char* name) const; + const bmqst::StatContext* getStatContext(const char* name) const; // PRIVATE MANIPULATORS diff --git a/src/plugins/bmqprometheus/bmqprometheus_versiontag.h b/src/plugins/bmqprometheus/bmqprometheus_versiontag.h index ba6829d7a..beaed60cb 100644 --- a/src/plugins/bmqprometheus/bmqprometheus_versiontag.h +++ b/src/plugins/bmqprometheus/bmqprometheus_versiontag.h @@ -69,11 +69,11 @@ /// integral constant. Also note that the patch version number is /// intentionally not included. The behavior is undefined unless 'major' /// and 'minor' are integral values in the range '[ 0 .. 99 ]'. -#define PROMETHEUS_MAKE_VERSION(major, minor) ((major)*10000 + (minor)*100) +#define PROMETHEUS_MAKE_VERSION(major, minor) ((major) * 10000 + (minor) * 100) /// Similar to PROMETHEUS_MAKE_VERSION(), but include patch number as well. #define PROMETHEUS_MAKE_EXT_VERSION(major, minor, patch) \ - ((major)*10000 + (minor)*100 + (patch)) + ((major) * 10000 + (minor) * 100 + (patch)) /// Construct a composite version number in the range [ 0 .. 999900 ] from /// the specified 'PROMETHEUS_VERSION_MAJOR' and 'PROMETHEUS_VERSION_MINOR' diff --git a/src/plugins/bmqprometheus/tests/bmqprometheus_prometheusstatconsumer_test.py b/src/plugins/bmqprometheus/tests/bmqprometheus_prometheusstatconsumer_test.py index 2ec1c66ba..67a54e26b 100755 --- a/src/plugins/bmqprometheus/tests/bmqprometheus_prometheusstatconsumer_test.py +++ b/src/plugins/bmqprometheus/tests/bmqprometheus_prometheusstatconsumer_test.py @@ -66,7 +66,11 @@ "queue_push_bytes", "queue_ack_msgs", ] -QUEUE_PRIMARY_NODE_METRICS = ["queue_gc_msgs", "queue_cfg_msgs", "queue_content_msgs"] +QUEUE_PRIMARY_NODE_METRICS = [ + "queue_gc_msgs", + "queue_cfg_msgs", + "queue_content_msgs_max", +] CLUSTER_METRICS = ["cluster_healthiness"] BROKER_METRICS = ["brkr_summary_queues_count", "brkr_summary_clients_count"] @@ -330,7 +334,7 @@ def _check_statistic(prometheus_host): value = response["result"][1]["value"][-1] assert value == "1", _assert_message(metric, "1", value) # Queue primary node statistic - elif metric == "queue_content_msgs": + elif metric == "queue_content_msgs_max": # For first queue assert value == "2", _assert_message(metric, "2", value) # For second queue diff --git a/src/python/blazingmq/dev/configurator/__init__.py b/src/python/blazingmq/dev/configurator/__init__.py index 4d73f78df..6fa7835ad 100644 --- a/src/python/blazingmq/dev/configurator/__init__.py +++ b/src/python/blazingmq/dev/configurator/__init__.py @@ -216,9 +216,8 @@ def domain(self, parameters: mqbconf.Domain) -> "Domain": return self._add_domain(Domain(self, domain)) def broadcast_domain(self, name: str) -> "Domain": - parameters = self.configurator.domain_definition() + parameters = self.configurator.broadcast_domain() parameters.name = name - parameters.mode = mqbconf.QueueMode(broadcast=mqbconf.QueueModeBroadcast()) parameters.storage.config.in_memory = mqbconf.InMemoryStorage() parameters.storage.config.file_backed = None domain = mqbconf.DomainDefinition(self.name, parameters) @@ -226,17 +225,16 @@ def broadcast_domain(self, name: str) -> "Domain": return self._add_domain(Domain(self, domain)) def fanout_domain(self, name: str, app_ids: List[str]) -> "Domain": - parameters = self.configurator.domain_definition() + parameters = self.configurator.fanout_domain() parameters.name = name - parameters.mode = mqbconf.QueueMode(fanout=mqbconf.QueueModeFanout([*app_ids])) + parameters.mode.fanout.app_ids = app_ids.copy() domain = mqbconf.DomainDefinition(self.name, parameters) return self._add_domain(Domain(self, domain)) def priority_domain(self, name: str) -> "Domain": - parameters = self.configurator.domain_definition() + parameters = self.configurator.priority_domain() parameters.name = name - parameters.mode = mqbconf.QueueMode(priority=mqbconf.QueueModePriority()) domain = mqbconf.DomainDefinition(self.name, parameters) return self._add_domain(Domain(self, domain)) @@ -314,6 +312,11 @@ class Proto: domain: mqbconf.Domain = field( default_factory=functools.partial( mqbconf.Domain, + mode=mqbconf.QueueMode( + broadcast=mqbconf.QueueModeBroadcast(), + fanout=mqbconf.QueueModeFanout(), + priority=mqbconf.QueueModePriority(), + ), max_delivery_attempts=0, deduplication_time_ms=300000, consistency=mqbconf.Consistency(strong=mqbconf.QueueConsistencyStrong()), @@ -338,7 +341,6 @@ class Proto: max_consumers=0, max_queues=0, max_idle_time=0, - mode=None, # overwritten ) ) diff --git a/src/python/blazingmq/dev/configurator/configurator.py b/src/python/blazingmq/dev/configurator/configurator.py index 8975d0e08..f44ebae9c 100644 --- a/src/python/blazingmq/dev/configurator/configurator.py +++ b/src/python/blazingmq/dev/configurator/configurator.py @@ -94,7 +94,33 @@ def virtual_cluster_definition(self): return copy.deepcopy(self.proto.virtual_cluster) def domain_definition(self): - return copy.deepcopy(self.proto.domain) + domain = copy.deepcopy(self.proto.domain) + domain.mode.broadcast = None + domain.mode.fanout = None + domain.mode.priority = None + + return domain + + def broadcast_domain(self): + domain = copy.deepcopy(self.proto.domain) + domain.mode.fanout = None + domain.mode.priority = None + + return domain + + def fanout_domain(self): + domain = copy.deepcopy(self.proto.domain) + domain.mode.broadcast = None + domain.mode.priority = None + + return domain + + def priority_domain(self): + domain = copy.deepcopy(self.proto.domain) + domain.mode.broadcast = None + domain.mode.fanout = None + + return domain def broker( self, diff --git a/src/python/blazingmq/dev/it/README.md b/src/python/blazingmq/dev/it/README.md index 523f9887a..42848fe37 100644 --- a/src/python/blazingmq/dev/it/README.md +++ b/src/python/blazingmq/dev/it/README.md @@ -585,7 +585,7 @@ messages output before BALL has been configured) are logged directly under This package performs the following transformations on the log records: -- It adds a a new attribute, `bmqContext`, which contains a description of the +- It adds a new attribute, `bmqContext`, which contains a description of the origin of the log record: `TEST` for records issued by test code, and the process name of the broker or tool for log records translated from BALL records. The attribute is available in format specifications. diff --git a/src/python/blazingmq/dev/it/data/data_metrics.py b/src/python/blazingmq/dev/it/data/data_metrics.py index e31479f38..2907217c4 100644 --- a/src/python/blazingmq/dev/it/data/data_metrics.py +++ b/src/python/blazingmq/dev/it/data/data_metrics.py @@ -55,70 +55,162 @@ def check(self, value: Any) -> bool: "appIds": { "bar": { "values": { - "queue_confirm_time_max": 0, - "queue_confirm_time_avg": 0, - "queue_nack_msgs": 0, - "queue_ack_time_max": 0, "queue_ack_msgs": 0, + "queue_ack_msgs_abs": 0, + "queue_ack_time_avg": 0, + "queue_ack_time_max": 0, + "queue_bytes_current": 96, + "queue_cfg_bytes": 0, + "queue_cfg_msgs": 0, "queue_confirm_msgs": 0, - "queue_push_bytes": 0, + "queue_confirm_msgs_abs": 0, + "queue_confirm_time_avg": 0, + "queue_confirm_time_max": 0, "queue_consumers_count": 0, + "queue_content_bytes": 96, + "queue_content_msgs": 32, + "queue_gc_msgs": 0, + "queue_gc_msgs_abs": 0, + "queue_history_abs": 0, + "queue_msgs_current": 32, + "queue_nack_msgs": 0, + "queue_nack_msgs_abs": 0, + "queue_nack_noquorum_msgs": 0, + "queue_nack_noquorum_msgs_abs": 0, "queue_producers_count": 0, + "queue_push_bytes": 0, + "queue_push_bytes_abs": 0, "queue_push_msgs": 0, - "queue_ack_time_avg": 0, + "queue_push_msgs_abs": 0, "queue_put_bytes": 0, + "queue_put_bytes_abs": 0, "queue_put_msgs": 0, + "queue_put_msgs_abs": 0, + "queue_queue_time_avg": 0, + "queue_queue_time_max": 0, + "queue_reject_msgs": 0, + "queue_reject_msgs_abs": 0, + "queue_role": 0, } }, "baz": { "values": { - "queue_confirm_time_max": 0, - "queue_confirm_time_avg": 0, - "queue_nack_msgs": 0, - "queue_ack_time_max": 0, "queue_ack_msgs": 0, + "queue_ack_msgs_abs": 0, + "queue_ack_time_avg": 0, + "queue_ack_time_max": 0, + "queue_bytes_current": 96, + "queue_cfg_bytes": 0, + "queue_cfg_msgs": 0, "queue_confirm_msgs": 0, - "queue_push_bytes": 0, + "queue_confirm_msgs_abs": 0, + "queue_confirm_time_avg": 0, + "queue_confirm_time_max": 0, "queue_consumers_count": 0, + "queue_content_bytes": 96, + "queue_content_msgs": 32, + "queue_gc_msgs": 0, + "queue_gc_msgs_abs": 0, + "queue_history_abs": 0, + "queue_msgs_current": 32, + "queue_nack_msgs": 0, + "queue_nack_msgs_abs": 0, + "queue_nack_noquorum_msgs": 0, + "queue_nack_noquorum_msgs_abs": 0, "queue_producers_count": 0, + "queue_push_bytes": 0, + "queue_push_bytes_abs": 0, "queue_push_msgs": 0, - "queue_ack_time_avg": 0, + "queue_push_msgs_abs": 0, "queue_put_bytes": 0, + "queue_put_bytes_abs": 0, "queue_put_msgs": 0, + "queue_put_msgs_abs": 0, + "queue_queue_time_avg": 0, + "queue_queue_time_max": 0, + "queue_reject_msgs": 0, + "queue_reject_msgs_abs": 0, + "queue_role": 0, } }, "foo": { "values": { - "queue_confirm_time_max": 0, - "queue_confirm_time_avg": 0, - "queue_nack_msgs": 0, - "queue_ack_time_max": 0, "queue_ack_msgs": 0, + "queue_ack_msgs_abs": 0, + "queue_ack_time_avg": 0, + "queue_ack_time_max": 0, + "queue_bytes_current": 96, + "queue_cfg_bytes": 0, + "queue_cfg_msgs": 0, "queue_confirm_msgs": 0, - "queue_push_bytes": 0, + "queue_confirm_msgs_abs": 0, + "queue_confirm_time_avg": 0, + "queue_confirm_time_max": 0, "queue_consumers_count": 0, + "queue_content_bytes": 96, + "queue_content_msgs": 32, + "queue_gc_msgs": 0, + "queue_gc_msgs_abs": 0, + "queue_history_abs": 0, + "queue_msgs_current": 32, + "queue_nack_msgs": 0, + "queue_nack_msgs_abs": 0, + "queue_nack_noquorum_msgs": 0, + "queue_nack_noquorum_msgs_abs": 0, "queue_producers_count": 0, + "queue_push_bytes": 0, + "queue_push_bytes_abs": 0, "queue_push_msgs": 0, - "queue_ack_time_avg": 0, + "queue_push_msgs_abs": 0, "queue_put_bytes": 0, + "queue_put_bytes_abs": 0, "queue_put_msgs": 0, + "queue_put_msgs_abs": 0, + "queue_queue_time_avg": 0, + "queue_queue_time_max": 0, + "queue_reject_msgs": 0, + "queue_reject_msgs_abs": 0, + "queue_role": 0, } }, }, "values": { - "queue_confirm_time_max": 0, - "queue_confirm_time_avg": 0, - "queue_nack_msgs": 0, - "queue_ack_time_max": GreaterThan(0), "queue_ack_msgs": 32, + "queue_ack_msgs_abs": 32, + "queue_ack_time_avg": GreaterThan(0), + "queue_ack_time_max": GreaterThan(0), + "queue_bytes_current": 96, + "queue_cfg_bytes": 1048576, + "queue_cfg_msgs": 1000, "queue_confirm_msgs": 0, - "queue_push_bytes": 0, + "queue_confirm_msgs_abs": 0, + "queue_confirm_time_avg": 0, + "queue_confirm_time_max": 0, "queue_consumers_count": 0, + "queue_content_bytes": 96, + "queue_content_msgs": 32, + "queue_gc_msgs": 0, + "queue_gc_msgs_abs": 0, + "queue_history_abs": 0, + "queue_msgs_current": 32, + "queue_nack_msgs": 0, + "queue_nack_msgs_abs": 0, + "queue_nack_noquorum_msgs": 0, + "queue_nack_noquorum_msgs_abs": 0, "queue_producers_count": 0, + "queue_push_bytes": 0, + "queue_push_bytes_abs": 0, "queue_push_msgs": 0, - "queue_ack_time_avg": GreaterThan(0), + "queue_push_msgs_abs": 0, "queue_put_bytes": 96, + "queue_put_bytes_abs": 96, "queue_put_msgs": 32, + "queue_put_msgs_abs": 32, + "queue_queue_time_avg": 0, + "queue_queue_time_max": 0, + "queue_reject_msgs": 0, + "queue_reject_msgs_abs": 0, + "queue_role": 1, }, } @@ -126,70 +218,325 @@ def check(self, value: Any) -> bool: "appIds": { "bar": { "values": { - "queue_confirm_time_max": GreaterThan(0), - "queue_confirm_time_avg": GreaterThan(0), - "queue_nack_msgs": 0, - "queue_ack_time_max": 0, "queue_ack_msgs": 0, + "queue_ack_msgs_abs": 0, + "queue_ack_time_avg": 0, + "queue_ack_time_max": 0, + "queue_bytes_current": 30, + "queue_cfg_bytes": 0, + "queue_cfg_msgs": 0, "queue_confirm_msgs": 0, - "queue_push_bytes": 0, + "queue_confirm_msgs_abs": 0, + "queue_confirm_time_avg": GreaterThan(0), + "queue_confirm_time_max": GreaterThan(0), "queue_consumers_count": 0, + "queue_content_bytes": 96, + "queue_content_msgs": 32, + "queue_gc_msgs": 0, + "queue_gc_msgs_abs": 0, + "queue_history_abs": 0, + "queue_msgs_current": 10, + "queue_nack_msgs": 0, + "queue_nack_msgs_abs": 0, + "queue_nack_noquorum_msgs": 0, + "queue_nack_noquorum_msgs_abs": 0, "queue_producers_count": 0, + "queue_push_bytes": 0, + "queue_push_bytes_abs": 0, "queue_push_msgs": 0, - "queue_ack_time_avg": 0, + "queue_push_msgs_abs": 0, "queue_put_bytes": 0, + "queue_put_bytes_abs": 0, "queue_put_msgs": 0, + "queue_put_msgs_abs": 0, + "queue_queue_time_avg": GreaterThan(0), + "queue_queue_time_max": GreaterThan(0), + "queue_reject_msgs": 0, + "queue_reject_msgs_abs": 0, + "queue_role": 0, } }, "baz": { "values": { - "queue_confirm_time_max": GreaterThan(0), - "queue_confirm_time_avg": GreaterThan(0), - "queue_nack_msgs": 0, - "queue_ack_time_max": 0, "queue_ack_msgs": 0, + "queue_ack_msgs_abs": 0, + "queue_ack_time_avg": 0, + "queue_ack_time_max": 0, + "queue_bytes_current": 63, + "queue_cfg_bytes": 0, + "queue_cfg_msgs": 0, "queue_confirm_msgs": 0, - "queue_push_bytes": 0, + "queue_confirm_msgs_abs": 0, + "queue_confirm_time_avg": GreaterThan(0), + "queue_confirm_time_max": GreaterThan(0), "queue_consumers_count": 0, + "queue_content_bytes": 96, + "queue_content_msgs": 32, + "queue_gc_msgs": 0, + "queue_gc_msgs_abs": 0, + "queue_history_abs": 0, + "queue_msgs_current": 21, + "queue_nack_msgs": 0, + "queue_nack_msgs_abs": 0, + "queue_nack_noquorum_msgs": 0, + "queue_nack_noquorum_msgs_abs": 0, "queue_producers_count": 0, + "queue_push_bytes": 0, + "queue_push_bytes_abs": 0, "queue_push_msgs": 0, - "queue_ack_time_avg": 0, + "queue_push_msgs_abs": 0, "queue_put_bytes": 0, + "queue_put_bytes_abs": 0, "queue_put_msgs": 0, + "queue_put_msgs_abs": 0, + "queue_queue_time_avg": GreaterThan(0), + "queue_queue_time_max": GreaterThan(0), + "queue_reject_msgs": 0, + "queue_reject_msgs_abs": 0, + "queue_role": 0, } }, "foo": { "values": { - "queue_confirm_time_max": GreaterThan(0), + "queue_ack_msgs": 0, + "queue_ack_msgs_abs": 0, + "queue_ack_time_avg": 0, + "queue_ack_time_max": 0, + "queue_bytes_current": 0, + "queue_cfg_bytes": 0, + "queue_cfg_msgs": 0, + "queue_confirm_msgs": 0, + "queue_confirm_msgs_abs": 0, "queue_confirm_time_avg": GreaterThan(0), + "queue_confirm_time_max": GreaterThan(0), + "queue_consumers_count": 0, + "queue_content_bytes": 96, + "queue_content_msgs": 32, + "queue_gc_msgs": 0, + "queue_gc_msgs_abs": 0, + "queue_history_abs": 0, + "queue_msgs_current": 0, "queue_nack_msgs": 0, - "queue_ack_time_max": 0, + "queue_nack_msgs_abs": 0, + "queue_nack_noquorum_msgs": 0, + "queue_nack_noquorum_msgs_abs": 0, + "queue_producers_count": 0, + "queue_push_bytes": 0, + "queue_push_bytes_abs": 0, + "queue_push_msgs": 0, + "queue_push_msgs_abs": 0, + "queue_put_bytes": 0, + "queue_put_bytes_abs": 0, + "queue_put_msgs": 0, + "queue_put_msgs_abs": 0, + "queue_queue_time_avg": GreaterThan(0), + "queue_queue_time_max": GreaterThan(0), + "queue_reject_msgs": 0, + "queue_reject_msgs_abs": 0, + "queue_role": 0, + } + }, + }, + "values": { + "queue_ack_msgs": 32, + "queue_ack_msgs_abs": 32, + "queue_ack_time_avg": GreaterThan(0), + "queue_ack_time_max": GreaterThan(0), + "queue_bytes_current": 63, + "queue_cfg_bytes": 1048576, + "queue_cfg_msgs": 1000, + "queue_confirm_msgs": 65, + "queue_confirm_msgs_abs": 65, + "queue_confirm_time_avg": GreaterThan(0), + "queue_confirm_time_max": GreaterThan(0), + "queue_consumers_count": 3, + "queue_content_bytes": 96, + "queue_content_msgs": 32, + "queue_gc_msgs": 0, + "queue_gc_msgs_abs": 0, + "queue_history_abs": 11, + "queue_msgs_current": 21, + "queue_nack_msgs": 0, + "queue_nack_msgs_abs": 0, + "queue_nack_noquorum_msgs": 0, + "queue_nack_noquorum_msgs_abs": 0, + "queue_producers_count": 0, + "queue_push_bytes": 288, + "queue_push_bytes_abs": 288, + "queue_push_msgs": 96, + "queue_push_msgs_abs": 96, + "queue_put_bytes": 96, + "queue_put_bytes_abs": 96, + "queue_put_msgs": 32, + "queue_put_msgs_abs": 32, + "queue_queue_time_avg": GreaterThan(0), + "queue_queue_time_max": GreaterThan(0), + "queue_reject_msgs": 0, + "queue_reject_msgs_abs": 0, + "queue_role": 1, + }, +} + +TEST_QUEUE_STATS_AFTER_PURGE = { + "appIds": { + "bar": { + "values": { "queue_ack_msgs": 0, + "queue_ack_msgs_abs": 0, + "queue_ack_time_avg": 0, + "queue_ack_time_max": 0, + "queue_bytes_current": 30, + "queue_cfg_bytes": 0, + "queue_cfg_msgs": 0, "queue_confirm_msgs": 0, + "queue_confirm_msgs_abs": 0, + "queue_confirm_time_avg": GreaterThan(0), + "queue_confirm_time_max": GreaterThan(0), + "queue_consumers_count": 0, + "queue_content_bytes": 96, + "queue_content_msgs": 32, + "queue_gc_msgs": 0, + "queue_gc_msgs_abs": 0, + "queue_history_abs": 0, + "queue_msgs_current": 10, + "queue_nack_msgs": 0, + "queue_nack_msgs_abs": 0, + "queue_nack_noquorum_msgs": 0, + "queue_nack_noquorum_msgs_abs": 0, + "queue_producers_count": 0, "queue_push_bytes": 0, + "queue_push_bytes_abs": 0, + "queue_push_msgs": 0, + "queue_push_msgs_abs": 0, + "queue_put_bytes": 0, + "queue_put_bytes_abs": 0, + "queue_put_msgs": 0, + "queue_put_msgs_abs": 0, + "queue_queue_time_avg": GreaterThan(0), + "queue_queue_time_max": GreaterThan(0), + "queue_reject_msgs": 0, + "queue_reject_msgs_abs": 0, + "queue_role": 0, + } + }, + "baz": { + "values": { + "queue_ack_msgs": 0, + "queue_ack_msgs_abs": 0, + "queue_ack_time_avg": 0, + "queue_ack_time_max": 0, + "queue_bytes_current": 0, + "queue_cfg_bytes": 0, + "queue_cfg_msgs": 0, + "queue_confirm_msgs": 0, + "queue_confirm_msgs_abs": 0, + "queue_confirm_time_avg": GreaterThan(0), + "queue_confirm_time_max": GreaterThan(0), "queue_consumers_count": 0, + "queue_content_bytes": 96, + "queue_content_msgs": 32, + "queue_gc_msgs": 0, + "queue_gc_msgs_abs": 0, + "queue_history_abs": 0, + "queue_msgs_current": 0, + "queue_nack_msgs": 0, + "queue_nack_msgs_abs": 0, + "queue_nack_noquorum_msgs": 0, + "queue_nack_noquorum_msgs_abs": 0, "queue_producers_count": 0, + "queue_push_bytes": 0, + "queue_push_bytes_abs": 0, "queue_push_msgs": 0, + "queue_push_msgs_abs": 0, + "queue_put_bytes": 0, + "queue_put_bytes_abs": 0, + "queue_put_msgs": 0, + "queue_put_msgs_abs": 0, + "queue_queue_time_avg": GreaterThan(0), + "queue_queue_time_max": GreaterThan(0), + "queue_reject_msgs": 0, + "queue_reject_msgs_abs": 0, + "queue_role": 0, + } + }, + "foo": { + "values": { + "queue_ack_msgs": 0, + "queue_ack_msgs_abs": 0, "queue_ack_time_avg": 0, + "queue_ack_time_max": 0, + "queue_bytes_current": 0, + "queue_cfg_bytes": 0, + "queue_cfg_msgs": 0, + "queue_confirm_msgs": 0, + "queue_confirm_msgs_abs": 0, + "queue_confirm_time_avg": GreaterThan(0), + "queue_confirm_time_max": GreaterThan(0), + "queue_consumers_count": 0, + "queue_content_bytes": 96, + "queue_content_msgs": 32, + "queue_gc_msgs": 0, + "queue_gc_msgs_abs": 0, + "queue_history_abs": 0, + "queue_msgs_current": 0, + "queue_nack_msgs": 0, + "queue_nack_msgs_abs": 0, + "queue_nack_noquorum_msgs": 0, + "queue_nack_noquorum_msgs_abs": 0, + "queue_producers_count": 0, + "queue_push_bytes": 0, + "queue_push_bytes_abs": 0, + "queue_push_msgs": 0, + "queue_push_msgs_abs": 0, "queue_put_bytes": 0, + "queue_put_bytes_abs": 0, "queue_put_msgs": 0, + "queue_put_msgs_abs": 0, + "queue_queue_time_avg": GreaterThan(0), + "queue_queue_time_max": GreaterThan(0), + "queue_reject_msgs": 0, + "queue_reject_msgs_abs": 0, + "queue_role": 0, } }, }, "values": { - "queue_confirm_time_max": GreaterThan(0), - "queue_confirm_time_avg": GreaterThan(0), - "queue_nack_msgs": 0, - "queue_ack_time_max": GreaterThan(0), "queue_ack_msgs": 32, + "queue_ack_msgs_abs": 32, + "queue_ack_time_avg": GreaterThan(0), + "queue_ack_time_max": GreaterThan(0), + "queue_bytes_current": 30, + "queue_cfg_bytes": 1048576, + "queue_cfg_msgs": 1000, "queue_confirm_msgs": 65, - "queue_push_bytes": 288, + "queue_confirm_msgs_abs": 65, + "queue_confirm_time_avg": GreaterThan(0), + "queue_confirm_time_max": GreaterThan(0), "queue_consumers_count": 3, + "queue_content_bytes": 96, + "queue_content_msgs": 32, + "queue_gc_msgs": 0, + "queue_gc_msgs_abs": 0, + "queue_history_abs": 22, + "queue_msgs_current": 10, + "queue_nack_msgs": 0, + "queue_nack_msgs_abs": 0, + "queue_nack_noquorum_msgs": 0, + "queue_nack_noquorum_msgs_abs": 0, "queue_producers_count": 0, + "queue_push_bytes": 288, + "queue_push_bytes_abs": 288, "queue_push_msgs": 96, - "queue_ack_time_avg": GreaterThan(0), + "queue_push_msgs_abs": 96, "queue_put_bytes": 96, + "queue_put_bytes_abs": 96, "queue_put_msgs": 32, + "queue_put_msgs_abs": 32, + "queue_queue_time_avg": GreaterThan(0), + "queue_queue_time_max": GreaterThan(0), + "queue_reject_msgs": 0, + "queue_reject_msgs_abs": 0, + "queue_role": 1, }, }