std_trace_stream.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_TRACE_STREAM_HPP_ )
00037 #define _OESS_1__DB__STORAGE__TRX__STD_TRACE_STREAM_HPP_
00038 
00039 #include <memory>
00040 
00041 #include <oess_1/db/storage/trx/h/types.hpp>
00042 
00043 namespace oess_1 {
00044 
00045 namespace db {
00046 
00047 namespace storage {
00048 
00049 namespace trx {
00050 
00051 namespace impl
00052 {
00053   class chain_ostream_t;
00054 } /* namespace impl */
00055 
00056 //
00057 // std_trace_stream_t
00058 //
00059 
00072 class std_trace_stream_t
00073   : public trace_stream_t
00074   {
00075   public :
00076     std_trace_stream_t();
00077     virtual ~std_trace_stream_t();
00078 
00081     virtual void
00082     open(
00083       const std::string & physic_name,
00084       const config_t & config,
00085       bool is_read_only );
00086 
00087     virtual void
00088     create(
00089       const std::string & physic_name,
00090       const config_t & config );
00091 
00092     virtual void
00093     destroy(
00094       const std::string & physic_name );
00095 
00096     virtual bool
00097     is_exists(
00098       const std::string & physic_name );
00099 
00100     virtual void
00101     append(
00102       const trace_stream_item_t & item );
00103 
00104     virtual void
00105     reverse_replay(
00106       committer_t & committer,
00107       trace_file_number_set_t * used_files = 0,
00108       trace_file_number_set_t * unused_files = 0,
00109       std::ostream * verbose_stream = 0 );
00110 
00111     virtual void
00112     close();
00114 
00115   protected :
00118 
00127     virtual std::auto_ptr< impl::chain_ostream_t >
00128     create_chain_ostream();
00129 
00131 
00135     bool
00136     is_open() const;
00137 
00139 
00143     const std::string &
00144     physic_name() const;
00145 
00147 
00151     const config_t &
00152     config() const;
00153 
00155 
00159     trace_file_number_set_t &
00160     all_traces();
00161 
00162   private :
00164 
00168     std::string m_physic_name;
00169 
00171 
00175     config_t  m_config;
00176 
00178 
00182     trace_file_number_set_t m_all_traces;
00183 
00185 
00189     bool  m_is_open;
00190 
00192 
00196     bool  m_is_read_only;
00197 
00199 
00202     std::auto_ptr< impl::chain_ostream_t >  m_chain_ostream;
00203   };
00204 
00205 //
00206 // last_trx_only_trace_stream_t
00207 //
00208 
00224 class last_trx_only_trace_stream_t
00225   : public std_trace_stream_t
00226   {
00227     typedef std_trace_stream_t base_type_t;
00228   public :
00229     last_trx_only_trace_stream_t();
00230     virtual ~last_trx_only_trace_stream_t();
00231 
00232   protected :
00235 
00244     virtual std::auto_ptr< impl::chain_ostream_t >
00245     create_chain_ostream();
00246   };
00247 
00248 //
00249 // pseudo_trace_stream_t
00250 //
00251 
00262 class pseudo_trace_stream_t
00263   : public trace_stream_t
00264   {
00265   public :
00266     pseudo_trace_stream_t();
00267     virtual ~pseudo_trace_stream_t();
00268 
00271     virtual void
00272     open(
00273       const std::string & physic_name,
00274       const config_t & config,
00275       bool is_read_only );
00276 
00277     virtual void
00278     create(
00279       const std::string & physic_name,
00280       const config_t & config );
00281 
00282     virtual void
00283     destroy(
00284       const std::string & physic_name );
00285 
00286     virtual bool
00287     is_exists(
00288       const std::string & physic_name );
00289 
00290     virtual void
00291     append(
00292       const trace_stream_item_t & item );
00293 
00294     virtual void
00295     reverse_replay(
00296       committer_t & committer,
00297       trace_file_number_set_t * used_files = 0,
00298       trace_file_number_set_t * unused_files = 0,
00299       std::ostream * verbose_stream = 0 );
00300 
00301     virtual void
00302     close();
00304   };
00305 
00306 } /* namespace trx */
00307 
00308 } /* namespace storage */
00309 
00310 } /* namespace db */
00311 
00312 } /* namespace oess */
00313 
00314 #endif
00315 

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