#pragma once #include #include #include #include #include #include #include #include #include #include namespace DCR { namespace ihd { /** * @brief IhyperDB的连接 */ struct Connection { // 由于iHyperDB的设计独特,一个进程只使用一个iHyperDB连接 // 且ihyperDB的连接一经建立,即使断开网络连接,也不会自动释放,故不再对其使用手动释放 struct Config { // 基本信息 std::string username; std::string password; HD3Connection hd3_conn; }; enum class State { disconnected, connected }; Config config; State state; std::thread::id tid; }; auto read_conn_config_maybe() -> maybe; auto init_conn_maybe(maybe&& conn_config_maybe) -> maybe; auto disconnect_maybe(maybe conn_maybe) -> maybe; auto connect_maybe(maybe conn_maybe) -> maybe; auto read_conn_state() -> Connection::State; auto read_conn() -> Connection; auto store_conn_to_local(Connection& conn) -> Connection; auto auto_connect() -> maybe; ///<对外实际使用 } // namespace ihd } // namespace DCR