aboutsummaryrefslogtreecommitdiffstats
path: root/storageapi
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-11-26 17:50:18 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-11-26 17:50:18 +0000
commit0acc3577c746805516323c5dd77f0fd5d4f8777b (patch)
treeca37d31857c79f2d693de8173f012d0cd3384d0b /storageapi
parenta2d4e3411d4173be5767750d4e71081d54bba9b6 (diff)
Add noexcept
Diffstat (limited to 'storageapi')
-rw-r--r--storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp18
-rw-r--r--storageapi/src/vespa/storageapi/messageapi/storagemessage.h80
2 files changed, 49 insertions, 49 deletions
diff --git a/storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp b/storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp
index 978b5d4a7e4..1c2eccb0743 100644
--- a/storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp
+++ b/storageapi/src/vespa/storageapi/messageapi/storagemessage.cpp
@@ -164,7 +164,7 @@ vespalib::string Empty;
}
// TODO we ideally want this removed. Currently just in place to support usage as map key when emplacement not available
-StorageMessageAddress::StorageMessageAddress()
+StorageMessageAddress::StorageMessageAddress() noexcept
: _cluster(&Empty),
_precomputed_storage_hash(0),
_type(lib::NodeType::Type::UNKNOWN),
@@ -172,12 +172,12 @@ StorageMessageAddress::StorageMessageAddress()
_index(0)
{}
-StorageMessageAddress::StorageMessageAddress(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index)
+StorageMessageAddress::StorageMessageAddress(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index) noexcept
: StorageMessageAddress(cluster, type, index, Protocol::STORAGE)
{ }
StorageMessageAddress::StorageMessageAddress(const vespalib::string * cluster, const lib::NodeType& type,
- uint16_t index, Protocol protocol)
+ uint16_t index, Protocol protocol) noexcept
: _cluster(cluster),
_precomputed_storage_hash(calculate_node_hash(type, index)),
_type(type.getType()),
@@ -199,7 +199,7 @@ StorageMessageAddress::to_mbus_route() const
}
bool
-StorageMessageAddress::operator==(const StorageMessageAddress& other) const
+StorageMessageAddress::operator==(const StorageMessageAddress& other) const noexcept
{
if (_protocol != other._protocol) return false;
if (_type != other._type) return false;
@@ -236,12 +236,12 @@ StorageMessageAddress::print(vespalib::asciistream & out) const
TransportContext::~TransportContext() = default;
StorageMessage::Id
-StorageMessage::generateMsgId()
+StorageMessage::generateMsgId() noexcept
{
return _G_lastMsgId.fetch_add(1, std::memory_order_relaxed);
}
-StorageMessage::StorageMessage(const MessageType& type, Id id)
+StorageMessage::StorageMessage(const MessageType& type, Id id) noexcept
: _type(type),
_msgId(id),
_address(),
@@ -251,7 +251,7 @@ StorageMessage::StorageMessage(const MessageType& type, Id id)
{
}
-StorageMessage::StorageMessage(const StorageMessage& other, Id id)
+StorageMessage::StorageMessage(const StorageMessage& other, Id id) noexcept
: _type(other._type),
_msgId(id),
_address(),
@@ -264,12 +264,12 @@ StorageMessage::StorageMessage(const StorageMessage& other, Id id)
StorageMessage::~StorageMessage() = default;
const documentapi::LoadType&
-StorageMessage::getLoadType() const {
+StorageMessage::getLoadType() const noexcept {
return documentapi::LoadType::DEFAULT;
}
void
-StorageMessage::setNewMsgId()
+StorageMessage::setNewMsgId() noexcept
{
_msgId = generateMsgId();
}
diff --git a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h
index b22a9a6566f..b49612d8728 100644
--- a/storageapi/src/vespa/storageapi/messageapi/storagemessage.h
+++ b/storageapi/src/vespa/storageapi/messageapi/storagemessage.h
@@ -241,16 +241,16 @@ public:
MessageType(const MessageType &) = delete;
MessageType& operator=(const MessageType &) = delete;
~MessageType();
- Id getId() const { return _id; }
- static Id getMaxId() { return MESSAGETYPE_MAX_ID; }
- const vespalib::string& getName() const { return _name; }
- bool isReply() const { return (_replyOf != 0); }
+ Id getId() const noexcept { return _id; }
+ static Id getMaxId() noexcept { return MESSAGETYPE_MAX_ID; }
+ const vespalib::string& getName() const noexcept { return _name; }
+ bool isReply() const noexcept { return (_replyOf != 0); }
/** Only valid to call on replies. */
- const MessageType& getCommandType() const { return *_replyOf; }
+ const MessageType& getCommandType() const noexcept { return *_replyOf; }
/** Only valid to call on commands. */
- const MessageType& getReplyType() const { return *_reply; }
- bool operator==(const MessageType& type) const { return (_id == type._id); }
- bool operator!=(const MessageType& type) const { return (_id != type._id); }
+ const MessageType& getReplyType() const noexcept { return *_reply; }
+ bool operator==(const MessageType& type) const noexcept { return (_id == type._id); }
+ bool operator!=(const MessageType& type) const noexcept { return (_id != type._id); }
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
};
@@ -274,31 +274,31 @@ private:
uint16_t _index;
public:
- StorageMessageAddress(); // Only to be used when transient default ctor semantics are needed by containers
- StorageMessageAddress(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index);
- StorageMessageAddress(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index, Protocol protocol);
+ StorageMessageAddress() noexcept; // Only to be used when transient default ctor semantics are needed by containers
+ StorageMessageAddress(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index) noexcept;
+ StorageMessageAddress(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index, Protocol protocol) noexcept;
~StorageMessageAddress();
- void setProtocol(Protocol p) { _protocol = p; }
+ void setProtocol(Protocol p) noexcept { _protocol = p; }
mbus::Route to_mbus_route() const;
- Protocol getProtocol() const { return _protocol; }
- uint16_t getIndex() const { return _index; }
- lib::NodeType::Type getNodeType() const { return _type; }
- const vespalib::string& getCluster() const { return *_cluster; }
+ Protocol getProtocol() const noexcept { return _protocol; }
+ uint16_t getIndex() const noexcept { return _index; }
+ lib::NodeType::Type getNodeType() const noexcept { return _type; }
+ const vespalib::string& getCluster() const noexcept { return *_cluster; }
// Returns precomputed hash over <type, index> pair. Other fields not included.
[[nodiscard]] uint32_t internal_storage_hash() const noexcept {
return _precomputed_storage_hash;
}
- bool operator==(const StorageMessageAddress& other) const;
+ bool operator==(const StorageMessageAddress& other) const noexcept;
vespalib::string toString() const;
friend std::ostream & operator << (std::ostream & os, const StorageMessageAddress & addr);
- static StorageMessageAddress create(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index) {
+ static StorageMessageAddress create(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index) noexcept {
return api::StorageMessageAddress(cluster, type, index);
}
- static StorageMessageAddress createDocApi(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index) {
+ static StorageMessageAddress createDocApi(const vespalib::string * cluster, const lib::NodeType& type, uint16_t index) noexcept {
return api::StorageMessageAddress(cluster, type, index, Protocol::DOCUMENT);
}
private:
@@ -353,10 +353,11 @@ public:
static const char* getPriorityString(Priority);
private:
+ static document::Bucket getDummyBucket() noexcept { return document::Bucket(document::BucketSpace::invalid(), document::BucketId()); }
mutable std::unique_ptr<TransportContext> _transportContext;
protected:
- static Id generateMsgId();
+ static Id generateMsgId() noexcept;
const MessageType& _type;
Id _msgId;
@@ -365,34 +366,33 @@ protected:
uint32_t _approxByteSize;
Priority _priority;
- StorageMessage(const MessageType& code, Id id);
- StorageMessage(const StorageMessage&, Id id);
+ StorageMessage(const MessageType& code, Id id) noexcept;
+ StorageMessage(const StorageMessage&, Id id) noexcept;
- static document::Bucket getDummyBucket() { return document::Bucket(document::BucketSpace::invalid(), document::BucketId()); }
public:
StorageMessage& operator=(const StorageMessage&) = delete;
StorageMessage(const StorageMessage&) = delete;
~StorageMessage() override;
- Id getMsgId() const { return _msgId; }
+ Id getMsgId() const noexcept { return _msgId; }
/** Method used by storage commands to set a new id. */
- void setNewMsgId();
+ void setNewMsgId() noexcept;
/**
* Set the id of this message. Typically used to set the id to a
* unique value previously generated with the generateMsgId method.
**/
- void forceMsgId(Id msgId) { _msgId = msgId; }
+ void forceMsgId(Id msgId) noexcept { _msgId = msgId; }
- const MessageType& getType() const { return _type; }
+ const MessageType& getType() const noexcept { return _type; }
- void setPriority(Priority p) { _priority = p; }
- Priority getPriority() const { return _priority; }
+ void setPriority(Priority p) noexcept { _priority = p; }
+ Priority getPriority() const noexcept { return _priority; }
- const StorageMessageAddress* getAddress() const { return (_address.getNodeType() != lib::NodeType::Type::UNKNOWN) ? &_address : nullptr; }
+ const StorageMessageAddress* getAddress() const noexcept { return (_address.getNodeType() != lib::NodeType::Type::UNKNOWN) ? &_address : nullptr; }
- void setAddress(const StorageMessageAddress& address) {
+ void setAddress(const StorageMessageAddress& address) noexcept {
_address = address;
}
@@ -404,7 +404,7 @@ public:
return _approxByteSize;
}
- void setApproxByteSize(uint32_t value) {
+ void setApproxByteSize(uint32_t value) noexcept {
_approxByteSize = value;
}
@@ -413,11 +413,11 @@ public:
* created, whether it was a storageprotocol message, a documentprotocol
* message, or an RPC call.
*/
- void setTransportContext(std::unique_ptr<TransportContext> context) {
+ void setTransportContext(std::unique_ptr<TransportContext> context) noexcept {
_transportContext = std::move(context);
}
- std::unique_ptr<TransportContext> getTransportContext() const {
+ std::unique_ptr<TransportContext> getTransportContext() const noexcept {
return std::move(_transportContext);
}
@@ -431,16 +431,16 @@ public:
*/
virtual bool callHandler(MessageHandler&, const StorageMessage::SP&) const = 0;
- const documentapi::LoadType& getLoadType() const;
+ const documentapi::LoadType& getLoadType() const noexcept;
- mbus::Trace && steal_trace() { return std::move(_trace); }
- mbus::Trace& getTrace() { return _trace; }
- const mbus::Trace& getTrace() const { return _trace; }
+ mbus::Trace && steal_trace() noexcept { return std::move(_trace); }
+ mbus::Trace& getTrace() noexcept { return _trace; }
+ const mbus::Trace& getTrace() const noexcept { return _trace; }
/**
Sets the trace object for this message.
*/
- void setTrace(vespalib::Trace && trace) { _trace = std::move(trace); }
+ void setTrace(vespalib::Trace && trace) noexcept { _trace = std::move(trace); }
/**
* Cheap version of tostring().
@@ -448,7 +448,7 @@ public:
virtual vespalib::string getSummary() const;
virtual document::Bucket getBucket() const { return getDummyBucket(); }
- document::BucketId getBucketId() const { return getBucket().getBucketId(); }
+ document::BucketId getBucketId() const noexcept { return getBucket().getBucketId(); }
virtual bool hasSingleBucketId() const { return false; }
virtual LockingRequirements lockingRequirements() const noexcept {
// Safe default: assume exclusive locking is required.