summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/collection.cpp
diff options
context:
space:
mode:
authorADAM David Alan Martin <adam.martin@10gen.com>2018-04-30 18:34:19 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2018-04-30 18:34:19 -0400
commit00ca22fc7097455ab1301931015a86d84e038744 (patch)
treeb3886adb9020c09eab0e77d8ceb08d31cf8ebc7c /src/mongo/db/catalog/collection.cpp
parentc68c5f493b042350f61dff7aaa32aa2e3e6d651e (diff)
downloadmongo-00ca22fc7097455ab1301931015a86d84e038744.tar.gz
SERVER-32645 Create a shim helper framework.
The `MONGO_DECLARE_SHIM`, `MONGO_DEFINE_SHIM`, and `MONGO_REGISTER_SHIM` macros can be used to create specialized types which are customization and auto-registration points for late-binding functions. In some sense they work like weak-symbols; however, they also are useful for tracking dependencies upon shimmed-out implementations.
Diffstat (limited to 'src/mongo/db/catalog/collection.cpp')
-rw-r--r--src/mongo/db/catalog/collection.cpp48
1 files changed, 3 insertions, 45 deletions
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp
index 13bb493e5a6..915980a34d3 100644
--- a/src/mongo/db/catalog/collection.cpp
+++ b/src/mongo/db/catalog/collection.cpp
@@ -70,56 +70,14 @@ namespace mongo {
// Emit the vtable in this TU
Collection::Impl::~Impl() = default;
-namespace {
-stdx::function<Collection::factory_function_type> factory;
-} // namespace
+MONGO_DEFINE_SHIM(Collection::makeImpl);
-void Collection::registerFactory(decltype(factory) newFactory) {
- factory = std::move(newFactory);
-}
+MONGO_DEFINE_SHIM(Collection::parseValidationLevel);
-auto Collection::makeImpl(Collection* _this,
- OperationContext* const opCtx,
- const StringData fullNS,
- OptionalCollectionUUID uuid,
- CollectionCatalogEntry* const details,
- RecordStore* const recordStore,
- DatabaseCatalogEntry* const dbce) -> std::unique_ptr<Impl> {
- return factory(_this, opCtx, fullNS, uuid, details, recordStore, dbce);
-}
+MONGO_DEFINE_SHIM(Collection::parseValidationAction);
void Collection::TUHook::hook() noexcept {}
-
-namespace {
-stdx::function<decltype(Collection::parseValidationLevel)> parseValidationLevelImpl;
-} // namespace
-
-void Collection::registerParseValidationLevelImpl(
- stdx::function<decltype(parseValidationLevel)> impl) {
- parseValidationLevelImpl = std::move(impl);
-}
-
-auto Collection::parseValidationLevel(const StringData data) -> StatusWith<ValidationLevel> {
- return parseValidationLevelImpl(data);
-}
-
-namespace {
-stdx::function<decltype(Collection::parseValidationAction)> parseValidationActionImpl;
-} // namespace
-
-void Collection::registerParseValidationActionImpl(
- stdx::function<decltype(parseValidationAction)> impl) {
- parseValidationActionImpl = std::move(impl);
-}
-
-auto Collection::parseValidationAction(const StringData data) -> StatusWith<ValidationAction> {
- return parseValidationActionImpl(data);
-}
-} // namespace mongo
-
-
-namespace mongo {
std::string CompactOptions::toString() const {
std::stringstream ss;
ss << "paddingMode: ";