blob: 5da5fb10513d3a7dfe12f42bc05f02aaa39a91db [file] [log] [blame]
dan6700d022010-04-12 19:05:58 +00001/*
2** 2010 February 1
3**
4** The author disclaims copyright to this source code. In place of
5** a legal notice, here is a blessing:
6**
7** May you do good and not evil.
8** May you find forgiveness for yourself and forgive others.
9** May you share freely, never taking more than you give.
10**
11*************************************************************************
12** This header file defines the interface to the write-ahead logging
13** system. Refer to the comments below and the header comment attached to
14** the implementation of each function in log.c for further details.
15*/
16
17#ifndef _LOG_H_
18#define _LOG_H_
19
20#include "sqliteInt.h"
21
dan6700d022010-04-12 19:05:58 +000022/* Connection to a log file. There is one object of this type for each pager. */
23typedef struct Log Log;
24
25/* Open and close a connection to a log file. */
26int sqlite3LogOpen(sqlite3_vfs*, const char *zDb, Log **ppLog);
danc5118782010-04-17 17:34:41 +000027int sqlite3LogClose(Log *pLog, sqlite3_file *pFd, int sync_flags, u8 *zBuf);
dan6700d022010-04-12 19:05:58 +000028
danc5118782010-04-17 17:34:41 +000029/* Used by readers to open (lock) and close (unlock) a snapshot. */
dan6700d022010-04-12 19:05:58 +000030int sqlite3LogOpenSnapshot(Log *pLog, int *);
31void sqlite3LogCloseSnapshot(Log *pLog);
32
33/* Read a page from the log, if it is present. */
34int sqlite3LogRead(Log *pLog, Pgno pgno, int *pInLog, u8 *pOut);
35void sqlite3LogMaxpgno(Log *pLog, Pgno *pPgno);
36
37/* Obtain or release the WRITER lock. */
38int sqlite3LogWriteLock(Log *pLog, int op);
39
danc5118782010-04-17 17:34:41 +000040/* Write a frame or frames to the log. */
dan6700d022010-04-12 19:05:58 +000041int sqlite3LogFrames(Log *pLog, int, PgHdr *, Pgno, int, int);
42
43/* Copy pages from the log to the database file */
44int sqlite3LogCheckpoint(
45 Log *pLog, /* Log connection */
46 sqlite3_file *pFd, /* File descriptor open on db file */
danc5118782010-04-17 17:34:41 +000047 int sync_flags, /* Flags to sync db file with (or 0) */
dan64d039e2010-04-13 19:27:31 +000048 u8 *zBuf, /* Temporary buffer to use */
49 int (*xBusyHandler)(void *), /* Pointer to busy-handler function */
50 void *pBusyHandlerArg /* Argument to pass to xBusyHandler */
dan6700d022010-04-12 19:05:58 +000051);
52
53#endif /* _LOG_H_ */