Skip to content

Commit

Permalink
Fix[BMQ,MQB]: ensure Solaris build
Browse files Browse the repository at this point in the history
Signed-off-by: Evgeny Malygin <[email protected]>
  • Loading branch information
678098 committed Jan 9, 2025
1 parent ebddab2 commit 81b0f42
Show file tree
Hide file tree
Showing 37 changed files with 296 additions and 284 deletions.
18 changes: 9 additions & 9 deletions src/groups/bmq/bmqa/bmqa_message.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ static void test2_validPushMessagePrint()
bdlbb::PooledBlobBufferFactory bufferFactory(
4 * 1024,
bmqtst::TestHelperUtil::allocator());
bmqp::BlobPoolUtil::BlobSpPool blobSpPool(
bmqp::BlobPoolUtil::BlobSpPoolSp blobSpPool(
bmqp::BlobPoolUtil::createBlobPool(
&bufferFactory,
bmqtst::TestHelperUtil::allocator()));
Expand All @@ -192,7 +192,7 @@ static void test2_validPushMessagePrint()
bsl::strlen(buffer));

// Create PushEventBuilder
bmqp::PushEventBuilder peb(&blobSpPool,
bmqp::PushEventBuilder peb(blobSpPool.get(),
bmqtst::TestHelperUtil::allocator());
BMQTST_ASSERT_EQ(sizeof(bmqp::EventHeader),
static_cast<size_t>(peb.eventSize()));
Expand Down Expand Up @@ -256,7 +256,7 @@ static void test3_messageProperties()
bdlbb::PooledBlobBufferFactory bufferFactory(
4 * 1024,
bmqtst::TestHelperUtil::allocator());
bmqp::BlobPoolUtil::BlobSpPool blobSpPool(
bmqp::BlobPoolUtil::BlobSpPoolSp blobSpPool(
bmqp::BlobPoolUtil::createBlobPool(
&bufferFactory,
bmqtst::TestHelperUtil::allocator()));
Expand Down Expand Up @@ -290,7 +290,7 @@ static void test3_messageProperties()
bdlbb::BlobUtil::append(&payload, buffer, bsl::strlen(buffer));

// Create PushEventBuilder
bmqp::PushEventBuilder peb(&blobSpPool,
bmqp::PushEventBuilder peb(blobSpPool.get(),
bmqtst::TestHelperUtil::allocator());

// Add SubQueueInfo option
Expand Down Expand Up @@ -432,7 +432,7 @@ static void test4_subscriptionHandle()
bdlbb::PooledBlobBufferFactory bufferFactory(
4 * 1024,
bmqtst::TestHelperUtil::allocator());
bmqp::BlobPoolUtil::BlobSpPool blobSpPool(
bmqp::BlobPoolUtil::BlobSpPoolSp blobSpPool(
bmqp::BlobPoolUtil::createBlobPool(
&bufferFactory,
bmqtst::TestHelperUtil::allocator()));
Expand All @@ -459,7 +459,7 @@ static void test4_subscriptionHandle()
bmqtst::TestHelperUtil::allocator());

// Create PushEventBuilder
bmqp::PushEventBuilder peb(&blobSpPool,
bmqp::PushEventBuilder peb(blobSpPool.get(),
bmqtst::TestHelperUtil::allocator());
BMQTST_ASSERT_EQ(0, peb.messageCount());

Expand Down Expand Up @@ -525,7 +525,7 @@ static void test4_subscriptionHandle()
bmqtst::TestHelperUtil::allocator());

// Create PushEventBuilder
bmqp::PushEventBuilder peb(&blobSpPool,
bmqp::PushEventBuilder peb(blobSpPool.get(),
bmqtst::TestHelperUtil::allocator());
BMQTST_ASSERT_EQ(0, peb.messageCount());

Expand Down Expand Up @@ -573,7 +573,7 @@ static void test4_subscriptionHandle()
bmqtst::TestHelperUtil::allocator());

// Create PutEventBuilder
bmqp::PutEventBuilder builder(&blobSpPool,
bmqp::PutEventBuilder builder(blobSpPool.get(),
bmqtst::TestHelperUtil::allocator());
BMQTST_ASSERT_EQ(0, builder.messageCount());

Expand Down Expand Up @@ -614,7 +614,7 @@ static void test4_subscriptionHandle()
bmqtst::TestHelperUtil::allocator());

// Create AckEventBuilder
bmqp::AckEventBuilder builder(&blobSpPool,
bmqp::AckEventBuilder builder(blobSpPool.get(),
bmqtst::TestHelperUtil::allocator());
BMQTST_ASSERT_EQ(0, builder.messageCount());

Expand Down
8 changes: 4 additions & 4 deletions src/groups/bmq/bmqa/bmqa_messageevent.t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,11 @@ static void test2_ackMesageIteratorTest()
bdlbb::PooledBlobBufferFactory bufferFactory(
256,
bmqtst::TestHelperUtil::allocator());
bmqp::BlobPoolUtil::BlobSpPool blobSpPool(
bmqp::BlobPoolUtil::BlobSpPoolSp blobSpPool(
bmqp::BlobPoolUtil::createBlobPool(
&bufferFactory,
bmqtst::TestHelperUtil::allocator()));
bmqp::AckEventBuilder builder(&blobSpPool,
bmqp::AckEventBuilder builder(blobSpPool.get(),
bmqtst::TestHelperUtil::allocator());
bsl::vector<AckData> messages(bmqtst::TestHelperUtil::allocator());

Expand Down Expand Up @@ -234,11 +234,11 @@ static void test3_putMessageIteratorTest()
bdlbb::PooledBlobBufferFactory bufferFactory(
256,
bmqtst::TestHelperUtil::allocator());
bmqp::BlobPoolUtil::BlobSpPool blobSpPool(
bmqp::BlobPoolUtil::BlobSpPoolSp blobSpPool(
bmqp::BlobPoolUtil::createBlobPool(
&bufferFactory,
bmqtst::TestHelperUtil::allocator()));
bmqp::PutEventBuilder builder(&blobSpPool,
bmqp::PutEventBuilder builder(blobSpPool.get(),
bmqtst::TestHelperUtil::allocator());
bsl::vector<PutData> messages(bmqtst::TestHelperUtil::allocator());

Expand Down
16 changes: 8 additions & 8 deletions src/groups/bmq/bmqa/bmqa_mocksession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ Event MockSessionUtil::createAckEvent(const bsl::vector<AckParams>& acks,

// TODO: deprecate `createAckEvent` with bufferFactory arg and introduce
// another function with BlobSpPool arg.
BlobSpPool blobSpPool(
bmqp::BlobPoolUtil::BlobSpPoolSp blobSpPool(
bmqp::BlobPoolUtil::createBlobPool(bufferFactory, allocator));

bmqp::AckEventBuilder ackBuilder(&blobSpPool, alloc);
bmqp::AckEventBuilder ackBuilder(blobSpPool.get(), alloc);
for (size_t i = 0; i != acks.size(); ++i) {
const AckParams& params = acks[i];
const QueueImplSp& impQueue = reinterpret_cast<const QueueImplSp&>(
Expand Down Expand Up @@ -335,10 +335,10 @@ Event MockSessionUtil::createPushEvent(

// TODO: deprecate `createPushEvent` with bufferFactory arg and introduce
// another function with BlobSpPool arg.
BlobSpPool blobSpPool(
bmqp::BlobPoolUtil::BlobSpPoolSp blobSpPool(
bmqp::BlobPoolUtil::createBlobPool(bufferFactory, allocator));

bmqp::PushEventBuilder pushBuilder(&blobSpPool, alloc);
bmqp::PushEventBuilder pushBuilder(blobSpPool.get(), alloc);

for (size_t i = 0; i != pushEventParams.size(); ++i) {
const QueueImplSp& queueImplPtr = reinterpret_cast<const QueueImplSp&>(
Expand Down Expand Up @@ -948,7 +948,7 @@ int MockSession::start(const bsls::TimeInterval& timeout)
MockSession::MockSession(const bmqt::SessionOptions& options,
bslma::Allocator* allocator)
: d_blobBufferFactory(1024, allocator)
, d_blobSpPool(
, d_blobSpPool_sp(
bmqp::BlobPoolUtil::createBlobPool(&d_blobBufferFactory, allocator))
, d_eventHandler_mp(0)
, d_calls(allocator)
Expand Down Expand Up @@ -994,7 +994,7 @@ MockSession::MockSession(bslma::ManagedPtr<SessionEventHandler> eventHandler,
const bmqt::SessionOptions& options,
bslma::Allocator* allocator)
: d_blobBufferFactory(1024, allocator)
, d_blobSpPool(
, d_blobSpPool_sp(
bmqp::BlobPoolUtil::createBlobPool(&d_blobBufferFactory, allocator))
, d_eventHandler_mp(eventHandler)
, d_calls(bslma::Default::allocator(allocator))
Expand Down Expand Up @@ -1520,7 +1520,7 @@ void MockSession::loadMessageEventBuilder(MessageEventBuilder* builder)
g_bufferFactory_p,
d_allocator_p);

eventImplSpRef->configureAsMessageEvent(&d_blobSpPool);
eventImplSpRef->configureAsMessageEvent(d_blobSpPool_sp.get());
eventImplSpRef->setMessageCorrelationIdContainer(
d_corrIdContainer_sp.get());
}
Expand All @@ -1544,7 +1544,7 @@ void MockSession::loadConfirmEventBuilder(ConfirmEventBuilder* builder)
}

new (builderImplRef.d_buffer.buffer())
bmqp::ConfirmEventBuilder(&d_blobSpPool, d_allocator_p);
bmqp::ConfirmEventBuilder(d_blobSpPool_sp.get(), d_allocator_p);

builderImplRef.d_builder_p = reinterpret_cast<bmqp::ConfirmEventBuilder*>(
builderImplRef.d_buffer.buffer());
Expand Down
7 changes: 5 additions & 2 deletions src/groups/bmq/bmqa/bmqa_mocksession.h
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,9 @@ class MockSession : public AbstractSession {
bdlcc::ObjectPoolFunctors::RemoveAll<bdlbb::Blob> >
BlobSpPool;

/// Shared pointer to a pool of shared pointers to Blobs
typedef bsl::shared_ptr<BlobSpPool> BlobSpPoolSp;

/// Aligned buffer holding the two key hash map
typedef bsls::AlignedBuffer<k_MAX_SIZEOF_BMQC_TWOKEYHASHMAP>
TwoKeyHashMapBuffer;
Expand Down Expand Up @@ -1035,8 +1038,8 @@ class MockSession : public AbstractSession {
/// Buffer factory used to build Blobs with `d_blobSpPool`
bdlbb::PooledBlobBufferFactory d_blobBufferFactory;

/// Pool of shared pointers to blobs
BlobSpPool d_blobSpPool;
/// Shared pointer to the pool of shared pointers to blobs
BlobSpPoolSp d_blobSpPool_sp;

/// Event handler (set only in asynchronous mode)
bslma::ManagedPtr<SessionEventHandler> d_eventHandler_mp;
Expand Down
6 changes: 3 additions & 3 deletions src/groups/bmq/bmqimp/bmqimp_application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ Application::Application(
, d_channelsTip(&d_allocator)
, d_blobBufferFactory(sessionOptions.blobBufferSize(),
d_allocators.get("BlobBufferFactory"))
, d_blobSpPool(
, d_blobSpPool_sp(
bmqp::BlobPoolUtil::createBlobPool(&d_blobBufferFactory,
d_allocators.get("BlobSpPool")))
, d_scheduler(bsls::SystemClockType::e_MONOTONIC, &d_allocator)
Expand Down Expand Up @@ -584,13 +584,13 @@ Application::Application(
NegotiatedChannelFactoryConfig(&d_statChannelFactory,
negotiationMessage,
sessionOptions.connectTimeout(),
&d_blobSpPool,
d_blobSpPool_sp.get(),
allocator),
allocator)
, d_connectHandle_mp()
, d_brokerSession(&d_scheduler,
&d_blobBufferFactory,
&d_blobSpPool,
d_blobSpPool_sp.get(),
d_sessionOptions,
eventHandlerCB,
bdlf::MemFnUtil::memFn(&Application::stateCb, this),
Expand Down
7 changes: 4 additions & 3 deletions src/groups/bmq/bmqimp/bmqimp_application.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class Application {
public:
// PUBLIC TYPES
typedef bmqp::BlobPoolUtil::BlobSpPool BlobSpPool;
typedef bmqp::BlobPoolUtil::BlobSpPoolSp BlobSpPoolSp;

private:
// PRIVATE TYPES
Expand Down Expand Up @@ -118,8 +119,8 @@ class Application {
bdlbb::PooledBlobBufferFactory d_blobBufferFactory;
// Factory for blob buffers

/// Pool of shared pointers to blobs.
BlobSpPool d_blobSpPool;
/// Shared pointer to the pool of shared pointers to blobs.
BlobSpPoolSp d_blobSpPool_sp;

bdlmt::EventScheduler d_scheduler;
// Scheduler
Expand Down Expand Up @@ -324,7 +325,7 @@ inline bool Application::isStarted() const

inline Application::BlobSpPool* Application::blobSpPool()
{
return &d_blobSpPool;
return d_blobSpPool_sp.get();
}

} // close package namespace
Expand Down
Loading

0 comments on commit 81b0f42

Please sign in to comment.