18b40798fSAxel Dörfler #ifndef CACHE_H 28b40798fSAxel Dörfler #define CACHE_H 38b40798fSAxel Dörfler /* cache - emulation for the B+Tree torture test 48b40798fSAxel Dörfler ** 58b40798fSAxel Dörfler ** Initial version by Axel Dörfler, axeld@pinc-software.de 6*b6f76ebeSAugustin Cavalier ** This file may be used under the terms of the MIT License. 78b40798fSAxel Dörfler */ 88b40798fSAxel Dörfler 98b40798fSAxel Dörfler 108b40798fSAxel Dörfler #include <SupportDefs.h> 118b40798fSAxel Dörfler 128b40798fSAxel Dörfler class BFile; 138b40798fSAxel Dörfler 148b40798fSAxel Dörfler 158b40798fSAxel Dörfler extern void init_cache(BFile* file, int32 blockSize); 168b40798fSAxel Dörfler extern void shutdown_cache(BFile* file, int32 blockSize); 178b40798fSAxel Dörfler 1824e159e1SMichael Lotz extern status_t cached_write(void* cache, off_t num, const void* _data, 1924e159e1SMichael Lotz off_t numBlocks); 2024e159e1SMichael Lotz 2124e159e1SMichael Lotz 2224e159e1SMichael Lotz // Block Cache API 2324e159e1SMichael Lotz 24488289a4SMichael Lotz extern "C" { 25488289a4SMichael Lotz 2624e159e1SMichael Lotz extern const void* block_cache_get(void* _cache, off_t blockNumber); 2724e159e1SMichael Lotz 2824e159e1SMichael Lotz extern status_t block_cache_make_writable(void* _cache, off_t blockNumber, 2924e159e1SMichael Lotz int32 transaction); 3024e159e1SMichael Lotz extern void* block_cache_get_writable(void* _cache, off_t blockNumber, 3124e159e1SMichael Lotz int32 transaction); 3224e159e1SMichael Lotz 3324e159e1SMichael Lotz extern status_t block_cache_set_dirty(void* _cache, off_t blockNumber, 3424e159e1SMichael Lotz bool dirty, int32 transaction); 3524e159e1SMichael Lotz extern void block_cache_put(void* _cache, off_t blockNumber); 368b40798fSAxel Dörfler 37488289a4SMichael Lotz } // extern "C" 38488289a4SMichael Lotz 398b40798fSAxel Dörfler #endif /* CACHE_H */ 40