2022-03-03 20:27:46 +00:00
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
#include <Poco/Util/Application.h>
|
2022-06-14 22:35:55 +00:00
|
|
|
#include <base/defines.h>
|
2022-03-03 20:27:46 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class KeeperDispatcher;
|
|
|
|
|
|
|
|
class TinyContext: public std::enable_shared_from_this<TinyContext>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::shared_ptr<KeeperDispatcher> getKeeperDispatcher() const;
|
|
|
|
void initializeKeeperDispatcher(bool start_async) const;
|
|
|
|
void shutdownKeeperDispatcher() const;
|
|
|
|
void updateKeeperConfiguration(const Poco::Util::AbstractConfiguration & config);
|
|
|
|
|
|
|
|
using ConfigurationPtr = Poco::AutoPtr<Poco::Util::AbstractConfiguration>;
|
|
|
|
|
|
|
|
void setConfig(const ConfigurationPtr & config);
|
|
|
|
const Poco::Util::AbstractConfiguration & getConfigRef() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
mutable std::mutex keeper_dispatcher_mutex;
|
2022-06-14 22:35:55 +00:00
|
|
|
mutable std::shared_ptr<KeeperDispatcher> keeper_dispatcher TSA_GUARDED_BY(keeper_dispatcher_mutex);
|
2022-03-03 20:27:46 +00:00
|
|
|
|
2022-06-14 22:35:55 +00:00
|
|
|
ConfigurationPtr config TSA_GUARDED_BY(keeper_dispatcher_mutex);
|
2022-03-03 20:27:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|