#pragma once #include #include #include #include // Y_IGNORE #include namespace DB { class InMemoryStateManager : public nuraft::state_mgr { public: InMemoryStateManager( int server_id_, const std::string & config_prefix, const Poco::Util::AbstractConfiguration & config); nuraft::ptr load_config() override { return cluster_config; } void save_config(const nuraft::cluster_config & config) override; void save_state(const nuraft::srv_state & state) override; nuraft::ptr read_state() override { return server_state; } nuraft::ptr load_log_store() override { return log_store; } Int32 server_id() override { return my_server_id; } nuraft::ptr get_srv_config() const { return my_server_config; } void system_exit(const int /* exit_code */) override {} int getPort() const { return my_port; } private: int my_server_id; int my_port; nuraft::ptr log_store; nuraft::ptr my_server_config; nuraft::ptr cluster_config; nuraft::ptr server_state; }; }