From 4be58f582e0cb3313eedc0abedc86170ab41580c Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Fri, 10 Aug 2018 23:35:13 +0200 Subject: Pass stringref by value --- storageapi/src/vespa/storageapi/message/persistence.h | 2 +- storageapi/src/vespa/storageapi/message/removelocation.cpp | 2 +- storageapi/src/vespa/storageapi/message/removelocation.h | 2 +- storageapi/src/vespa/storageapi/message/visitor.cpp | 2 +- storageapi/src/vespa/storageapi/message/visitor.h | 10 +++++----- .../src/vespa/storageapi/messageapi/maintenancecommand.h | 2 +- storageapi/src/vespa/storageapi/messageapi/returncode.h | 2 +- storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp | 6 +++--- storageapi/src/vespa/storageapi/messageapi/storagemessage.h | 4 ++-- 9 files changed, 16 insertions(+), 16 deletions(-) (limited to 'storageapi') diff --git a/storageapi/src/vespa/storageapi/message/persistence.h b/storageapi/src/vespa/storageapi/message/persistence.h index 59934154cf5..c27264624b7 100644 --- a/storageapi/src/vespa/storageapi/message/persistence.h +++ b/storageapi/src/vespa/storageapi/message/persistence.h @@ -194,7 +194,7 @@ public: const document::DocumentId& getDocumentId() const { return _docId; } Timestamp getBeforeTimestamp() const { return _beforeTimestamp; } const vespalib::string& getFieldSet() const { return _fieldSet; } - void setFieldSet(const vespalib::stringref & fieldSet) { _fieldSet = fieldSet; } + void setFieldSet(vespalib::stringref fieldSet) { _fieldSet = fieldSet; } vespalib::string getSummary() const override; void print(std::ostream& out, bool verbose, const std::string& indent) const override; diff --git a/storageapi/src/vespa/storageapi/message/removelocation.cpp b/storageapi/src/vespa/storageapi/message/removelocation.cpp index ab44f0e6890..ac50bdd6a1e 100644 --- a/storageapi/src/vespa/storageapi/message/removelocation.cpp +++ b/storageapi/src/vespa/storageapi/message/removelocation.cpp @@ -8,7 +8,7 @@ namespace storage::api { IMPLEMENT_COMMAND(RemoveLocationCommand, RemoveLocationReply) IMPLEMENT_REPLY(RemoveLocationReply) -RemoveLocationCommand::RemoveLocationCommand(const vespalib::stringref & documentSelection, +RemoveLocationCommand::RemoveLocationCommand(vespalib::stringref documentSelection, const document::Bucket &bucket) : BucketInfoCommand(MessageType::REMOVELOCATION, bucket), _documentSelection(documentSelection) diff --git a/storageapi/src/vespa/storageapi/message/removelocation.h b/storageapi/src/vespa/storageapi/message/removelocation.h index 54edbc5916e..cdf43219169 100644 --- a/storageapi/src/vespa/storageapi/message/removelocation.h +++ b/storageapi/src/vespa/storageapi/message/removelocation.h @@ -10,7 +10,7 @@ namespace storage::api { class RemoveLocationCommand : public BucketInfoCommand { public: - RemoveLocationCommand(const vespalib::stringref & documentSelection, const document::Bucket &bucket); + RemoveLocationCommand(vespalib::stringref documentSelection, const document::Bucket &bucket); ~RemoveLocationCommand(); void print(std::ostream& out, bool verbose, const std::string& indent) const override; diff --git a/storageapi/src/vespa/storageapi/message/visitor.cpp b/storageapi/src/vespa/storageapi/message/visitor.cpp index 3cb6f72d5d9..2597b818d10 100644 --- a/storageapi/src/vespa/storageapi/message/visitor.cpp +++ b/storageapi/src/vespa/storageapi/message/visitor.cpp @@ -140,7 +140,7 @@ CreateVisitorReply::print(std::ostream& out, bool verbose, } } -DestroyVisitorCommand::DestroyVisitorCommand(const vespalib::stringref & instanceId) +DestroyVisitorCommand::DestroyVisitorCommand(vespalib::stringref instanceId) : StorageCommand(MessageType::VISITOR_DESTROY), _instanceId(instanceId) { diff --git a/storageapi/src/vespa/storageapi/message/visitor.h b/storageapi/src/vespa/storageapi/message/visitor.h index 0e78ea93753..c1dc65a23d6 100644 --- a/storageapi/src/vespa/storageapi/message/visitor.h +++ b/storageapi/src/vespa/storageapi/message/visitor.h @@ -63,13 +63,13 @@ public: ~CreateVisitorCommand(); void setVisitorCmdId(uint32_t id) { _visitorCmdId = id; } - void setControlDestination(const vespalib::stringref & d) + void setControlDestination(vespalib::stringref d) { _controlDestination = d; } - void setDataDestination(const vespalib::stringref & d) { _dataDestination = d; } + void setDataDestination(vespalib::stringref d) { _dataDestination = d; } void setParameters(const vdslib::Parameters& params) { _params = params; } void setMaximumPendingReplyCount(uint32_t count) { _maxPendingReplyCount = count; } - void setFieldSet(const vespalib::stringref& fieldSet) + void setFieldSet(vespalib::stringref fieldSet) { _fieldSet = fieldSet; } void setVisitRemoves(bool value = true) { _visitRemoves = value; } void setVisitInconsistentBuckets(bool visitInconsistent = true) @@ -77,7 +77,7 @@ public: void addBucketToBeVisited(const document::BucketId& id) { _buckets.push_back(id); } void setVisitorId(const VisitorId id) { _visitorId = id; } - void setInstanceId(const vespalib::stringref & id) { _instanceId = id; } + void setInstanceId(vespalib::stringref id) { _instanceId = id; } void setQueueTimeout(uint32_t milliSecs) { _queueTimeout = milliSecs; } void setFromTime(Timestamp ts) { _fromTime = ts; } void setToTime(Timestamp ts) { _toTime = ts; } @@ -157,7 +157,7 @@ private: vespalib::string _instanceId; public: - explicit DestroyVisitorCommand(const vespalib::stringref & instanceId); + explicit DestroyVisitorCommand(vespalib::stringref instanceId); const vespalib::string & getInstanceId() const { return _instanceId; } diff --git a/storageapi/src/vespa/storageapi/messageapi/maintenancecommand.h b/storageapi/src/vespa/storageapi/messageapi/maintenancecommand.h index 7e9a41e6220..3bf65d3ac15 100644 --- a/storageapi/src/vespa/storageapi/messageapi/maintenancecommand.h +++ b/storageapi/src/vespa/storageapi/messageapi/maintenancecommand.h @@ -17,7 +17,7 @@ public: ~MaintenanceCommand(); const vespalib::string& getReason() const { return _reason; }; - void setReason(const vespalib::stringref & reason) { _reason = reason; }; + void setReason(vespalib::stringref reason) { _reason = reason; }; protected: vespalib::string _reason; }; diff --git a/storageapi/src/vespa/storageapi/messageapi/returncode.h b/storageapi/src/vespa/storageapi/messageapi/returncode.h index 78f2168e170..6e2aa79f09f 100644 --- a/storageapi/src/vespa/storageapi/messageapi/returncode.h +++ b/storageapi/src/vespa/storageapi/messageapi/returncode.h @@ -87,7 +87,7 @@ public: size_t getSerializedSize() const override; const vespalib::string& getMessage() const { return _message; } - void setMessage(const vespalib::stringref & message) { _message = message; } + void setMessage(vespalib::stringref message) { _message = message; } Result getResult() const { return _result; } diff --git a/storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp b/storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp index 380d846dd93..39ece68d2fe 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp +++ b/storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp @@ -123,7 +123,7 @@ MessageType::MessageType::get(Id id) } return *it->second; } -MessageType::MessageType(const vespalib::stringref & name, Id id, +MessageType::MessageType(vespalib::stringref name, Id id, const MessageType* replyOf) : _name(name), _id(id), _reply(NULL), _replyOf(replyOf) { @@ -163,14 +163,14 @@ std::ostream & operator << (std::ostream & os, const StorageMessageAddress & add } static vespalib::string -createAddress(const vespalib::stringref & cluster, const lib::NodeType& type, uint16_t index) +createAddress(vespalib::stringref cluster, const lib::NodeType& type, uint16_t index) { vespalib::asciistream os; os << STORAGEADDRESS_PREFIX << cluster << '/' << type.toString() << '/' << index << "/default"; return os.str(); } -StorageMessageAddress::StorageMessageAddress(const vespalib::stringref & cluster, const lib::NodeType& type, +StorageMessageAddress::StorageMessageAddress(vespalib::stringref cluster, const lib::NodeType& type, uint16_t index, Protocol protocol) : _route(), _retryEnabled(false), diff --git a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h index 6c561f3af21..34ad25e76cf 100644 --- a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h +++ b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h @@ -163,7 +163,7 @@ private: MessageType *_reply; const MessageType *_replyOf; - MessageType(const vespalib::stringref & name, Id id, const MessageType* replyOf = 0); + MessageType(vespalib::stringref name, Id id, const MessageType* replyOf = 0); public: static const MessageType DOCBLOCK; static const MessageType DOCBLOCK_REPLY; @@ -280,7 +280,7 @@ private: public: StorageMessageAddress(const mbus::Route& route); - StorageMessageAddress(const vespalib::stringref & clusterName, + StorageMessageAddress(vespalib::stringref clusterName, const lib::NodeType& type, uint16_t index, Protocol protocol = STORAGE); ~StorageMessageAddress(); -- cgit v1.2.3