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_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
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
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
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 }
00325
00326 }
00327
00328 }
00329
00330 }
00331
00332 #endif
00333