2010-04-12 23:05:58 +04:00
|
|
|
/*
|
|
|
|
** 2010 February 1
|
|
|
|
**
|
|
|
|
** The author disclaims copyright to this source code. In place of
|
|
|
|
** a legal notice, here is a blessing:
|
|
|
|
**
|
|
|
|
** May you do good and not evil.
|
|
|
|
** May you find forgiveness for yourself and forgive others.
|
|
|
|
** May you share freely, never taking more than you give.
|
|
|
|
**
|
|
|
|
*************************************************************************
|
|
|
|
** This header file defines the interface to the write-ahead logging
|
|
|
|
** system. Refer to the comments below and the header comment attached to
|
|
|
|
** the implementation of each function in log.c for further details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LOG_H_
|
|
|
|
#define _LOG_H_
|
|
|
|
|
|
|
|
#include "sqliteInt.h"
|
|
|
|
|
|
|
|
/* Connection to a log file. There is one object of this type for each pager. */
|
|
|
|
typedef struct Log Log;
|
|
|
|
|
|
|
|
/* Open and close a connection to a log file. */
|
|
|
|
int sqlite3LogOpen(sqlite3_vfs*, const char *zDb, Log **ppLog);
|
2010-04-17 21:34:41 +04:00
|
|
|
int sqlite3LogClose(Log *pLog, sqlite3_file *pFd, int sync_flags, u8 *zBuf);
|
2010-04-12 23:05:58 +04:00
|
|
|
|
2010-04-17 21:34:41 +04:00
|
|
|
/* Used by readers to open (lock) and close (unlock) a snapshot. */
|
2010-04-12 23:05:58 +04:00
|
|
|
int sqlite3LogOpenSnapshot(Log *pLog, int *);
|
|
|
|
void sqlite3LogCloseSnapshot(Log *pLog);
|
|
|
|
|
|
|
|
/* Read a page from the log, if it is present. */
|
|
|
|
int sqlite3LogRead(Log *pLog, Pgno pgno, int *pInLog, u8 *pOut);
|
2010-04-19 22:03:51 +04:00
|
|
|
void sqlite3LogDbsize(Log *pLog, Pgno *pPgno);
|
2010-04-12 23:05:58 +04:00
|
|
|
|
|
|
|
/* Obtain or release the WRITER lock. */
|
|
|
|
int sqlite3LogWriteLock(Log *pLog, int op);
|
|
|
|
|
2010-04-24 22:44:05 +04:00
|
|
|
/* Undo any frames written (but not committed) to the log */
|
|
|
|
int sqlite3LogUndo(Log *pLog, int (*xUndo)(void *, Pgno), void *pUndoCtx);
|
|
|
|
|
2010-04-23 23:15:00 +04:00
|
|
|
/* Return true if data has been written but not committed to the log file. */
|
|
|
|
int sqlite3LogDirty(Log *pLog);
|
|
|
|
|
2010-04-17 21:34:41 +04:00
|
|
|
/* Write a frame or frames to the log. */
|
2010-04-12 23:05:58 +04:00
|
|
|
int sqlite3LogFrames(Log *pLog, int, PgHdr *, Pgno, int, int);
|
|
|
|
|
|
|
|
/* Copy pages from the log to the database file */
|
|
|
|
int sqlite3LogCheckpoint(
|
|
|
|
Log *pLog, /* Log connection */
|
|
|
|
sqlite3_file *pFd, /* File descriptor open on db file */
|
2010-04-17 21:34:41 +04:00
|
|
|
int sync_flags, /* Flags to sync db file with (or 0) */
|
2010-04-13 23:27:31 +04:00
|
|
|
u8 *zBuf, /* Temporary buffer to use */
|
|
|
|
int (*xBusyHandler)(void *), /* Pointer to busy-handler function */
|
|
|
|
void *pBusyHandlerArg /* Argument to pass to xBusyHandler */
|
2010-04-12 23:05:58 +04:00
|
|
|
);
|
|
|
|
|
2010-04-19 22:03:51 +04:00
|
|
|
/* Return the value to pass to a log callback. Or 0 for no callback. */
|
|
|
|
int sqlite3LogCallback(Log *pLog);
|
|
|
|
|
2010-04-12 23:05:58 +04:00
|
|
|
#endif /* _LOG_H_ */
|