stasis-aries-wal/lladd/operations/alloc.h
Sears Russell c413203ec8 Talloc() now reuses space when possible. It still needs to call slottedCompact() intelligentally. Also, allocationPolicy should support an extra tier
of pages, so it doesn't suggest ones that aren't already in the buffer pool unless it has to.
2006-07-29 00:56:54 +00:00

82 lines
2.2 KiB
C

/**
@file
Allocates and deallocates records.
@todo Talloc() should reuse space freed by Tdealloc(), but
currently just leaks it.
@ingroup OPERATIONS
$Id$
*/
#ifndef __ALLOC_H
#define __ALLOC_H 1
Operation getAlloc();
Operation getDealloc();
Operation getRealloc();
Operation getInitializePage();
void allocTransactionAbort(int xid);
void allocTransactionCommit(int xid);
void TallocInit();
/**
Allocate a record.
@param xid The transaction responsible for the allocation
@param size The size of the new record to be allocated. Talloc will allocate a
blob if the record will not easily fit on a page.
@todo need to obtain (transaction-level) write locks _before_ writing log entries. Otherwise, we can deadlock at recovery.
@return the recordid of the new record.
*/
compensated_function recordid Talloc(int xid, unsigned long size);
compensated_function recordid TallocFromPage(int xid, long page, unsigned long size);
/**
Free a record.
@todo Currently, we just leak store space on dealloc.
*/
compensated_function void Tdealloc(int xid, recordid rid);
/**
Obtain the type of a record, as returned by getRecordType.
@param xid the transaction id.
@param rid the record of interest. The size field will be ignored,
allowing this function to be used to probe for records in pages.
@return UNINITIALIZED_RECORD, BLOB_RECORD, SLOTTED_RECORD, or FIXED_RECORD.
@see getRecordType
*/
compensated_function int TrecordType(int xid, recordid rid);
/**
Obtain the length of the data stored in a record.
@param xid the transaction id.
@param rid the record of interest. The size field will be ignored,
allowing this function to be used to probe for records in pages.
@return -1 if the record does not exist, the size of the record otherwise.
*/
compensated_function int TrecordSize(int xid, recordid rid);
/** Return the number of records stored in page pageid */
compensated_function int TrecordsInPage(int xid, int pageid);
compensated_function void TinitializeSlottedPage(int xid, int pageid);
compensated_function void TinitializeFixedPage(int xid, int pageid, int slotLength);
#endif