types.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__TRX__TYPES_HPP_ )
00039 #define _OESS_1__DB__STORAGE__TRX__TYPES_HPP_
00040 
00041 #include <list>
00042 #include <set>
00043 #include <memory>
00044 
00045 #include <cpp_util_2/h/nocopy.hpp>
00046 
00047 #include <oess_1/db/h/declspec.hpp>
00048 
00049 #include <oess_1/defs/h/types.hpp>
00050 
00051 #include <oess_1/stdsn/h/serializable.hpp>
00052 #include <oess_1/stdsn/h/shptr.hpp>
00053 
00054 #include <oess_1/db/storage/h/config.hpp>
00055 #include <oess_1/db/storage/h/dirty_page_storage.hpp>
00056 
00057 namespace oess_1 {
00058 
00059 namespace db {
00060 
00061 namespace storage {
00062 
00063 namespace trx {
00064 
00065 //
00066 // delta_info_t
00067 //
00068 
00082 class OESS_1__DB__TYPE  delta_info_t
00083   : public oess_1::stdsn::serializable_t
00084   {
00085   OESS_SERIALIZER_EX( delta_info_t, OESS_1__DB__TYPE )
00086   typedef oess_1::stdsn::serializable_t base_type_t;
00087   public :
00089     delta_info_t();
00091     delta_info_t(
00093       oess_1::uint_t index,
00095       const std::string & value );
00096     virtual ~delta_info_t();
00097 
00099     oess_1::uint_t
00100     index() const;
00101 
00103     const std::string &
00104     value() const;
00105 
00106   private :
00108     oess_1::uint_t  m_index;
00109 
00111     std::string m_value;
00112   };
00113 
00114 //
00115 // delta_info_shptr_t
00116 //
00117 
00122 class OESS_1__DB__TYPE  delta_info_shptr_t
00123   : public oess_1::stdsn::shptr_t
00124   {
00125   OESS_SERIALIZER_EX( delta_info_shptr_t, OESS_1__DB__TYPE )
00126   OESS_1_SHPTR_IFACE( delta_info_shptr_t,
00127       oess_1::db::storage::trx::delta_info_t,
00128       oess_1::stdsn::shptr_t )
00129   };
00130 
00131 //
00132 // delta_info_list_t
00133 //
00134 
00139 typedef std::list< delta_info_shptr_t > delta_info_list_t;
00140 
00141 //
00142 // page_info_t
00143 //
00144 
00151 class OESS_1__DB__TYPE  page_info_t
00152   : public oess_1::stdsn::serializable_t
00153   {
00154   OESS_SERIALIZER_EX( page_info_t, OESS_1__DB__TYPE )
00155 
00156   
00157   typedef oess_1::stdsn::serializable_t base_type_t;
00158 
00159   public :
00161     page_info_t();
00163     page_info_t(
00165       oess_1::uint_t ordinal );
00166     virtual ~page_info_t();
00167 
00169     oess_1::uint_t
00170     ordinal() const;
00171 
00173     void
00174     add( const delta_info_shptr_t & delta );
00175 
00177     const delta_info_list_t &
00178     deltas() const;
00179 
00181     oess_1::uint_t
00182     summary_delta_length() const;
00183 
00184   private :
00186     oess_1::uint_t  m_ordinal;
00187 
00189     delta_info_list_t m_deltas;
00190   };
00191 
00192 //
00193 // page_info_list_t
00194 //
00195 
00200 typedef std::list< page_info_t >  page_info_list_t;
00201 
00202 //
00203 // trace_stream_item_t
00204 //
00205 
00210 class OESS_1__DB__TYPE  trace_stream_item_t
00211   : public oess_1::stdsn::serializable_t
00212   {
00213   OESS_SERIALIZER_EX( trace_stream_item_t, OESS_1__DB__TYPE )
00214   typedef oess_1::stdsn::serializable_t base_type_t;
00215 
00216   public :
00218     trace_stream_item_t();
00220 
00224     trace_stream_item_t(
00226       oess_1::uint_t main_file_length );
00227     virtual ~trace_stream_item_t();
00228 
00230     oess_1::uint_t
00231     main_file_length() const;
00232 
00234     void
00235     add(
00236       const page_info_t & page );
00237 
00239     const page_info_list_t &
00240     pages() const;
00241 
00243     oess_1::uint_t
00244     summary_length() const;
00245 
00246   private :
00248     oess_1::uint_t  m_main_file_length;
00249 
00251     page_info_list_t  m_pages;
00252   };
00253 
00254 //
00255 // make_item.
00256 //
00257 
00266 OESS_1__DB__FUNC(void)
00267 make_item(
00269   dirty_page_storage_t & storage,
00271   const config_t & config,
00276   trace_stream_item_t & receiver );
00277 
00278 //
00279 // image_header_t
00280 //
00281 
00286 class OESS_1__DB__TYPE  image_header_t
00287   : public oess_1::stdsn::serializable_t
00288   {
00289     OESS_SERIALIZER_EX( image_header_t, OESS_1__DB__TYPE )
00290     typedef oess_1::stdsn::serializable_t base_type_t;
00291 
00292   public :
00294     typedef trace_compression_mode_t  compression_mode_t;
00295 
00297     image_header_t();
00299     image_header_t(
00301       const compression_mode_t & compression,
00303       oess_1::uint_t uncompressed_size,
00305       oess_1::uint_t compressed_size );
00306     virtual ~image_header_t();
00307 
00309     const compression_mode_t &
00310     compression_mode() const;
00311 
00313     oess_1::uint_t
00314     uncompressed_size() const;
00315 
00317     oess_1::uint_t
00318     compressed_size() const;
00319 
00320   private :
00322     compression_mode_t m_compression_mode;
00323 
00325     oess_1::uint_t  m_uncompressed_size;
00326 
00328     oess_1::uint_t  m_compressed_size;
00329   };
00330 
00331 //
00332 // trace_file_number_t
00333 //
00334 
00339 typedef oess_1::uint_t trace_file_number_t;
00340 
00341 //
00342 // trace_file_number_set_t
00343 //
00344 
00349 typedef std::set< trace_file_number_t > trace_file_number_set_t;
00350 
00351 //
00352 // snapshot_collection_t
00353 //
00354 
00359 class OESS_1__DB__TYPE  snapshot_collection_t
00360   : private cpp_util_2::nocopy_t
00361   {
00362   public :
00363     virtual ~snapshot_collection_t();
00364 
00366     virtual unsigned int
00367     size() const = 0;
00368 
00370     virtual trace_file_number_set_t
00371     non_actual() const = 0;
00372 
00374 
00377     virtual trace_file_number_t
00378     actual() const = 0;
00379 
00381 
00384     virtual bool
00385     has_actual() const = 0;
00386 
00388 
00395     virtual void
00396     include(
00398       const std::string & file_name,
00401       trace_file_number_t last_used_trace ) = 0;
00402 
00405 
00412     virtual void
00413     get_actual(
00415       const std::string & file_name ) const = 0;
00416 
00418     virtual void
00419     destroy() = 0;
00420   };
00421 
00422 //
00423 // committer_t
00424 //
00425 
00432 class OESS_1__DB__TYPE  committer_t
00433   : private cpp_util_2::nocopy_t
00434   {
00435   public :
00436     virtual ~committer_t();
00437 
00461     virtual void
00462     detect_nonactual_traces(
00467       trace_file_number_set_t & traces ) = 0;
00468 
00474     virtual void
00475     initialize(
00477       oess_1::uint_t total_page_count,
00479       oess_1::uint_t page_size,
00482       oess_1::uint_t block_size ) = 0;
00483 
00488     virtual void
00489     finalize() = 0;
00490 
00507     virtual void
00508     store_block(
00510       oess_1::uint_t ordinal,
00512       oess_1::uint_t block_index,
00514       const std::string & block_value ) = 0;
00515 
00531     virtual bool
00532     is_insufficient_trace_info_allowed() const = 0;
00533   };
00534 
00535 //
00536 // trace_stream_t
00537 //
00538 
00550 class OESS_1__DB__TYPE  trace_stream_t
00551   : private cpp_util_2::nocopy_t
00552   {
00553   public :
00554     virtual ~trace_stream_t();
00555 
00562     virtual void
00563     open(
00565       const std::string & physic_name,
00567       const config_t & config,
00569       bool is_read_only ) = 0;
00570 
00577     virtual void
00578     create(
00580       const std::string & physic_name,
00582       const config_t & config ) = 0;
00583 
00589     virtual void
00590     destroy(
00593       const std::string & physic_name ) = 0;
00594 
00600     virtual bool
00601     is_exists(
00604       const std::string & physic_name ) = 0;
00605 
00613     virtual void
00614     append(
00615       const trace_stream_item_t & item ) = 0;
00616 
00633     virtual void
00634     reverse_replay(
00635       committer_t & committer,
00636       trace_file_number_set_t * used_files = 0,
00637       trace_file_number_set_t * unused_files = 0,
00640       std::ostream * verbose_stream = 0 ) = 0;
00641 
00645     virtual void
00646     close() = 0;
00647   };
00648 
00649 //
00650 // create_std_trace_stream
00651 //
00652 
00663 OESS_1__DB__FUNC(std::auto_ptr< trace_stream_t >)
00664 create_std_trace_stream(
00666   trace_mode_t trace_mode );
00667 
00668 //
00669 // create_std_file_committer
00670 //
00671 
00700 OESS_1__DB__FUNC(std::auto_ptr< committer_t >)
00701 create_std_file_committer(
00703   const std::string & physic_name,
00705   trace_mode_t trace_mode );
00706 
00707 //
00708 // create_std_snapshot_collection
00709 //
00710 
00715 OESS_1__DB__FUNC(std::auto_ptr< snapshot_collection_t >)
00716 create_std_snapshot_collection(
00718   const std::string & physic_name );
00719 
00720 //
00721 // trace_file_extension
00722 //
00723 
00731 OESS_1__DB__FUNC(std::string)
00732 trace_file_extension();
00733 
00734 //
00735 // create_trace_file_name
00736 //
00737 
00742 OESS_1__DB__FUNC(std::string)
00743 create_trace_file_name(
00744   const std::string & physic_name,
00745   trace_file_number_t trace_file_number );
00746 
00747 //
00748 // snapshot_file_extension
00749 //
00750 
00758 OESS_1__DB__FUNC(std::string)
00759 snapshot_file_extension();
00760 
00761 //
00762 // create_snapshot_file_name
00763 //
00764 
00769 OESS_1__DB__FUNC(std::string)
00770 create_snapshot_file_name(
00771   const std::string & physic_name,
00772   trace_file_number_t snapshot_file_number );
00773 
00774 } /* namespace trx */
00775 
00776 } /* namespace storage */
00777 
00778 } /* namespace db */
00779 
00780 } /* namespace oess */
00781 
00782 #endif
00783 

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