Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 36 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ if (NOT DEFINED INSTALL_TARGETS)
set(BMQ_TARGET_PROMETHEUS_NEEDED NO)
set(BMQ_TARGET_IT_NEEDED YES)
set(BMQ_TARGET_FUZZTESTS_NEEDED NO)
set(BMQ_TARGET_AUTHNPASS_NEEDED YES)
set(BMQ_TARGET_AUTHNFAIL_NEEDED YES)
set(BMQ_TARGET_AUTHNBASIC_NEEDED YES)
else()
bbproject_check_install_target("bmqbrkr" installBMQBRKR)
bbproject_check_install_target("BMQBRKR_NIGHTLY" installNightly)
Expand All @@ -148,14 +151,20 @@ else()
set(BMQ_TARGET_PROMETHEUS_NEEDED NO)
set(BMQ_TARGET_IT_NEEDED NO)
set(BMQ_TARGET_FUZZTESTS_NEEDED NO)

bbproject_check_install_target("bmq" installBMQ)
bbproject_check_install_target("mqb" installMQB)
bbproject_check_install_target("bmqbrkrcfg" installBMQBRKRCFG)
bbproject_check_install_target("bmqtool" installBMQTOOL)
bbproject_check_install_target("bmqstoragetool" installBMQSTORAGETOOL)
bbproject_check_install_target("prometheus" installPROMETHEUS)
bbproject_check_install_target("fuzztests" installFUZZTESTS)
set(BMQ_TARGET_AUTHNPASS_NEEDED NO)
set(BMQ_TARGET_AUTHNFAIL_NEEDED NO)
set(BMQ_TARGET_AUTHNBASIC_NEEDED NO)

bbproject_check_install_target("bmq" installBMQ)
bbproject_check_install_target("mqb" installMQB)
bbproject_check_install_target("bmqbrkrcfg" installBMQBRKRCFG)
bbproject_check_install_target("bmqtool" installBMQTOOL)
bbproject_check_install_target("bmqstoragetool" installBMQSTORAGETOOL)
bbproject_check_install_target("prometheus" installPROMETHEUS)
bbproject_check_install_target("fuzztests" installFUZZTESTS)
bbproject_check_install_target("authnpass" installAUTHNPASS)
bbproject_check_install_target("authnfail" installAUTHNFAIL)
bbproject_check_install_target("authnbasic" installAUTHNBASIC)

if (installBMQ)
set(BMQ_TARGET_BMQ_NEEDED YES)
Expand Down Expand Up @@ -200,6 +209,24 @@ else()
set(BMQ_TARGET_MQB_NEEDED YES)
set(BMQ_TARGET_FUZZTESTS_NEEDED YES)
endif()

if (installAUTHNPASS)
set(BMQ_TARGET_BMQ_NEEDED YES)
set(BMQ_TARGET_MQB_NEEDED YES)
set(BMQ_TARGET_AUTHNPASS_NEEDED YES)
endif()

if (installAUTHNFAIL)
set(BMQ_TARGET_BMQ_NEEDED YES)
set(BMQ_TARGET_MQB_NEEDED YES)
set(BMQ_TARGET_AUTHNFAIL_NEEDED YES)
endif()

if (installAUTHNBASIC)
set(BMQ_TARGET_BMQ_NEEDED YES)
set(BMQ_TARGET_MQB_NEEDED YES)
set(BMQ_TARGET_AUTHNBASIC_NEEDED YES)
endif()
endif()

find_package(Git)
Expand Down Expand Up @@ -326,7 +353,7 @@ if(NOT BMQ_TARGET_BMQBRKR_NEEDED)
return()
endif()

# Install all the headers for mqb + bmq
# Install all the headers for mqb + bmq
install(TARGETS bmqbrkr_plugins
EXPORT BmqbrkrPluginsTargets
FILE_SET HEADERS
Expand Down
2 changes: 1 addition & 1 deletion bin/build-darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ CMAKE_OPTIONS=(\

PKG_CONFIG_PATH="${DIR_INSTALL}/lib/pkgconfig:${BREW_PKG_CONFIG_PATH}" \
cmake -B "${DIR_BUILD}/blazingmq" -S "${DIR_ROOT}" "${CMAKE_OPTIONS[@]}"
make -C "${DIR_BUILD}/blazingmq" -j 16
cmake --build "${DIR_BUILD}/blazingmq" --parallel 16 --target bmqbrkr bmqtool all.it

echo broker is here: "${DIR_BUILD}/blazingmq/src/applications/bmqbrkr/bmqbrkr.tsk"
echo to run the broker: "${DIR_BUILD}/blazingmq/src/applications/bmqbrkr/run"
Expand Down
4 changes: 2 additions & 2 deletions docker/sanitizers/build_sanitizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ apt-get install -qy cmake

# Install LLVM
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
chmod +x llvm.sh
LLVM_VERSION=18
LLVM_TAG="llvmorg-18.1.8"
./llvm.sh ${LLVM_VERSION} all

# Create version-agnostic pointers to required LLVM binaries.
ln -sf /usr/bin/clang-${LLVM_VERSION} /usr/bin/clang
ln -sf /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++
ln -sf /usr/bin/clang++-${LLVM_VERSION} /usr/bin/clang++
ln -sf /usr/bin/llvm-symbolizer-${LLVM_VERSION} /usr/bin/llvm-symbolizer

# Set some initial constants
Expand Down
3 changes: 3 additions & 0 deletions src/groups/mqb/mqba/mqba_adminsession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ void AdminSession::processEvent(const bmqp::Event& event,
{
// executed by the *IO* thread

// PRECONDITIONS
BSLS_ASSERT_SAFE(!event.isAuthenticationEvent());

if (!event.isControlEvent()) {
BALL_LOG_ERROR << "#ADMCLIENT_UNEXPECTED_EVENT " << description()
<< ": Unexpected event type: " << event;
Expand Down
37 changes: 27 additions & 10 deletions src/groups/mqb/mqba/mqba_application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@

#include <mqbscm_version.h>
// MQB
#include <mqba_authenticator.h>
#include <mqba_configprovider.h>
#include <mqba_dispatcher.h>
#include <mqba_domainmanager.h>
#include <mqba_initialconnectionhandler.h>
#include <mqba_sessionnegotiator.h>
#include <mqbauthn_authenticationcontroller.h>
#include <mqbblp_clustercatalog.h>
#include <mqbblp_relayqueueengine.h>
#include <mqbcfg_brokerconfig.h>
Expand Down Expand Up @@ -170,6 +171,7 @@ Application::Application(bdlmt::EventScheduler* scheduler,
, d_allocatorsStatContext_p(allocatorsStatContext)
, d_pluginManager_mp()
, d_statController_mp()
, d_authenticationController_mp()
, d_configProvider_mp()
, d_dispatcher_mp()
, d_transportManager_mp()
Expand Down Expand Up @@ -257,7 +259,8 @@ int Application::start(bsl::ostream& errorDescription)
rc_DOMAINMANAGER = -8,
rc_TRANSPORTMANAGER_LISTEN = -9,
rc_ADMIN_POOL_START_FAILURE = -10,
rc_PLUGINMANAGER = -11
rc_PLUGINMANAGER = -11,
rc_AUTHENTICATIONCONTROLLER = -12,
};

int rc = rc_SUCCESS;
Expand Down Expand Up @@ -299,6 +302,17 @@ int Application::start(bsl::ostream& errorDescription)
return (rc * 100) + rc_STATCONTROLLER; // RETURN
}

// Start the AuthenticationController
d_authenticationController_mp.load(
new (*d_allocator_p) mqbauthn::AuthenticationController(
d_pluginManager_mp.get(),
d_allocators.get("AuthenticationController")),
d_allocator_p);
rc = d_authenticationController_mp->start(errorDescription);
if (rc != 0) {
return (rc * 100) + rc_AUTHENTICATIONCONTROLLER; // RETURN
}

// Start the config provider
d_configProvider_mp.load(new (*d_allocator_p) ConfigProvider(
d_allocators.get("ConfigProvider")),
Expand All @@ -320,6 +334,13 @@ int Application::start(bsl::ostream& errorDescription)
}

// Start the transport manager
bslma::ManagedPtr<mqbnet::Authenticator> authenticatorMp(
new (*d_allocator_p) Authenticator(d_authenticationController_mp.get(),
&d_blobSpPool,
d_scheduler_p,
d_allocators.get("Authenticator")),
d_allocator_p);

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not creating SessionNegotiator below in the same way (vs. using raw pointer and then bslma::ManagedPtr)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setAdminCommandEnqueueCallback is a function for SessionNegotiator, but not exposed for mqbnet::Negotiator.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very minor (since we do not throw exceptions) but what I meant is

    bslma::ManagedPtr<mqbnet::Negotiator> negotiatorMp(
        new (*d_allocator_p)
        SessionNegotiator(&d_bufferFactory,
                          d_dispatcher_mp.get(),
                          d_statController_mp->clientsStatContext(),
                          &d_blobSpPool,
                          d_scheduler_p,
                          d_allocators.get("SessionNegotiator"),
        d_allocator_p);
    negotiatorMp
        ->setAdminCommandEnqueueCallback(
            bdlf::BindUtil::bind(&Application::enqueueCommand,
                                 this,
                                 bdlf::PlaceHolders::_1,    // source
                                 bdlf::PlaceHolders::_2,    // cmd
                                 bdlf::PlaceHolders::_3,    // onProcessedCb
                                 bdlf::PlaceHolders::_4));  // fromReroute

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I understand. But mqbnet::Negotiator doesn't expose an interface setAdminCommandEnqueueCallback.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is not a problem (we could do bslma::ManagedPtr<mqbnet::Negotiator> negotiatorMp(impl); where impl is bslma::ManagedPtr<mqbnet::Negotiator>). The problem is setClusterCatalog below.
This is ok since we do not throw exceptions, do early returns

SessionNegotiator* sessionNegotiator = new (*d_allocator_p)
SessionNegotiator(&d_bufferFactory,
d_dispatcher_mp.get(),
Expand All @@ -340,17 +361,11 @@ int Application::start(bsl::ostream& errorDescription)
bslma::ManagedPtr<mqbnet::Negotiator> negotiatorMp(sessionNegotiator,
d_allocator_p);

bslma::ManagedPtr<mqbnet::InitialConnectionHandler>
initialConnectionHandlerMp(
new (*d_allocator_p) InitialConnectionHandler(
negotiatorMp,
d_allocators.get("InitialConnectionHandler")),
d_allocator_p);

d_transportManager_mp.load(new (*d_allocator_p) mqbnet::TransportManager(
d_scheduler_p,
&d_bufferFactory,
initialConnectionHandlerMp,
authenticatorMp,
negotiatorMp,
d_statController_mp.get(),
d_allocators.get("TransportManager")),
d_allocator_p);
Expand Down Expand Up @@ -521,6 +536,7 @@ void Application::stop()
STOP_OBJ(d_domainManager_mp, "DomainManager");
STOP_OBJ(d_dispatcher_mp, "Dispatcher");
STOP_OBJ(d_configProvider_mp, "ConfigProvider");
STOP_OBJ(d_authenticationController_mp, "AuthenticationController");
STOP_OBJ(d_statController_mp, "StatController");
STOP_OBJ(d_pluginManager_mp, "PluginManager");

Expand All @@ -530,6 +546,7 @@ void Application::stop()
DESTROY_OBJ(d_transportManager_mp, "TransportManager");
DESTROY_OBJ(d_dispatcher_mp, "Dispatcher");
DESTROY_OBJ(d_configProvider_mp, "ConfigProvider");
DESTROY_OBJ(d_authenticationController_mp, "AuthenticationController");
DESTROY_OBJ(d_statController_mp, "StatController");
DESTROY_OBJ(d_pluginManager_mp, "PluginManager");

Expand Down
18 changes: 12 additions & 6 deletions src/groups/mqb/mqba/mqba_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

// MQB
#include <mqba_commandrouter.h>
#include <mqbauthn_authenticationcontroller.h>
#include <mqbcmd_messages.h>
#include <mqbconfm_messages.h>
#include <mqbi_cluster.h>
Expand Down Expand Up @@ -99,12 +100,14 @@ class Application {

private:
// PRIVATE TYPES
typedef bslma::ManagedPtr<mqbplug::PluginManager> PluginManagerMp;
typedef bslma::ManagedPtr<mqbblp::ClusterCatalog> ClusterCatalogMp;
typedef bslma::ManagedPtr<ConfigProvider> ConfigProviderMp;
typedef bslma::ManagedPtr<Dispatcher> DispatcherMp;
typedef bslma::ManagedPtr<DomainManager> DomainManagerMp;
typedef bslma::ManagedPtr<mqbstat::StatController> StatControllerMp;
typedef bslma::ManagedPtr<mqbplug::PluginManager> PluginManagerMp;
typedef bslma::ManagedPtr<mqbblp::ClusterCatalog> ClusterCatalogMp;
typedef bslma::ManagedPtr<ConfigProvider> ConfigProviderMp;
typedef bslma::ManagedPtr<Dispatcher> DispatcherMp;
typedef bslma::ManagedPtr<DomainManager> DomainManagerMp;
typedef bslma::ManagedPtr<mqbstat::StatController> StatControllerMp;
typedef bslma::ManagedPtr<mqbauthn::AuthenticationController>
AuthenticationControllerMp;
typedef bslma::ManagedPtr<mqbnet::TransportManager> TransportManagerMp;
typedef bdlcc::SharedObjectPool<
bdlbb::Blob,
Expand Down Expand Up @@ -146,6 +149,9 @@ class Application {
/// Statistics controller component.
StatControllerMp d_statController_mp;

/// Authentication controller component.
AuthenticationControllerMp d_authenticationController_mp;

ConfigProviderMp d_configProvider_mp;

DispatcherMp d_dispatcher_mp;
Expand Down
Loading
Loading