// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. /** * \brief Interface to deduct what bucket copies to send load to. * * - Must handle inconsistent split buckets. */ #pragma once #include #include #include namespace storage::distributor { class OperationTarget : public vespalib::AsciiPrintable { document::Bucket _bucket; lib::Node _node; bool _newCopy; public: OperationTarget() noexcept : _newCopy(true) {} OperationTarget(const document::Bucket& bucket, const lib::Node& node, bool newCopy) noexcept : _bucket(bucket), _node(node), _newCopy(newCopy) {} document::BucketId getBucketId() const noexcept { return _bucket.getBucketId(); } document::Bucket getBucket() const noexcept { return _bucket; } const lib::Node& getNode() const noexcept { return _node; } bool isNewCopy() const noexcept { return _newCopy; } bool operator==(const OperationTarget& o) const noexcept { return (_bucket == o._bucket && _node == o._node && _newCopy == o._newCopy); } bool operator!=(const OperationTarget& o) const noexcept { return !(operator==(o)); } void print(vespalib::asciistream& out, const PrintProperties&) const override; }; class OperationTargetList : public std::vector { public: bool hasAnyNewCopies() const noexcept { for (size_t i=0; i