diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2016-09-12 22:16:01 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2016-09-14 06:58:17 +0000 |
commit | 755b6913407613821fb47fac95592930612add4b (patch) | |
tree | 702738d8426016c972acded228ce3d9288c7c151 | |
parent | af61fbd1a0b8ea6867ea662111edd3fbe53205cb (diff) |
Reduce boost::noncopyable exposure.
21 files changed, 56 insertions, 114 deletions
diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/buffer.h b/memfilepersistence/src/vespa/memfilepersistence/mapper/buffer.h index 2484209d23e..d097a078af9 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/buffer.h +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/buffer.h @@ -11,14 +11,13 @@ #pragma once -#include <boost/utility.hpp> #include <vespa/vespalib/util/alloc.h> #include <vespa/vespalib/util/linkedptr.h> namespace storage { namespace memfile { -class Buffer : boost::noncopyable // Ensure no accidental copying of a buffer +class Buffer { // Use AutoAlloc to transparently use mmap for large buffers. // It is crucial that any backing buffer type returns an address that is @@ -33,6 +32,8 @@ class Buffer : boost::noncopyable // Ensure no accidental copying of a buffer public: typedef vespalib::LinkedPtr<Buffer> LP; + Buffer(const Buffer &) = delete; + Buffer & operator = (const Buffer &) = delete; Buffer(size_t size); /** diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/bufferedfilewriter.h b/memfilepersistence/src/vespa/memfilepersistence/mapper/bufferedfilewriter.h index e1101d94b58..67cdd2208a0 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/bufferedfilewriter.h +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/bufferedfilewriter.h @@ -16,7 +16,6 @@ #pragma once -#include <boost/utility.hpp> #include <vespa/fastos/types.h> #include <vector> @@ -28,7 +27,7 @@ namespace storage { namespace memfile { -class BufferedFileWriter : public boost::noncopyable { +class BufferedFileWriter { public: struct Cache { virtual ~Cache() {} @@ -55,6 +54,8 @@ private: bool _writing; public: + BufferedFileWriter(const BufferedFileWriter &) = delete; + BufferedFileWriter & operator = (const BufferedFileWriter &) = delete; /** * Create a new buffered file writer. * diff --git a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecache.h b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecache.h index cc25bd5f7a8..e4417fb6e0f 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecache.h +++ b/memfilepersistence/src/vespa/memfilepersistence/memfile/memfilecache.h @@ -51,7 +51,7 @@ public: {} }; private: - class Entry : boost::noncopyable { + class Entry { public: typedef vespalib::LinkedPtr<Entry> LP; @@ -61,6 +61,8 @@ private: bool _inUse; bool _returnToCacheWhenFinished; + Entry(const Entry &) = delete; + Entry & operator = (const Entry &) = delete; Entry(FileSpecification& file, Environment& env, bool returnToCacheWhenFinished = true) : _file(file, env), _env(env), _inUse(true), diff --git a/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.h b/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.h index 9a2700c4209..fad723de4aa 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.h +++ b/memfilepersistence/src/vespa/memfilepersistence/spi/operationhandler.h @@ -10,7 +10,6 @@ */ #pragma once -#include <boost/utility.hpp> #include <vespa/memfilepersistence/common/exceptions.h> #include <vespa/memfilepersistence/common/filespecification.h> #include <vespa/memfilepersistence/common/types.h> @@ -25,8 +24,7 @@ namespace storage { namespace memfile { -class OperationHandler : protected Types, - private boost::noncopyable +class OperationHandler : protected Types { protected: Environment& _env; @@ -34,6 +32,8 @@ protected: public: typedef std::unique_ptr<OperationHandler> UP; + OperationHandler(const OperationHandler &) = delete; + OperationHandler & operator = (const OperationHandler &) = delete; OperationHandler(Environment&); virtual ~OperationHandler() {} diff --git a/metrics/src/vespa/metrics/namehash.h b/metrics/src/vespa/metrics/namehash.h index 9a281e39111..21cb9bdeedb 100644 --- a/metrics/src/vespa/metrics/namehash.h +++ b/metrics/src/vespa/metrics/namehash.h @@ -20,18 +20,19 @@ */ #pragma once -#include <boost/utility.hpp> #include <vespa/metrics/memoryconsumption.h> #include <vespa/vespalib/stllike/hash_set.h> namespace metrics { -class NameHash : private boost::noncopyable { +class NameHash { vespalib::hash_set<std::string> _hash; uint32_t _unifiedCounter; uint32_t _checkedCounter; public: + NameHash(const NameHash &) = delete; + NameHash & operator = (const NameHash &) = delete; NameHash() : _unifiedCounter(0), _checkedCounter(0) {} void updateName(std::string& name) { diff --git a/searchcore/src/vespa/searchcore/proton/index/indexmanager.h b/searchcore/src/vespa/searchcore/proton/index/indexmanager.h index a7d8cf77649..8a7d6a64b30 100644 --- a/searchcore/src/vespa/searchcore/proton/index/indexmanager.h +++ b/searchcore/src/vespa/searchcore/proton/index/indexmanager.h @@ -17,7 +17,7 @@ using searchcorespi::IIndexManager; * across all indexes, and manages the set of indexes through flushing * of memory indexes and fusion of disk indexes. */ -class IndexManager : public boost::noncopyable, public IIndexManager +class IndexManager : public IIndexManager { public: class MaintainerOperations : public searchcorespi::index::IIndexMaintainerOperations { @@ -53,6 +53,8 @@ private: searchcorespi::index::IndexMaintainer _maintainer; public: + IndexManager(const IndexManager &) = delete; + IndexManager & operator = (const IndexManager &) = delete; IndexManager(const vespalib::string &baseDir, const searchcorespi::index::WarmupConfig & warmup, size_t maxFlushed, diff --git a/searchcorespi/src/vespa/searchcorespi/index/i_thread_service.h b/searchcorespi/src/vespa/searchcorespi/index/i_thread_service.h index ffa160f7c96..1d6fba517d2 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/i_thread_service.h +++ b/searchcorespi/src/vespa/searchcorespi/index/i_thread_service.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 <boost/noncopyable.hpp> #include <vespa/vespalib/util/runnable.h> #include <vespa/vespalib/util/threadexecutor.h> @@ -11,9 +10,11 @@ namespace index { /** * Interface for a single thread used for write tasks. */ -struct IThreadService : public boost::noncopyable, - public vespalib::ThreadExecutor +struct IThreadService : public vespalib::ThreadExecutor { + IThreadService(const IThreadService &) = delete; + IThreadService & operator = (const IThreadService &) = delete; + IThreadService() = default; virtual ~IThreadService() {} /** diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h index 537dc39f3ce..417f79fa6ca 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h +++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h @@ -11,7 +11,6 @@ #include "imemoryindex.h" #include "warmupindexcollection.h" #include "ithreadingservice.h" -#include <boost/noncopyable.hpp> #include <vespa/searchcorespi/index/iindexmanager.h> #include <vespa/searchcorespi/index/indexsearchable.h> #include <vespa/searchcorespi/index/indexcollection.h> @@ -42,8 +41,7 @@ namespace index { * across all indexes, and manages the set of indexes through flushing * of memory indexes and fusion of disk indexes. */ -class IndexMaintainer : public boost::noncopyable, - public IIndexManager, +class IndexMaintainer : public IIndexManager, public IWarmupDone { /** @@ -313,6 +311,8 @@ class IndexMaintainer : public boost::noncopyable, void commit(); public: + IndexMaintainer(const IndexMaintainer &) = delete; + IndexMaintainer & operator = (const IndexMaintainer &) = delete; IndexMaintainer(const IndexMaintainerConfig &config, const IndexMaintainerContext &context, IIndexMaintainerOperations &operations); diff --git a/searchcorespi/src/vespa/searchcorespi/index/ithreadingservice.h b/searchcorespi/src/vespa/searchcorespi/index/ithreadingservice.h index ec68b374487..2cc93dc229b 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/ithreadingservice.h +++ b/searchcorespi/src/vespa/searchcorespi/index/ithreadingservice.h @@ -2,7 +2,6 @@ #pragma once #include "i_thread_service.h" -#include <boost/noncopyable.hpp> #include <vespa/vespalib/util/runnable.h> #include <vespa/vespalib/util/executor.h> #include <vespa/vespalib/util/syncable.h> @@ -48,9 +47,11 @@ namespace index { * to sync index field inverter executor before syncing index field * writer executor. */ -struct IThreadingService : public boost::noncopyable, - public vespalib::Syncable +struct IThreadingService : public vespalib::Syncable { + IThreadingService(const IThreadingService &) = delete; + IThreadingService & operator = (const IThreadingService &) = delete; + IThreadingService() = default; virtual ~IThreadingService() {} /** diff --git a/searchlib/src/vespa/searchlib/attribute/attributeguard.h b/searchlib/src/vespa/searchlib/attribute/attributeguard.h index 42eb381a9d5..726dd436454 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributeguard.h +++ b/searchlib/src/vespa/searchlib/attribute/attributeguard.h @@ -2,7 +2,6 @@ #pragma once #include <vespa/searchlib/attribute/attributevector.h> -#include <boost/noncopyable.hpp> namespace search { @@ -64,9 +63,11 @@ public: /** * This class makes sure that the attribute vector is not updated with enum changes while the guard is held. **/ -class AttributeEnumGuard : public AttributeGuard, public boost::noncopyable +class AttributeEnumGuard : public AttributeGuard { public: + AttributeEnumGuard(const AttributeEnumGuard &) = delete; + AttributeEnumGuard & operator = (const AttributeEnumGuard &) = delete; explicit AttributeEnumGuard(const AttributeVector::SP & attribute); explicit AttributeEnumGuard(const AttributeGuard & attribute); private: diff --git a/staging_vespalib/src/vespa/vespalib/util/blockwritermutex.hpp b/staging_vespalib/src/vespa/vespalib/util/blockwritermutex.hpp deleted file mode 100644 index d238fed18bf..00000000000 --- a/staging_vespalib/src/vespa/vespalib/util/blockwritermutex.hpp +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#include <vector> - -#include <boost/noncopyable.hpp> -#include <boost/thread/locks.hpp> -#include <boost/thread/mutex.hpp> -#include <boost/thread/condition_variable.hpp> - - -namespace vespalib { - - -/* Blocks a writer from being called while readers are active and vice versa. - * This is only intended to be used by a single writer. - */ -class BlockWriterMutex : boost::noncopyable { - typedef boost::mutex ReadersMutex; - - ReadersMutex _readersMutex; - int _readers; - - boost::condition_variable _noReaders; - - void lockImpl(int sign) { - boost::unique_lock<ReadersMutex> readersLock(_readersMutex); - while ((sign*_readers) > 0) - _noReaders.wait(readersLock); - _readers -= sign; - } - - void unlockImpl(int sign) { - ReadersMutex::scoped_lock readersLock(_readersMutex); - _readers += sign; - if (_readers == 0) - _noReaders.notify_all(); - } - -public: - typedef boost::shared_lock<BlockWriterMutex> ReaderLock; - typedef boost::unique_lock<BlockWriterMutex> WriterLock; - - BlockWriterMutex() - :_readers(0) - {} - - void lock() { - lockImpl(1); - } - - void unlock() { - unlockImpl(1); - } - - void lock_shared() { - lockImpl(-1); - } - - void unlock_shared() { - unlockImpl(-1); - } -}; - -} //namespace vespalib - - diff --git a/storage/src/vespa/storage/bucketmover/run.h b/storage/src/vespa/storage/bucketmover/run.h index 31f11d74e44..575a9c60183 100644 --- a/storage/src/vespa/storage/bucketmover/run.h +++ b/storage/src/vespa/storage/bucketmover/run.h @@ -15,7 +15,6 @@ #pragma once -#include <boost/utility.hpp> #include <list> #include <map> #include <vespa/storage/bucketmover/move.h> @@ -33,7 +32,7 @@ class Clock; namespace bucketmover { -class Run : public document::Printable, boost::noncopyable { +class Run : public document::Printable { StorBucketDatabase& _bucketDatabase; lib::Distribution::SP _distribution; lib::NodeState _nodeState; @@ -47,6 +46,8 @@ class Run : public document::Printable, boost::noncopyable { std::map<uint16_t, bool> _diskDisabled; public: + Run(const Run &) = delete; + Run & operator = (const Run &) = delete; Run(StorBucketDatabase&, lib::Distribution::SP, const lib::NodeState&, diff --git a/storage/src/vespa/storage/common/storagelink.h b/storage/src/vespa/storage/common/storagelink.h index a7b68c59ee5..5a683d55b03 100644 --- a/storage/src/vespa/storage/common/storagelink.h +++ b/storage/src/vespa/storage/common/storagelink.h @@ -19,7 +19,6 @@ #pragma once -#include <boost/utility.hpp> #include <vespa/vespalib/util/printable.h> #include <vespa/fastos/fastos.h> #include <memory> @@ -35,7 +34,6 @@ class FileStorManagerTest; class StorageLink : public document::Printable, public ChainedMessageSender, - private boost::noncopyable, protected api::MessageHandler { public: @@ -44,15 +42,14 @@ public: enum State { CREATED, OPENED, CLOSING, FLUSHINGDOWN, FLUSHINGUP, CLOSED }; private: - StorageLink(const StorageLink&); - StorageLink& operator=(const StorageLink&); - std::string _name; StorageLink* _up; std::unique_ptr<StorageLink> _down; State _state; public: + StorageLink(const StorageLink &) = delete; + StorageLink & operator = (const StorageLink &) = delete; StorageLink(const std::string& name) : _name(name), _up(0), _down(), _state(CREATED) {} virtual ~StorageLink(); diff --git a/storage/src/vespa/storage/distributor/statechecker.cpp b/storage/src/vespa/storage/distributor/statechecker.cpp index b9f8058cf13..972397922c2 100644 --- a/storage/src/vespa/storage/distributor/statechecker.cpp +++ b/storage/src/vespa/storage/distributor/statechecker.cpp @@ -15,12 +15,13 @@ namespace distributor { namespace { class StoredResultImpl - : public StateChecker::ResultImpl, - boost::noncopyable + : public StateChecker::ResultImpl { mutable IdealStateOperation::UP _operation; MaintenancePriority _priority; public: + StoredResultImpl(const StoredResultImpl &) = delete; + StoredResultImpl & operator = (const StoredResultImpl &) = delete; StoredResultImpl() : _operation(), _priority(MaintenancePriority::NO_MAINTENANCE_NEEDED) diff --git a/storage/src/vespa/storage/distributor/statechecker.h b/storage/src/vespa/storage/distributor/statechecker.h index 2ae43a4338c..3b0d16644df 100644 --- a/storage/src/vespa/storage/distributor/statechecker.h +++ b/storage/src/vespa/storage/distributor/statechecker.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 <boost/noncopyable.hpp> #include <vespa/storage/bucketdb/distrbucketdb.h> #include <vespa/storage/common/storagecomponent.h> #include <vespa/storage/distributor/operations/idealstate/idealstateoperation.h> diff --git a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h index 009adb0c2d0..2f3f5ea9d57 100644 --- a/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h +++ b/storage/src/vespa/storage/frameworkimpl/status/statuswebserver.h @@ -10,7 +10,6 @@ #pragma once -#include <boost/noncopyable.hpp> #include <vespa/vespalib/stllike/string.h> #include <vespa/fastlib/net/httpserver.h> #include <list> @@ -21,8 +20,7 @@ namespace storage { -class StatusWebServer : private boost::noncopyable, - private config::IFetcherCallback<vespa::config::content::core::StorStatusConfig>, +class StatusWebServer : private config::IFetcherCallback<vespa::config::content::core::StorStatusConfig>, private framework::Runnable { class WebServer : public Fast_HTTPServer { @@ -63,6 +61,8 @@ class StatusWebServer : private boost::noncopyable, framework::Thread::UP _thread; public: + StatusWebServer(const StatusWebServer &) = delete; + StatusWebServer & operator = (const StatusWebServer &) = delete; StatusWebServer(framework::ComponentRegister&, framework::StatusReporterMap&, const config::ConfigUri & configUri); diff --git a/storage/src/vespa/storage/persistence/diskthread.h b/storage/src/vespa/storage/persistence/diskthread.h index 5f0f367f010..3626bbb2c70 100644 --- a/storage/src/vespa/storage/persistence/diskthread.h +++ b/storage/src/vespa/storage/persistence/diskthread.h @@ -12,7 +12,6 @@ */ #pragma once -#include <boost/utility.hpp> #include <vespa/vespalib/util/printable.h> #include <vespa/vespalib/util/document_runnable.h> #include <vespa/storageframework/storageframework.h> @@ -27,12 +26,14 @@ class Directory; class SlotFileOptions; struct FileStorThreadMetrics; -class DiskThread : public framework::Runnable, - private boost::noncopyable +class DiskThread : public framework::Runnable { public: typedef std::shared_ptr<DiskThread> SP; + DiskThread(const DiskThread &) = delete; + DiskThread & operator = (const DiskThread &) = delete; + DiskThread() = default; virtual ~DiskThread() {} /** diff --git a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h index f7448fc25b8..7849d06b971 100644 --- a/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h +++ b/storage/src/vespa/storage/persistence/filestorage/modifiedbucketchecker.h @@ -10,7 +10,6 @@ #include <vespa/storage/persistence/types.h> #include <vespa/storageframework/storageframework.h> #include <vespa/vespalib/util/sync.h> -#include <boost/noncopyable.hpp> namespace storage { diff --git a/storage/src/vespa/storage/storageserver/storagenode.h b/storage/src/vespa/storage/storageserver/storagenode.h index a63bd1ce4e9..8afe3397179 100644 --- a/storage/src/vespa/storage/storageserver/storagenode.h +++ b/storage/src/vespa/storage/storageserver/storagenode.h @@ -14,7 +14,6 @@ #pragma once -#include <boost/utility.hpp> #include <vespa/document/bucket/bucketidfactory.h> #include <vespa/fastos/fastos.h> #include <memory> @@ -57,8 +56,7 @@ class FileStorManager; class HostInfo; class StateManager; -class StorageNode : private boost::noncopyable, - private config::IFetcherCallback<vespa::config::content::core::StorServerConfig>, +class StorageNode : private config::IFetcherCallback<vespa::config::content::core::StorServerConfig>, private config::IFetcherCallback<vespa::config::content::StorDistributionConfig>, private config::IFetcherCallback<vespa::config::content::UpgradingConfig>, private config::IFetcherCallback<vespa::config::content::core::StorPrioritymappingConfig>, @@ -69,6 +67,8 @@ class StorageNode : private boost::noncopyable, public: enum RunMode { NORMAL, SINGLE_THREADED_TEST_MODE }; + StorageNode(const StorageNode &) = delete; + StorageNode & operator = (const StorageNode &) = delete; /** * @param excludeStorageChain With this option set, no chain will be set * up. This can be useful in unit testing if you need a storage server diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.h b/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.h index 488f32ec5ca..8ce3769fd1c 100644 --- a/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.h +++ b/storageframework/src/vespa/storageframework/defaultimplementation/memory/memorymanager.h @@ -21,7 +21,6 @@ #pragma once -#include <boost/utility.hpp> #include <map> #include <vespa/storageframework/generic/memory/memorymanagerinterface.h> #include <vespa/vespalib/util/printable.h> @@ -36,8 +35,7 @@ class AllocationLogic; class MemoryState; class MemoryTokenImpl : public vespalib::Printable, - public MemoryToken, - public boost::noncopyable + public MemoryToken { friend class AllocationLogic; @@ -51,6 +49,8 @@ class MemoryTokenImpl : public vespalib::Printable, public: typedef std::unique_ptr<MemoryTokenImpl> UP; + MemoryTokenImpl(const MemoryTokenImpl &) = delete; + MemoryTokenImpl & operator = (const MemoryTokenImpl &) = delete; MemoryTokenImpl(AllocationLogic& logic, const MemoryAllocationType& type, uint64_t allocated, diff --git a/storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.h b/storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.h index 73a986ec877..0be8e41a05f 100644 --- a/storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.h +++ b/storageframework/src/vespa/storageframework/defaultimplementation/memory/nomemorymanager.h @@ -11,7 +11,6 @@ #pragma once -#include <boost/utility.hpp> #include <map> #include <vespa/storageframework/generic/memory/memorymanagerinterface.h> #include <vespa/vespalib/util/printable.h> @@ -21,11 +20,13 @@ namespace storage { namespace framework { namespace defaultimplementation { -class SimpleMemoryTokenImpl : public MemoryToken, public boost::noncopyable +class SimpleMemoryTokenImpl : public MemoryToken { uint64_t _allocated; public: + SimpleMemoryTokenImpl(const SimpleMemoryTokenImpl &) = delete; + SimpleMemoryTokenImpl & operator = (const SimpleMemoryTokenImpl &) = delete; SimpleMemoryTokenImpl(uint64_t allocated) : _allocated(allocated) {} virtual uint64_t getSize() const { return _allocated; } |