36 #include "mongo/base/disallow_copying.h" 37 #include "mongo/base/status.h" 40 #include "mongo/db/index/index_access_method.h" 41 #include "mongo/db/record_id.h" 42 #include "mongo/stdx/functional.h" 45 class BackgroundOperation;
48 class OperationContext;
81 virtual Status insert(
const BSONObj& wholeDocument,
const RecordId& loc) = 0;
85 virtual void commit(stdx::function<
void(
const BSONObj& spec)> onCreateFn) = 0;
99 static void hook() noexcept;
120 PrivateTo<MultiIndexBlock>)
121 ->std::unique_ptr<Impl>) makeImpl;
129 : _pimpl(makeImpl(opCtx, collection, PrivateCall<
MultiIndexBlock>{})) {}
211 inline Status insert(
const BSONObj& wholeDocument,
const RecordId& loc) {
242 inline void commit(stdx::function<
void(
const BSONObj& spec)> onCreateFn =
nullptr) {
const Impl & _impl() const
Definition: index_create.h:107
void removeExistingIndexes(std::vector< BSONObj > *const specs) const
Removes pre-existing indexes from 'specs'.
Definition: index_create.h:166
virtual Status doneInserting(std::set< RecordId > *dupsOut=NULL)=0
~MultiIndexBlock()=default
Status doneInserting(std::set< RecordId > *const dupsOut=nullptr)
Call this after the last insert().
Definition: index_create.h:227
void allowBackgroundBuilding()
By default we ignore the 'background' flag in specs when building an index.
Definition: index_create.h:139
Status insert(const BSONObj &wholeDocument, const RecordId &loc)
Call this after init() for each document in the collection.
Definition: index_create.h:211
void commit(stdx::function< void(const BSONObj &spec)> onCreateFn=nullptr)
Marks the index ready for use.
Definition: index_create.h:242
virtual void allowBackgroundBuilding()=0
virtual void allowInterruption()=0
Copyright (C) 2014 MongoDB Inc.
Definition: bson_collection_catalog_entry.cpp:38
virtual bool getBuildInBackground() const =0
Collection *const collection
Definition: collection_info_cache_impl.cpp:53
TUHook() noexcept
Definition: index_create.h:101
OperationContext Database StringData BSONObj CollectionOptions::ParseKind bool const BSONObj &idIndex Status
Definition: database_impl.cpp:956
void abortWithoutCleanup()
May be called at any time after construction but before a successful commit().
Definition: index_create.h:260
Definition: index_create.h:98
virtual StatusWith< std::vector< BSONObj > > init(const std::vector< BSONObj > &specs)=0
this is NOT safe through a yield right now.
Definition: collection.h:160
Impl & _impl()
Definition: index_create.h:112
virtual Status insert(const BSONObj &wholeDocument, const RecordId &loc)=0
StatusWith< std::vector< BSONObj > > init(const std::vector< BSONObj > &specs)
Prepares the index(es) for building and returns the canonicalized form of the requested index specifi...
Definition: index_create.h:178
Definition: index_create.h:63
void ignoreUniqueConstraint()
By default we enforce the 'unique' flag in specs when building an index by failing.
Definition: index_create.h:158
Definition: index_key_validate.h:40
virtual void ignoreUniqueConstraint()=0
std::unique_ptr< Impl > _pimpl
Definition: index_create.h:93
virtual Status insertAllDocumentsInCollection(std::set< RecordId > *dupsOut=NULL)=0
MultiIndexBlock(OperationContext *const opCtx, Collection *const collection)
Neither pointer is owned.
Definition: index_create.h:128
Builds one or more indexes.
Definition: index_create.h:61
virtual void abortWithoutCleanup()=0
virtual void commit(stdx::function< void(const BSONObj &spec)> onCreateFn)=0
void allowInterruption()
Call this before init() to allow the index build to be interrupted.
Definition: index_create.h:147
Collection *const OperationContext *const opCtx
Definition: collection_impl.cpp:80
Status insertAllDocumentsInCollection(std::set< RecordId > *const dupsOut=nullptr)
Inserts all documents in the Collection into the indexes and logs with timing info.
Definition: index_create.h:200
bool getBuildInBackground() const
Definition: index_create.h:264
StatusWith< std::vector< BSONObj > > init(const BSONObj &spec)
Definition: index_create.h:182
static MONGO_DECLARE_SHIM((OperationContext *opCtx, Collection *collection, PrivateTo< MultiIndexBlock >) ->std::unique_ptr< Impl >) makeImpl
virtual void removeExistingIndexes(std::vector< BSONObj > *specs) const =0