From cad7af3ec2d6fd8e1d70c3575088d0edab4bbe41 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 2 Feb 2021 05:31:48 +0000 Subject: Properly track execution of BucketTasks and provide sync() and orderly shutdown. --- .../src/vespa/storageapi/buckets/bucketinfo.cpp | 5 ++- .../src/vespa/storageapi/buckets/bucketinfo.h | 40 +++++++++++----------- 2 files changed, 22 insertions(+), 23 deletions(-) (limited to 'storageapi') diff --git a/storageapi/src/vespa/storageapi/buckets/bucketinfo.cpp b/storageapi/src/vespa/storageapi/buckets/bucketinfo.cpp index 9e4e48d67f4..4c3b290d4d7 100644 --- a/storageapi/src/vespa/storageapi/buckets/bucketinfo.cpp +++ b/storageapi/src/vespa/storageapi/buckets/bucketinfo.cpp @@ -19,8 +19,7 @@ BucketInfo::BucketInfo() noexcept _active(false) {} -BucketInfo::BucketInfo(uint32_t checksum, uint32_t docCount, - uint32_t totDocSize) noexcept +BucketInfo::BucketInfo(uint32_t checksum, uint32_t docCount, uint32_t totDocSize) noexcept : _lastModified(0), _checksum(checksum), _docCount(docCount), @@ -73,7 +72,7 @@ BucketInfo::BucketInfo(uint32_t checksum, uint32_t docCount, {} bool -BucketInfo::operator==(const BucketInfo& info) const +BucketInfo::operator==(const BucketInfo& info) const noexcept { return (_checksum == info._checksum && _docCount == info._docCount && diff --git a/storageapi/src/vespa/storageapi/buckets/bucketinfo.h b/storageapi/src/vespa/storageapi/buckets/bucketinfo.h index 5b2de4b4d61..7e6e7a2aed2 100644 --- a/storageapi/src/vespa/storageapi/buckets/bucketinfo.h +++ b/storageapi/src/vespa/storageapi/buckets/bucketinfo.h @@ -42,37 +42,37 @@ public: uint32_t metaCount, uint32_t usedFileSize, bool ready, bool active, Timestamp lastModified) noexcept; - Timestamp getLastModified() const { return _lastModified; } - uint32_t getChecksum() const { return _checksum; } - uint32_t getDocumentCount() const { return _docCount; } - uint32_t getTotalDocumentSize() const { return _totDocSize; } - uint32_t getMetaCount() const { return _metaCount; } - uint32_t getUsedFileSize() const { return _usedFileSize; } - bool isReady() const { return _ready; } - bool isActive() const { return _active; } + Timestamp getLastModified() const noexcept { return _lastModified; } + uint32_t getChecksum() const noexcept { return _checksum; } + uint32_t getDocumentCount() const noexcept { return _docCount; } + uint32_t getTotalDocumentSize() const noexcept { return _totDocSize; } + uint32_t getMetaCount() const noexcept { return _metaCount; } + uint32_t getUsedFileSize() const noexcept { return _usedFileSize; } + bool isReady() const noexcept { return _ready; } + bool isActive() const noexcept { return _active; } - void setChecksum(uint32_t crc) { _checksum = crc; } - void setDocumentCount(uint32_t count) { _docCount = count; } - void setTotalDocumentSize(uint32_t size) { _totDocSize = size; } - void setMetaCount(uint32_t count) { _metaCount = count; } - void setUsedFileSize(uint32_t size) { _usedFileSize = size; } - void setReady(bool ready = true) { _ready = ready; } - void setActive(bool active = true) { _active = active; } - void setLastModified(Timestamp lastModified) { _lastModified = lastModified; } + void setChecksum(uint32_t crc) noexcept { _checksum = crc; } + void setDocumentCount(uint32_t count) noexcept { _docCount = count; } + void setTotalDocumentSize(uint32_t size) noexcept { _totDocSize = size; } + void setMetaCount(uint32_t count) noexcept { _metaCount = count; } + void setUsedFileSize(uint32_t size) noexcept { _usedFileSize = size; } + void setReady(bool ready = true) noexcept { _ready = ready; } + void setActive(bool active = true) noexcept { _active = active; } + void setLastModified(Timestamp lastModified) noexcept { _lastModified = lastModified; } /** * Only compare checksum, total document count and document * size, not meta count or used file size. */ - bool equalDocumentInfo(const BucketInfo& other) const { + bool equalDocumentInfo(const BucketInfo& other) const noexcept { return (_checksum == other._checksum && _docCount == other._docCount && _totDocSize == other._totDocSize); } - bool operator==(const BucketInfo& info) const; - bool valid() const { return (_docCount > 0 || _totDocSize == 0); } - bool empty() const { + bool operator==(const BucketInfo& info) const noexcept; + bool valid() const noexcept { return (_docCount > 0 || _totDocSize == 0); } + bool empty() const noexcept { return _metaCount == 0 && _usedFileSize == 0 && _checksum == 0; } vespalib::string toString() const; -- cgit v1.2.3