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
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 }
00055
00056
00057
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
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
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 }
00307
00308 }
00309
00310 }
00311
00312 }
00313
00314 #endif
00315