diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-23 20:24:00 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-02-23 20:24:00 +0000 |
commit | 4822bc3f0ddb4ef5761401e8bc17d844f7d56032 (patch) | |
tree | e110741481231d0c8028f1a41fb56bdb4de2be76 /documentapi | |
parent | 04596050bc494e338696cae4cc3f68771424c275 (diff) |
Add missing files
Diffstat (limited to 'documentapi')
-rw-r--r-- | documentapi/src/vespa/documentapi/messagebus/policies/mirror_with_all.cpp | 24 | ||||
-rw-r--r-- | documentapi/src/vespa/documentapi/messagebus/policies/mirror_with_all.h | 27 |
2 files changed, 51 insertions, 0 deletions
diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/mirror_with_all.cpp b/documentapi/src/vespa/documentapi/messagebus/policies/mirror_with_all.cpp new file mode 100644 index 00000000000..4bcf87c14a6 --- /dev/null +++ b/documentapi/src/vespa/documentapi/messagebus/policies/mirror_with_all.cpp @@ -0,0 +1,24 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include <mirror_with_all.h> +#include <vespa/slobrok/sbmirror.h> +#include <vespa/fnet/frt/supervisor.h> +#include <vespa/fnet/transport.h> +#include <vespa/fastos/thread.h> + +namespace documentapi { + +MirrorAndStuff::MirrorAndStuff(const slobrok::ConfiguratorFactory & config) + : _threadPool(std::make_unique<FastOS_ThreadPool>(64_Ki)), + _transport(std::make_unique<FNET_Transport>()), + _orb(std::make_unique<FRT_Supervisor>(_transport.get())), + _mirror(std::make_unique<slobrok::api::MirrorAPI>(*_orb, config)) +{ + _transport->Start(_threadPool.get()); +} + +MirrorAndStuff::~MirrorAndStuff() { + _transport->ShutDown(true); +} + +} diff --git a/documentapi/src/vespa/documentapi/messagebus/policies/mirror_with_all.h b/documentapi/src/vespa/documentapi/messagebus/policies/mirror_with_all.h new file mode 100644 index 00000000000..05571c4420e --- /dev/null +++ b/documentapi/src/vespa/documentapi/messagebus/policies/mirror_with_all.h @@ -0,0 +1,27 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include <memory> + +class FastOS_ThreadPool; +class FNET_Transport; +class FRT_Supervisor; +namespace slobrok { class ConfiguratorFactory; } +namespace slobrok::api { class IMirrorAPI; } + +namespace documentapi { + +class MirrorAndStuff { +public: + MirrorAndStuff(const slobrok::ConfiguratorFactory & config); + ~MirrorAndStuff(); + slobrok::api::IMirrorAPI * mirror() { return _mirror.get(); } +private: + std::unique_ptr<FastOS_ThreadPool> _threadPool; + std::unique_ptr<FNET_Transport> _transport; + std::unique_ptr<FRT_Supervisor> _orb; + std::unique_ptr<slobrok::api::IMirrorAPI> _mirror; +}; + +} |