diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-06 20:47:39 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-06-07 09:50:24 +0200 |
commit | 0b37a1b9eecf9b38310bde4a11c01a7962234450 (patch) | |
tree | 1f6b1836d69fe2e72d800397167f5b5ff02ed90a | |
parent | a9ba7645226f200148de44a19aff204dd0841493 (diff) |
Hide BucketId::List
18 files changed, 70 insertions, 40 deletions
diff --git a/document/src/vespa/document/bucket/CMakeLists.txt b/document/src/vespa/document/bucket/CMakeLists.txt index 757884f0050..7dfeaa1920f 100644 --- a/document/src/vespa/document/bucket/CMakeLists.txt +++ b/document/src/vespa/document/bucket/CMakeLists.txt @@ -5,6 +5,7 @@ vespa_add_library(document_bucket OBJECT bucketdistribution.cpp bucketid.cpp bucketidfactory.cpp + bucketidlist.cpp bucketselector.cpp bucketspace.cpp DEPENDS diff --git a/document/src/vespa/document/bucket/bucketid.h b/document/src/vespa/document/bucket/bucketid.h index 63b513dd5a2..79da6c2d11b 100644 --- a/document/src/vespa/document/bucket/bucketid.h +++ b/document/src/vespa/document/bucket/bucketid.h @@ -22,7 +22,6 @@ #pragma once #include <vespa/vespalib/stllike/string.h> -#include <vespa/vespalib/util/array.h> namespace vespalib { class nbostream; @@ -33,6 +32,8 @@ namespace document { extern const unsigned char reverseBitTable[256]; +namespace bucket { class BucketIdList; } + class BucketId { public: @@ -47,7 +48,7 @@ public: * typedef when needed we can alter this later with less code changes. */ using Type = uint64_t; - using List = vespalib::Array<BucketId>; + using List = bucket::BucketIdList; /** Create an initially unset bucket id. */ BucketId() : _id(0) {} /** Create a bucket id with the given raw unchecked content. */ diff --git a/document/src/vespa/document/bucket/bucketidlist.cpp b/document/src/vespa/document/bucket/bucketidlist.cpp new file mode 100644 index 00000000000..6c9f7250b8e --- /dev/null +++ b/document/src/vespa/document/bucket/bucketidlist.cpp @@ -0,0 +1,12 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "bucketidlist.h" + +namespace document::bucket { + +BucketIdList::BucketIdList() { } +BucketIdList::BucketIdList(const BucketIdList & rhs) = default; +BucketIdList & BucketIdList::operator = (const BucketIdList &) = default; +BucketIdList::~BucketIdList() { } + +} diff --git a/document/src/vespa/document/bucket/bucketidlist.h b/document/src/vespa/document/bucket/bucketidlist.h new file mode 100644 index 00000000000..f53301d1b44 --- /dev/null +++ b/document/src/vespa/document/bucket/bucketidlist.h @@ -0,0 +1,22 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include "bucketid.h" +#include <vespa/vespalib/util/array.h> + +namespace document::bucket { + +using BucketIdListT = vespalib::Array<BucketId>; + +class BucketIdList : public BucketIdListT { +public: + BucketIdList(); + BucketIdList(BucketIdList && rhs) = default; + BucketIdList & operator = (BucketIdList &&) = default; + BucketIdList(const BucketIdList & rhs); + BucketIdList & operator = (const BucketIdList &); + ~BucketIdList(); +}; + +} diff --git a/persistence/src/vespa/persistence/spi/clusterstate.cpp b/persistence/src/vespa/persistence/spi/clusterstate.cpp index 70bc8724c96..841fef4620d 100644 --- a/persistence/src/vespa/persistence/spi/clusterstate.cpp +++ b/persistence/src/vespa/persistence/spi/clusterstate.cpp @@ -5,9 +5,9 @@ #include <vespa/vdslib/distribution/distribution.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/stllike/asciistream.h> +#include <cassert> -namespace storage { -namespace spi { +namespace storage::spi { ClusterState::ClusterState(const lib::ClusterState& state, uint16_t nodeIndex, @@ -99,5 +99,4 @@ void ClusterState::serialize(vespalib::nbostream& o) const { o << _distribution->serialize(); } -} // spi -} // storage +} diff --git a/persistence/src/vespa/persistence/spi/result.h b/persistence/src/vespa/persistence/spi/result.h index 359f6af5164..93db642611f 100644 --- a/persistence/src/vespa/persistence/spi/result.h +++ b/persistence/src/vespa/persistence/spi/result.h @@ -5,6 +5,7 @@ #include "bucketinfo.h" #include "bucket.h" #include "docentry.h" +#include <vespa/document/bucket/bucketidlist.h> namespace storage::spi { @@ -196,7 +197,7 @@ private: class BucketIdListResult : public Result { public: - typedef document::BucketId::List List; + using List = document::bucket::BucketIdList; /** * Constructor used when there was an error listing the buckets. diff --git a/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h b/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h index 281c814fc77..4947c7500ed 100644 --- a/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h +++ b/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h @@ -2,11 +2,12 @@ #pragma once #include <vespa/searchcore/proton/server/ibucketstatecalculator.h> -#include <vespa/document/bucket/bucketid.h> +#include <vespa/document/bucket/bucketidlist.h> namespace proton::test { -typedef document::BucketId::List BucketIdVector; +using BucketIdVector = document::bucket::BucketIdList; + typedef std::set<document::BucketId> BucketIdSet; class BucketStateCalculator : public IBucketStateCalculator diff --git a/staging_vespalib/src/vespa/vespalib/util/clock.h b/staging_vespalib/src/vespa/vespalib/util/clock.h index 4a5611bbe5a..e17ec962fc9 100644 --- a/staging_vespalib/src/vespa/vespalib/util/clock.h +++ b/staging_vespalib/src/vespa/vespalib/util/clock.h @@ -33,7 +33,7 @@ public: Clock(double timePeriod=0.100); ~Clock(); - fastos::TimeStamp getTimeNS(void) const { + fastos::TimeStamp getTimeNS() const { if (!_running) { setTime(); } @@ -41,7 +41,7 @@ public: } fastos::TimeStamp getTimeNSAssumeRunning() const { return _timeNS; } - void stop(void); + void stop(); }; } diff --git a/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.cpp b/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.cpp index 537b44c49eb..354d2e013ed 100644 --- a/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.cpp @@ -1,5 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/util/growablebytebuffer.h> +#include "growablebytebuffer.h" +#include <arpa/inet.h> using namespace vespalib; diff --git a/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.h b/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.h index fd65f0134bc..fdf090d22f9 100644 --- a/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.h +++ b/staging_vespalib/src/vespa/vespalib/util/growablebytebuffer.h @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/fastos/types.h> #include <vespa/vespalib/util/memory.h> #include <vespa/vespalib/stllike/string.h> diff --git a/storage/src/vespa/storage/distributor/operationtargetresolverimpl.cpp b/storage/src/vespa/storage/distributor/operationtargetresolverimpl.cpp index fba6b131e09..6f331e23e2c 100644 --- a/storage/src/vespa/storage/distributor/operationtargetresolverimpl.cpp +++ b/storage/src/vespa/storage/distributor/operationtargetresolverimpl.cpp @@ -4,9 +4,9 @@ #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/printable.hpp> #include <sstream> +#include <cassert> -namespace storage { -namespace distributor { +namespace storage::distributor { BucketInstance::BucketInstance( const document::BucketId& id, const api::BucketInfo& info, @@ -197,5 +197,4 @@ OperationTargetResolverImpl::getAllInstances(OperationType type, return instances; } -} // distributor -} // storage +} diff --git a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h index 5e45e846337..51bdb94188e 100644 --- a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h +++ b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h @@ -1,13 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <memory> #include <vespa/storage/common/storagecomponent.h> #include <vespa/storage/common/servicelayercomponent.h> #include <vespa/storage/common/storagelink.h> #include <vespa/storage/config/config-stor-server.h> #include <vespa/storage/persistence/messages.h> #include <vespa/storage/persistence/types.h> +#include <vespa/document/bucket/bucketidlist.h> #include <vespa/vespalib/util/sync.h> #include <vespa/config/config.h> @@ -60,7 +60,7 @@ private: config::ConfigFetcher _configFetcher; vespalib::Monitor _monitor; vespalib::Lock _stateLock; - document::BucketId::List _rechecksNotStarted; + document::bucket::BucketIdList _rechecksNotStarted; size_t _pendingRequests; size_t _maxPendingChunkSize; bool _singleThreadMode; // For unit testing only diff --git a/vdslib/src/vespa/vdslib/container/visitorordering.h b/vdslib/src/vespa/vdslib/container/visitorordering.h index 3d31a6ac078..e5a61d6332d 100644 --- a/vdslib/src/vespa/vdslib/container/visitorordering.h +++ b/vdslib/src/vespa/vdslib/container/visitorordering.h @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/fastos/types.h> #include <string> +#include <cstdint> namespace vdslib { diff --git a/vdslib/src/vespa/vdslib/distribution/group.cpp b/vdslib/src/vespa/vdslib/distribution/group.cpp index 8ad3dcb2f80..2fce519298f 100644 --- a/vdslib/src/vespa/vdslib/distribution/group.cpp +++ b/vdslib/src/vespa/vdslib/distribution/group.cpp @@ -6,9 +6,9 @@ #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/stllike/asciistream.h> #include <ostream> +#include <cassert> -namespace storage { -namespace lib { +namespace storage::lib { Group::Group(uint16_t index, vespalib::stringref name) : _name(name), @@ -204,4 +204,3 @@ Group::getDistributionConfigHash() const { } } -} diff --git a/vdslib/src/vespa/vdslib/distribution/idealnodecalculatorimpl.cpp b/vdslib/src/vespa/vdslib/distribution/idealnodecalculatorimpl.cpp index ca7ab742278..0ab4bc6b21a 100644 --- a/vdslib/src/vespa/vdslib/distribution/idealnodecalculatorimpl.cpp +++ b/vdslib/src/vespa/vdslib/distribution/idealnodecalculatorimpl.cpp @@ -3,9 +3,9 @@ #include "idealnodecalculatorimpl.h" #include <vespa/vespalib/util/exceptions.h> #include <ostream> +#include <cassert> -namespace storage { -namespace lib { +namespace storage::lib { IdealNodeList::IdealNodeList() : _idealNodes() @@ -71,5 +71,4 @@ IdealNodeCalculatorImpl::initUpStateMapping() { } } -} // lib -} // storage +} diff --git a/vespalib/src/tests/random/friendfinder.cpp b/vespalib/src/tests/random/friendfinder.cpp index 5f6e55815e5..7bf390ef083 100644 --- a/vespalib/src/tests/random/friendfinder.cpp +++ b/vespalib/src/tests/random/friendfinder.cpp @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/util/random.h> -#include <stdio.h> #include <vespa/vespalib/stllike/string.h> #include <cmath> +#include <vector> int main(int argc, char **argv) { diff --git a/vespalib/src/vespa/vespalib/util/random.cpp b/vespalib/src/vespa/vespalib/util/random.cpp index 06bfc1f9c25..2abf67605a8 100644 --- a/vespalib/src/vespa/vespalib/util/random.cpp +++ b/vespalib/src/vespa/vespalib/util/random.cpp @@ -2,6 +2,9 @@ #include "random.h" #include <cmath> +#include <cstring> +#include <ctime> +#include <unistd.h> namespace vespalib { diff --git a/vespalib/src/vespa/vespalib/util/random.h b/vespalib/src/vespa/vespalib/util/random.h index c4cce3b42d8..f9d2587272d 100644 --- a/vespalib/src/vespa/vespalib/util/random.h +++ b/vespalib/src/vespa/vespalib/util/random.h @@ -1,14 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <stdlib.h> -#include <stdio.h> -#include <inttypes.h> -#include <vespa/fastos/types.h> -#include <vector> -#include <sys/types.h> -#include <unistd.h> -#include <time.h> +#include <cstdint> namespace vespalib { @@ -22,9 +15,9 @@ private: /** * step the random generator once **/ - void iterate(void) { - _state = (UINT64_C(0x5DEECE66D) * _state + 0xb) & - UINT64_C(0xFFFFFFFFFFFF); + void iterate() { + _state = (0x5DEECE66Dul * _state + 0xb) & + 0xFFFFFFFFFFFFul; } /** @@ -73,7 +66,7 @@ public: * @brief reset the seed **/ void setSeed(int64_t seed) { - _state = (seed ^ UINT64_C(0x5DEECE66D)) & ((1L << 48) -1); + _state = (seed ^ 0x5DEECE66Dul) & ((1L << 48) -1); }; /** |