config.hpp

См. документацию.
00001 /*
00002 
00003 Copyright (c) 2002-2005, Yauheni Akhotnikau
00004 All rights reserved.
00005 
00006 Redistribution and use in source and binary forms, with or without
00007 modification, are permitted provided that the following conditions are met:
00008 
00009 - Redistributions of source code must retain the above copyright notice, this
00010 list of conditions and the following disclaimer.
00011 
00012 - Redistributions in binary form must reproduce the above copyright notice, this
00013 list of conditions and the following disclaimer in the documentation and/or
00014 other materials provided with the distribution.
00015 
00016 - The name of the author may not be used to endorse or promote products derived
00017 from this software without specific prior written permission.
00018 
00019 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00020 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00021 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
00022 EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00024 OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00027 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00028 OF SUCH DAMAGE.
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 // hard_config_t
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 // config_t
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 // create_cfg_file
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 // load_cfg_file
00437 //
00438 
00443 OESS_1__DB__FUNC(config_t)
00444 load_cfg_file(
00446   const std::string & file_name );
00447 
00448 } /* namespace storage */
00449 
00450 } /* namespace db */
00451 
00452 } /* namespace oess_1 */
00453 
00454 #endif
00455 

Документация по ObjESSty. Последние изменения: Fri Oct 13 18:35:35 2006. Создано системой  doxygen 1.4.7
Hosted by uCoz