Skip to content

Commit e37e618

Browse files
committed
Remove unneeded operator= overloads
1 parent 4f28bc4 commit e37e618

File tree

3 files changed

+1
-53
lines changed

3 files changed

+1
-53
lines changed

collector/lib/CollectorStatsExporter.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define _COLLECTOR_STATS_EXPORTER_H_
33

44
#include <memory>
5-
#include <utility>
65

76
#include "CollectorConfig.h"
87
#include "CollectorStats.h"
@@ -14,32 +13,6 @@ namespace collector {
1413

1514
class CollectorStatsExporter {
1615
public:
17-
CollectorStatsExporter() = default;
18-
CollectorStatsExporter(const CollectorStatsExporter&) = delete;
19-
CollectorStatsExporter(CollectorStatsExporter&&) = delete;
20-
CollectorStatsExporter& operator=(const CollectorStatsExporter&) = delete;
21-
~CollectorStatsExporter() = default;
22-
23-
CollectorStatsExporter& operator=(CollectorStatsExporter&& other) noexcept {
24-
auto swap_running = other.thread_.running();
25-
26-
if (swap_running) {
27-
other.stop();
28-
}
29-
30-
registry_.swap(other.registry_);
31-
std::swap(config_, other.config_);
32-
std::swap(system_inspector_, other.system_inspector_);
33-
connections_total_reporter_.swap(other.connections_total_reporter_);
34-
connections_rate_reporter_.swap(other.connections_rate_reporter_);
35-
36-
if (swap_running) {
37-
start();
38-
}
39-
40-
return *this;
41-
}
42-
4316
CollectorStatsExporter(std::shared_ptr<prometheus::Registry> registry, const CollectorConfig* config, system_inspector::Service* si);
4417

4518
bool start();

collector/lib/system-inspector/Service.cpp

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,7 @@
3333

3434
namespace collector::system_inspector {
3535

36-
Service::Service() = default;
3736
Service::~Service() = default;
38-
Service& Service::operator=(Service&& other) noexcept {
39-
{
40-
auto other_sinsp_lock = std::lock_guard<std::mutex>(other.libsinsp_mutex_);
41-
auto this_sinsp_lock = std::lock_guard<std::mutex>(libsinsp_mutex_);
42-
43-
inspector_.swap(other.inspector_);
44-
container_metadata_inspector_.swap(other.container_metadata_inspector_);
45-
default_formatter_.swap(other.default_formatter_);
46-
}
47-
48-
signal_handlers_.swap(other.signal_handlers_);
49-
50-
userspace_stats_ = other.userspace_stats_;
51-
global_event_filter_ = other.global_event_filter_;
52-
53-
{
54-
auto other_running_lock = std::lock_guard<std::mutex>(other.running_mutex_);
55-
auto this_running_lock = std::lock_guard<std::mutex>(running_mutex_);
56-
std::swap(running_, other.running_);
57-
}
58-
59-
return *this;
60-
}
6137

6238
Service::Service(const CollectorConfig& config, CollectorOutput* client)
6339
: inspector_(std::make_unique<sinsp>(true)),

collector/lib/system-inspector/Service.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ namespace collector::system_inspector {
2424

2525
class Service : public SystemInspector {
2626
public:
27-
Service();
2827
Service(const Service&) = delete;
2928
Service(Service&&) = delete;
3029
Service& operator=(const Service&) = delete;
31-
Service& operator=(Service&&) noexcept;
30+
Service& operator=(Service&&) = delete;
3231
~Service() override;
3332

3433
Service(const CollectorConfig& config, CollectorOutput* client);

0 commit comments

Comments
 (0)