more
This commit is contained in:
parent
7ef98d1af9
commit
8dfad06979
|
@ -20,6 +20,7 @@ static void tdbMPoolRegFile(TDB_MPOOL *mp, TDB_MPFILE *mpf);
|
|||
static void tdbMPoolUnregFile(TDB_MPOOL *mp, TDB_MPFILE *mpf);
|
||||
static TDB_MPFILE *tdbMPoolGetFile(TDB_MPOOL *mp, uint8_t *fileid);
|
||||
static int tdbMPoolFileReadPage(TDB_MPFILE *mpf, pgno_t pgno, void *p);
|
||||
static int tdbMPoolFileWritePage(TDB_MPFILE *mpf, pgno_t pgno, const void *p);
|
||||
|
||||
int tdbMPoolOpen(TDB_MPOOL **mpp, uint64_t cachesize, pgsize_t pgsize) {
|
||||
TDB_MPOOL *mp = NULL;
|
||||
|
@ -317,5 +318,23 @@ static int tdbMPoolFileReadPage(TDB_MPFILE *mpf, pgno_t pgno, void *p) {
|
|||
rsize = pread(mpf->fd, p, pgsize, offset);
|
||||
// TODO: error handle
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tdbMPoolFileWritePage(TDB_MPFILE *mpf, pgno_t pgno, const void *p) {
|
||||
pgsize_t pgsize;
|
||||
TDB_MPOOL *mp;
|
||||
off_t offset;
|
||||
|
||||
mp = mpf->mp;
|
||||
pgsize = mp->pgsize;
|
||||
offset = pgno * pgsize;
|
||||
|
||||
lseek(mpf->fd, offset, SEEK_SET);
|
||||
// TODO: handle error
|
||||
|
||||
write(mpf->fd, p, pgsize);
|
||||
// TODO: handle error
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue