// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "document_db_reference.h" #include "gid_to_lid_mapper_factory.h" #include "gid_to_lid_change_registrator.h" #include #include #include #include #include namespace proton { DocumentDBReference::DocumentDBReference(std::shared_ptr attrMgr, std::shared_ptr dmsContext, std::shared_ptr gidToLidChangeHandler) : _attrMgr(std::move(attrMgr)), _dmsContext(std::move(dmsContext)), _gidToLidChangeHandler(std::move(gidToLidChangeHandler)) { } DocumentDBReference::~DocumentDBReference() { } std::shared_ptr DocumentDBReference::getAttribute(vespalib::stringref name) { search::AttributeGuard::UP guard = _attrMgr->getAttribute(name); if (guard && guard->valid()) { return guard->getSP(); } else { auto importedAttributesRepo = _attrMgr->getImportedAttributes(); if (importedAttributesRepo != nullptr) { return importedAttributesRepo->get(name); } return std::shared_ptr(); } } std::shared_ptr DocumentDBReference::getDocumentMetaStore() const { return _dmsContext; } std::shared_ptr DocumentDBReference::getGidToLidMapperFactory() { return std::make_shared(_dmsContext); } std::unique_ptr DocumentDBReference::makeGidToLidChangeRegistrator(const vespalib::string &docTypeName) { return std::make_unique(_gidToLidChangeHandler, docTypeName); } } // namespace proton