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
00038 #if !defined( _OESS_1__DB__STORAGE__CONFIG_HPP_ )
00039 #define _OESS_1__DB__STORAGE__CONFIG_HPP_
00040
00041 #include <string>
00042
00043 #include <oess_1/defs/h/types.hpp>
00044
00045 #include <oess_1/stdsn/h/serializable.hpp>
00046
00047 #include <oess_1/db/h/declspec.hpp>
00048
00049 namespace oess_1 {
00050
00051 namespace db {
00052
00053 namespace storage {
00054
00057
00059
00062 typedef oess_1::uchar_t trace_mode_t;
00063
00065
00071 const trace_mode_t trace_no = 0;
00072
00074
00090 const trace_mode_t trace_last = 1;
00091
00093
00105 const trace_mode_t trace_all = 2;
00106
00108
00109
00110
00111
00112
00118 class OESS_1__DB__TYPE hard_config_t
00119 : public oess_1::stdsn::serializable_t
00120 {
00121 typedef oess_1::stdsn::serializable_t base_type_t;
00122 OESS_SERIALIZER( hard_config_t )
00123 public :
00125 enum defaults_t
00126 {
00128 default_page_size = 4096,
00130 default_chain_link_size = 256,
00133 default_trx_delta_block_size = 4096,
00135 default_trace_file_page_size = 512,
00137 default_trace_mode = trace_last
00138 };
00139
00141
00144 hard_config_t();
00146
00151 hard_config_t(
00153 oess_1::uint_t page_size,
00155 oess_1::uint_t chain_link_size,
00158 oess_1::uint_t trx_delta_block_size,
00160 oess_1::uint_t trace_file_page_size,
00162 trace_mode_t trace_mode );
00164 hard_config_t(
00165 const hard_config_t & o );
00166 virtual ~hard_config_t();
00167
00169 hard_config_t &
00170 operator=( const hard_config_t & o );
00171
00173 oess_1::uint_t
00174 page_size() const;
00175
00177 oess_1::uint_t
00178 chain_link_size() const;
00179
00182 oess_1::uint_t
00183 trx_delta_block_size() const;
00184
00186 oess_1::uint_t
00187 trace_file_page_size() const;
00188
00190 trace_mode_t
00191 trace_mode() const;
00192
00193 private :
00195 oess_1::uint_t m_page_size;
00196
00198 oess_1::uint_t m_chain_link_size;
00199
00202 oess_1::uint_t m_trx_delta_block_size;
00203
00205 oess_1::uint_t m_trace_file_page_size;
00206
00208 trace_mode_t m_trace_mode;
00209 };
00210
00213
00215
00218 typedef oess_1::uchar_t trace_compression_mode_t;
00219
00221
00232 const trace_compression_mode_t
00233 trace_no_compression = 0;
00234
00236
00239 const trace_compression_mode_t
00240 trace_zlib_compression = 1;
00241
00243
00246 const trace_compression_mode_t
00247 trace_default_compression = trace_no_compression;
00248
00250
00251
00252
00253
00254
00264 class OESS_1__DB__TYPE config_t
00265 {
00266 public :
00268 enum defaults_t
00269 {
00271 default_cache_size = 256,
00273 default_trace_file_size_limit = 10u * 1024 * 1024,
00275 default_trace_stream_buffered_pages = 128,
00277 default_trace_stream_compression =
00278 trace_default_compression
00279 };
00280
00282
00285 config_t();
00287
00291 config_t(
00292 const hard_config_t & o );
00293 ~config_t();
00294
00298 void
00299 set_hard_config(
00300 const hard_config_t & config );
00301
00303 oess_1::uint_t
00304 page_size() const;
00305
00307 oess_1::uint_t
00308 chain_link_size() const;
00309
00312 oess_1::uint_t
00313 trx_delta_block_size() const;
00314
00316 oess_1::uint_t
00317 trace_file_page_size() const;
00318
00320 trace_mode_t
00321 trace_mode() const;
00323
00327
00331 oess_1::uint_t
00332 cache_size() const;
00333
00335 void
00336 set_cache_size( oess_1::uint_t v );
00337
00339 oess_1::uint_t
00340 trace_file_size_limit() const;
00341
00343 void
00344 set_trace_file_size_limit( oess_1::uint_t v );
00345
00348
00351 oess_1::uint_t
00352 trace_stream_buffered_pages() const;
00353
00356 void
00357 set_trace_stream_buffered_pages( oess_1::uint_t v );
00358
00360 trace_compression_mode_t
00361 trace_compression() const;
00362
00364 void
00365 set_trace_compression(
00366 const trace_compression_mode_t & v );
00368
00372 std::string
00373 make_cfg_file_name(
00374 const std::string & physic_name ) const;
00375
00377 std::string
00378 make_main_file_name(
00379 const std::string & physic_name ) const;
00380
00382 std::string
00383 make_unclear_file_name(
00384 const std::string & physic_name ) const;
00385
00387
00388 std::string
00389 make_tmp_main_file_name(
00390 const std::string & physic_name ) const;
00391
00394
00395 std::string
00396 make_tmp_unclear_file_name(
00397 const std::string & physic_name ) const;
00399
00400 private :
00402 hard_config_t m_hard_config;
00403
00407 oess_1::uint_t m_cache_size;
00408
00410 oess_1::uint_t m_trace_file_size_limit;
00411
00413 oess_1::uint_t m_trace_stream_buffered_pages;
00414
00416 trace_compression_mode_t m_trace_compression;
00418 };
00419
00420
00421
00422
00423
00428 OESS_1__DB__FUNC(void)
00429 create_cfg_file(
00431 const std::string & file_name,
00433 const config_t & config );
00434
00435
00436
00437
00438
00443 OESS_1__DB__FUNC(config_t)
00444 load_cfg_file(
00446 const std::string & file_name );
00447
00448 }
00449
00450 }
00451
00452 }
00453
00454 #endif
00455