diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-11-17 18:31:29 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-11-17 18:31:29 +0000 |
commit | 8e5767e8d878d59c082ade3ef51f991a81338220 (patch) | |
tree | 5c86157e0449947fafd57c0a904018bc9173fcb5 /persistence | |
parent | ab3518e8b3a4caf742e12a134c4fb1d2bbf3c293 (diff) |
Move removeLocation over to Asynchandler and issue all removes for one bucket before waiting for the replies.
Prepare RemoveResult to contain more replies.
Diffstat (limited to 'persistence')
-rw-r--r-- | persistence/src/vespa/persistence/spi/result.h | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/persistence/src/vespa/persistence/spi/result.h b/persistence/src/vespa/persistence/spi/result.h index 4ec323c6b47..73838e99a18 100644 --- a/persistence/src/vespa/persistence/spi/result.h +++ b/persistence/src/vespa/persistence/spi/result.h @@ -25,14 +25,15 @@ public: /** * Constructor to use for a result where there is no error. */ - Result() : _errorCode(ErrorType::NONE), _errorMessage() {} + Result() noexcept : _errorCode(ErrorType::NONE), _errorMessage() {} /** * Constructor to use when an error has been detected. */ - Result(ErrorType error, const vespalib::string& errorMessage) + Result(ErrorType error, const vespalib::string& errorMessage) noexcept : _errorCode(error), - _errorMessage(errorMessage) {} + _errorMessage(errorMessage) + {} Result(const Result &); Result & operator = (const Result &); @@ -130,21 +131,20 @@ public: * The service layer will not update the bucket information in this case, * so it should not be returned either. */ - RemoveResult(ErrorType error, const vespalib::string& errorMessage) + RemoveResult(ErrorType error, const vespalib::string& errorMessage) noexcept : Result(error, errorMessage), - _wasFound(false) + _numRemoved(0) { } - /** - * Constructor to use when the remove was successful. - */ - RemoveResult(bool foundDocument) - : _wasFound(foundDocument) { } - - bool wasFound() const { return _wasFound; } + explicit RemoveResult(bool found) noexcept + : RemoveResult(found ? 1u : 0u) { } + explicit RemoveResult(uint32_t numRemoved) noexcept + : _numRemoved(numRemoved) { } + bool wasFound() const { return _numRemoved > 0; } + uint32_t num_removed() const { return _numRemoved; } private: - bool _wasFound; + uint32_t _numRemoved; }; class GetResult : public Result { @@ -257,14 +257,14 @@ public: /** * Constructor used when there was an error creating the iterator. */ - CreateIteratorResult(ErrorType error, const vespalib::string& errorMessage) + CreateIteratorResult(ErrorType error, const vespalib::string& errorMessage) noexcept : Result(error, errorMessage), _iterator(0) { } /** * Constructor used when the iterator state was successfully created. */ - CreateIteratorResult(const IteratorId& id) + CreateIteratorResult(const IteratorId& id) noexcept : _iterator(id) { } @@ -299,8 +299,8 @@ public: { } IterateResult(const IterateResult &) = delete; - IterateResult(IterateResult &&rhs) = default; - IterateResult &operator=(IterateResult &&rhs) = default; + IterateResult(IterateResult &&rhs) noexcept = default; + IterateResult &operator=(IterateResult &&rhs) noexcept = default; ~IterateResult(); |