std_file_committer.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 
00036 #if !defined( _OESS_1__DB__STORAGE__TRX__STD_FILE_COMMITTER_HPP_ )
00037 #define _OESS_1__DB__STORAGE__TRX__STD_FILE_COMMITTER_HPP_
00038 
00039 #include <vector>
00040 
00041 #include <oess_1/file/h/file.hpp>
00042 
00043 #include <oess_1/db/storage/trx/h/types.hpp>
00044 
00045 namespace oess_1 {
00046 
00047 namespace db {
00048 
00049 namespace storage {
00050 
00051 namespace trx {
00052 
00053 //
00054 // std_file_committer_t
00055 //
00056 
00082 class OESS_1__DB__TYPE  std_file_committer_t
00083   : public committer_t
00084   {
00085   public :
00087     std_file_committer_t(
00089       const std::string & physic_name );
00090     virtual ~std_file_committer_t();
00091 
00094     virtual void
00095     detect_nonactual_traces(
00096       trace_file_number_set_t & traces );
00097 
00101     virtual void
00102     initialize(
00103       oess_1::uint_t total_page_count,
00104       oess_1::uint_t page_size,
00105       oess_1::uint_t block_size );
00106 
00107     virtual void
00108     finalize();
00109 
00110     virtual void
00111     store_block(
00112       oess_1::uint_t ordinal,
00113       oess_1::uint_t block_index,
00114       const std::string & block_value );
00115 
00116     virtual bool
00117     is_insufficient_trace_info_allowed() const;
00119 
00121     const std::string &
00122     physic_name() const;
00123 
00127     void
00128     set_result_file_name(
00129       const std::string & file_name );
00130 
00131   private :
00133     std::string m_physic_name;
00134 
00136     std::auto_ptr< snapshot_collection_t >  m_snapshots;
00137 
00139     oess_1::file::file_t  m_file;
00140 
00142 
00147     bool  m_is_file_exists;
00148 
00150 
00153     oess_1::uint_t  m_page_size;
00154 
00156     std::vector< oess_1::char_t > m_io_buf;
00157 
00160 
00163     std::string m_result_file_name;
00164 
00167     std::string
00168     make_tmp_file_name(
00170       const std::string & physic_name );
00171   };
00172 
00173 //
00174 // unclear_file_committer_t
00175 //
00176 
00210 class OESS_1__DB__TYPE  unclear_file_committer_t
00211   : public committer_t
00212   {
00213   public :
00215     unclear_file_committer_t(
00217       const std::string & physic_name );
00218     virtual ~unclear_file_committer_t();
00219 
00222     virtual void
00223     detect_nonactual_traces(
00224       trace_file_number_set_t & traces );
00225 
00231     virtual void
00232     initialize(
00233       oess_1::uint_t total_page_count,
00234       oess_1::uint_t page_size,
00235       oess_1::uint_t block_size );
00236 
00237     virtual void
00238     finalize();
00239 
00240     virtual void
00241     store_block(
00242       oess_1::uint_t ordinal,
00243       oess_1::uint_t block_index,
00244       const std::string & block_value );
00245 
00246     virtual bool
00247     is_insufficient_trace_info_allowed() const;
00249 
00250   private :
00252     std::string m_physic_name;
00254     oess_1::file::file_t  m_file;
00255 
00257 
00260     oess_1::uint_t  m_page_size;
00261 
00263     std::vector< oess_1::char_t > m_io_buf;
00264   };
00265 
00266 //
00267 // snapshot_file_committer_t
00268 //
00269 
00283 class OESS_1__DB__TYPE  snapshot_file_committer_t
00284   : public std_file_committer_t
00285   {
00287     typedef std_file_committer_t  base_type_t;
00288 
00289   public :
00291     snapshot_file_committer_t(
00293       const std::string & physic_name );
00294     virtual ~snapshot_file_committer_t();
00295 
00298     virtual void
00299     detect_nonactual_traces(
00300       trace_file_number_set_t & traces );
00302 
00304 
00316     trace_file_number_set_t
00317     outdated_traces() const;
00318 
00319   private :
00321     trace_file_number_set_t m_outdated_traces;
00322   };
00323 
00324 } /* namespace trx */
00325 
00326 } /* namespace storage */
00327 
00328 } /* namespace db */
00329 
00330 } /* namespace oess */
00331 
00332 #endif
00333 

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