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 00038 #if !defined( _OESS_1__DB__STORAGE__IMPL__PAGE_ACCESSOR_HPP_ ) 00039 #define _OESS_1__DB__STORAGE__IMPL__PAGE_ACCESSOR_HPP_ 00040 00041 #include <memory> 00042 00043 #include <cpp_util_2/h/nocopy.hpp> 00044 00045 #include <oess_1/defs/h/types.hpp> 00046 00047 #include <oess_1/file/h/file.hpp> 00048 00049 #include <oess_1/db/storage/h/chain_storage.hpp> 00050 00051 #include <oess_1/db/storage/impl/h/cache.hpp> 00052 00053 namespace oess_1 { 00054 00055 namespace db { 00056 00057 namespace storage { 00058 00059 namespace impl { 00060 00061 // 00062 // page_accessor_t 00063 // 00064 00087 class page_accessor_t 00088 : private cpp_util_2::nocopy_t 00089 { 00090 public : 00091 virtual ~page_accessor_t(); 00092 00094 00101 virtual bool 00102 is_exists( oess_1::uint_t page ) = 0; 00103 00105 00109 virtual const oess_1::char_t * 00110 read_access( oess_1::uint_t page ) = 0; 00111 00113 00123 virtual oess_1::char_t * 00124 write_access( oess_1::uint_t page ) = 0; 00125 }; 00126 00127 // 00128 // create_std_page_accessor 00129 // 00130 00138 std::auto_ptr< page_accessor_t > 00139 create_std_page_accessor( 00141 const config_t & config, 00143 oess_1::file::file_t & main_file, 00146 oess_1::uint_t & main_file_logic_length, 00148 cache_t & cache, 00150 dirty_page_storage_t & dirty_pages, 00152 bool is_read_only ); 00153 00154 } /* namespace impl */ 00155 00156 } /* namespace storage */ 00157 00158 } /* namespace db */ 00159 00160 } /* namespace oess_1 */ 00161 00162 #endif 00163