diff options
author | Tor Egge <Tor.Egge@oath.com> | 2018-04-04 11:29:32 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2018-04-04 11:29:32 +0000 |
commit | 7902239839a6f34e12ed7aa0f2b7a65114f8ee68 (patch) | |
tree | dd4acdb69101c6eb844d3d09a033aa54e8b4a402 /searchcore | |
parent | 4af2908b7854cbec1ee8173cc4a821d0482a978e (diff) |
Use shared pointer to const DocumentTypeRepo.
Diffstat (limited to 'searchcore')
6 files changed, 11 insertions, 9 deletions
diff --git a/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp b/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp index 51763b20f14..3cd4598d8a7 100644 --- a/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp +++ b/searchcore/src/tests/proton/documentdb/documentdbconfigscout/documentdbconfigscout_test.cpp @@ -21,7 +21,7 @@ namespace DDBCSP getConfig(int64_t generation, const Schema::SP &schema, - shared_ptr<DocumentTypeRepo> repo, + shared_ptr<const DocumentTypeRepo> repo, const AttributesConfig &attributes) { return test::DocumentDBConfigBuilder(generation, schema, "client", "test"). @@ -232,7 +232,7 @@ TEST("Test that DocumentDBConfigScout::scout looks ahead") AttributesConfigBuilder liveAttributes; setupLiveAttributes(liveAttributes.attribute); - shared_ptr<DocumentTypeRepo> repo(make_shared<DocumentTypeRepo>()); + shared_ptr<const DocumentTypeRepo> repo(make_shared<DocumentTypeRepo>()); Schema::SP schema(make_shared<Schema>()); DDBCSP cfg = getConfig(4, schema, repo, attributes); DDBCSP liveCfg = getConfig(4, schema, repo, liveAttributes); diff --git a/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp b/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp index 91b310e3925..e41758fdb22 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedstates.cpp @@ -5,12 +5,14 @@ #include "ifeedview.h" #include "ireplayconfig.h" #include "replaypacketdispatcher.h" +#include <vespa/document/repo/documenttyperepo.h> #include <vespa/searchcore/proton/bucketdb/ibucketdbhandler.h> #include <vespa/searchcore/proton/common/eventlogger.h> #include <vespa/searchlib/common/idestructorcallback.h> #include <vespa/vespalib/util/closuretask.h> #include <vespa/vespalib/util/exceptions.h> + #include <vespa/log/log.h> LOG_SETUP(".proton.server.feedstates"); @@ -127,7 +129,7 @@ public: virtual NewConfigOperation::IStreamHandler &getNewConfigStreamHandler() override { return _config_store; } - virtual document::DocumentTypeRepo &getDeserializeRepo() override { + virtual const document::DocumentTypeRepo &getDeserializeRepo() override { return *_feed_view_ptr->getDocumentTypeRepo(); } }; diff --git a/searchcore/src/vespa/searchcore/proton/server/ifeedview.h b/searchcore/src/vespa/searchcore/proton/server/ifeedview.h index 3e1635d0f33..3ded41180d5 100644 --- a/searchcore/src/vespa/searchcore/proton/server/ifeedview.h +++ b/searchcore/src/vespa/searchcore/proton/server/ifeedview.h @@ -34,7 +34,7 @@ public: IFeedView & operator = (const IFeedView &) = delete; virtual ~IFeedView() { } - virtual const std::shared_ptr<document::DocumentTypeRepo> &getDocumentTypeRepo() const = 0; + virtual const std::shared_ptr<const document::DocumentTypeRepo> &getDocumentTypeRepo() const = 0; /** * Access to const version of document meta store. diff --git a/searchcore/src/vespa/searchcore/proton/server/ireplaypackethandler.h b/searchcore/src/vespa/searchcore/proton/server/ireplaypackethandler.h index 01307750606..210ece3a36a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/ireplaypackethandler.h +++ b/searchcore/src/vespa/searchcore/proton/server/ireplaypackethandler.h @@ -30,7 +30,7 @@ struct IReplayPacketHandler virtual void replay(const CompactLidSpaceOperation &op) = 0; virtual NewConfigOperation::IStreamHandler &getNewConfigStreamHandler() = 0; - virtual document::DocumentTypeRepo &getDeserializeRepo() = 0; + virtual const document::DocumentTypeRepo &getDeserializeRepo() = 0; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.cpp b/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.cpp index f2deb456090..ff39ed89999 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.cpp @@ -178,7 +178,7 @@ ProtonConfigFetcher::close() } void -ProtonConfigFetcher::rememberDocumentTypeRepo(std::shared_ptr<document::DocumentTypeRepo> repo) +ProtonConfigFetcher::rememberDocumentTypeRepo(std::shared_ptr<const document::DocumentTypeRepo> repo) { // Ensure that previous document type repo is kept alive, and also // any document type repo that was current within last 10 minutes. diff --git a/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.h b/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.h index 8ba56deb7e8..252d8e6dc0e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton_config_fetcher.h @@ -50,7 +50,7 @@ private: typedef std::map<DocTypeName, DocumentDBConfigManager::SP> DBManagerMap; using Clock = std::chrono::steady_clock; using TimePoint = std::chrono::time_point<Clock>; - using OldDocumentTypeRepo = std::pair<TimePoint, std::shared_ptr<document::DocumentTypeRepo>>; + using OldDocumentTypeRepo = std::pair<TimePoint, std::shared_ptr<const document::DocumentTypeRepo>>; BootstrapConfigManager _bootstrapConfigManager; config::ConfigRetriever _retriever; @@ -62,13 +62,13 @@ private: FastOS_ThreadPool _threadPool; std::deque<OldDocumentTypeRepo> _oldDocumentTypeRepos; - std::shared_ptr<document::DocumentTypeRepo> _currentDocumentTypeRepo; + std::shared_ptr<const document::DocumentTypeRepo> _currentDocumentTypeRepo; void fetchConfigs(); void updateDocumentDBConfigs(const BootstrapConfigSP & config, const config::ConfigSnapshot & snapshot); void reconfigure(); const config::ConfigKeySet pruneManagerMap(const BootstrapConfigSP & config); - void rememberDocumentTypeRepo(std::shared_ptr<document::DocumentTypeRepo> repo); + void rememberDocumentTypeRepo(std::shared_ptr<const document::DocumentTypeRepo> repo); }; } // namespace proton |