/*-
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 1996, 1997, 1998
 *	Sleepycat Software.  All rights reserved.
 *
 *	@(#)db.src	10.6 (Sleepycat) 4/28/98
 */

PREFIX	db

/*
 * addrem -- Add or remove an entry from a duplicate page.
 *
 * opcode:	identifies if this is an add or delete.
 * fileid:	file identifier of the file being modified.
 * pgno:	duplicate page number.
 * indx:	location at which to insert or delete.
 * nbytes:	number of bytes added/removed to/from the page.
 * hdr:		header for the data item.
 * dbt:		data that is deleted or is to be added.
 * pagelsn:	former lsn of the page.
 *
 * If the hdr was NULL then, the dbt is a regular B_KEYDATA.
 * If the dbt was NULL then the hdr is a complete item to be
 * pasted on the page.
 */
BEGIN addrem
ARG	opcode		u_int32_t	lu
ARG	fileid		u_int32_t	lu
ARG	pgno		db_pgno_t	lu
ARG	indx		u_int32_t	lu
ARG	nbytes		size_t		lu
DBT	hdr		DBT		s
DBT	dbt		DBT		s
POINTER	pagelsn		DB_LSN *	lu
END

/*
 * split -- Handles the split of a duplicate page.
 *
 * opcode:	defines whether we are splitting from or splitting onto
 * fileid:	file identifier of the file being modified.
 * pgno:	page number being split.
 * pageimage:	entire page contents.
 * pagelsn:	former lsn of the page.
 */
BEGIN split
ARG	opcode		u_int32_t	lu
ARG	fileid		u_int32_t	lu
ARG	pgno		db_pgno_t	lu
DBT	pageimage	DBT		s
POINTER	pagelsn		DB_LSN *	lu
END

/*
 * big -- Handles addition and deletion of big key/data items.
 *
 * opcode:	identifies get/put.
 * fileid:	file identifier of the file being modified.
 * pgno:	page onto which data is being added/removed.
 * prev_pgno:	the page before the one we are logging.
 * next_pgno:	the page after the one we are logging.
 * dbt:		data being written onto the page.
 * pagelsn:	former lsn of the orig_page.
 * prevlsn:	former lsn of the prev_pgno.
 * nextlsn:	former lsn of the next_pgno. This is not currently used, but
 *		may be used later if we actually do overwrites of big key/
 *		data items in place.
 */
BEGIN big
ARG	opcode		u_int32_t	lu
ARG	fileid		u_int32_t	lu
ARG	pgno		db_pgno_t	lu
ARG	prev_pgno	db_pgno_t	lu
ARG	next_pgno	db_pgno_t	lu
DBT	dbt		DBT		s
POINTER	pagelsn		DB_LSN *	lu
POINTER	prevlsn		DB_LSN *	lu
POINTER	nextlsn		DB_LSN *	lu
END

/*
 * ovref -- Handles increment/decrement of overflow page reference count.
 *
 * fileid:	identifies the file being modified.
 * pgno:	page number whose ref count is being incremented/decremented.
 * adjust:	the adjustment being made.
 * lsn:		the page's original lsn.
 */
BEGIN ovref
ARG	fileid		u_int32_t	lu
ARG	pgno		db_pgno_t	lu
ARG	adjust		int32_t		ld
POINTER	lsn		DB_LSN *	lu
END

/*
 * relink -- Handles relinking around a page.
 *
 * pgno:	the page being changed.
 * lsn		the page's original lsn.
 * prev:	the previous page.
 * lsn_prev:	the previous page's original lsn.
 * next:	the next page.
 * lsn_next:	the previous page's original lsn.
 */
BEGIN relink
ARG	fileid		u_int32_t	lu
ARG	pgno		db_pgno_t	lu
POINTER	lsn		DB_LSN *	lu
ARG	prev		db_pgno_t	lu
POINTER	lsn_prev	DB_LSN *	lu
ARG	next		db_pgno_t	lu
POINTER	lsn_next	DB_LSN *	lu
END

/*
 * Addpage -- Handles adding a new duplicate page onto the end of
 * an existing duplicate page.
 * fileid:	identifies the file being changed.
 * pgno:	page number to which a new page is being added.
 * lsn:		lsn of pgno
 * nextpgno:	new page number being added.
 * nextlsn:	lsn of nextpgno;
 */
BEGIN addpage
ARG	fileid		u_int32_t	lu
ARG	pgno		db_pgno_t	lu
POINTER	lsn		DB_LSN *	lu
ARG	nextpgno	db_pgno_t	lu
POINTER	nextlsn		DB_LSN *	lu
END

/*
 * Debug -- log an operation upon entering an access method.
 * op:		Operation (cursor, c_close, c_get, c_put, c_del,
 *		get, put, delete).
 * fileid:	identifies the file being acted upon.
 * key:		key paramater
 * data:	data parameter
 * flags:	flags parameter
 */
BEGIN debug
DBT	op		DBT		s
ARG	fileid		u_int32_t	lu
DBT	key		DBT		s
DBT	data		DBT		s
ARG	arg_flags	u_int32_t	lu
END

/*
 * noop -- do nothing, but get an LSN.
 */
BEGIN noop
ARG	fileid		u_int32_t	lu
ARG	pgno		db_pgno_t	lu
POINTER	prevlsn		DB_LSN *	lu
END
