summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-08-07 07:39:55 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-08-07 07:44:36 +0000
commit394557a1a6434a8a112781dd1560e0a411026d92 (patch)
treea32ebd221e57fbf77225cdac55793c0ab303c366 /searchcore
parent4c9b70f42b071d9d3c7116a11f6a749c50be5afb (diff)
Use tranfer by value and std::move to avoid copying shared pointer to the Update.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp2
-rw-r--r--searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h6
-rw-r--r--searchcore/src/vespa/searchcore/proton/persistenceengine/ipersistencehandler.h7
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.h2
7 files changed, 16 insertions, 17 deletions
diff --git a/searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp
index 0c72d11899a..8eace5ac657 100644
--- a/searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp
+++ b/searchcore/src/tests/proton/persistenceengine/persistence_handler_map/persistence_handler_map_test.cpp
@@ -16,7 +16,7 @@ struct DummyPersistenceHandler : public IPersistenceHandler {
using SP = std::shared_ptr<DummyPersistenceHandler>;
void initialize() override {}
void handlePut(FeedToken, const storage::spi::Bucket &, storage::spi::Timestamp, DocumentSP) override {}
- void handleUpdate(FeedToken, const storage::spi::Bucket &, storage::spi::Timestamp, const document::DocumentUpdate::SP &) override {}
+ void handleUpdate(FeedToken, const storage::spi::Bucket &, storage::spi::Timestamp, DocumentUpdateSP) override {}
void handleRemove(FeedToken, const storage::spi::Bucket &, storage::spi::Timestamp, const document::DocumentId &) override {}
void handleListBuckets(IBucketIdListResultHandler &) override {}
void handleSetClusterState(const storage::spi::ClusterState &, IGenericResultHandler &) override {}
diff --git a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp
index f5346213a7a..214ca186656 100644
--- a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp
+++ b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp
@@ -204,7 +204,7 @@ struct MyHandler : public IPersistenceHandler, IBucketFreezer {
}
void handleUpdate(FeedToken token, const Bucket& bucket,
- Timestamp timestamp, const document::DocumentUpdate::SP& upd) override {
+ Timestamp timestamp, DocumentUpdateSP upd) override {
token->setResult(std::make_unique<UpdateResult>(existingTimestamp), existingTimestamp > 0);
handle(token, bucket, timestamp, upd->getId());
}
diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp
index 75086f7a2dd..051e9726452 100644
--- a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp
+++ b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.cpp
@@ -31,18 +31,20 @@ UpdateOperation::UpdateOperation(Type type)
UpdateOperation::UpdateOperation(Type type, const BucketId &bucketId,
- const Timestamp &timestamp, const DocumentUpdate::SP &upd)
+ const Timestamp &timestamp, DocumentUpdate::SP upd)
: DocumentOperation(type, bucketId, timestamp),
- _upd(upd)
+ _upd(std::move(upd))
{
}
-UpdateOperation::UpdateOperation(const BucketId &bucketId, const Timestamp &timestamp, const DocumentUpdate::SP &upd)
- : UpdateOperation(FeedOperation::UPDATE, bucketId, timestamp, upd)
+UpdateOperation::UpdateOperation(const BucketId &bucketId, const Timestamp &timestamp, DocumentUpdate::SP upd)
+ : UpdateOperation(FeedOperation::UPDATE, bucketId, timestamp, std::move(upd))
{
}
+UpdateOperation::~UpdateOperation() = default;
+
void
UpdateOperation::serializeUpdate(vespalib::nbostream &os) const
{
diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h
index 83e87fea096..7975452cfc6 100644
--- a/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h
+++ b/searchcore/src/vespa/searchcore/proton/feedoperation/updateoperation.h
@@ -17,7 +17,7 @@ private:
DocumentUpdateSP _upd;
UpdateOperation(Type type, const document::BucketId &bucketId,
const storage::spi::Timestamp &timestamp,
- const DocumentUpdateSP &upd);
+ DocumentUpdateSP upd);
void serializeUpdate(vespalib::nbostream &os) const;
void deserializeUpdate(vespalib::nbostream && is, const document::DocumentTypeRepo &repo);
public:
@@ -25,8 +25,8 @@ public:
UpdateOperation(Type type);
UpdateOperation(const document::BucketId &bucketId,
const storage::spi::Timestamp &timestamp,
- const DocumentUpdateSP &upd);
- ~UpdateOperation() override {}
+ DocumentUpdateSP upd);
+ ~UpdateOperation() override;
const DocumentUpdateSP &getUpdate() const { return _upd; }
void serialize(vespalib::nbostream &os) const override;
void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override;
diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/ipersistencehandler.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/ipersistencehandler.h
index c95f51b29dc..a4bede28d7b 100644
--- a/searchcore/src/vespa/searchcore/proton/persistenceengine/ipersistencehandler.h
+++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/ipersistencehandler.h
@@ -30,10 +30,7 @@ public:
IPersistenceHandler(const IPersistenceHandler &) = delete;
IPersistenceHandler & operator = (const IPersistenceHandler &) = delete;
- /**
- * Virtual destructor to allow inheritance.
- */
- virtual ~IPersistenceHandler() { }
+ virtual ~IPersistenceHandler() = default;
/**
* Called before all other functions so that the persistence handler
@@ -45,7 +42,7 @@ public:
storage::spi::Timestamp timestamp, DocumentSP doc) = 0;
virtual void handleUpdate(FeedToken token, const storage::spi::Bucket &bucket,
- storage::spi::Timestamp timestamp, const DocumentUpdateSP &upd) = 0;
+ storage::spi::Timestamp timestamp, DocumentUpdateSP upd) = 0;
virtual void handleRemove(FeedToken token, const storage::spi::Bucket &bucket,
storage::spi::Timestamp timestamp, const document::DocumentId &id) = 0;
diff --git a/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.cpp b/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.cpp
index cd6df7c5816..7d151a9ef14 100644
--- a/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.cpp
@@ -44,9 +44,9 @@ PersistenceHandlerProxy::handlePut(FeedToken token, const Bucket &bucket, Timest
}
void
-PersistenceHandlerProxy::handleUpdate(FeedToken token, const Bucket &bucket, Timestamp timestamp, const DocumentUpdateSP &upd)
+PersistenceHandlerProxy::handleUpdate(FeedToken token, const Bucket &bucket, Timestamp timestamp, DocumentUpdateSP upd)
{
- auto op = std::make_unique<UpdateOperation>(bucket.getBucketId().stripUnused(), timestamp, upd);
+ auto op = std::make_unique<UpdateOperation>(bucket.getBucketId().stripUnused(), timestamp, std::move(upd));
_feedHandler.handleOperation(std::move(token), std::move(op));
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.h b/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.h
index 38ddb667213..ee6e8a7ee42 100644
--- a/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.h
+++ b/searchcore/src/vespa/searchcore/proton/server/persistencehandlerproxy.h
@@ -28,7 +28,7 @@ public:
storage::spi::Timestamp timestamp, DocumentSP doc) override;
void handleUpdate(FeedToken token, const storage::spi::Bucket &bucket,
- storage::spi::Timestamp timestamp, const DocumentUpdateSP &upd) override;
+ storage::spi::Timestamp timestamp, DocumentUpdateSP upd) override;
void handleRemove(FeedToken token, const storage::spi::Bucket &bucket,
storage::spi::Timestamp timestamp,