Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NgapBuildDmrppContainer lifecycle changes from lcfo-2023 #867

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
11 changes: 6 additions & 5 deletions modules/builddmrpp_module/NgapBuildDmrppContainer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ void NgapBuildDmrppContainer::initialize()
}

NgapBuildDmrppContainer::NgapBuildDmrppContainer(const NgapBuildDmrppContainer &copy_from) :
BESContainer(copy_from), d_data_rresource(copy_from.d_data_rresource), d_real_name(copy_from.d_real_name) {
BESContainer(copy_from), d_real_name(copy_from.d_real_name) {

BESDEBUG(MODULE, prolog << "BEGIN object address: "<< (void *) this << " Copying from: " << (void *) &copy_from << endl);
// We can not make a copy of this container once the request has been made.
if (d_data_rresource) {
if (copy_from.d_data_rresource) {
throw BESInternalError("The Container has already been accessed, cannot create a copy of this container.",
__FILE__, __LINE__);
}
Expand All @@ -113,14 +113,15 @@ void NgapBuildDmrppContainer::_duplicate(NgapBuildDmrppContainer &copy_to) {
BESDEBUG(MODULE, prolog << "BEGIN object address: "<< (void *) this << " Copying to: " << (void *) &copy_to << endl);

if (copy_to.d_data_rresource) {
throw BESInternalError("The Container has already been accessed, cannot duplicate this resource.",
throw BESInternalError("The target Container has already been accessed, "
"cannot duplicate this resource into it.",
__FILE__, __LINE__);
}

BESContainer::_duplicate(copy_to);

copy_to.d_real_name = d_real_name;
copy_to.d_data_rresource = d_data_rresource;
copy_to.d_data_rresource = std::move(d_data_rresource);
}

BESContainer *
Expand Down Expand Up @@ -159,7 +160,7 @@ string NgapBuildDmrppContainer::access() {

auto data_url(std::make_shared<http::url>(data_access_url_str, true));
{
d_data_rresource = std::make_shared<http::RemoteResource>(data_url);
d_data_rresource = std::make_unique<http::RemoteResource>(data_url);
#ifndef NDEBUG
BESStopWatch besTimer;
if (BESISDEBUG(MODULE) || BESDebug::IsSet(TIMING_LOG_KEY) || BESLog::TheLog()->is_verbose()) {
Expand Down
2 changes: 1 addition & 1 deletion modules/builddmrpp_module/NgapBuildDmrppContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace builddmrpp {
class NgapBuildDmrppContainer : public BESContainer {

private:
std::shared_ptr<http::RemoteResource> d_data_rresource = nullptr;
std::unique_ptr<http::RemoteResource> d_data_rresource = nullptr;
std::string d_real_name; ///< The full name of the thing (filename, database table name, ...)

void initialize();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <string>

#include "RemoteResource.h"
#include "NgapBuildDmrppContainerStorage.h"
#include "NgapBuildDmrppContainer.h"

Expand Down