00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #if !defined( _OESS_1__DB__SITE__IMPL__STD__LOCALHOST_HPP_ )
00037 #define _OESS_1__DB__SITE__IMPL__STD__LOCALHOST_HPP_
00038
00039 #include <map>
00040
00041 #include <ace/Thread_Mutex.h>
00042
00043 #include <smart_ref_3/h/smart_ref.hpp>
00044
00045 #include <oess_1/db/impl/db_content/h/db_content.hpp>
00046
00047 #include <oess_1/db/site/h/localhost.hpp>
00048
00049 #include <oess_1/db/site/impl/h/attach_cmd.hpp>
00050 #include <oess_1/db/site/impl/h/detach_cmd.hpp>
00051 #include <oess_1/db/site/impl/h/ent_create_cmd.hpp>
00052 #include <oess_1/db/site/impl/h/ent_destroy_cmd.hpp>
00053 #include <oess_1/db/site/impl/h/ent_destroy_all_cmd.hpp>
00054 #include <oess_1/db/site/impl/h/ent_load_cmd.hpp>
00055 #include <oess_1/db/site/impl/h/ent_update_cmd.hpp>
00056 #include <oess_1/db/site/impl/h/ent_find_next_cmd.hpp>
00057 #include <oess_1/db/site/impl/h/slice_create_cmd.hpp>
00058 #include <oess_1/db/site/impl/h/slice_destroy_cmd.hpp>
00059 #include <oess_1/db/site/impl/h/slice_is_exists_cmd.hpp>
00060 #include <oess_1/db/site/impl/h/slice_names_cmd.hpp>
00061 #include <oess_1/db/site/impl/h/transaction_cmd.hpp>
00062
00063 namespace oess_1 {
00064
00065 namespace db {
00066
00067 namespace site {
00068
00069 namespace impl {
00070
00071
00072
00073
00074 SMART_REF_3_DECL_REF_FULL(
00075 oess_1::db::impl::db_content::db_content_t,
00076 ref_db_content_t,
00077 class
00078 )
00079
00080
00081
00082
00083 typedef std::map< std::string, ref_db_content_t >
00084 ref_db_content_map_t;
00085
00086
00087
00088
00089
00093 struct db_info_t {
00094 std::string m_physic_name;
00095 oess_1::db::storage::config_t m_config;
00096 bool m_is_read_only;
00097 bool m_is_auto_repair_enabled;
00098
00099 db_info_t();
00100 db_info_t(
00101 const std::string & physic_name,
00102 const oess_1::db::storage::config_t & config,
00103 bool is_read_only,
00104 bool is_auto_repair_enabled );
00105 db_info_t( const db_info_t & o );
00106 ~db_info_t();
00107
00108 db_info_t &
00109 operator=( const db_info_t & o );
00110 };
00111
00112
00113
00114
00115 typedef std::map< std::string, db_info_t >
00116 db_info_map_t;
00117
00118
00119
00120
00121
00125 class std_localhost_t :
00126 public localhost_t
00127 {
00128 public :
00129 std_localhost_t();
00130 virtual ~std_localhost_t();
00131
00134 virtual void
00135 db_create(
00136 const std::string & physic_name,
00137 oess_1::uint_t creation_mode );
00138
00139 virtual void
00140 db_create(
00141 const std::string & physic_name,
00142 const oess_1::db::storage::config_t & config,
00143 oess_1::uint_t creation_mode );
00144
00145 virtual void
00146 db_describe(
00147 const std::string & logic_name,
00148 const std::string & physic_name,
00149 oess_1::uint_t cache_size,
00150 bool is_read_only,
00151 bool is_auto_repair_enabled );
00152
00153 virtual void
00154 db_describe(
00155 const std::string & logic_name,
00156 const std::string & physic_name,
00157 const oess_1::db::storage::config_t & config,
00158 bool is_read_only,
00159 bool is_auto_repair_enabled );
00160
00161 virtual void
00162 db_flush_all();
00163
00164 virtual bool
00165 db_set_auto_flush(
00166 const std::string & logic_name,
00167 bool is_on );
00168
00169 virtual response_t *
00170 process(
00171 const request_t & req );
00173
00174 private :
00175 ACE_Thread_Mutex m_lock;
00176
00177 db_info_map_t m_db_info_map;
00178 ref_db_content_map_t m_db_content_map;
00179
00180
00181
00182
00183
00184 response_t *
00185 on_attach_cmd(
00186 const attach_cmd_t & req );
00187
00188 response_t *
00189 on_detach_cmd(
00190 const detach_cmd_t & req );
00191
00192 response_t *
00193 on_ent_create_cmd(
00194 const ent_create_cmd_t & req );
00195
00196 response_t *
00197 on_ent_destroy_cmd(
00198 const ent_destroy_cmd_t & req );
00199
00200 response_t *
00201 on_ent_destroy_all_cmd(
00202 const ent_destroy_all_cmd_t & req );
00203
00204 response_t *
00205 on_ent_load_cmd(
00206 const ent_load_cmd_t & req );
00207
00208 response_t *
00209 on_ent_update_cmd(
00210 const ent_update_cmd_t & req );
00211
00212 response_t *
00213 on_ent_find_next_cmd(
00214 const ent_find_next_cmd_t & req );
00215
00217
00218 response_t *
00219 on_slice_create_cmd(
00220 const slice_create_cmd_t & req );
00221
00223
00224 response_t *
00225 on_slice_destroy_cmd(
00226 const slice_destroy_cmd_t & req );
00227
00229
00230 response_t *
00231 on_slice_is_exists_cmd(
00232 const slice_is_exists_cmd_t & req );
00233
00235
00236 response_t *
00237 on_slice_names_cmd(
00238 const slice_names_cmd_t & req );
00239
00241
00242 response_t *
00243 on_transaction_cmd(
00244 const transaction_cmd_t & req );
00245
00246
00247
00248
00249
00251 const db_info_t &
00252 find_db_info(
00253 const std::string & db_logic_name ) const;
00254
00256
00257 oess_1::db::impl::db_content::db_content_t &
00258 open_db_if_needed(
00259 const std::string & db_logic_name,
00260 const db_info_t & db_info );
00261
00264 oess_1::db::impl::db_content::db_content_t &
00265 find_opened_db(
00266 const std::string & db_logic_name );
00267
00269 void
00270 close_db(
00271 const std::string & db_logic_name );
00272 };
00273
00274 }
00275
00276 }
00277
00278 }
00279
00280 }
00281
00282 #endif