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

Reduce boost dependency in Utilities/XrdAdaptor #30262

Merged
merged 1 commit into from
Jun 26, 2020
Merged
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: 8 additions & 3 deletions Utilities/XrdAdaptor/src/QualityMetric.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <memory>

#include "tbb/concurrent_unordered_map.h"
#include <boost/utility.hpp>

#include "FWCore/Utilities/interface/propagate_const.h"
#include "FWCore/Utilities/interface/thread_safety_macros.h"
Expand All @@ -18,14 +17,17 @@ namespace XrdAdaptor {
class QualityMetricSource;
class QualityMetricUniqueSource;

class QualityMetricWatch : boost::noncopyable {
class QualityMetricWatch {
friend class QualityMetricSource;

public:
QualityMetricWatch() : m_parent1(nullptr), m_parent2(nullptr) {}
QualityMetricWatch(QualityMetricWatch &&);
~QualityMetricWatch();

QualityMetricWatch(const QualityMetricWatch &) = delete;
QualityMetricWatch &operator=(const QualityMetricWatch &) = delete;

void swap(QualityMetricWatch &);

private:
Expand All @@ -35,13 +37,16 @@ namespace XrdAdaptor {
edm::propagate_const<QualityMetric *> m_parent2;
};

class QualityMetric : boost::noncopyable {
class QualityMetric {
friend class QualityMetricWatch;

public:
QualityMetric(timespec now, int default_value = 260);
unsigned get();

QualityMetric(const QualityMetric &) = delete;
QualityMetric &operator=(const QualityMetric &) = delete;

private:
void finishWatch(timespec now, int ms);

Expand Down
6 changes: 4 additions & 2 deletions Utilities/XrdAdaptor/src/XrdRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <future>
#include <vector>

#include <boost/utility.hpp>
#include <XrdCl/XrdClXRootDResponses.hh>

#include "Utilities/StorageFactory/interface/Storage.h"
Expand All @@ -20,10 +19,13 @@ namespace XrdAdaptor {

class XrdReadStatistics;

class ClientRequest : boost::noncopyable, public XrdCl::ResponseHandler {
class ClientRequest : public XrdCl::ResponseHandler {
friend class Source;

public:
ClientRequest(const ClientRequest &) = delete;
ClientRequest &operator=(const ClientRequest &) = delete;

ClientRequest(RequestManager &manager, void *into, IOSize size, IOOffset off)
: m_failure_count(0), m_into(into), m_size(size), m_off(off), m_iolist(nullptr), m_manager(manager) {}

Expand Down
7 changes: 6 additions & 1 deletion Utilities/XrdAdaptor/src/XrdRequestManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ long long timeDiffMS(const timespec &a, const timespec &b) {
* We do not care about the response of sending the monitoring information;
* this handler class simply frees any returned buffer to prevent memory leaks.
*/
class SendMonitoringInfoHandler : boost::noncopyable, public XrdCl::ResponseHandler {
class SendMonitoringInfoHandler : public XrdCl::ResponseHandler {
void HandleResponse(XrdCl::XRootDStatus *status, XrdCl::AnyObject *response) override {
if (response) {
XrdCl::Buffer *buffer = nullptr;
Expand All @@ -78,6 +78,11 @@ class SendMonitoringInfoHandler : boost::noncopyable, public XrdCl::ResponseHand
delete response;
delete status;
}

public:
SendMonitoringInfoHandler(const SendMonitoringInfoHandler &) = delete;
SendMonitoringInfoHandler &operator=(const SendMonitoringInfoHandler &) = delete;
SendMonitoringInfoHandler() = default;
};

CMS_THREAD_SAFE SendMonitoringInfoHandler nullHandler;
Expand Down
11 changes: 8 additions & 3 deletions Utilities/XrdAdaptor/src/XrdRequestManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <random>
#include <sys/stat.h>

#include <boost/utility.hpp>
#include "tbb/concurrent_unordered_set.h"

#include "FWCore/Utilities/interface/EDMException.h"
Expand Down Expand Up @@ -42,8 +41,11 @@ namespace XrdAdaptor {
uint16_t m_code;
};

class RequestManager : boost::noncopyable {
class RequestManager {
public:
RequestManager(const RequestManager &) = delete;
RequestManager &operator=(const RequestManager &) = delete;

static const unsigned int XRD_DEFAULT_TIMEOUT = 3 * 60;

virtual ~RequestManager() = default;
Expand Down Expand Up @@ -232,8 +234,11 @@ namespace XrdAdaptor {

std::atomic<unsigned> m_excluded_active_count;

class OpenHandler : boost::noncopyable, public XrdCl::ResponseHandler {
class OpenHandler : public XrdCl::ResponseHandler {
public:
OpenHandler(const OpenHandler &) = delete;
OpenHandler &operator=(const OpenHandler &) = delete;

static std::shared_ptr<OpenHandler> getInstance(std::weak_ptr<RequestManager> manager) {
OpenHandler *instance_ptr = new OpenHandler(manager);
std::shared_ptr<OpenHandler> instance(instance_ptr);
Expand Down
5 changes: 4 additions & 1 deletion Utilities/XrdAdaptor/src/XrdSource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ using namespace XrdAdaptor;
// inactive anyway!) can even timeout. Rather than wait around for
// a few minutes in the main thread, this class asynchronously closes
// and deletes the XrdCl::File
class DelayedClose : boost::noncopyable, public XrdCl::ResponseHandler {
class DelayedClose : public XrdCl::ResponseHandler {
public:
DelayedClose(const DelayedClose &) = delete;
DelayedClose &operator=(const DelayedClose &) = delete;

DelayedClose(std::shared_ptr<XrdCl::File> fh, const std::string &id, const std::string &site)
: m_fh(std::move(fh)), m_id(id), m_site(site) {
if (m_fh && m_fh->IsOpen()) {
Expand Down
7 changes: 4 additions & 3 deletions Utilities/XrdAdaptor/src/XrdSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include <memory>
#include <vector>

#include <boost/utility.hpp>

#include "QualityMetric.h"

namespace XrdCl {
Expand All @@ -22,8 +20,11 @@ namespace XrdAdaptor {
class XrdSiteStatistics;
class XrdStatisticsService;

class Source : public std::enable_shared_from_this<Source>, boost::noncopyable {
class Source : public std::enable_shared_from_this<Source> {
public:
Source(const Source &) = delete;
Source &operator=(const Source &) = delete;

Source(timespec now, std::unique_ptr<XrdCl::File> fileHandle, const std::string &exclude);

~Source();
Expand Down