more refactoring; removed static variables from pageHandle.c

This commit is contained in:
Sears Russell 2009-05-08 04:56:34 +00:00
parent a0dd692b2c
commit 651a1a22e5
23 changed files with 264 additions and 222 deletions

View file

@ -195,7 +195,7 @@ void releasePage(Page * p) {
releasePageImpl(p);
}
int stasis_buffer_manager_open(int type) {
int stasis_buffer_manager_open(int type, stasis_page_handle_t * ph) {
bufferManagerType = type;
static int lastType = 0;
if(type == BUFFER_MANAGER_REOPEN) {
@ -203,13 +203,14 @@ int stasis_buffer_manager_open(int type) {
}
lastType = type;
if(type == BUFFER_MANAGER_DEPRECATED_HASH) {
stasis_buffer_manager_deprecated_open();
stasis_buffer_manager_deprecated_open(ph);
return 0;
} else if (type == BUFFER_MANAGER_MEM_ARRAY) {
stasis_buffer_manager_mem_array_open();
ph->close(ph); // XXX should never have been opened in the first place!
return 0;
} else if (type == BUFFER_MANAGER_HASH) {
stasis_buffer_manager_hash_open();
stasis_buffer_manager_hash_open(ph);
return 0;
} else {
// XXX error handling

View file

@ -34,6 +34,8 @@ static replacementPolicy * lru;
static stasis_buffer_pool_t * stasis_buffer_pool;
static stasis_page_handle_t * page_handle;
static int running;
typedef struct LL_ENTRY(node_t) node_t;
@ -110,7 +112,7 @@ inline static Page * writeBackOnePage() {
assert(old == victim);
// printf("Write(%ld)\n", (long)victim->id);
pageWrite(victim); /// XXX pageCleanup and pageFlushed might be heavyweight.
page_handle->write(page_handle,victim); /// XXX pageCleanup and pageFlushed might be heavyweight.
stasis_page_cleanup(victim);
// Make sure that no one mistakenly thinks this is still a live copy.
victim->id = -1;
@ -269,7 +271,7 @@ static Page * bhLoadPageImpl_helper(int xid, const pageid_t pageid, int uninitia
// try to read this page from disk.
pthread_mutex_unlock(&mut);
pageRead(ret);
page_handle->read(page_handle, ret);
pthread_mutex_lock(&mut);
@ -322,13 +324,13 @@ static void bhReleasePage(Page * p) {
pthread_mutex_unlock(&mut);
}
static void bhWriteBackPage(Page * p) {
pageWrite(p);
page_handle->write(page_handle, p);
}
static void bhForcePages() {
forcePageFile();
page_handle->force_file(page_handle);
}
static void bhForcePageRange(pageid_t start, pageid_t stop) {
forceRangePageFile(start, stop);
page_handle->force_range(page_handle, start, stop);
}
static void bhBufDeinit() {
running = 0;
@ -340,7 +342,7 @@ static void bhBufDeinit() {
const struct LH_ENTRY(pair_t) * next;
LH_ENTRY(openlist)(cachedPages, &iter);
while((next = LH_ENTRY(readlist)(&iter))) {
pageWrite((next->value));
page_handle->write(page_handle, (next->value));
stasis_page_cleanup((next->value)); // normally called by writeBackOnePage()
}
LH_ENTRY(closelist)(&iter);
@ -350,6 +352,7 @@ static void bhBufDeinit() {
lru->deinit(lru);
stasis_buffer_pool_deinit(stasis_buffer_pool);
page_handle->close(page_handle);
}
static void bhSimulateBufferManagerCrash() {
running = 0;
@ -374,10 +377,11 @@ static void bhSimulateBufferManagerCrash() {
lru->deinit(lru);
stasis_buffer_pool_deinit(stasis_buffer_pool);
page_handle->close(page_handle);
}
void stasis_buffer_manager_hash_open() {
void stasis_buffer_manager_hash_open(stasis_page_handle_t * h) {
page_handle = h;
assert(!running);
#ifdef LONG_RUN

View file

@ -4,6 +4,7 @@
#include <stasis/bufferManager.h>
#include <stasis/pageHandle.h>
#include <stasis/bufferPool.h>
#include <stasis/bufferManager/legacy/pageFile.h>
#include <stasis/bufferManager/legacy/pageCache.h>
@ -25,16 +26,28 @@ static compensated_function Page *bufManLoadUninitPage(int xid, pageid_t pageid)
static void bufManReleasePage (Page * p);
static void bufManSimulateBufferManagerCrash();
static stasis_page_handle_t * page_handle;
static stasis_buffer_pool_t * stasis_buffer_pool;
int stasis_buffer_manager_deprecated_open() {
static void pageWrite_legacyWrapper(Page * p) {
page_handle->write(page_handle,p);
}
static void forcePageFile_legacyWrapper() {
page_handle->force_file(page_handle);
}
static void forceRangePageFile_legacyWrapper(lsn_t start, lsn_t stop) {
page_handle->force_range(page_handle, start, stop);
}
int stasis_buffer_manager_deprecated_open(stasis_page_handle_t * ph) {
page_handle = ph;
releasePageImpl = bufManReleasePage;
loadPageImpl = bufManLoadPage;
loadUninitPageImpl = bufManLoadUninitPage;
writeBackPage = pageWrite;
forcePages = forcePageFile;
forcePageRange = forceRangePageFile;
writeBackPage = pageWrite_legacyWrapper;
forcePages = forcePageFile_legacyWrapper;
forcePageRange = forceRangePageFile_legacyWrapper;
stasis_buffer_manager_close = bufManBufDeinit;
stasis_buffer_manager_simulate_crash = bufManSimulateBufferManagerCrash;
@ -50,7 +63,7 @@ int stasis_buffer_manager_deprecated_open() {
first = stasis_buffer_pool_malloc_page(stasis_buffer_pool);
stasis_buffer_pool_free_page(stasis_buffer_pool, first, 0);
LH_ENTRY(insert)(activePages, &first->id, sizeof(first->id), first);
pageRead(first);
page_handle->read(page_handle, first);
pageCacheInit(first);
int err = pthread_key_create(&lastPage, 0);
@ -73,7 +86,7 @@ static void bufManBufDeinit() {
LH_ENTRY(openlist(activePages, &iter));
while((next = LH_ENTRY(readlist)(&iter))) {
pageWrite((Page*)next->value);
page_handle->write(page_handle, (Page*)next->value);
DEBUG("+");
}
@ -83,10 +96,10 @@ static void bufManBufDeinit() {
pageCacheDeinit();
//closePageFile();
stasis_buffer_pool_deinit(stasis_buffer_pool);
page_handle->close(page_handle);
#ifdef PIN_COUNT
if(pinCount != 0) {
printf("WARNING: At exit, %d pages were still pinned!\n", pinCount);
@ -98,10 +111,10 @@ static void bufManBufDeinit() {
Just close file descriptors, don't do any other clean up. (For
testing.)
@todo buffer manager should never call closePageFile(); it not longer manages pageFile handles
@todo buffer manager should never call close_(); it not longer manages pageFile handles
*/
void bufManSimulateBufferManagerCrash() {
closePageFile();
static void bufManSimulateBufferManagerCrash() {
page_handle->close(page_handle);
#ifdef PIN_COUNT
pinCount = 0;
#endif
@ -259,12 +272,12 @@ static Page* bufManGetPage(pageid_t pageid, int locktype, int uninitialized) {
assert(ret != dummy_page);
if(ret->id != -1) {
pageWrite(ret);
page_handle->write(page_handle, ret);
}
stasis_buffer_pool_free_page(stasis_buffer_pool, ret, pageid);
if(!uninitialized) {
pageRead(ret);
page_handle->read(page_handle, ret);
} else {
memset(ret->memAddr, 0, PAGE_SIZE);
ret->dirty = 0;
@ -283,7 +296,7 @@ static Page* bufManGetPage(pageid_t pageid, int locktype, int uninitialized) {
/* @todo Put off putting this back into cache until we're done with
it. -- This could cause the cache to empty out if the ratio of
threads to buffer slots is above ~ 1/3, but it decreases the
liklihood of thrashing. */
likelihood of thrashing. */
cacheInsertPage(ret);
pthread_mutex_unlock(&loadPagePtr_mutex);

View file

@ -4,19 +4,19 @@
*/
#include "config.h"
#include <stasis/page.h>
#include <stasis/page.h>
#include <stasis/bufferManager.h>
#include <stasis/pageHandle.h>
#include <stasis/truncation.h>
#include <stasis/bufferManager/legacy/pageFile.h>
#include <stasis/logger/logger2.h>
#include <assert.h>
#include <stasis/logger/logger2.h>
#include <stasis/truncation.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
/** For O_DIRECT. It's unclear that this is the correct thing to \#define, but it works under linux. */
#define __USE_GNU
@ -28,16 +28,16 @@
static int stable = -1;
static pthread_mutex_t stable_mutex;
static void pfForcePageFile();
static void pfClosePageFile();
static void pfForceRangePageFile(lsn_t start, lsn_t stop) ;
static void pfForcePageFile(stasis_page_handle_t* h);
static void pfClosePageFile(stasis_page_handle_t* h);
static void pfForceRangePageFile(stasis_page_handle_t* h, lsn_t start, lsn_t stop) ;
inline static pageid_t myLseekNoLock(int f, pageid_t offset, int whence);
static int oldOffset = -1;
int pageFile_isDurable = 1;
static void pfPageRead(Page *ret) {
static void pfPageRead(stasis_page_handle_t * h, Page *ret) {
pageid_t pageoffset;
pageid_t offset;
@ -78,7 +78,7 @@ static void pfPageRead(Page *ret) {
}
/** @todo need to sync the page file to disk occasionally, so that the
dirty page table can be kept up to date. */
static void pfPageWrite(Page * ret) {
static void pfPageWrite(stasis_page_handle_t * h, Page * ret) {
/** If the page is clean, there's no reason to write it out. */
assert(ret->dirty == dirtyPages_isDirty(ret));
if(!ret->dirty) {
@ -133,12 +133,13 @@ static void pfPageWrite(Page * ret) {
//#define PAGE_FILE_O_DIRECT
/** @todo O_DIRECT is broken in older linuxes (eg 2.4). The build script should disable it on such platforms. */
void openPageFile() {
pageRead = pfPageRead;
pageWrite = pfPageWrite;
forcePageFile = pfForcePageFile;
forceRangePageFile = pfForceRangePageFile;
closePageFile = pfClosePageFile;
stasis_page_handle_t* openPageFile() {
stasis_page_handle_t * ret = malloc(sizeof(*ret));
ret->read = pfPageRead;
ret->write = pfPageWrite;
ret->force_file = pfForcePageFile;
ret->force_range = pfForceRangePageFile;
ret->close = pfClosePageFile;
DEBUG("Opening storefile.\n");
@ -161,10 +162,10 @@ void openPageFile() {
}
pthread_mutex_init(&stable_mutex, NULL);
return ret;
}
static void pfForcePageFile() {
static void pfForcePageFile(stasis_page_handle_t * h) {
if(pageFile_isDurable) {
#ifndef PAGE_FILE_O_DIRECT
#ifdef HAVE_FDATASYNC
@ -176,7 +177,7 @@ static void pfForcePageFile() {
}
}
static void pfForceRangePageFile(lsn_t start, lsn_t stop) {
static void pfForceRangePageFile(stasis_page_handle_t * h, lsn_t start, lsn_t stop) {
if(pageFile_isDurable) {
#ifdef HAVE_SYNC_FILE_RANGE
int ret = sync_file_range(stable, start, stop,
@ -193,9 +194,9 @@ static void pfForceRangePageFile(lsn_t start, lsn_t stop) {
#endif
}
}
static void pfClosePageFile() {
static void pfClosePageFile(stasis_page_handle_t * h) {
assert(stable != -1);
forcePageFile();
h->force_file(h);
DEBUG("Closing storefile\n");
int ret = close(stable);

View file

@ -5,12 +5,18 @@
* Author: sears
*/
#include <config.h>
#include <stasis/common.h>
#include <stasis/constants.h>
#include <stasis/flags.h>
#include <stasis/io/handle.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stasis/io/handle.h>
#include <assert.h>
#include <stdio.h>
// @todo this factory stuff doesn't really belong here...
static stasis_handle_t * fast_factory(lsn_t off, lsn_t len, void * ignored) {

View file

@ -1,4 +1,8 @@
#include "config.h"
#include <stasis/common.h>
#include <stasis/constants.h>
#include <stasis/io/handle.h>
#include <stasis/linkedlist.h>
#include <stasis/redblack.h>
#include <pthread.h>
#include <errno.h>
@ -6,7 +10,7 @@
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <stasis/linkedlist.h>
/**
@file

View file

@ -1,9 +1,11 @@
#define _XOPEN_SOURCE 600
#include <stdlib.h>
#include "config.h"
#include <config.h>
#include <stasis/page.h>
#include <stasis/logger/logEntry.h>
#include <stasis/operations/pageOperations.h>
#include <stasis/operations/regions.h>
#include <assert.h>
#include <alloca.h>

View file

@ -9,21 +9,12 @@
#include <stasis/page.h>
void (*pageWrite)(Page * dat);
void (*pageRead)(Page * ret);
void (*forcePageFile)();
void (*forceRangePageFile)();
void (*closePageFile)();
int printedForceWarning = 0;
static stasis_handle_t * h;
/**
@todo Make sure this doesn't need to be atomic. (It isn't!) Can
we get in trouble by setting the page clean after it's written
out, or forcing the log too early?
*/
static void phWrite(Page * ret) {
static void phWrite(stasis_page_handle_t * ph, Page * ret) {
if(!ret->dirty) { return; }
// This lock is only held to make the page implementation happy. We should
// implicitly have exclusive access to the page before this function is called,
@ -31,7 +22,7 @@ static void phWrite(Page * ret) {
writelock(ret->rwlatch,0);
stasis_page_flushed(ret);
LogForce(stasis_log_file, ret->LSN, LOG_FORCE_WAL);
int err = h->write(h, PAGE_SIZE * ret->id, ret->memAddr, PAGE_SIZE);
int err = ((stasis_handle_t*)ph->impl)->write(ph->impl, PAGE_SIZE * ret->id, ret->memAddr, PAGE_SIZE);
if(err) {
printf("Couldn't write to page file: %s\n", strerror(err));
fflush(stdout);
@ -40,9 +31,9 @@ static void phWrite(Page * ret) {
dirtyPages_remove(ret);
unlock(ret->rwlatch);
}
static void phRead(Page * ret) {
static void phRead(stasis_page_handle_t * ph, Page * ret) {
writelock(ret->rwlatch,0);
int err = h->read(h, PAGE_SIZE * ret->id, ret->memAddr, PAGE_SIZE);
int err = ((stasis_handle_t*)ph->impl)->read(ph->impl, PAGE_SIZE * ret->id, ret->memAddr, PAGE_SIZE);
if(err) {
if(err == EDOM) {
// tried to read off end of file...
@ -57,30 +48,32 @@ static void phRead(Page * ret) {
stasis_page_loaded(ret);
unlock(ret->rwlatch);
}
static void phForce() {
int err = h->force(h);
static void phForce(stasis_page_handle_t * ph) {
int err = ((stasis_handle_t*)ph->impl)->force(ph->impl);
assert(!err);
}
static void phForceRange(lsn_t start, lsn_t stop) {
int err = h->force_range(h,start,stop);
static void phForceRange(stasis_page_handle_t * ph, lsn_t start, lsn_t stop) {
int err = ((stasis_handle_t*)ph->impl)->force_range(ph->impl,start,stop);
assert(!err);
}
static void phClose() {
int err = h->close(h);
static void phClose(stasis_page_handle_t * ph) {
int err = ((stasis_handle_t*)ph->impl)->close(ph->impl);
DEBUG("Closing pageHandle\n");
if(err) {
printf("Couldn't close page file: %s\n", strerror(err));
fflush(stdout);
abort();
}
free(ph);
}
void pageHandleOpen(stasis_handle_t * handle) {
stasis_page_handle_t * stasis_page_handle_open(stasis_handle_t * handle) {
DEBUG("Using pageHandle implementation\n");
pageWrite = phWrite;
pageRead = phRead;
forcePageFile = phForce;
forceRangePageFile = phForceRange;
closePageFile = phClose;
h = handle;
stasis_page_handle_t * ret = malloc(sizeof(*ret));
ret->write = phWrite;
ret->read = phRead;
ret->force_file = phForce;
ret->force_range = phForceRange;
ret->close = phClose;
ret->impl = handle;
return ret;
}

View file

@ -21,7 +21,7 @@
#include <stasis/truncation.h>
#include <stasis/io/handle.h>
#include <stasis/blobManager.h> // XXX remove this, move Tread() to set.c
//#include <stdio.h>
#include <assert.h>
#include <limits.h>
@ -60,6 +60,7 @@ int Tinit() {
stasis_transaction_table_init();
stasis_operation_table_init();
dirtyPagesInit();
if(LOG_TO_FILE == stasis_log_type) {
stasis_log_file = stasis_log_safe_writes_open(stasis_log_file_name,
stasis_log_file_mode,
@ -69,17 +70,18 @@ int Tinit() {
} else {
assert(stasis_log_file != NULL);
}
stasis_page_init();
stasis_page_init();
stasis_page_handle_t * page_handle;
if(bufferManagerFileHandleType == BUFFER_MANAGER_FILE_HANDLE_DEPRECATED) {
printf("\nWarning: Using old I/O routines (with known bugs).\n");
openPageFile();
page_handle = openPageFile();
} else {
stasis_handle_t * h = stasis_handle_open(stasis_store_file_name);
// XXX should not be global.
pageHandleOpen(h);
page_handle = stasis_page_handle_open(h);
}
stasis_buffer_manager_open(bufferManagerType);
stasis_buffer_manager_open(bufferManagerType, page_handle);
DEBUG("Buffer manager type = %d\n", bufferManagerType);
pageOperationsInit();
TallocInit();
@ -347,7 +349,6 @@ int Tdeinit() {
TallocDeinit();
stasis_buffer_manager_close();
DEBUG("Closing page file tdeinit\n");
closePageFile();
stasis_page_deinit();
stasis_log_file->close(stasis_log_file);
dirtyPagesDeinit();
@ -364,7 +365,7 @@ int TuncleanShutdown() {
stasis_truncation_deinit();
TnaiveHashDeinit();
stasis_buffer_manager_simulate_crash();
// XXX: closePageFile?
// XXX: close_file?
stasis_page_deinit();
stasis_log_file->close(stasis_log_file);
stasis_transaction_table_num_active = 0;

View file

@ -76,14 +76,11 @@ terms specified in this license.
@ingroup BUFFER_MANAGER
* $Id$
*/
#include <stasis/transactional.h>
#ifndef __BUFFERMANAGER_H__
#define __BUFFERMANAGER_H__
BEGIN_C_DECLS
#include <stasis/pageHandle.h>
/**
* Obtain a pointer to a page from the buffer manager. The page will
* be pinned, and the pointer valid until releasePage is called.
@ -148,7 +145,7 @@ extern void (*forcePages)();
extern void (*forcePageRange)(pageid_t start, pageid_t stop);
extern void (*stasis_buffer_manager_simulate_crash)();
int stasis_buffer_manager_open(int type);
int stasis_buffer_manager_open(int type, stasis_page_handle_t* ph);
/**
* will write out any dirty pages, assumes that there are no running
* transactions

View file

@ -1 +1,5 @@
void stasis_buffer_manager_hash_open();
#ifndef STASIS_BUFFERMANAGER_BUFFERHASH_H
#define STASIS_BUFFERMANAGER_BUFFERHASH_H
#include <stasis/pageHandle.h>
void stasis_buffer_manager_hash_open(stasis_page_handle_t* ph);
#endif //STASIS_BUFFERMANAGER_BUFFERHASH_H

View file

@ -1,4 +1,5 @@
#ifndef __STASIS_BUFFERMANAGER_LEGACY_LEGACYBUFFERMANAGER_H
#define __STASIS_BUFFERMANAGER_LEGACY_LEGACYBUFFERMANAGER_H
int stasis_buffer_manager_deprecated_open();
#endif//__STASIS_BUFFERMANAGER_LEGACY_LEGACYBUFFERMANAGER_H
#ifndef STASIS_BUFFERMANAGER_LEGACY_LEGACYBUFFERMANAGER_H
#define STASIS_BUFFERMANAGER_LEGACY_LEGACYBUFFERMANAGER_H
#include <stasis/pageHandle.h>
int stasis_buffer_manager_deprecated_open(stasis_page_handle_t * ph);
#endif//STASIS_BUFFERMANAGER_LEGACY_LEGACYBUFFERMANAGER_H

View file

@ -8,7 +8,7 @@
Implements lladd's caching policy. Looks up pageid in the cache.
If pageid doesn't exist, then allocate a new slot for it. If
there are no new slots, then callback into bufferManager's
pageRead() function. Eventually, this could be extended to
read_page() function. Eventually, this could be extended to
support application specific caching schemes.
If you would like to implement your own caching policy, implement
@ -18,7 +18,7 @@
The implementation of this module does not need to be threadsafe.
@param first The caller should manually read this page by calling
pageRead() before calling pageCacheInit.
read_page() before calling pageCacheInit.
@todo pageCacheInit should not take a page as a parameter.

View file

@ -2,6 +2,8 @@
#ifndef __PAGE_FILE_H
#define __PAGE_FILE_H
void openPageFile();
#include <stasis/pageHandle.h>
stasis_page_handle_t* openPageFile();
#endif /* __PAGE_FILE_H */

View file

@ -1,8 +1,6 @@
#include <stasis/transactional.h>
#ifndef IO_HANDLE_H
#define IO_HANDLE_H
#include <stasis/common.h>
/**
stasis_handle() is a macro that prepends a unique prefix to the its

View file

@ -75,7 +75,7 @@ terms specified in this license.
/** @{ */
#ifndef __ARRAY_LIST_H
#define __ARRAY_LIST_H
#include <stasis/operations.h>
/** Allocate a new array list.
@param xid The transaction allocating the new arrayList.

View file

@ -5,7 +5,7 @@
#include "stasis/bufferManager.h"
#include "stasis/page/compression/compression.h"
#include "stasis/page/compression/tuple.h"
#include "stasis/operations.h"
/**
@file

View file

@ -55,10 +55,9 @@ terms specified in this license.
*
* $Id$
*/
#ifndef __PAGE_OPERATIONS_H__
#define __PAGE_OPERATIONS_H__
#include <stasis/operations.h>
compensated_function pageid_t TpageAlloc(int xid);
compensated_function pageid_t TfixedPageAlloc(int xid, int size);

View file

@ -1,3 +1,6 @@
#ifndef STASIS_OPERATIONS_REGIONS_H
#define STASIS_OPERATIONS_REGIONS_H
#include <stasis/operations.h>
/**
Allocates and deallocates regions of pages. The page before each
region is of type BOUNDARY_TAG. All regions except the last one in
@ -51,3 +54,4 @@ stasis_operation_impl stasis_op_impl_region_dealloc_inverse();
void fsckRegions(int xid);
// XXX need callbacks to handle transaction commit/abort.
#endif

View file

@ -102,8 +102,10 @@ terms specified in this license.
#define __PAGE_H__
#include <stasis/common.h>
#include <stasis/constants.h>
#include <stasis/latches.h>
#include <stasis/transactional.h>
#include <assert.h>
BEGIN_C_DECLS
@ -182,7 +184,7 @@ struct Page_s {
Read from a record Read lock
@see rwlatch, getPage(), pageRalloc(), pageRead()
@see rwlatch, getPage(), pageRalloc(), read_page()
*/
rwl * loadlatch;

View file

@ -1,13 +1,17 @@
#include <stasis/bufferPool.h>
#ifndef STASIS_PAGEHANDLE_H
#define STASIS_PAGEHANDLE_H
#include <stasis/page.h>
#include <stasis/io/handle.h>
/**
typedef struct stasis_page_handle_t {
/**
* Write page to disk, including correct LSN. Doing so may require a
* call to logSync(). There is not much that can be done to avoid
* this call right now. In the future, it might make sense to check
* to see if some other page can be kicked, in order to avoid the log
* flush.
*
* This funciton is automatically called immediately before a page is
* This function is automatically called immediately before a page is
* evicted from cache. Operation implementors, and normal users
* should never have to call this routine.
*
@ -17,12 +21,10 @@
* may have the same value of dat.
*
*/
extern void (*pageWrite)(Page * dat);
void (*write)(struct stasis_page_handle_t* ph, Page * dat);
extern int pageFile_isDurable;
/**
Read a page from disk. This bypassess the cache, and should only be
/**
Read a page from disk. This bypasses the cache, and should only be
called by bufferManager and blobManager. To retrieve a page under
normal circumstances, use loadPage() instead.
@ -33,25 +35,32 @@ extern int pageFile_isDurable;
struct will be overwritten by pageMap. This method assumes that no
concurrent calls will be passed the same value of ret.
@see bufferManager.c for the implementation of pageRead.
@see bufferManager.c for the implementation of read_page.
@todo pageRead and pageWrite should be stored in a struct returned by
an initailizer, not in global function pointers.
*/
extern void (*pageRead)(Page * ret);
/**
@todo read_page and pageWrite should be stored in a struct returned by
an initializer, not in global function pointers.
*/
void (*read)(struct stasis_page_handle_t* ph, Page * ret);
/**
Force the page file to disk. Pages that have had pageWrite()
called on them are guaranteed to be on disk after this returns.
(Note that bufferManager implementations typically call pageWrite()
automatically, so in general, other pages could be written back
as well...)
*/
extern void (*forcePageFile)();
extern void (*forceRangePageFile)();
/**
*/
void (*force_file)(struct stasis_page_handle_t* ph);
void (*force_range)(struct stasis_page_handle_t* ph, lsn_t start, lsn_t stop);
/**
Force the page file to disk, then close it.
*/
extern void (*closePageFile)();
*/
void (*close)(struct stasis_page_handle_t* ph);
/**
* Pointer to implementation-specific state.
*/
void * impl;
} stasis_page_handle_t;
void pageHandleOpen(stasis_handle_t * handle);
stasis_page_handle_t * stasis_page_handle_open(struct stasis_handle_t * handle);
#endif //STASIS_PAGEHANDLE_H

View file

@ -42,7 +42,7 @@ terms specified in this license.
---*/
#include "../check_includes.h"
#include <stasis/transactional.h>
#include <stasis/bufferManager.h>
#include <stasis/page.h>
#include <stasis/page/indirect.h>

View file

@ -42,7 +42,8 @@ terms specified in this license.
#include "../check_includes.h"
#include <stasis/io/handle.h>
#include <stasis/constants.h>
#include <stasis/flags.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>