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 00039 #if !defined( _OESS_1__DB__STORAGE__IMPL__HEADER_PROCESSOR_HPP_ ) 00040 #define _OESS_1__DB__STORAGE__IMPL__HEADER_PROCESSOR_HPP_ 00041 00042 #include <memory> 00043 00044 #include <cpp_util_2/h/nocopy.hpp> 00045 00046 #include <oess_1/defs/h/types.hpp> 00047 00048 #include <oess_1/db/storage/h/chain_storage.hpp> 00049 00050 #include <oess_1/db/storage/impl/h/page_accessor.hpp> 00051 00052 namespace oess_1 { 00053 00054 namespace db { 00055 00056 namespace storage { 00057 00058 namespace impl { 00059 00060 // 00061 // header_processor_t 00062 // 00063 00093 class header_processor_t 00094 : private cpp_util_2::nocopy_t 00095 { 00096 public : 00097 virtual ~header_processor_t(); 00098 00100 00104 virtual chain_id_t 00105 allocate_block() = 0; 00106 00108 virtual void 00109 deallocate_block( 00111 const chain_id_t & block ) = 0; 00112 00114 virtual chain_id_t 00115 get_next( 00117 const chain_id_t & block ) = 0; 00118 00120 virtual void 00121 change_next( 00123 const chain_id_t & block, 00125 const chain_id_t & next ) = 0; 00126 00132 virtual void 00133 ensure_allocated( 00135 const chain_id_t & block_id ) = 0; 00136 00139 virtual void 00140 operation_finished( 00143 bool is_read_only = false ) = 0; 00144 }; 00145 00146 // 00147 // create_std_header_processor 00148 // 00149 00157 std::auto_ptr< header_processor_t > 00158 create_std_header_processor( 00160 const config_t & config, 00162 page_accessor_t & accessor, 00164 bool is_read_only ); 00165 00166 } /* namespace impl */ 00167 00168 } /* namespace storage */ 00169 00170 } /* namespace db */ 00171 00172 } /* namespace oess_1 */ 00173 00174 #endif 00175 00176